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:
parent
412b959870
commit
5c6a302112
@ -18,7 +18,7 @@
|
|||||||
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import libcalamares
|
import libcalamares
|
||||||
from libcalamares.utils import check_chroot_call
|
from libcalamares.utils import check_chroot_call, chroot_call
|
||||||
|
|
||||||
class PackageManager:
|
class PackageManager:
|
||||||
def __init__(self, backend):
|
def __init__(self, backend):
|
||||||
@ -50,7 +50,8 @@ class PackageManager:
|
|||||||
elif self.backend == "yum":
|
elif self.backend == "yum":
|
||||||
check_chroot_call(["yum", "--disablerepo=*", "-C", "-y", "remove"] + pkgs)
|
check_chroot_call(["yum", "--disablerepo=*", "-C", "-y", "remove"] + pkgs)
|
||||||
elif self.backend == "dnf":
|
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":
|
elif self.backend == "urpmi":
|
||||||
check_chroot_call(["urpme"] + pkgs)
|
check_chroot_call(["urpme"] + pkgs)
|
||||||
elif self.backend == "apt":
|
elif self.backend == "apt":
|
||||||
|
Loading…
Reference in New Issue
Block a user