Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Joshua Watt <jpewhacker@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] classes/update-alternatives: Skip alternatives when disabled
Date: Thu, 29 Nov 2018 08:57:20 -0600	[thread overview]
Message-ID: <20181129145720.22520-1-JPEWhacker@gmail.com> (raw)

Skips the update alternative steps for recipes that shouldn't have them
enabled.

Fixes errors like:

 nativesdk-bzip2-1.0.6-r5 do_package: bzip2: alternative target
 (/opt/poky/2.5+snapshot/sysroots/i686-pokysdk-mingw32/usr/bin/bunzip2
 or
 /opt/poky/2.5+snapshot/sysroots/i686-pokysdk-mingw32/usr/bin/bunzip2.bzip2)
 does not exist, skipping...

When building mingw SDKs

[YOCTO #12962]

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes/update-alternatives.bbclass | 27 +++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/meta/classes/update-alternatives.bbclass b/meta/classes/update-alternatives.bbclass
index aa01058cf99..ee663799332 100644
--- a/meta/classes/update-alternatives.bbclass
+++ b/meta/classes/update-alternatives.bbclass
@@ -89,15 +89,21 @@ def ua_extend_depends(d):
     if not 'virtual/update-alternatives' in d.getVar('PROVIDES'):
         d.appendVar('DEPENDS', ' virtual/${MLPREFIX}update-alternatives')
 
-python __anonymous() {
+def update_alternatives_enabled(d):
     # Update Alternatives only works on target packages...
     if bb.data.inherits_class('native', d) or \
        bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d) or \
        bb.data.inherits_class('cross-canadian', d):
-        return
+        return False
 
     # Disable when targeting mingw32 (no target support)
     if d.getVar("TARGET_OS") == "mingw32":
+        return False
+
+    return True
+
+python __anonymous() {
+    if not update_alternatives_enabled(d):
         return
 
     # compute special vardeps
@@ -128,6 +134,11 @@ populate_packages[vardeps] += "${UPDALTVARS} ${@gen_updatealternativesvars(d)}"
 # the split and strip steps..  packagecopy seems to be the earliest reasonable
 # place.
 python perform_packagecopy_append () {
+    if update_alternatives_enabled(d):
+        apply_update_alternative_renames(d)
+}
+
+def apply_update_alternative_renames(d):
     # Check for deprecated usage...
     pn = d.getVar('BPN')
     if d.getVar('ALTERNATIVE_LINKS') != None:
@@ -194,11 +205,13 @@ python perform_packagecopy_append () {
                     os.unlink(src)
                 else:
                     bb.warn('%s: Unable to resolve dangling symlink: %s' % (pn, alt_target))
-}
 
 PACKAGESPLITFUNCS_prepend = "populate_packages_updatealternatives "
 
 python populate_packages_updatealternatives () {
+    if not update_alternatives_enabled(d):
+        return
+
     pn = d.getVar('BPN')
 
     # Do actual update alternatives processing
@@ -252,10 +265,15 @@ python populate_packages_updatealternatives () {
 }
 
 python package_do_filedeps_append () {
+    if update_alternatives_enabled(d):
+        apply_update_alternative_provides(d)
+}
+
+def apply_update_alternative_provides(d):
     pn = d.getVar('BPN')
     pkgdest = d.getVar('PKGDEST')
 
-    for pkg in packages.split():
+    for pkg in d.getVar('PACKAGES').split():
         for alt_name in (d.getVar('ALTERNATIVE_%s' % pkg) or "").split():
             alt_link     = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name)
             alt_target   = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name) or d.getVarFlag('ALTERNATIVE_TARGET', alt_name)
@@ -273,5 +291,4 @@ python package_do_filedeps_append () {
             d.appendVar('FILERPROVIDES_%s_%s' % (trans_target, pkg), " " + alt_link)
             if not trans_target in (d.getVar('FILERPROVIDESFLIST_%s' % pkg) or ""):
                 d.appendVar('FILERPROVIDESFLIST_%s' % pkg, " " + trans_target)
-}
 
-- 
2.19.1



                 reply	other threads:[~2018-11-29 14:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181129145720.22520-1-JPEWhacker@gmail.com \
    --to=jpewhacker@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox