* Re: [PATCH V2] binconfig.bbclass: fix multilib file conflicts
[not found] <1398058390-3227-1-git-send-email-mliu3@pek-lpgbuild1.wrs.com>
@ 2014-04-21 5:41 ` Ming Liu
0 siblings, 0 replies; only message in thread
From: Ming Liu @ 2014-04-21 5:41 UTC (permalink / raw)
To: ming liu; +Cc: openembedded-core
I know this patch is not going to be integrated, for as Richard Purdie
pointed out, it should be replaced by a requirement and not needed for
any kind of shored up, but my V1 patch introduced a few drawbacks, so I
put the V2 here to ensure anybody wanna enable multilib in their builds
wouldn't get blocked by this issue before the binconfig.bbclass is removed.
//Ming Liu
On 04/21/2014 01:33 PM, ming liu wrote:
> From: Ming Liu <ming.liu@windriver.com>
>
> In most cases binconfig files conflict among multilib packages, to avoid
> that, use update-alternatives link *-config from real path with a
> PACKAGE_ARCH suffix.
>
> This change needs only apply to target recipes.
>
> Signed-off-by: Ming Liu <ming.liu@windriver.com>
> ---
> meta/classes/binconfig.bbclass | 86 +++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 85 insertions(+), 1 deletions(-)
>
> diff --git a/meta/classes/binconfig.bbclass b/meta/classes/binconfig.bbclass
> index 7158c8c..b6c3923 100644
> --- a/meta/classes/binconfig.bbclass
> +++ b/meta/classes/binconfig.bbclass
> @@ -1,4 +1,6 @@
> -FILES_${PN}-dev += "${bindir}/*-config"
> +BINCONFIG_FILES = "${bindir}/*-config"
> +BINCONFIG_FILES_class-target = "${bindir}/*-config.${PACKAGE_ARCH}"
> +FILES_${PN}-dev += "${BINCONFIG_FILES}"
>
> # The namespaces can clash here hence the two step replace
> def get_binconfig_mangle(d):
> @@ -26,9 +28,21 @@ def get_binconfig_mangle(d):
>
> return s
>
> +python __anonymous() {
> + # Update Alternatives are only used on target packages
> + if bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d) or \
> + bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d) or \
> + bb.data.inherits_class('cross-canadian', d):
> + return
> +
> + if not 'virtual/update-alternatives' in d.getVar('PROVIDES', True):
> + d.appendVar('DEPENDS', ' virtual/${MLPREFIX}update-alternatives')
> +}
> +
> BINCONFIG_GLOB ?= "*-config"
>
> PACKAGE_PREPROCESS_FUNCS += "binconfig_package_preprocess"
> +PACKAGE_PREPROCESS_FUNCS_append_class-target = " binconfig_rename_package_preprocess"
>
> binconfig_package_preprocess () {
> for config in `find ${PKGD} -name '${BINCONFIG_GLOB}'`; do
> @@ -51,6 +65,76 @@ binconfig_package_preprocess () {
> done
> }
>
> +binconfig_rename_package_preprocess () {
> + for config in `find ${PKGD} -name '${BINCONFIG_GLOB}'`; do
> + if [ -h $config ]; then
> + real_config=`readlink $config`
> + unlink $config
> + ( cd ${PKGD}${bindir} ; ln -sf $real_config.${PACKAGE_ARCH} $config.${PACKAGE_ARCH} )
> + else
> + mv $config $config.${PACKAGE_ARCH}
> + fi
> + done
> +}
> +
> +BINCONFIG_PRIORITY ?= "10"
> +
> +PACKAGESPLITFUNCS_prepend_class-target = "populate_packages_binconfig "
> +
> +#
> +# Fix binconfig conflicts among multilib packages
> +#
> +python populate_packages_binconfig () {
> + import os, glob
> +
> + pkg = d.getVar('PN', True) + '-dev'
> + dvar = d.getVar('PKGD', True)
> + bindir = d.getVar('bindir', True)
> + binconfig_glob = d.getVar('BINCONFIG_GLOB', True)
> + binconfig_priority = d.getVar('BINCONFIG_PRIORITY', True)
> + binconfig_setup_links = ""
> + binconfig_remove_links = ""
> + for file in glob.glob('%s%s/%s.%s' % (dvar, bindir, binconfig_glob, d.getVar('PACKAGE_ARCH', True))):
> + binconfig_target = os.path.basename(file)
> + binconfig_name = binconfig_target[:binconfig_target.find('.')]
> + binconfig_link = bindir + os.sep + binconfig_name
> + binconfig_setup_links += '\tupdate-alternatives --install %s %s %s %s\n' % (binconfig_link, binconfig_name, binconfig_target, binconfig_priority)
> + binconfig_remove_links += '\tupdate-alternatives --remove %s %s\n' % (binconfig_name, binconfig_target)
> +
> + if binconfig_setup_links:
> + provider = d.getVar('VIRTUAL-RUNTIME_update-alternatives', True)
> + if provider:
> + d.appendVar('RDEPENDS_%s' % pkg, ' ' + d.getVar('MLPREFIX') + provider)
> +
> + postinst = d.getVar('pkg_postinst_%s' % pkg, True) or '#!/bin/sh\n'
> + postinst += binconfig_setup_links
> + d.setVar('pkg_postinst_%s' % pkg, postinst)
> +
> + postrm = d.getVar('pkg_postrm_%s' % pkg, True) or '#!/bin/sh\n'
> + postrm += binconfig_remove_links
> + d.setVar('pkg_postrm_%s' % pkg, postrm)
> +}
> +
> +python package_do_filedeps_append_class-target () {
> + import glob
> +
> + pn = d.getVar('BPN', True)
> + pkg = d.getVar('PN', True) + '-dev'
> + pkgdest = d.getVar('PKGDEST', True)
> + bindir = d.getVar('bindir', True)
> + binconfig_glob = d.getVar('BINCONFIG_GLOB', True)
> +
> + for file in glob.glob('%s/%s%s/%s.%s' % (pkgdest, pkg, bindir, binconfig_glob, d.getVar('PACKAGE_ARCH', True))):
> + binconfig_target = os.path.basename(file)
> + binconfig_link = '%s/%s' % (bindir, binconfig_target[:binconfig_target.find('.')])
> +
> + # Add file provide
> + trans_target = oe.package.file_translate('%s/%s' % (bindir, binconfig_target))
> + d.appendVar('FILERPROVIDES_%s_%s' % (trans_target, pkg), " " + binconfig_link)
> + if not trans_target in (d.getVar('FILERPROVIDESFLIST_%s' % pkg, True) or ""):
> + d.appendVar('FILERPROVIDESFLIST_%s' % pkg, " " + trans_target)
> +}
> +
> SYSROOT_PREPROCESS_FUNCS += "binconfig_sysroot_preprocess"
>
> binconfig_sysroot_preprocess () {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-04-21 5:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1398058390-3227-1-git-send-email-mliu3@pek-lpgbuild1.wrs.com>
2014-04-21 5:41 ` [PATCH V2] binconfig.bbclass: fix multilib file conflicts Ming Liu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.