* [PATCH] binconfig.bbclass: fix multilib file conflicts
@ 2014-11-25 3:15 Ming Liu
2014-11-25 3:18 ` Ming Liu
0 siblings, 1 reply; 2+ messages in thread
From: Ming Liu @ 2014-11-25 3:15 UTC (permalink / raw)
To: openembedded-core
In a lot of cases binconfig files refer to multilib particular paths like
${base_libdir}, ${libdir}, this would certainly cause files conflict among
multilib packages when they are involved in the image, for instance:
with following lines:
......
IMAGE_INSTALL_append = " curl"
IMAGE_INSTALL_append = " lib32-curl"
......
$ bitbake ${DEFAULT_IMAGE} -c populate_sdk
The above task would fail due to the file conflicts between multilib
binconfigs.
I know the situation is that most of the binconfig usage were removed from
recipes, but there are still some not in the case, and we also need take
account of the cases that some recipes may need it for their own purpose.
This patch aims to use update-alternatives link *-config from real path
with a PACKAGE_ARCH suffix to avoid the conflicts, which will shore up the
binconfig.bbclass without introducing any harmness.
Signed-off-by: Ming Liu <ming.liu@windriver.com>
---
meta/classes/binconfig.bbclass | 81 ++++++++++++++++++++++++++++++++
meta/recipes-devtools/tcltk/tcl_8.6.3.bb | 1 +
2 files changed, 82 insertions(+)
diff --git a/meta/classes/binconfig.bbclass b/meta/classes/binconfig.bbclass
index abeda57..b8cc518 100644
--- a/meta/classes/binconfig.bbclass
+++ b/meta/classes/binconfig.bbclass
@@ -1,4 +1,5 @@
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
@@ -27,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
@@ -54,6 +67,74 @@ binconfig_package_preprocess () {
done
}
+binconfig_rename_package_preprocess () {
+ binconfig_files=`echo ${BINCONFIG_FILES} | sed 's:\.${PACKAGE_ARCH}::'`
+ for config in `find ${PKGD} -wholename ${PKGD}$binconfig_files`; 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)
+ binconfig_files = d.getVar('BINCONFIG_FILES', True)
+ binconfig_priority = d.getVar('BINCONFIG_PRIORITY', True)
+ binconfig_setup_links = ""
+ binconfig_remove_links = ""
+ for file in glob.glob('%s%s' % (dvar, binconfig_files)):
+ binconfig_target = os.path.basename(file)
+ binconfig_name = binconfig_target[:binconfig_target.find('.')]
+ binconfig_link = file[:file.rfind('.')].replace(dvar, "")
+ 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
+
+ pkg = d.getVar('PN', True) + '-dev'
+ pkgdest = d.getVar('PKGDEST', True)
+ binconfig_files = d.getVar('BINCONFIG_FILES', True)
+
+ for file in glob.glob('%s/%s%s' % (pkgdest, pkg, binconfig_files)):
+ binconfig_target = os.path.basename(file)
+ binconfig_link = file[:file.rfind('.')].replace(pkgdest + os.sep + pkg, "")
+
+ # Add file provide
+ trans_target = oe.package.file_translate('%s' % file.replace(pkgdest + os.sep + pkg, ""))
+ 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 () {
diff --git a/meta/recipes-devtools/tcltk/tcl_8.6.3.bb b/meta/recipes-devtools/tcltk/tcl_8.6.3.bb
index 27197fa..055b9cf 100644
--- a/meta/recipes-devtools/tcltk/tcl_8.6.3.bb
+++ b/meta/recipes-devtools/tcltk/tcl_8.6.3.bb
@@ -92,6 +92,7 @@ do_install_ptest() {
# Fix some paths that might be used by Tcl extensions
BINCONFIG_GLOB = "*Config.sh"
BINCONFIG_FILES = "${bindir}/*Config.sh"
+BINCONFIG_FILES_class-target = "${bindir}/*Config.sh.${PACKAGE_ARCH}"
# Fix the path in sstate
SSTATE_SCAN_FILES += "*Config.sh"
--
1.8.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] binconfig.bbclass: fix multilib file conflicts
2014-11-25 3:15 [PATCH] binconfig.bbclass: fix multilib file conflicts Ming Liu
@ 2014-11-25 3:18 ` Ming Liu
0 siblings, 0 replies; 2+ messages in thread
From: Ming Liu @ 2014-11-25 3:18 UTC (permalink / raw)
To: openembedded-core
This path is after my previous review request "[OE-core] [PATCH 1/3]
binconfig.bbclass: introduce BINCONFIG_FILES variable".
//Ming Liu
On 11/25/2014 11:15 AM, Ming Liu wrote:
> In a lot of cases binconfig files refer to multilib particular paths like
> ${base_libdir}, ${libdir}, this would certainly cause files conflict among
> multilib packages when they are involved in the image, for instance:
> with following lines:
> ......
> IMAGE_INSTALL_append = " curl"
> IMAGE_INSTALL_append = " lib32-curl"
> ......
>
> $ bitbake ${DEFAULT_IMAGE} -c populate_sdk
>
> The above task would fail due to the file conflicts between multilib
> binconfigs.
>
> I know the situation is that most of the binconfig usage were removed from
> recipes, but there are still some not in the case, and we also need take
> account of the cases that some recipes may need it for their own purpose.
>
> This patch aims to use update-alternatives link *-config from real path
> with a PACKAGE_ARCH suffix to avoid the conflicts, which will shore up the
> binconfig.bbclass without introducing any harmness.
>
> Signed-off-by: Ming Liu <ming.liu@windriver.com>
> ---
> meta/classes/binconfig.bbclass | 81 ++++++++++++++++++++++++++++++++
> meta/recipes-devtools/tcltk/tcl_8.6.3.bb | 1 +
> 2 files changed, 82 insertions(+)
>
> diff --git a/meta/classes/binconfig.bbclass b/meta/classes/binconfig.bbclass
> index abeda57..b8cc518 100644
> --- a/meta/classes/binconfig.bbclass
> +++ b/meta/classes/binconfig.bbclass
> @@ -1,4 +1,5 @@
> 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
> @@ -27,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
> @@ -54,6 +67,74 @@ binconfig_package_preprocess () {
> done
> }
>
> +binconfig_rename_package_preprocess () {
> + binconfig_files=`echo ${BINCONFIG_FILES} | sed 's:\.${PACKAGE_ARCH}::'`
> + for config in `find ${PKGD} -wholename ${PKGD}$binconfig_files`; 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)
> + binconfig_files = d.getVar('BINCONFIG_FILES', True)
> + binconfig_priority = d.getVar('BINCONFIG_PRIORITY', True)
> + binconfig_setup_links = ""
> + binconfig_remove_links = ""
> + for file in glob.glob('%s%s' % (dvar, binconfig_files)):
> + binconfig_target = os.path.basename(file)
> + binconfig_name = binconfig_target[:binconfig_target.find('.')]
> + binconfig_link = file[:file.rfind('.')].replace(dvar, "")
> + 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
> +
> + pkg = d.getVar('PN', True) + '-dev'
> + pkgdest = d.getVar('PKGDEST', True)
> + binconfig_files = d.getVar('BINCONFIG_FILES', True)
> +
> + for file in glob.glob('%s/%s%s' % (pkgdest, pkg, binconfig_files)):
> + binconfig_target = os.path.basename(file)
> + binconfig_link = file[:file.rfind('.')].replace(pkgdest + os.sep + pkg, "")
> +
> + # Add file provide
> + trans_target = oe.package.file_translate('%s' % file.replace(pkgdest + os.sep + pkg, ""))
> + 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 () {
> diff --git a/meta/recipes-devtools/tcltk/tcl_8.6.3.bb b/meta/recipes-devtools/tcltk/tcl_8.6.3.bb
> index 27197fa..055b9cf 100644
> --- a/meta/recipes-devtools/tcltk/tcl_8.6.3.bb
> +++ b/meta/recipes-devtools/tcltk/tcl_8.6.3.bb
> @@ -92,6 +92,7 @@ do_install_ptest() {
> # Fix some paths that might be used by Tcl extensions
> BINCONFIG_GLOB = "*Config.sh"
> BINCONFIG_FILES = "${bindir}/*Config.sh"
> +BINCONFIG_FILES_class-target = "${bindir}/*Config.sh.${PACKAGE_ARCH}"
>
> # Fix the path in sstate
> SSTATE_SCAN_FILES += "*Config.sh"
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-25 3:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-25 3:15 [PATCH] binconfig.bbclass: fix multilib file conflicts Ming Liu
2014-11-25 3:18 ` Ming Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox