[oe-commits] [openembedded-core] 01/07: package_manager.py: handle renamed packages for PACKAGE_EXCLUDE with opkg

git at git.openembedded.org git at git.openembedded.org
Tue Jun 4 10:35:41 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 4561f7af2b025064dcdf5177cea91f00b835bcfa
Author: Michael Ho <Michael.Ho at bmw.de>
AuthorDate: Mon Jun 3 16:42:01 2019 +0000

    package_manager.py: handle renamed packages for PACKAGE_EXCLUDE with opkg
    
    The PACKAGE_EXCLUDE variable is used to pass a list of packages to be
    forbidden from installation with opkg. This list however does not account
    normally for the renaming of packages which can occur (for example when the
    debian bbclass is enabled, packages with libs are renamed from xxx to libxxx)
    and so expected excluded packages are not blocked.
    
    Rather than tediously maintaining the PACKAGE_EXCLUDE variable to handle
    renamed packages that can dynamically change, move the expansion of the
    variable from parsing time to run time so it can use the pkgdata dictionaries
    to add automatically any renamed packages.
    
    Upstream-Status: Pending
    
    Signed-off-by: Michael Ho <Michael.Ho at bmw.de>
    Signed-off-by: Aditya.Tayade <Aditya.Tayade at kpit.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/package_ipk.bbclass |  1 -
 meta/lib/oe/package_manager.py   | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass
index d1b317b..fa71869 100644
--- a/meta/classes/package_ipk.bbclass
+++ b/meta/classes/package_ipk.bbclass
@@ -12,7 +12,6 @@ OPKGBUILDCMD ??= 'opkg-build -Z xz -a "${XZ_DEFAULTS}"'
 
 OPKG_ARGS += "--force_postinstall --prefer-arch-to-version"
 OPKG_ARGS += "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS") == "1"]}"
-OPKG_ARGS += "${@['', '--add-exclude ' + ' --add-exclude '.join((d.getVar('PACKAGE_EXCLUDE') or "").split())][(d.getVar("PACKAGE_EXCLUDE") or "").strip() != ""]}"
 
 OPKGLIBDIR = "${localstatedir}/lib"
 
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 06feb4d..ca66bdf 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -1160,6 +1160,21 @@ class OpkgPM(OpkgDpkgPM):
         self.deploy_lock_file = os.path.join(self.deploy_dir, "deploy.lock")
         self.opkg_cmd = bb.utils.which(os.getenv('PATH'), "opkg")
         self.opkg_args = "--volatile-cache -f %s -t %s -o %s " % (self.config_file, self.d.expand('${T}/ipktemp/') ,target_rootfs)
+
+        # Handle excluded packages here rather than at parsing time so we can expand out the
+        # PACKAGE_EXCLUDES at the runtime moment when pkgdata is available
+        def opkg_exclude_args(pkg_excludes):
+            remapped_pkg_excludes = []
+            for pkg in pkg_excludes:
+                pkg_data = oe.packagedata.read_subpkgdata(pkg, d)
+                rename_key = "PKG_{}".format(pkg)
+                if pkg_data and rename_key in pkg_data and pkg_data[rename_key] != pkg:
+                    remapped_pkg_excludes.append(pkg_data[rename_key])
+            pkg_excludes.extend(remapped_pkg_excludes)
+            pkg_excludes.sort()
+            return " --add-exclude " + " --add-exclude ".join(pkg_excludes)
+
+        self.opkg_args += opkg_exclude_args((d.getVar("PACKAGE_EXCLUDE") or "").split())
         self.opkg_args += self.d.getVar("OPKG_ARGS")
 
         if prepare_index:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list