summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-10-16 14:32:04 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-10-18 11:03:12 +0100
commit715ec20c433cb4ed5fde938c33a42b2a296e4e56 (patch)
tree6a24b747037fdf0dfd6db84d6f1daf9966b90a2c
parentd31212bcfe9232e7f6ac9efb4fad0be175a9ca00 (diff)
downloadopenembedded-core-contrib-715ec20c433cb4ed5fde938c33a42b2a296e4e56.tar.gz
openembedded-core-contrib-715ec20c433cb4ed5fde938c33a42b2a296e4e56.tar.bz2
openembedded-core-contrib-715ec20c433cb4ed5fde938c33a42b2a296e4e56.zip
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 ] Signed-off-by: Ross Burton <ross.burton@intel.com>
-rw-r--r--meta/lib/oe/package_manager.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 5964c61338..2cc1c752b3 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -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))