[oe-commits] [openembedded-core] 10/27: update-alternatives: convert file renames to PACKAGE_PREPROCESS_FUNCS

git at git.openembedded.org git at git.openembedded.org
Thu Jan 31 23:24:53 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 6a3db495bc3ed5716110b45d802b0beeafc6223a
Author: André Draszik <andre.draszik at jci.com>
AuthorDate: Wed Jan 16 12:51:15 2019 +0000

    update-alternatives: convert file renames to PACKAGE_PREPROCESS_FUNCS
    
    At the moment, the update-alternatives file renaming is
    happening right after copying into PKGD during packaging
    time using an _append OVERRIDE to the copy function
    perform_packagecopy().
    
    This is not really readable and hard to maintain.
    
    Additionally, this makes it impossible to e.g. populate
    PACKAGES dynamically using do_split_packages() and still
    do update-alternatives - update-alternatives file renaming
    requires the PACKAGES variable to have been fully populated
    to work correctly. On the other hand, do_split_packages()
    can only execute after perform_packagecopy(), as it needs
    PKGD populated; so it's impossible to insert
    do_split_packages() early enough in a deterministic way in
    this use-case.
    
    As there doesn't seem to be a reason not to, convert
    this to a proper function and use PACKAGE_PREPROCESS_FUNCS
    instead - after all, that's what this is meant for.
    
    No other classes or recipes in oe-core or meta-openembededd
    seem to have a hard requirement on update-alterantives
    executing before any other PACKAGE_PREPROCESS_FUNCS, so
    this should be perfectly fine.
    
    The only implication is that if compress_doc is inherited,
    compressed man-page file names will end up being, e.g.
        eject.1.util-linux.gz
      or
        eject.1.gz.util-linux
    based on the include of compress_doc.bbclass vs.
    update-alternatives.bbclass order, but the symlink created
    (alternative name) will always be correct.
    
    This solves both problems:
    * the code is easier to read / follow
    * the above described use-case can be accomodated easily
    
    [YOCTO #13058]
    
    Signed-off-by: André Draszik <andre.draszik at jci.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/update-alternatives.bbclass | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/meta/classes/update-alternatives.bbclass b/meta/classes/update-alternatives.bbclass
index f1250f8..f3c014a 100644
--- a/meta/classes/update-alternatives.bbclass
+++ b/meta/classes/update-alternatives.bbclass
@@ -131,14 +131,13 @@ def gen_updatealternativesvars(d):
 populate_packages[vardeps] += "${UPDALTVARS} ${@gen_updatealternativesvars(d)}"
 
 # We need to do the rename after the image creation step, but before
-# 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)
-}
+# the split and strip steps..  PACKAGE_PREPROCESS_FUNCS is the right
+# place for that.
+PACKAGE_PREPROCESS_FUNCS += "apply_update_alternative_renames"
+python apply_update_alternative_renames () {
+    if not update_alternatives_enabled(d):
+       return
 
-def apply_update_alternative_renames(d):
     # Check for deprecated usage...
     pn = d.getVar('BPN')
     if d.getVar('ALTERNATIVE_LINKS') != None:
@@ -204,6 +203,7 @@ def apply_update_alternative_renames(d):
                     os.unlink(src)
                 else:
                     bb.warn('%s: Unable to resolve dangling symlink: %s' % (pn, alt_target))
+}
 
 PACKAGESPLITFUNCS_prepend = "populate_packages_updatealternatives "
 

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


More information about the Openembedded-commits mailing list