mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +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:
committed by
Richard Purdie
parent
4ef016683d
commit
1de82d5fc0
@@ -864,8 +864,9 @@ class RpmPM(PackageManager):
|
|||||||
failed_postinsts_abort(list(failed_scriptlets_pkgnames.keys()), self.d.expand("${T}/log.do_${BB_CURRENTTASK}"))
|
failed_postinsts_abort(list(failed_scriptlets_pkgnames.keys()), self.d.expand("${T}/log.do_${BB_CURRENTTASK}"))
|
||||||
|
|
||||||
def remove(self, pkgs, with_dependencies = True):
|
def remove(self, pkgs, with_dependencies = True):
|
||||||
if len(pkgs) == 0:
|
if not pkgs:
|
||||||
return
|
return
|
||||||
|
|
||||||
self._prepare_pkg_transaction()
|
self._prepare_pkg_transaction()
|
||||||
|
|
||||||
if with_dependencies:
|
if with_dependencies:
|
||||||
@@ -1353,6 +1354,9 @@ class OpkgPM(OpkgDpkgPM):
|
|||||||
(cmd, e.returncode, e.output.decode("utf-8")))
|
(cmd, e.returncode, e.output.decode("utf-8")))
|
||||||
|
|
||||||
def remove(self, pkgs, with_dependencies=True):
|
def remove(self, pkgs, with_dependencies=True):
|
||||||
|
if not pkgs:
|
||||||
|
return
|
||||||
|
|
||||||
if with_dependencies:
|
if with_dependencies:
|
||||||
cmd = "%s %s --force-remove --force-removal-of-dependent-packages remove %s" % \
|
cmd = "%s %s --force-remove --force-removal-of-dependent-packages remove %s" % \
|
||||||
(self.opkg_cmd, self.opkg_args, ' '.join(pkgs))
|
(self.opkg_cmd, self.opkg_args, ' '.join(pkgs))
|
||||||
@@ -1663,6 +1667,9 @@ class DpkgPM(OpkgDpkgPM):
|
|||||||
|
|
||||||
|
|
||||||
def remove(self, pkgs, with_dependencies=True):
|
def remove(self, pkgs, with_dependencies=True):
|
||||||
|
if not pkgs:
|
||||||
|
return
|
||||||
|
|
||||||
if with_dependencies:
|
if with_dependencies:
|
||||||
os.environ['APT_CONFIG'] = self.apt_conf_file
|
os.environ['APT_CONFIG'] = self.apt_conf_file
|
||||||
cmd = "%s purge %s" % (self.apt_get_cmd, ' '.join(pkgs))
|
cmd = "%s purge %s" % (self.apt_get_cmd, ' '.join(pkgs))
|
||||||
|
|||||||
Reference in New Issue
Block a user