summaryrefslogtreecommitdiffstats
path: root/meta/classes
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
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')
-rw-r--r--meta/classes/image.bbclass89
-rw-r--r--meta/classes/package_rpm.bbclass74
-rw-r--r--meta/classes/populate_sdk_deb.bbclass2
-rw-r--r--meta/classes/populate_sdk_ipk.bbclass2
-rw-r--r--meta/classes/populate_sdk_rpm.bbclass3
-rw-r--r--meta/classes/rootfs_deb.bbclass27
-rw-r--r--meta/classes/rootfs_ipk.bbclass26
-rw-r--r--meta/classes/rootfs_rpm.bbclass35
8 files changed, 147 insertions, 111 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
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 29018e9cca..b4bc52e69b 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -248,6 +248,7 @@ process_pkg_list_rpm() {
248# INSTALL_PACKAGES_LINGUAS_RPM - additional packages for uclibc 248# INSTALL_PACKAGES_LINGUAS_RPM - additional packages for uclibc
249# INSTALL_PROVIDENAME_RPM - content for provide name 249# INSTALL_PROVIDENAME_RPM - content for provide name
250# INSTALL_TASK_RPM - task name 250# INSTALL_TASK_RPM - task name
251# INSTALL_COMPLEMENTARY_RPM - 1 to enable complementary package install mode
251 252
252package_install_internal_rpm () { 253package_install_internal_rpm () {
253 254
@@ -261,31 +262,35 @@ package_install_internal_rpm () {
261 local providename="${INSTALL_PROVIDENAME_RPM}" 262 local providename="${INSTALL_PROVIDENAME_RPM}"
262 local task="${INSTALL_TASK_RPM}" 263 local task="${INSTALL_TASK_RPM}"
263 264
264 # Setup base system configuration 265 if [ "${INSTALL_COMPLEMENTARY_RPM}" != "1" ] ; then
265 mkdir -p ${target_rootfs}/etc/rpm/ 266 # Setup base system configuration
266 echo "${platform}${TARGET_VENDOR}-${TARGET_OS}" > ${target_rootfs}/etc/rpm/platform 267 mkdir -p ${target_rootfs}/etc/rpm/
267 if [ ! -z "$platform_extra" ]; then 268 echo "${platform}${TARGET_VENDOR}-${TARGET_OS}" > ${target_rootfs}/etc/rpm/platform
268 for pt in $platform_extra ; do 269 if [ ! -z "$platform_extra" ]; then
269 case $pt in 270 for pt in $platform_extra ; do
270 noarch | any | all) 271 case $pt in
271 os="`echo ${TARGET_OS} | sed "s,-.*,,"`.*" 272 noarch | any | all)
272 ;; 273 os="`echo ${TARGET_OS} | sed "s,-.*,,"`.*"
273 *) 274 ;;
274 os="${TARGET_OS}" 275 *)
275 ;; 276 os="${TARGET_OS}"
276 esac 277 ;;
277 echo "$pt-.*-$os" >> ${target_rootfs}/etc/rpm/platform 278 esac
278 done 279 echo "$pt-.*-$os" >> ${target_rootfs}/etc/rpm/platform
279 fi 280 done
281 fi
280 282
281 # Tell RPM that the "/" directory exist and is available 283 # Tell RPM that the "/" directory exist and is available
282 mkdir -p ${target_rootfs}/etc/rpm/sysinfo 284 mkdir -p ${target_rootfs}/etc/rpm/sysinfo
283 echo "/" >${target_rootfs}/etc/rpm/sysinfo/Dirnames 285 echo "/" >${target_rootfs}/etc/rpm/sysinfo/Dirnames
284 if [ ! -z "$providename" ]; then 286 if [ ! -z "$providename" ]; then
285 cat /dev/null > ${target_rootfs}/etc/rpm/sysinfo/Providename 287 cat /dev/null > ${target_rootfs}/etc/rpm/sysinfo/Providename
286 for provide in $providename ; do 288 for provide in $providename ; do
287 echo $provide >> ${target_rootfs}/etc/rpm/sysinfo/Providename 289 echo $provide >> ${target_rootfs}/etc/rpm/sysinfo/Providename
288 done 290 done
291 fi
292 else
293 mv ${target_rootfs}/install/total_solution.manifest ${target_rootfs}/install/original_solution.manifest
289 fi 294 fi
290 295
291 # Setup manifest of packages to install... 296 # Setup manifest of packages to install...
@@ -480,13 +485,22 @@ mutex_set_max 163840
480# ================ Replication 485# ================ Replication
481EOF 486EOF
482 487
483 # RPM is special. It can't handle dependencies and preinstall scripts correctly. Its 488 if [ "${INSTALL_COMPLEMENTARY_RPM}" = "1" ] ; then
484 # probably a feature. The only way to convince rpm to actually run the preinstall scripts 489 # Only install packages not already installed (dependency calculation will
485 # for base-passwd and shadow first before installing packages that depend on these packages 490 # almost certainly have added some that have been)
486 # is to do two image installs, installing one set of packages, then the other. 491 sort ${target_rootfs}/install/original_solution.manifest > ${target_rootfs}/install/original_solution_sorted.manifest
487 if [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f "$pre_btmanifest" ]; then 492 sort ${target_rootfs}/install/total_solution.manifest > ${target_rootfs}/install/total_solution_sorted.manifest
488 echo "Skipping pre install due to exisitng image" 493 comm -2 -3 ${target_rootfs}/install/total_solution_sorted.manifest \
494 ${target_rootfs}/install/original_solution_sorted.manifest | awk '{print $1}' > \
495 ${target_rootfs}/install/diff.manifest
496 mv ${target_rootfs}/install/diff.manifest ${target_rootfs}/install/total_solution.manifest
497 elif [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f "$pre_btmanifest" ]; then
498 echo "Skipping pre install due to existing image"
489 else 499 else
500 # RPM is special. It can't handle dependencies and preinstall scripts correctly. Its
501 # probably a feature. The only way to convince rpm to actually run the preinstall scripts
502 # for base-passwd and shadow first before installing packages that depend on these packages
503 # is to do two image installs, installing one set of packages, then the other.
490 rm -f ${target_rootfs}/install/initial_install.manifest 504 rm -f ${target_rootfs}/install/initial_install.manifest
491 echo "Installing base dependencies first (base-passwd, base-files and shadow) since rpm is special" 505 echo "Installing base dependencies first (base-passwd, base-files and shadow) since rpm is special"
492 grep /base-passwd-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true 506 grep /base-passwd-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true
diff --git a/meta/classes/populate_sdk_deb.bbclass b/meta/classes/populate_sdk_deb.bbclass
index 9e9e1e1d8b..6f89dcfa06 100644
--- a/meta/classes/populate_sdk_deb.bbclass
+++ b/meta/classes/populate_sdk_deb.bbclass
@@ -36,6 +36,8 @@ populate_sdk_deb () {
36 36
37 package_install_internal_deb 37 package_install_internal_deb
38 38
39 ${POPULATE_SDK_POST_TARGET_COMMAND}
40
39 populate_sdk_post_deb ${INSTALL_ROOTFS_DEB} 41 populate_sdk_post_deb ${INSTALL_ROOTFS_DEB}
40 42
41 populate_sdk_log_check populate_sdk 43 populate_sdk_log_check populate_sdk
diff --git a/meta/classes/populate_sdk_ipk.bbclass b/meta/classes/populate_sdk_ipk.bbclass
index 4321afb295..65a95e7a2b 100644
--- a/meta/classes/populate_sdk_ipk.bbclass
+++ b/meta/classes/populate_sdk_ipk.bbclass
@@ -29,6 +29,8 @@ populate_sdk_ipk() {
29 29
30 package_install_internal_ipk 30 package_install_internal_ipk
31 31
32 ${POPULATE_SDK_POST_TARGET_COMMAND}
33
32 #install host 34 #install host
33 export INSTALL_ROOTFS_IPK="${SDK_OUTPUT}" 35 export INSTALL_ROOTFS_IPK="${SDK_OUTPUT}"
34 export INSTALL_CONF_IPK="${IPKGCONF_SDK}" 36 export INSTALL_CONF_IPK="${IPKGCONF_SDK}"
diff --git a/meta/classes/populate_sdk_rpm.bbclass b/meta/classes/populate_sdk_rpm.bbclass
index 365a337a05..fac653bd6f 100644
--- a/meta/classes/populate_sdk_rpm.bbclass
+++ b/meta/classes/populate_sdk_rpm.bbclass
@@ -37,6 +37,7 @@ populate_sdk_rpm () {
37 export INSTALL_PACKAGES_LINGUAS_RPM="" 37 export INSTALL_PACKAGES_LINGUAS_RPM=""
38 export INSTALL_PROVIDENAME_RPM="/bin/sh /bin/bash /usr/bin/env /usr/bin/perl pkgconfig pkgconfig(pkg-config)" 38 export INSTALL_PROVIDENAME_RPM="/bin/sh /bin/bash /usr/bin/env /usr/bin/perl pkgconfig pkgconfig(pkg-config)"
39 export INSTALL_TASK_RPM="populate_sdk-target" 39 export INSTALL_TASK_RPM="populate_sdk-target"
40 export INSTALL_COMPLEMENTARY_RPM=""
40 41
41 # Setup base system configuration 42 # Setup base system configuration
42 mkdir -p ${INSTALL_ROOTFS_RPM}/etc/rpm/ 43 mkdir -p ${INSTALL_ROOTFS_RPM}/etc/rpm/
@@ -74,6 +75,7 @@ EOF
74 export INSTALL_PLATFORM_EXTRA_RPM 75 export INSTALL_PLATFORM_EXTRA_RPM
75 76
76 package_install_internal_rpm 77 package_install_internal_rpm
78 ${POPULATE_SDK_POST_TARGET_COMMAND}
77 populate_sdk_post_rpm ${INSTALL_ROOTFS_RPM} 79 populate_sdk_post_rpm ${INSTALL_ROOTFS_RPM}
78 80
79 ## install nativesdk ## 81 ## install nativesdk ##
@@ -86,6 +88,7 @@ EOF
86 export INSTALL_PACKAGES_LINGUAS_RPM="" 88 export INSTALL_PACKAGES_LINGUAS_RPM=""
87 export INSTALL_PROVIDENAME_RPM="/bin/sh /bin/bash /usr/bin/env /usr/bin/perl pkgconfig libGL.so()(64bit) libGL.so" 89 export INSTALL_PROVIDENAME_RPM="/bin/sh /bin/bash /usr/bin/env /usr/bin/perl pkgconfig libGL.so()(64bit) libGL.so"
88 export INSTALL_TASK_RPM="populate_sdk_rpm-nativesdk" 90 export INSTALL_TASK_RPM="populate_sdk_rpm-nativesdk"
91 export INSTALL_COMPLEMENTARY_RPM=""
89 92
90 # List must be prefered to least preferred order 93 # List must be prefered to least preferred order
91 INSTALL_PLATFORM_EXTRA_RPM="" 94 INSTALL_PLATFORM_EXTRA_RPM=""
diff --git a/meta/classes/rootfs_deb.bbclass b/meta/classes/rootfs_deb.bbclass
index 67871a9087..a002b1ec02 100644
--- a/meta/classes/rootfs_deb.bbclass
+++ b/meta/classes/rootfs_deb.bbclass
@@ -10,7 +10,7 @@ do_rootfs[recrdeptask] += "do_package_write_deb"
10 10
11do_rootfs[lockfiles] += "${WORKDIR}/deb.lock" 11do_rootfs[lockfiles] += "${WORKDIR}/deb.lock"
12 12
13DEB_POSTPROCESS_COMMANDS = "rootfs_install_all_locales; " 13DEB_POSTPROCESS_COMMANDS = ""
14 14
15opkglibdir = "${localstatedir}/lib/opkg" 15opkglibdir = "${localstatedir}/lib/opkg"
16 16
@@ -42,6 +42,8 @@ fakeroot rootfs_deb_do_rootfs () {
42 package_install_internal_deb 42 package_install_internal_deb
43 ${DEB_POSTPROCESS_COMMANDS} 43 ${DEB_POSTPROCESS_COMMANDS}
44 44
45 rootfs_install_complementary
46
45 export D=${IMAGE_ROOTFS} 47 export D=${IMAGE_ROOTFS}
46 export OFFLINE_ROOT=${IMAGE_ROOTFS} 48 export OFFLINE_ROOT=${IMAGE_ROOTFS}
47 export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} 49 export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
@@ -87,10 +89,16 @@ remove_packaging_data_files() {
87 rm -rf ${IMAGE_ROOTFS}/usr/dpkg/ 89 rm -rf ${IMAGE_ROOTFS}/usr/dpkg/
88} 90}
89 91
90DPKG_QUERY_COMMAND = "${STAGING_BINDIR_NATIVE}/dpkg --admindir=${IMAGE_ROOTFS}/var/lib/dpkg" 92# This will of course only work after rootfs_deb_do_rootfs has been called
93DPKG_QUERY_COMMAND = "${STAGING_BINDIR_NATIVE}/dpkg-query --admindir=$INSTALL_ROOTFS_DEB/var/lib/dpkg"
91 94
92list_installed_packages() { 95list_installed_packages() {
93 ${DPKG_QUERY_COMMAND} -l | grep ^ii | awk '{ print $2 }' 96 if [ "$1" = "arch" ] ; then
97 # Here we want the PACKAGE_ARCH not the deb architecture
98 ${DPKG_QUERY_COMMAND} -W -f='${Package} ${PackageArch}\n'
99 else
100 ${DPKG_QUERY_COMMAND} -W -f='${Package}\n'
101 fi
94} 102}
95 103
96get_package_filename() { 104get_package_filename() {
@@ -110,16 +118,9 @@ list_package_recommends() {
110 ${DPKG_QUERY_COMMAND} -s $1 | grep ^Recommends | sed -e 's/^Recommends: //' -e 's/,//g' -e 's:([=<>]* [^ )]*)::g' 118 ${DPKG_QUERY_COMMAND} -s $1 | grep ^Recommends | sed -e 's/^Recommends: //' -e 's/,//g' -e 's:([=<>]* [^ )]*)::g'
111} 119}
112 120
113rootfs_check_package_exists() {
114 if [ `apt-cache policy $1 | wc -l` -gt 4 ]; then
115 echo $1
116 fi
117}
118
119rootfs_install_packages() { 121rootfs_install_packages() {
120 ${STAGING_BINDIR_NATIVE}/apt-get install $@ --force-yes --allow-unauthenticated 122 ${STAGING_BINDIR_NATIVE}/apt-get install `cat $1` --force-yes --allow-unauthenticated
121 123
122 for pkg in $@ ; do 124 # Mark all packages installed
123 deb_package_setflag installed $pkg 125 sed -i -e "s/Status: install ok unpacked/Status: install ok installed/;" $INSTALL_ROOTFS_DEB/var/lib/dpkg/status
124 done
125} 126}
diff --git a/meta/classes/rootfs_ipk.bbclass b/meta/classes/rootfs_ipk.bbclass
index 9732385613..7df97a014b 100644
--- a/meta/classes/rootfs_ipk.bbclass
+++ b/meta/classes/rootfs_ipk.bbclass
@@ -15,10 +15,12 @@ do_rootfs[recrdeptask] += "do_package_write_ipk"
15do_rootfs[lockfiles] += "${WORKDIR}/ipk.lock" 15do_rootfs[lockfiles] += "${WORKDIR}/ipk.lock"
16 16
17IPKG_ARGS = "-f ${IPKGCONF_TARGET} -o ${IMAGE_ROOTFS} --force-overwrite" 17IPKG_ARGS = "-f ${IPKGCONF_TARGET} -o ${IMAGE_ROOTFS} --force-overwrite"
18# The _POST version also works when constructing the matching SDK
19IPKG_ARGS_POST = "-f ${IPKGCONF_TARGET} -o $INSTALL_ROOTFS_IPK --force-overwrite"
18 20
19OPKG_PREPROCESS_COMMANDS = "package_update_index_ipk; package_generate_ipkg_conf" 21OPKG_PREPROCESS_COMMANDS = "package_update_index_ipk; package_generate_ipkg_conf"
20 22
21OPKG_POSTPROCESS_COMMANDS = "ipk_insert_feed_uris; rootfs_install_all_locales; " 23OPKG_POSTPROCESS_COMMANDS = "ipk_insert_feed_uris; "
22 24
23opkglibdir = "${localstatedir}/lib/opkg" 25opkglibdir = "${localstatedir}/lib/opkg"
24 26
@@ -74,6 +76,8 @@ fakeroot rootfs_ipk_do_rootfs () {
74 #mkdir -p ${IMAGE_ROOTFS}/etc/opkg/ 76 #mkdir -p ${IMAGE_ROOTFS}/etc/opkg/
75 #grep "^arch" ${IPKGCONF_TARGET} >${IMAGE_ROOTFS}/etc/opkg/arch.conf 77 #grep "^arch" ${IPKGCONF_TARGET} >${IMAGE_ROOTFS}/etc/opkg/arch.conf
76 78
79 rootfs_install_complementary
80
77 ${OPKG_POSTPROCESS_COMMANDS} 81 ${OPKG_POSTPROCESS_COMMANDS}
78 ${ROOTFS_POSTINSTALL_COMMAND} 82 ${ROOTFS_POSTINSTALL_COMMAND}
79 83
@@ -125,12 +129,16 @@ remove_packaging_data_files() {
125} 129}
126 130
127list_installed_packages() { 131list_installed_packages() {
128 grep ^Package: ${IMAGE_ROOTFS}${opkglibdir}/status | sed "s/^Package: //" 132 if [ "$1" = "arch" ] ; then
133 opkg-cl ${IPKG_ARGS_POST} status | opkg-query-helper.py -a
134 else
135 opkg-cl ${IPKG_ARGS_POST} list_installed | awk '{ print $1 }'
136 fi
129} 137}
130 138
131get_package_filename() { 139get_package_filename() {
132 set +x 140 set +x
133 info=`opkg-cl ${IPKG_ARGS} info $1 | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" || true` 141 info=`opkg-cl ${IPKG_ARGS_POST} info $1 | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" || true`
134 name=`echo "${info}" | awk '/^Package/ {printf $2"_"}'` 142 name=`echo "${info}" | awk '/^Package/ {printf $2"_"}'`
135 name=$name`echo "${info}" | awk -F: '/^Version/ {printf $NF"_"}' | sed 's/^\s*//g'` 143 name=$name`echo "${info}" | awk -F: '/^Version/ {printf $NF"_"}' | sed 's/^\s*//g'`
136 name=$name`echo "${info}" | awk '/^Archi/ {print $2".ipk"}'` 144 name=$name`echo "${info}" | awk '/^Archi/ {print $2".ipk"}'`
@@ -145,21 +153,15 @@ get_package_filename() {
145} 153}
146 154
147list_package_depends() { 155list_package_depends() {
148 opkg-cl ${IPKG_ARGS} info $1 | grep ^Depends | sed -e 's/^Depends: //' -e 's/,//g' -e 's:([=<>]* [^ )]*)::g' 156 opkg-cl ${IPKG_ARGS_POST} info $1 | grep ^Depends | sed -e 's/^Depends: //' -e 's/,//g' -e 's:([=<>]* [^ )]*)::g'
149} 157}
150 158
151list_package_recommends() { 159list_package_recommends() {
152 opkg-cl ${IPKG_ARGS} info $1 | grep ^Recommends | sed -e 's/^Recommends: //' -e 's/,//g' -e 's:([=<>]* [^ )]*)::g' 160 opkg-cl ${IPKG_ARGS_POST} info $1 | grep ^Recommends | sed -e 's/^Recommends: //' -e 's/,//g' -e 's:([=<>]* [^ )]*)::g'
153}
154
155rootfs_check_package_exists() {
156 if [ `opkg-cl ${IPKG_ARGS} info $1 | wc -l` -gt 2 ]; then
157 echo $1
158 fi
159} 161}
160 162
161rootfs_install_packages() { 163rootfs_install_packages() {
162 opkg-cl ${IPKG_ARGS} install $PACKAGES_TO_INSTALL 164 opkg-cl ${IPKG_ARGS_POST} install `cat $1`
163} 165}
164 166
165ipk_insert_feed_uris () { 167ipk_insert_feed_uris () {
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass
index cd9c5ab778..1cc4a84495 100644
--- a/meta/classes/rootfs_rpm.bbclass
+++ b/meta/classes/rootfs_rpm.bbclass
@@ -22,7 +22,7 @@ do_rootfs[depends] += "opkg-native:do_populate_sysroot"
22do_rootfs[recrdeptask] += "do_package_write_rpm" 22do_rootfs[recrdeptask] += "do_package_write_rpm"
23 23
24RPM_PREPROCESS_COMMANDS = "package_update_index_rpm; package_generate_rpm_conf; " 24RPM_PREPROCESS_COMMANDS = "package_update_index_rpm; package_generate_rpm_conf; "
25RPM_POSTPROCESS_COMMANDS = "rootfs_install_all_locales; " 25RPM_POSTPROCESS_COMMANDS = ""
26 26
27# 27#
28# Allow distributions to alter when [postponed] package install scripts are run 28# Allow distributions to alter when [postponed] package install scripts are run
@@ -56,6 +56,7 @@ fakeroot rootfs_rpm_do_rootfs () {
56 export INSTALL_PACKAGES_LINGUAS_RPM="${LINGUAS_INSTALL}" 56 export INSTALL_PACKAGES_LINGUAS_RPM="${LINGUAS_INSTALL}"
57 export INSTALL_PROVIDENAME_RPM="" 57 export INSTALL_PROVIDENAME_RPM=""
58 export INSTALL_TASK_RPM="rootfs_rpm_do_rootfs" 58 export INSTALL_TASK_RPM="rootfs_rpm_do_rootfs"
59 export INSTALL_COMPLEMENTARY_RPM=""
59 60
60 # Setup base system configuration 61 # Setup base system configuration
61 mkdir -p ${INSTALL_ROOTFS_RPM}/etc/rpm/ 62 mkdir -p ${INSTALL_ROOTFS_RPM}/etc/rpm/
@@ -69,6 +70,8 @@ fakeroot rootfs_rpm_do_rootfs () {
69 70
70 package_install_internal_rpm 71 package_install_internal_rpm
71 72
73 rootfs_install_complementary
74
72 export D=${IMAGE_ROOTFS} 75 export D=${IMAGE_ROOTFS}
73 export OFFLINE_ROOT=${IMAGE_ROOTFS} 76 export OFFLINE_ROOT=${IMAGE_ROOTFS}
74 export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} 77 export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
@@ -134,11 +137,15 @@ remove_packaging_data_files() {
134 rm -rf ${IMAGE_ROOTFS}${opkglibdir} 137 rm -rf ${IMAGE_ROOTFS}${opkglibdir}
135} 138}
136 139
137RPM_QUERY_CMD = '${RPM} --root ${IMAGE_ROOTFS} -D "_dbpath ${rpmlibdir}" \ 140RPM_QUERY_CMD = '${RPM} --root $INSTALL_ROOTFS_RPM -D "_dbpath ${rpmlibdir}" \
138 -D "__dbi_txn create nofsync private"' 141 -D "__dbi_txn create nofsync private"'
139 142
140list_installed_packages() { 143list_installed_packages() {
141 ${RPM_QUERY_CMD} -qa --qf "[%{NAME}\n]" 144 if [ "$1" = "arch" ] ; then
145 ${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH}\n]"
146 else
147 ${RPM_QUERY_CMD} -qa --qf "[%{NAME}\n]"
148 fi
142} 149}
143 150
144get_package_filename() { 151get_package_filename() {
@@ -172,21 +179,15 @@ list_package_recommends() {
172 ${RPM_QUERY_CMD} -q --suggests $1 179 ${RPM_QUERY_CMD} -q --suggests $1
173} 180}
174 181
175rootfs_check_package_exists() {
176 resolve_package_rpm ${RPMCONF_TARGET_BASE}-base_archs.conf $1
177}
178
179rootfs_install_packages() { 182rootfs_install_packages() {
180 # The pkg to be installed here is not controlled by the 183 # Note - we expect the variables not set here to already have been set
181 # package_install_internal_rpm, so it may have already been 184 export INSTALL_PACKAGES_RPM=""
182 # installed(e.g, installed in the first time when generate the 185 export INSTALL_PACKAGES_ATTEMPTONLY_RPM="`cat $1`"
183 # rootfs), use '--replacepkgs' to always install them 186 export INSTALL_PROVIDENAME_RPM=""
184 for pkg in $@; do 187 export INSTALL_TASK_RPM="rootfs_install_packages"
185 ${RPM} --root ${IMAGE_ROOTFS} -D "_dbpath ${rpmlibdir}" \ 188 export INSTALL_COMPLEMENTARY_RPM="1"
186 -D "__dbi_txn create nofsync private" \ 189
187 --noscripts --notriggers --noparentdirs --nolinktos \ 190 package_install_internal_rpm
188 --replacepkgs -Uhv $pkg || true
189 done
190} 191}
191 192
192python () { 193python () {