1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

package_manager: handle remove() with no packages

If remove() is called with an empty package list, ensure we do nothing instead
of calling the underlying package manager with an invalid command line.

[ YOCTO #12900 ]

(From OE-Core rev: 715ec20c433cb4ed5fde938c33a42b2a296e4e56)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton
2018-10-16 14:32:04 +01:00
committed by Richard Purdie
parent 4ef016683d
commit 1de82d5fc0
+8 -1
View File
@@ -864,8 +864,9 @@ class RpmPM(PackageManager):
failed_postinsts_abort(list(failed_scriptlets_pkgnames.keys()), self.d.expand("${T}/log.do_${BB_CURRENTTASK}"))
def remove(self, pkgs, with_dependencies = True):
if len(pkgs) == 0:
if not pkgs:
return
self._prepare_pkg_transaction()
if with_dependencies:
@@ -1353,6 +1354,9 @@ class OpkgPM(OpkgDpkgPM):
(cmd, e.returncode, e.output.decode("utf-8")))
def remove(self, pkgs, with_dependencies=True):
if not pkgs:
return
if with_dependencies:
cmd = "%s %s --force-remove --force-removal-of-dependent-packages remove %s" % \
(self.opkg_cmd, self.opkg_args, ' '.join(pkgs))
@@ -1663,6 +1667,9 @@ class DpkgPM(OpkgDpkgPM):
def remove(self, pkgs, with_dependencies=True):
if not pkgs:
return
if with_dependencies:
os.environ['APT_CONFIG'] = self.apt_conf_file
cmd = "%s purge %s" % (self.apt_get_cmd, ' '.join(pkgs))