summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rwxr-xr-xscripts/oe-pkgdata-util167
-rwxr-xr-xscripts/opkg-query-helper.py76
10 files changed, 390 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 () {
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
new file mode 100755
index 0000000000..2427f10d89
--- /dev/null
+++ b/scripts/oe-pkgdata-util
@@ -0,0 +1,167 @@
1#!/usr/bin/env python
2
3# OpenEmbedded pkgdata utility
4#
5# Written by: Paul Eggleton <paul.eggleton@linux.intel.com>
6#
7# Copyright 2012 Intel Corporation
8#
9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License version 2 as
11# published by the Free Software Foundation.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License along
19# with this program; if not, write to the Free Software Foundation, Inc.,
20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21#
22#
23# Currently only has one function - mapping of packages to their dev/dbg/doc/locale etc.
24# counterparts ("glob" command). Could be extended in future to perform other useful querying
25# functions on the pkgdata though.
26#
27
28import sys
29import os
30import os.path
31import fnmatch
32import re
33
34def usage():
35 print("syntax: pkgdata-util glob [-d] <pkgdatadir> <vendor-os> <pkglist> \"<globs>\"");
36
37
38
39def glob(args):
40 if len(args) < 4:
41 usage()
42 sys.exit(1)
43
44 pkgdata_dir = args[0]
45 target_suffix = args[1]
46 pkglist_file = args[2]
47 globs = args[3].split()
48
49 if target_suffix.startswith("-"):
50 target_suffix = target_suffix[1:]
51
52 skipregex = re.compile("-locale-|^locale-base-|-dev$|-doc$|-dbg$|-staticdev$|^kernel-module-")
53
54 mappedpkgs = set()
55 with open(pkglist_file, 'r') as f:
56 for line in f:
57 fields = line.rstrip().split()
58 if len(fields) < 2:
59 continue
60 pkg = fields[0]
61 arch = fields[1]
62 multimach_target_sys = "%s-%s" % (arch, target_suffix)
63
64 # Skip packages for which there is no point applying globs
65 if skipregex.search(pkg):
66 if debug:
67 print("%s -> !!" % pkg)
68 continue
69
70 # Skip packages that already match the globs, so if e.g. a dev package
71 # is already installed and thus in the list, we don't process it any further
72 # Most of these will be caught by skipregex already, but just in case...
73 already = False
74 for g in globs:
75 if fnmatch.fnmatchcase(pkg, g):
76 already = True
77 break
78 if already:
79 if debug:
80 print("%s -> !" % pkg)
81 continue
82
83 # Define some functions
84 def revpkgdata(pkgn):
85 return os.path.join(pkgdata_dir, multimach_target_sys, "runtime-reverse", pkgn)
86 def fwdpkgdata(pkgn):
87 return os.path.join(pkgdata_dir, multimach_target_sys, "runtime", pkgn)
88 def readpn(pkgdata_file):
89 pn = ""
90 with open(pkgdata_file, 'r') as f:
91 for line in f:
92 if line.startswith("PN:"):
93 pn = line.split(': ')[1].rstrip()
94 return pn
95 def readrenamed(pkgdata_file):
96 renamed = ""
97 pn = os.path.basename(pkgdata_file)
98 with open(pkgdata_file, 'r') as f:
99 for line in f:
100 if line.startswith("PKG_%s:" % pn):
101 renamed = line.split(': ')[1].rstrip()
102 return renamed
103
104 # Main processing loop
105 for g in globs:
106 mappedpkg = ""
107 # First just try substitution (i.e. packagename -> packagename-dev)
108 newpkg = g.replace("*", pkg)
109 revlink = revpkgdata(newpkg)
110 if os.path.exists(revlink):
111 mappedpkg = os.path.basename(os.readlink(revlink))
112 fwdfile = fwdpkgdata(mappedpkg)
113 if os.path.exists(fwdfile):
114 mappedpkg = readrenamed(fwdfile)
115 else:
116 # That didn't work, so now get the PN, substitute that, then map in the other direction
117 revlink = revpkgdata(pkg)
118 if os.path.exists(revlink):
119 pn = readpn(revlink)
120 newpkg = g.replace("*", pn)
121 fwdfile = fwdpkgdata(newpkg)
122 if os.path.exists(fwdfile):
123 mappedpkg = readrenamed(fwdfile)
124 else:
125 # Package doesn't even exist...
126 if debug:
127 print "%s is not a valid package!" % (pkg)
128 break
129
130 if mappedpkg:
131 if debug:
132 print "%s (%s) -> %s" % (pkg, g, mappedpkg)
133 mappedpkgs.add(mappedpkg)
134 else:
135 if debug:
136 print "%s (%s) -> ?" % (pkg, g)
137
138 if debug:
139 print "------"
140
141 print("\n".join(mappedpkgs))
142
143
144
145# Too lazy to use getopt
146debug = False
147noopt = False
148args = []
149for arg in sys.argv[1:]:
150 if arg == "--":
151 noopt = True
152 else:
153 if not noopt:
154 if arg == "-d":
155 debug = True
156 continue
157 args.append(arg)
158
159if len(args) < 1:
160 usage()
161 sys.exit(1)
162
163if args[0] == "glob":
164 glob(args[1:])
165else:
166 usage()
167 sys.exit(1)
diff --git a/scripts/opkg-query-helper.py b/scripts/opkg-query-helper.py
new file mode 100755
index 0000000000..b52284b325
--- /dev/null
+++ b/scripts/opkg-query-helper.py
@@ -0,0 +1,76 @@
1#!/usr/bin/env python
2
3# OpenEmbedded opkg query helper utility
4#
5# Written by: Paul Eggleton <paul.eggleton@linux.intel.com>
6#
7# Copyright 2012 Intel Corporation
8#
9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License version 2 as
11# published by the Free Software Foundation.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License along
19# with this program; if not, write to the Free Software Foundation, Inc.,
20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21#
22#
23
24
25import sys
26import fileinput
27import re
28
29archmode = False
30filemode = False
31
32args = []
33for arg in sys.argv[1:]:
34 if arg == '-a':
35 archmode = True
36 elif arg == '-f':
37 filemode = True
38 else:
39 args.append(arg)
40
41# Regex for removing version specs after dependency items
42verregex = re.compile(' \([=<>]* [^ )]*\)')
43
44pkg = ""
45ver = ""
46for line in fileinput.input(args):
47 line = line.rstrip()
48 if ': ' in line:
49 if line.startswith("Package:"):
50 pkg = line.split(": ")[1]
51 ver = ""
52 else:
53 if archmode:
54 if line.startswith("Architecture:"):
55 arch = line.split(": ")[1]
56 print("%s %s" % (pkg,arch))
57 elif filemode:
58 if line.startswith("Version:"):
59 ver = line.split(": ")[1]
60 elif line.startswith("Architecture:"):
61 arch = line.split(": ")[1]
62 print("%s %s_%s_%s.ipk" % (pkg,pkg,ver,arch))
63 else:
64 if line.startswith("Depends:"):
65 depval = line.split(": ")[1]
66 deps = depval.split(", ")
67 for dep in deps:
68 dep = verregex.sub('', dep)
69 print("%s|%s" % (pkg,dep))
70 elif line.startswith("Recommends:"):
71 recval = line.split(": ")[1]
72 recs = recval.split(", ")
73 for rec in recs:
74 rec = verregex.sub('', rec)
75 print("%s|%s [REC]" % (pkg, rec))
76