mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
a73c25d2de
commit
fa5640d143
+48
-37
@@ -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
|
||||
# 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)
|
||||
|
||||
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"
|
||||
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)"`
|
||||
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
|
||||
|
||||
# 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
|
||||
# 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
|
||||
|
||||
# Install the packages, if any
|
||||
if [ "$PACKAGES_TO_INSTALL" != "" ]; then
|
||||
rootfs_install_packages $PACKAGES_TO_INSTALL
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user