summaryrefslogtreecommitdiff
path: root/meta/classes/image.bbclass
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-07-09 14:15:08 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-07-28 11:13:51 +0100
commit72d1048a8381fa4a8c4c0d082047536727b4be47 (patch)
treeb8627cf178fca43ff7b2c0e73ecd26d06cd7d8ca /meta/classes/image.bbclass
parent9135d351ba7cb21e50239d2b310565680bd4fdca (diff)
downloadopenembedded-core-72d1048a8381fa4a8c4c0d082047536727b4be47.tar.gz
openembedded-core-72d1048a8381fa4a8c4c0d082047536727b4be47.tar.bz2
openembedded-core-72d1048a8381fa4a8c4c0d082047536727b4be47.zip
Rework installation of dev, dbg, doc, and locale packages
Use a similar mechanism that was previously used to install locales at rootfs generation time to install other "complementary" packages (e.g. *-dev packages) - i.e. install all of the explicitly requested packages and their dependencies, then get a list of the packages that were installed, and use that list to install the complementary packages. This has been implemented by using a list of globs which should make it easier to extend in future. The previous locale package installation code assumed that the locale packages did not have any dependencies that were not already installed; now that we are installing non-locale packages this is no longer correct. In practice only the rpm backend actually made use of this assumption, so it needed to be changed to call into the existing package backend code to do the complementary package installation rather than calling rpm directly. This fixes the doc-pkgs IMAGE_FEATURES feature to work correctly, and also ensures that all dev/dbg packages get installed for dev-pkgs/dbg-pkgs respectively even if the dependency chains between those packages was not ensuring that already. The code has also been adapted to work correctly with the new SDK-from-image functionality. To that end, an SDKIMAGE_FEATURES variable has been added to allow specifying what extra image features should go into the SDK (extra, because by virtue of installing all of the packages in the image into the target part of the SDK, we already include all of IMAGE_FEATURES) with a default value of "dev-pkgs dbg-pkgs". Fixes [YOCTO #2614]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'meta/classes/image.bbclass')
-rw-r--r--meta/classes/image.bbclass89
1 files changed, 50 insertions, 39 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 0a380f1172..0f7744aa5e 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -6,7 +6,8 @@ inherit imagetest-${IMAGETEST}
inherit populate_sdk_base
TOOLCHAIN_TARGET_TASK += "${PACKAGE_INSTALL}"
-TOOLCHAIN_TARGET_TASK_ATTEMPTONLY += "${PACKAGE_INSTALL_ATTEMPTONLY} ${PACKAGE_GROUP_dev-pkgs} ${PACKAGE_GROUP_dbg-pkgs}"
+TOOLCHAIN_TARGET_TASK_ATTEMPTONLY += "${PACKAGE_INSTALL_ATTEMPTONLY}"
+POPULATE_SDK_POST_TARGET_COMMAND += "rootfs_install_complementary populate_sdk; "
inherit gzipnative
@@ -38,25 +39,23 @@ def normal_groups(d):
features = set(oe.data.typed_value('IMAGE_FEATURES', d))
return features.difference(extras)
-def normal_pkgs_to_install(d):
- import oe.packagedata
-
- to_install = oe.data.typed_value('IMAGE_INSTALL', d)
- features = normal_groups(d)
- required = list(oe.packagegroup.required_packages(features, d))
- optional = list(oe.packagegroup.optional_packages(features, d))
- all_packages = to_install + required + optional
-
- recipes = filter(None, [oe.packagedata.recipename(pkg, d) for pkg in all_packages])
-
- return all_packages + recipes
-
-PACKAGE_GROUP_dbg-pkgs = "${@' '.join('%s-dbg' % pkg for pkg in normal_pkgs_to_install(d))}"
-PACKAGE_GROUP_dbg-pkgs[optional] = "1"
-PACKAGE_GROUP_dev-pkgs = "${@' '.join('%s-dev' % pkg for pkg in normal_pkgs_to_install(d))}"
-PACKAGE_GROUP_dev-pkgs[optional] = "1"
-PACKAGE_GROUP_doc-pkgs = "${@' '.join('%s-doc' % pkg for pkg in normal_pkgs_to_install(d))}"
-PACKAGE_GROUP_doc-pkgs[optional] = "1"
+# Wildcards specifying complementary packages to install for every package that has been explicitly
+# installed into the rootfs
+def complementary_globs(featurevar, d):
+ globs = []
+ features = set((d.getVar(featurevar, True) or '').split())
+ for feature in features:
+ if feature == 'dev-pkgs':
+ globs.append('*-dev')
+ elif feature == 'doc-pkgs':
+ globs.append('*-doc')
+ elif feature == 'dbg-pkgs':
+ globs.append('*-dbg')
+ return ' '.join(globs)
+
+IMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("IMAGE_FEATURES", d)}'
+SDKIMAGE_FEATURES ??= "dev-pkgs dbg-pkgs"
+SDKIMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("SDKIMAGE_FEATURES", d)}'
# "export IMAGE_BASENAME" not supported at this time
IMAGE_INSTALL ?= ""
@@ -306,32 +305,44 @@ get_split_linguas() {
done | sort | uniq
}
-rootfs_install_all_locales() {
- # Generate list of installed packages for which additional locale packages might be available
- INSTALLED_PACKAGES=`list_installed_packages | egrep -v -- "(-locale-|^locale-base-|-dev$|-doc$|^kernel|^glibc|^ttf|^task|^perl|^python)"`
-
- # Generate a list of locale packages that exist
- SPLIT_LINGUAS=`get_split_linguas`
- PACKAGES_TO_INSTALL=""
- for lang in $SPLIT_LINGUAS; do
- for pkg in $INSTALLED_PACKAGES; do
- existing_pkg=`rootfs_check_package_exists $pkg-locale-$lang`
- if [ "$existing_pkg" != "" ]; then
- PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL $existing_pkg"
- fi
+rootfs_install_complementary() {
+ # Install complementary packages based upon the list of currently installed packages
+ # e.g. locales, *-dev, *-dbg, etc. This will only attempt to install these packages,
+ # if they don't exist then no error will occur.
+ # Note: every backend needs to call this function explicitly after the normal
+ # package installation
+
+ # Get list of installed packages
+ list_installed_packages arch > ${WORKDIR}/installed_pkgs.txt
+
+ # Apply the globs to all the packages currently installed
+ if [ "$1" = "populate_sdk" ] ; then
+ GLOBS="${SDKIMAGE_INSTALL_COMPLEMENTARY}"
+ else
+ GLOBS="${IMAGE_INSTALL_COMPLEMENTARY}"
+ # Add locales
+ SPLIT_LINGUAS=`get_split_linguas`
+ PACKAGES_TO_INSTALL=""
+ for lang in $SPLIT_LINGUAS ; do
+ GLOBS="$GLOBS *-locale-$lang"
done
- done
+ fi
+
+ if [ "$GLOBS" != "" ] ; then
+ # Use the magic script to do all the work for us :)
+ oe-pkgdata-util glob ${TMPDIR}/pkgdata ${TARGET_VENDOR}-${TARGET_OS} ${WORKDIR}/installed_pkgs.txt "$GLOBS" > ${WORKDIR}/complementary_pkgs.txt
- # Install the packages, if any
- if [ "$PACKAGES_TO_INSTALL" != "" ]; then
- rootfs_install_packages $PACKAGES_TO_INSTALL
+ # Install the packages, if any
+ sed -i '/^$/d' ${WORKDIR}/complementary_pkgs.txt
+ if [ -s ${WORKDIR}/complementary_pkgs.txt ]; then
+ echo "Installing complementary packages"
+ rootfs_install_packages ${WORKDIR}/complementary_pkgs.txt
+ fi
fi
# Workaround for broken shell function dependencies
if false ; then
get_split_linguas
- list_installed_packages
- rootfs_check_package_exists
fi
}