From: Michael Ho <michael...@bmw.de>

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...@bmw.de>
Signed-off-by: Aditya.Tayade <aditya.tay...@kpit.com>
---
 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:
--
2.7.4

This message contains information that may be privileged or confidential and is 
the property of the KPIT Technologies Ltd. It is intended only for the person 
to whom it is addressed. If you are not the intended recipient, you are not 
authorized to read, print, retain copy, disseminate, distribute, or use this 
message or any part thereof. If you receive this message in error, please 
notify the sender immediately and delete all copies of this message. KPIT 
Technologies Ltd. does not accept any liability for virus infected mails.
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to