packages: Ignore error code for "dnf remove".

Unfortunately, dnf treats it as an error if we try to remove a package
that already did not exist. This means that, e.g., if we try to remove
calamares itself, but calamares was not installed on the base image,
only in the overlay, we will fail with an error. So, as long as we do
not have a better solution, we ignore the exit code of "dnf remove"
entirely.

(yum does not show this behavior, it returns success when the package to
remove is already not installed.)
This commit is contained in:
Kevin Kofler 2015-01-19 03:06:12 +01:00
parent 412b959870
commit 5c6a302112

View File

@ -18,7 +18,7 @@
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
import libcalamares
from libcalamares.utils import check_chroot_call
from libcalamares.utils import check_chroot_call, chroot_call
class PackageManager:
def __init__(self, backend):
@ -50,7 +50,8 @@ class PackageManager:
elif self.backend == "yum":
check_chroot_call(["yum", "--disablerepo=*", "-C", "-y", "remove"] + pkgs)
elif self.backend == "dnf":
check_chroot_call(["dnf", "--disablerepo=*", "-C", "-y", "remove"] + pkgs)
# ignore the error code for now because dnf thinks removing a nonexistent package is an error
chroot_call(["dnf", "--disablerepo=*", "-C", "-y", "remove"] + pkgs)
elif self.backend == "urpmi":
check_chroot_call(["urpme"] + pkgs)
elif self.backend == "apt":