mirror of
https://git.yoctoproject.org/poky
synced 2026-05-08 17:19:20 +00:00
update-alternatives: try to update FILES_${PN} when renaming a file
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]
(From OE-Core rev: 5c23fe378732038643a450cbf916334d24764b70)
Signed-off-by: André Draszik <andre.draszik@jci.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
0b782c39b9
commit
bcb3e7b7f8
@@ -138,6 +138,14 @@ python apply_update_alternative_renames () {
|
|||||||
if not update_alternatives_enabled(d):
|
if not update_alternatives_enabled(d):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
from re import sub
|
||||||
|
|
||||||
|
def update_files(alt_target, alt_target_rename, pkg, d):
|
||||||
|
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)
|
||||||
|
|
||||||
# Check for deprecated usage...
|
# Check for deprecated usage...
|
||||||
pn = d.getVar('BPN')
|
pn = d.getVar('BPN')
|
||||||
if d.getVar('ALTERNATIVE_LINKS') != None:
|
if d.getVar('ALTERNATIVE_LINKS') != None:
|
||||||
@@ -177,6 +185,7 @@ python apply_update_alternative_renames () {
|
|||||||
else:
|
else:
|
||||||
bb.note('%s: Rename %s -> %s' % (pn, alt_target, alt_target_rename))
|
bb.note('%s: Rename %s -> %s' % (pn, alt_target, alt_target_rename))
|
||||||
os.rename(src, dest)
|
os.rename(src, dest)
|
||||||
|
update_files(alt_target, alt_target_rename, pkg, d)
|
||||||
else:
|
else:
|
||||||
bb.warn("%s: alternative target (%s or %s) does not exist, skipping..." % (pn, alt_target, alt_target_rename))
|
bb.warn("%s: alternative target (%s or %s) does not exist, skipping..." % (pn, alt_target, alt_target_rename))
|
||||||
continue
|
continue
|
||||||
@@ -203,6 +212,8 @@ python apply_update_alternative_renames () {
|
|||||||
os.unlink(src)
|
os.unlink(src)
|
||||||
else:
|
else:
|
||||||
bb.warn('%s: Unable to resolve dangling symlink: %s' % (pn, alt_target))
|
bb.warn('%s: Unable to resolve dangling symlink: %s' % (pn, alt_target))
|
||||||
|
continue
|
||||||
|
update_files(alt_target, alt_target_rename, pkg, d)
|
||||||
}
|
}
|
||||||
|
|
||||||
PACKAGESPLITFUNCS_prepend = "populate_packages_updatealternatives "
|
PACKAGESPLITFUNCS_prepend = "populate_packages_updatealternatives "
|
||||||
|
|||||||
Reference in New Issue
Block a user