From: Ming Liu <ming.liu@windriver.com>
To: ming liu <mliu3@pek-lpgbuild1.wrs.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH V2] binconfig.bbclass: fix multilib file conflicts
Date: Mon, 21 Apr 2014 13:41:41 +0800 [thread overview]
Message-ID: <5354AF95.7040109@windriver.com> (raw)
In-Reply-To: <1398058390-3227-1-git-send-email-mliu3@pek-lpgbuild1.wrs.com>
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 () {
parent reply other threads:[~2014-04-21 5:41 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <1398058390-3227-1-git-send-email-mliu3@pek-lpgbuild1.wrs.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5354AF95.7040109@windriver.com \
--to=ming.liu@windriver.com \
--cc=mliu3@pek-lpgbuild1.wrs.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox