[OE-core] [PATCH v2 1/4] update-alternatives.bbclass: Add function to get metadata
Richard Purdie
richard.purdie at linuxfoundation.org
Sun Apr 7 21:32:23 UTC 2019
On Sun, 2019-04-07 at 12:15 -0500, Mariano Lopez wrote:
> python populate_packages_updatealternatives () {
> if not update_alternatives_enabled(d):
> return
>
> - pn = d.getVar('BPN')
> -
> # Do actual update alternatives processing
> - pkgdest = d.getVar('PKGD')
> for pkg in (d.getVar('PACKAGES') or "").split():
> # Create post install/removal scripts
> alt_setup_links = ""
> alt_remove_links = ""
> - 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)
> - alt_target = alt_target or d.getVar('ALTERNATIVE_TARGET_%s' % pkg) or d.getVar('ALTERNATIVE_TARGET') or alt_link
> - # Sometimes alt_target is specified as relative to the link name.
> - alt_target = os.path.join(os.path.dirname(alt_link), alt_target)
> -
> - alt_priority = d.getVarFlag('ALTERNATIVE_PRIORITY_%s' % pkg, alt_name) or d.getVarFlag('ALTERNATIVE_PRIORITY', alt_name)
> - alt_priority = alt_priority or d.getVar('ALTERNATIVE_PRIORITY_%s' % pkg) or d.getVar('ALTERNATIVE_PRIORITY')
> -
> - # This shouldn't trigger, as it should have been resolved earlier!
> - if alt_link == alt_target:
> - bb.note('alt_link == alt_target: %s == %s -- correcting, this should not happen!' % (alt_link, alt_target))
> - alt_target = '%s.%s' % (alt_target, pn)
> -
> - if not os.path.lexists('%s/%s' % (pkgdest, alt_target)):
> - bb.warn('%s: NOT adding alternative provide %s: %s does not exist' % (pn, alt_link, alt_target))
> - continue
> -
> - # Default to generate shell script.. eventually we may want to change this...
> - alt_target = os.path.normpath(alt_target)
> -
> - alt_setup_links += '\tupdate-alternatives --install %s %s %s %s\n' % (alt_link, alt_name, alt_target, alt_priority)
> - alt_remove_links += '\tupdate-alternatives --remove %s %s\n' % (alt_name, alt_target)
> + updates = update_alternatives_alt_targets(d, pkg)
> + for alt_name, alt_link, alt_target, alt_priority in updates:
> + alt_setup_links += '\tupdate-alternatives --install %s %s %s %s\n' % (alt_link, alt_name, alt_target, alt_priority)
> + alt_remove_links += '\tupdate-alternatives --remove %s %s\n' % (alt_name, alt_target)
I think the above is three whitespaces, not four? I know its minor but
it jumped out as I was comparing the code before/after!
Cheers,
Richard
More information about the Openembedded-core
mailing list