summaryrefslogtreecommitdiffstats
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-29 10:16:14 +0100
commitfa5640d143beea4be101d6622d3fa133d04272f2 (patch)
tree7ca77430c1531399bdde6caec441bae40ac69568 /meta/classes/image.bbclass
parenta73c25d2ded3a72159f2ce527e7307808c734686 (diff)
downloadpoky-fa5640d143beea4be101d6622d3fa133d04272f2.tar.gz
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]. (From OE-Core rev: 72d1048a8381fa4a8c4c0d082047536727b4be47) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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}
6inherit populate_sdk_base 6inherit populate_sdk_base
7 7
8TOOLCHAIN_TARGET_TASK += "${PACKAGE_INSTALL}" 8TOOLCHAIN_TARGET_TASK += "${PACKAGE_INSTALL}"
9TOOLCHAIN_TARGET_TASK_ATTEMPTONLY += "${PACKAGE_INSTALL_ATTEMPTONLY} ${PACKAGE_GROUP_dev-pkgs} ${PACKAGE_GROUP_dbg-pkgs}" 9TOOLCHAIN_TARGET_TASK_ATTEMPTONLY += "${PACKAGE_INSTALL_ATTEMPTONLY}"
10POPULATE_SDK_POST_TARGET_COMMAND += "rootfs_install_complementary populate_sdk; "
10 11
11inherit gzipnative 12inherit gzipnative
12 13
@@ -38,25 +39,23 @@ def normal_groups(d):
38 features = set(oe.data.typed_value('IMAGE_FEATURES', d)) 39 features = set(oe.data.typed_value('IMAGE_FEATURES', d))
39 return features.difference(extras) 40 return features.difference(extras)
40 41
41def normal_pkgs_to_install(d): 42# Wildcards specifying complementary packages to install for every package that has been explicitly
42 import oe.packagedata 43# installed into the rootfs
43 44def complementary_globs(featurevar, d):
44 to_install = oe.data.typed_value('IMAGE_INSTALL', d) 45 globs = []
45 features = normal_groups(d) 46 features = set((d.getVar(featurevar, True) or '').split())
46 required = list(oe.packagegroup.required_packages(features, d)) 47 for feature in features:
47 optional = list(oe.packagegroup.optional_packages(features, d)) 48 if feature == 'dev-pkgs':
48 all_packages = to_install + required + optional 49 globs.append('*-dev')
49 50 elif feature == 'doc-pkgs':
50 recipes = filter(None, [oe.packagedata.recipename(pkg, d) for pkg in all_packages]) 51 globs.append('*-doc')
51 52 elif feature == 'dbg-pkgs':
52 return all_packages + recipes 53 globs.append('*-dbg')
53 54 return ' '.join(globs)
54PACKAGE_GROUP_dbg-pkgs = "${@' '.join('%s-dbg' % pkg for pkg in normal_pkgs_to_install(d))}" 55
55PACKAGE_GROUP_dbg-pkgs[optional] = "1" 56IMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("IMAGE_FEATURES", d)}'
56PACKAGE_GROUP_dev-pkgs = "${@' '.join('%s-dev' % pkg for pkg in normal_pkgs_to_install(d))}" 57SDKIMAGE_FEATURES ??= "dev-pkgs dbg-pkgs"
57PACKAGE_GROUP_dev-pkgs[optional] = "1" 58SDKIMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("SDKIMAGE_FEATURES", d)}'
58PACKAGE_GROUP_doc-pkgs = "${@' '.join('%s-doc' % pkg for pkg in normal_pkgs_to_install(d))}"
59PACKAGE_GROUP_doc-pkgs[optional] = "1"
60 59
61# "export IMAGE_BASENAME" not supported at this time 60# "export IMAGE_BASENAME" not supported at this time
62IMAGE_INSTALL ?= "" 61IMAGE_INSTALL ?= ""
@@ -306,32 +305,44 @@ get_split_linguas() {
306 done | sort | uniq 305 done | sort | uniq
307} 306}
308 307
309rootfs_install_all_locales() { 308rootfs_install_complementary() {
310 # Generate list of installed packages for which additional locale packages might be available 309 # Install complementary packages based upon the list of currently installed packages
311 INSTALLED_PACKAGES=`list_installed_packages | egrep -v -- "(-locale-|^locale-base-|-dev$|-doc$|^kernel|^glibc|^ttf|^task|^perl|^python)"` 310 # e.g. locales, *-dev, *-dbg, etc. This will only attempt to install these packages,
312 311 # if they don't exist then no error will occur.
313 # Generate a list of locale packages that exist 312 # Note: every backend needs to call this function explicitly after the normal
314 SPLIT_LINGUAS=`get_split_linguas` 313 # package installation
315 PACKAGES_TO_INSTALL="" 314
316 for lang in $SPLIT_LINGUAS; do 315 # Get list of installed packages
317 for pkg in $INSTALLED_PACKAGES; do 316 list_installed_packages arch > ${WORKDIR}/installed_pkgs.txt
318 existing_pkg=`rootfs_check_package_exists $pkg-locale-$lang` 317
319 if [ "$existing_pkg" != "" ]; then 318 # Apply the globs to all the packages currently installed
320 PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL $existing_pkg" 319 if [ "$1" = "populate_sdk" ] ; then
321 fi 320 GLOBS="${SDKIMAGE_INSTALL_COMPLEMENTARY}"
321 else
322 GLOBS="${IMAGE_INSTALL_COMPLEMENTARY}"
323 # Add locales
324 SPLIT_LINGUAS=`get_split_linguas`
325 PACKAGES_TO_INSTALL=""
326 for lang in $SPLIT_LINGUAS ; do
327 GLOBS="$GLOBS *-locale-$lang"
322 done 328 done
323 done 329 fi
330
331 if [ "$GLOBS" != "" ] ; then
332 # Use the magic script to do all the work for us :)
333 oe-pkgdata-util glob ${TMPDIR}/pkgdata ${TARGET_VENDOR}-${TARGET_OS} ${WORKDIR}/installed_pkgs.txt "$GLOBS" > ${WORKDIR}/complementary_pkgs.txt
324 334
325 # Install the packages, if any 335 # Install the packages, if any
326 if [ "$PACKAGES_TO_INSTALL" != "" ]; then 336 sed -i '/^$/d' ${WORKDIR}/complementary_pkgs.txt
327 rootfs_install_packages $PACKAGES_TO_INSTALL 337 if [ -s ${WORKDIR}/complementary_pkgs.txt ]; then
338 echo "Installing complementary packages"
339 rootfs_install_packages ${WORKDIR}/complementary_pkgs.txt
340 fi
328 fi 341 fi
329 342
330 # Workaround for broken shell function dependencies 343 # Workaround for broken shell function dependencies
331 if false ; then 344 if false ; then
332 get_split_linguas 345 get_split_linguas
333 list_installed_packages
334 rootfs_check_package_exists
335 fi 346 fi
336} 347}
337 348