[OE-core] [PATCH 06/12] update-alternatives: allow hooks before renaming files

André Draszik git at andred.net
Mon Jan 14 12:56:26 UTC 2019


From: André Draszik <andre.draszik at jci.com>

At the moment, the update alternatives handling is happening
right after copying into PKGD during packaging time using
an _append OVERRIDE to the copy function. This means that at
this point the PACKAGES variable must have been fully
populated, as that is a prerequisite for update-alternatives.

In other words, this makes it impossible to e.g. populate
PACKAGES dynamically using do_split_packages() and still do
update-alternatives, as do_split_packages() can never
execute early enough in a deterministic way.

By converting the existing python function from a 'def'
type function to a 'python' type function, we now make it
possible for somebody to hook themselves between copying
into PKGD and execution of update-alternatives, via
a _prepend OVERRIDE, which is not possible with 'def' type
functions.

[YOCTO #13058]

Signed-off-by: André Draszik <andre.draszik at jci.com>
---
 meta/classes/update-alternatives.bbclass | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/meta/classes/update-alternatives.bbclass b/meta/classes/update-alternatives.bbclass
index f1250f877b..ffedada2f6 100644
--- a/meta/classes/update-alternatives.bbclass
+++ b/meta/classes/update-alternatives.bbclass
@@ -135,10 +135,10 @@ populate_packages[vardeps] += "${UPDALTVARS} ${@gen_updatealternativesvars(d)}"
 # place.
 python perform_packagecopy_append () {
     if update_alternatives_enabled(d):
-        apply_update_alternative_renames(d)
+        bb.build.exec_func('apply_update_alternative_renames', d)
 }
 
-def apply_update_alternative_renames(d):
+python apply_update_alternative_renames () {
     # Check for deprecated usage...
     pn = d.getVar('BPN')
     if d.getVar('ALTERNATIVE_LINKS') != None:
@@ -204,6 +204,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 "
 
-- 
2.20.1



More information about the Openembedded-core mailing list