[OE-core] [PATCH v3 07/15] update-alternatives: try to update FILES_${PN} when renaming a file
André Draszik
git at andred.net
Wed Jan 16 12:00:43 UTC 2019
From: André Draszik <andre.draszik at jci.com>
When using update-alternatives, FILES_${PN} must be
referencing the new name after update-alternatives has
renamed files.
This is more or less OK when having static lists of files to
be packaged into a package, but makes it quite hard to
dynamically generate FILES_${PN}, e.g. using do_split_packages(),
as in that case we can not easily modify what goes into
FILES_${PN}, because that list is based on filenames as seen
at the time do_split_packages() is executing.
Of couse one could explicitly specify the (renamed) file(s)
in the recipe, but that contradicts the intended usage of
do_split_packages().
Instead, if FILES_${PN} contains the file name as it was pre
renaming, we here modify this to reflect the new name.
This will allow usage of do_split_packages() to populate
FILES_${PN}.
[YOCTO #13058]
Signed-off-by: André Draszik <andre.draszik at jci.com>
---
meta/classes/update-alternatives.bbclass | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/meta/classes/update-alternatives.bbclass b/meta/classes/update-alternatives.bbclass
index 78291e7e45..363f1ae129 100644
--- a/meta/classes/update-alternatives.bbclass
+++ b/meta/classes/update-alternatives.bbclass
@@ -135,6 +135,8 @@ populate_packages[vardeps] += "${UPDALTVARS} ${@gen_updatealternativesvars(d)}"
# place for that.
PACKAGE_PREPROCESS_FUNCS += "${@'apply_update_alternative_renames' if update_alternatives_enabled(d) else ''}"
python apply_update_alternative_renames () {
+ from re import sub
+
# Check for deprecated usage...
pn = d.getVar('BPN')
if d.getVar('ALTERNATIVE_LINKS') != None:
@@ -174,6 +176,10 @@ python apply_update_alternative_renames () {
else:
bb.note('%s: Rename %s -> %s' % (pn, alt_target, alt_target_rename))
os.rename(src, dest)
+ f = d.getVar('FILES_' + pkg)
+ if f:
+ f = sub(r'(^|\s)%s(\s|$)' % alt_target, r'\1%s\2' % alt_target_rename, f)
+ d.setVar('FILES_' + pkg, f)
else:
bb.warn("%s: alternative target (%s or %s) does not exist, skipping..." % (pn, alt_target, alt_target_rename))
continue
@@ -200,6 +206,11 @@ python apply_update_alternative_renames () {
os.unlink(src)
else:
bb.warn('%s: Unable to resolve dangling symlink: %s' % (pn, alt_target))
+ continue
+ f = d.getVar('FILES_' + pkg)
+ if f:
+ f = sub(r'(^|\s)%s(\s|$)' % alt_target, r'\1%s\2' % alt_target_rename, f)
+ d.setVar('FILES_' + pkg, f)
}
PACKAGESPLITFUNCS_prepend = "populate_packages_updatealternatives "
--
2.20.1
More information about the Openembedded-core
mailing list