summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/package_rpm.bbclass472
-rw-r--r--meta/classes/rootfs_rpm.bbclass184
2 files changed, 0 insertions, 656 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index e9a6ac8770..4d33d01835 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -12,478 +12,6 @@ PKGWRITEDIRSRPM = "${DEPLOY_DIR}/sources/deploy-srpm"
12# packages. When set, this value merges them for efficiency. 12# packages. When set, this value merges them for efficiency.
13MERGEPERFILEDEPS = "1" 13MERGEPERFILEDEPS = "1"
14 14
15#
16# Update the packages indexes ${DEPLOY_DIR_RPM}
17#
18package_update_index_rpm () {
19 if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then
20 return
21 fi
22
23 sdk_archs=`echo "${SDK_PACKAGE_ARCHS}" | tr - _`
24
25 target_archs=""
26 for i in ${MULTILIB_PREFIX_LIST} ; do
27 old_IFS="$IFS"
28 IFS=":"
29 set $i
30 IFS="$old_IFS"
31 shift # remove mlib
32 while [ -n "$1" ]; do
33 target_archs="$target_archs $1"
34 shift
35 done
36 done
37
38 # FIXME stopgap for broken "bitbake package-index" since MULTILIB_PREFIX_LIST isn't set for that
39 if [ "$target_archs" = "" ] ; then
40 target_archs="${ALL_MULTILIB_PACKAGE_ARCHS}"
41 fi
42
43 target_archs=`echo "$target_archs" | tr - _`
44
45 archs=`for arch in $target_archs $sdk_archs ; do
46 echo $arch
47 done | sort | uniq`
48
49 found=0
50 for arch in $archs; do
51 if [ -d ${DEPLOY_DIR_RPM}/$arch ] ; then
52 createrepo --update -q ${DEPLOY_DIR_RPM}/$arch
53 found=1
54 fi
55 done
56 if [ "$found" != "1" ]; then
57 bbfatal "There are no packages in ${DEPLOY_DIR_RPM}!"
58 fi
59}
60
61rpm_log_check() {
62 target="$1"
63 lf_path="$2"
64
65 lf_txt="`cat $lf_path`"
66 for keyword_die in "unpacking of archive failed" "Cannot find package" "exit 1" ERR Fail
67 do
68 if (echo "$lf_txt" | grep -v log_check | grep "\<$keyword_die\>") >/dev/null 2>&1
69 then
70 echo "log_check: There were error messages in the logfile"
71 printf "log_check: Matched keyword: [$keyword_die]\n\n"
72 echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
73 echo ""
74 do_exit=1
75 fi
76 done
77 test "$do_exit" = 1 && exit 1
78 true
79}
80
81# Translate the RPM/Smart format names to the OE multilib format names
82# Input via stdin (only the first item per line is converted!)
83# Output via stdout
84translate_smart_to_oe() {
85 arg1="$1"
86
87 # Dump installed packages
88 while read pkg arch other ; do
89 found=0
90 if [ -z "$pkg" ]; then
91 continue
92 fi
93 new_pkg=$pkg
94 fixed_arch=`echo "$arch" | tr _ -`
95 for i in ${MULTILIB_PREFIX_LIST} ; do
96 old_IFS="$IFS"
97 IFS=":"
98 set $i
99 IFS="$old_IFS"
100 mlib="$1"
101 shift
102 while [ -n "$1" ]; do
103 cmp_arch=$1
104 shift
105 fixed_cmp_arch=`echo "$cmp_arch" | tr _ -`
106 if [ "$fixed_arch" = "$fixed_cmp_arch" ]; then
107 if [ "$mlib" = "default" ]; then
108 new_pkg="$pkg"
109 new_arch=$cmp_arch
110 else
111 new_pkg="$mlib-$pkg"
112 # We need to strip off the ${mlib}_ prefix on the arch
113 new_arch=${cmp_arch#${mlib}_}
114 fi
115 # Workaround for bug 3565
116 # Simply look to see if we know of a package with that name, if not try again!
117 filename=`ls ${PKGDATA_DIR}/runtime-reverse/$new_pkg 2>/dev/null | head -n 1`
118 if [ -n "$filename" ] ; then
119 found=1
120 break
121 fi
122 # 'real' code
123 # found=1
124 # break
125 fi
126 done
127 if [ "$found" = "1" ] && [ "$fixed_arch" = "$fixed_cmp_arch" ]; then
128 break
129 fi
130 done
131
132 #echo "$pkg -> $new_pkg" >&2
133 if [ "$arg1" = "arch" ]; then
134 echo $new_pkg $new_arch $other
135 elif [ "$arg1" = "file" ]; then
136 echo $new_pkg $other $new_arch
137 else
138 echo $new_pkg $other
139 fi
140 done
141}
142
143# Translate the OE multilib format names to the RPM/Smart format names
144# Input via arguments
145# Ouput via pkgs_to_install
146translate_oe_to_smart() {
147 default_archs=""
148 sdk_mode=""
149 if [ "$1" = "--sdk" ]; then
150 shift
151 sdk_mode="true"
152 # Need to reverse the order of the SDK_ARCHS highest -> lowest priority
153 archs=`echo "${SDK_PACKAGE_ARCHS}" | tr - _`
154 for arch in $archs ; do
155 default_archs="$arch $default_archs"
156 done
157 fi
158
159 attemptonly="Error"
160 if [ "$1" = "--attemptonly" ]; then
161 attemptonly="Warning"
162 shift
163 fi
164
165 # Dump a list of all available packages
166 [ ! -e ${target_rootfs}/install/tmp/fullpkglist.query ] && smart --data-dir=${target_rootfs}/var/lib/smart query --output ${target_rootfs}/install/tmp/fullpkglist.query
167
168 pkgs_to_install=""
169 for pkg in "$@" ; do
170 new_pkg="$pkg"
171 if [ -z "$sdk_mode" ]; then
172 for i in ${MULTILIB_PREFIX_LIST} ; do
173 old_IFS="$IFS"
174 IFS=":"
175 set $i
176 IFS="$old_IFS"
177 mlib="$1"
178 shift
179 if [ "$mlib" = "default" ]; then
180 if [ -z "$default_archs" ]; then
181 default_archs=$@
182 fi
183 continue
184 fi
185 subst=${pkg#${mlib}-}
186 if [ "$subst" != "$pkg" ]; then
187 feeds=$@
188 while [ -n "$1" ]; do
189 arch="$1"
190 arch=`echo "$arch" | tr - _`
191 shift
192 if grep -q '^'$subst'-[^-]*-[^-]*@'$arch'$' ${target_rootfs}/install/tmp/fullpkglist.query ; then
193 new_pkg="$subst@$arch"
194 # First found is best match
195 break
196 fi
197 done
198 if [ "$pkg" = "$new_pkg" ]; then
199 # Failed to translate, package not found!
200 echo "$attemptonly: $pkg not found in the $mlib feeds ($feeds)." >&2
201 if [ "$attemptonly" = "Error" ]; then
202 exit 1
203 fi
204 continue
205 fi
206 fi
207 done
208 fi
209 # Apparently not a multilib package...
210 if [ "$pkg" = "$new_pkg" ]; then
211 default_archs_fixed=`echo "$default_archs" | tr - _`
212 for arch in $default_archs_fixed ; do
213 if grep -q '^'$pkg'-[^-]*-[^-]*@'$arch'$' ${target_rootfs}/install/tmp/fullpkglist.query ; then
214 new_pkg="$pkg@$arch"
215 # First found is best match
216 break
217 fi
218 done
219 if [ "$pkg" = "$new_pkg" ]; then
220 # Failed to translate, package not found!
221 echo "$attemptonly: $pkg not found in the base feeds ($default_archs)." >&2
222 if [ "$attemptonly" = "Error" ]; then
223 exit 1
224 fi
225 continue
226 fi
227 fi
228 #echo "$pkg -> $new_pkg" >&2
229 pkgs_to_install="${pkgs_to_install} ${new_pkg}"
230 done
231 export pkgs_to_install
232}
233
234package_write_smart_config() {
235 # Write common configuration for host and target usage
236 smart --data-dir=$1/var/lib/smart config --set rpm-nolinktos=1
237 smart --data-dir=$1/var/lib/smart config --set rpm-noparentdirs=1
238 for i in ${BAD_RECOMMENDATIONS}; do
239 smart --data-dir=$1/var/lib/smart flag --set ignore-recommends $i
240 done
241}
242
243#
244# Install a bunch of packages using rpm.
245# There are two solutions in an image's FRESH generation:
246# 1) main package solution
247# 2) complementary solution
248#
249# It is different when incremental image generation is enabled:
250# 1) The incremental image generation takes action during the main package
251# installation, the previous installed complementary packages would
252# usually be removed here, and the new complementary ones would be
253# installed in the next step.
254# 2) The complementary would always be installed since it is
255# generated based on the first step's image.
256#
257# the following shell variables needs to be set before calling this func:
258# INSTALL_ROOTFS_RPM - install root dir
259# INSTALL_PLATFORM_RPM - main platform
260# INSTALL_PLATFORM_EXTRA_RPM - extra platform
261# INSTALL_PACKAGES_RPM - packages to be installed
262# INSTALL_PACKAGES_ATTEMPTONLY_RPM - packages attemped to be installed only
263# INSTALL_PACKAGES_LINGUAS_RPM - additional packages for uclibc
264# INSTALL_PROVIDENAME_RPM - content for provide name
265# INSTALL_TASK_RPM - task name
266# INSTALL_COMPLEMENTARY_RPM - 1 to enable complementary package install mode
267
268package_install_internal_rpm () {
269
270 local target_rootfs="$INSTALL_ROOTFS_RPM"
271 local package_to_install="$INSTALL_PACKAGES_RPM"
272 local package_attemptonly="$INSTALL_PACKAGES_ATTEMPTONLY_RPM"
273 local package_linguas="$INSTALL_PACKAGES_LINGUAS_RPM"
274 local providename="$INSTALL_PROVIDENAME_RPM"
275 local task="$INSTALL_TASK_RPM"
276
277 local sdk_mode=""
278 if [ "$1" = "--sdk" ]; then
279 sdk_mode="--sdk"
280 fi
281
282 # Configure internal RPM environment when using Smart
283 export RPM_ETCRPM=${target_rootfs}/etc/rpm
284
285 # Setup temporary directory -- install...
286 rm -rf ${target_rootfs}/install
287 mkdir -p ${target_rootfs}/install/tmp
288
289 channel_priority=5
290 if [ "${INSTALL_COMPLEMENTARY_RPM}" != "1" ] ; then
291 # Setup base system configuration
292 echo "Note: configuring RPM platform settings"
293 mkdir -p ${target_rootfs}/etc/rpm/
294 echo "$INSTALL_PLATFORM_RPM" > ${target_rootfs}/etc/rpm/platform
295
296 if [ ! -z "$INSTALL_PLATFORM_EXTRA_RPM" ]; then
297 for pt in $INSTALL_PLATFORM_EXTRA_RPM ; do
298 channel_priority=$(expr $channel_priority + 5)
299 pt=$(echo $pt | sed "s,-linux.*$,-linux\.*,")
300 echo "$pt" >> ${target_rootfs}/etc/rpm/platform
301 done
302 fi
303
304 # Tell RPM that the "/" directory exist and is available
305 echo "Note: configuring RPM system provides"
306 mkdir -p ${target_rootfs}/etc/rpm/sysinfo
307 echo "/" >${target_rootfs}/etc/rpm/sysinfo/Dirnames
308
309 if [ ! -z "$providename" ]; then
310 cat /dev/null > ${target_rootfs}/etc/rpm/sysinfo/Providename
311 for provide in $providename ; do
312 echo $provide >> ${target_rootfs}/etc/rpm/sysinfo/Providename
313 done
314 fi
315
316 # Configure RPM... we enforce these settings!
317 echo "Note: configuring RPM DB settings"
318 mkdir -p ${target_rootfs}${rpmlibdir}
319 mkdir -p ${target_rootfs}${rpmlibdir}/log
320 # After change the __db.* cache size, log file will not be generated automatically,
321 # that will raise some warnings, so touch a bare log for rpm write into it.
322 touch ${target_rootfs}${rpmlibdir}/log/log.0000000001
323 if [ ! -e ${target_rootfs}${rpmlibdir}/DB_CONFIG ]; then
324 cat > ${target_rootfs}${rpmlibdir}/DB_CONFIG << EOF
325# ================ Environment
326set_data_dir .
327set_create_dir .
328set_lg_dir ./log
329set_tmp_dir ./tmp
330set_flags db_log_autoremove on
331
332# -- thread_count must be >= 8
333set_thread_count 64
334
335# ================ Logging
336
337# ================ Memory Pool
338set_cachesize 0 1048576 0
339set_mp_mmapsize 268435456
340
341# ================ Locking
342set_lk_max_locks 16384
343set_lk_max_lockers 16384
344set_lk_max_objects 16384
345 mutex_set_max 163840
346
347# ================ Replication
348EOF
349 fi
350
351 # Create database so that smart doesn't complain (lazy init)
352 rpm --root $target_rootfs --dbpath /var/lib/rpm -qa > /dev/null
353
354 # Configure smart
355 echo "Note: configuring Smart settings"
356 rm -rf ${target_rootfs}/var/lib/smart
357 smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-root=${target_rootfs}
358 smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-dbpath=${rpmlibdir}
359 smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-extra-macros._var=${localstatedir}
360 smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-extra-macros._tmppath=/install/tmp
361 package_write_smart_config ${target_rootfs}
362 # Do the following configurations here, to avoid them being saved for field upgrade
363 if [ "x${NO_RECOMMENDATIONS}" = "x1" ]; then
364 smart --data-dir=${target_rootfs}/var/lib/smart config --set ignore-all-recommends=1
365 fi
366 for i in ${PACKAGE_EXCLUDE}; do
367 smart --data-dir=${target_rootfs}/var/lib/smart flag --set exclude-packages $i
368 done
369
370 # Optional debugging
371 #smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-log-level=debug
372 #smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-log-file=/tmp/smart-debug-logfile
373
374 # Delay this until later...
375 #smart --data-dir=${target_rootfs}/var/lib/smart channel --add rpmsys type=rpm-sys -y
376
377 for canonical_arch in $INSTALL_PLATFORM_EXTRA_RPM; do
378 arch=$(echo $canonical_arch | sed "s,\([^-]*\)-.*,\1,")
379 if [ -d ${DEPLOY_DIR_RPM}/$arch -a ! -e ${target_rootfs}/install/channel.$arch.stamp ] ; then
380 echo "Note: adding Smart channel $arch ($channel_priority)"
381 smart --data-dir=${target_rootfs}/var/lib/smart channel --add $arch type=rpm-md type=rpm-md baseurl=${DEPLOY_DIR_RPM}/$arch -y
382 smart --data-dir=${target_rootfs}/var/lib/smart channel --set $arch priority=$channel_priority
383 touch ${target_rootfs}/install/channel.$arch.stamp
384 fi
385 channel_priority=$(expr $channel_priority - 5)
386 done
387 fi
388
389 # Construct install scriptlet wrapper
390 # Scripts need to be ordered when executed, this ensures numeric order
391 # If we ever run into needing more the 899 scripts, we'll have to
392 # change num to start with 1000.
393 #
394 cat << EOF > ${WORKDIR}/scriptlet_wrapper
395#!/bin/bash
396
397export PATH="${PATH}"
398export D="${target_rootfs}"
399export OFFLINE_ROOT="\$D"
400export IPKG_OFFLINE_ROOT="\$D"
401export OPKG_OFFLINE_ROOT="\$D"
402export INTERCEPT_DIR="${WORKDIR}/intercept_scripts"
403export NATIVE_ROOT=${STAGING_DIR_NATIVE}
404
405\$2 \$1/\$3 \$4
406if [ \$? -ne 0 ]; then
407 if [ \$4 -eq 1 ]; then
408 mkdir -p \$1/etc/rpm-postinsts
409 num=100
410 while [ -e \$1/etc/rpm-postinsts/\${num}-* ]; do num=\$((num + 1)); done
411 name=\`head -1 \$1/\$3 | cut -d' ' -f 2\`
412 echo "#!\$2" > \$1/etc/rpm-postinsts/\${num}-\${name}
413 echo "# Arg: \$4" >> \$1/etc/rpm-postinsts/\${num}-\${name}
414 cat \$1/\$3 >> \$1/etc/rpm-postinsts/\${num}-\${name}
415 chmod +x \$1/etc/rpm-postinsts/\${num}-\${name}
416 else
417 echo "Error: pre/post remove scriptlet failed"
418 fi
419fi
420EOF
421
422 echo "Note: configuring RPM cross-install scriptlet_wrapper"
423 chmod 0755 ${WORKDIR}/scriptlet_wrapper
424 smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-extra-macros._cross_scriptlet_wrapper=${WORKDIR}/scriptlet_wrapper
425
426 # Determine what to install
427 translate_oe_to_smart ${sdk_mode} ${package_to_install} ${package_linguas}
428
429 # If incremental install, we need to determine what we've got,
430 # what we need to add, and what to remove...
431 if [ "${INC_RPM_IMAGE_GEN}" = "1" -a "${INSTALL_COMPLEMENTARY_RPM}" != "1" ]; then
432 # Dump the new solution
433 echo "Note: creating install solution for incremental install"
434 smart --data-dir=${target_rootfs}/var/lib/smart install -y --dump ${pkgs_to_install} 2> ${target_rootfs}/../solution.manifest
435 fi
436
437 if [ "${INSTALL_COMPLEMENTARY_RPM}" != "1" ]; then
438 echo "Note: adding Smart RPM DB channel"
439 smart --data-dir=${target_rootfs}/var/lib/smart channel --add rpmsys type=rpm-sys -y
440 fi
441
442 # If incremental install, we need to determine what we've got,
443 # what we need to add, and what to remove...
444 if [ "${INC_RPM_IMAGE_GEN}" = "1" -a "${INSTALL_COMPLEMENTARY_RPM}" != "1" ]; then
445 # First upgrade everything that was previously installed to the latest version
446 echo "Note: incremental update -- upgrade packages in place"
447 smart --data-dir=${target_rootfs}/var/lib/smart upgrade
448
449 # Dump what is already installed
450 echo "Note: dump installed packages for incremental update"
451 smart --data-dir=${target_rootfs}/var/lib/smart query --installed --output ${target_rootfs}/../installed.manifest
452
453 sort ${target_rootfs}/../installed.manifest > ${target_rootfs}/../installed.manifest.sorted
454 sort ${target_rootfs}/../solution.manifest > ${target_rootfs}/../solution.manifest.sorted
455
456 comm -1 -3 ${target_rootfs}/../solution.manifest.sorted ${target_rootfs}/../installed.manifest.sorted \
457 > ${target_rootfs}/../remove.list
458 comm -2 -3 ${target_rootfs}/../solution.manifest.sorted ${target_rootfs}/../installed.manifest.sorted \
459 > ${target_rootfs}/../install.list
460
461 pkgs_to_remove=`cat ${target_rootfs}/../remove.list | xargs echo`
462 pkgs_to_install=`cat ${target_rootfs}/../install.list | xargs echo`
463
464 echo "Note: to be removed: ${pkgs_to_remove}"
465
466 for pkg in ${pkgs_to_remove}; do
467 echo "Debug: What required: $pkg"
468 smart --data-dir=${target_rootfs}/var/lib/smart query $pkg --show-requiredby
469 done
470
471 [ -n "$pkgs_to_remove" ] && smart --data-dir=${target_rootfs}/var/lib/smart remove -y ${pkgs_to_remove}
472 fi
473
474 echo "Note: to be installed: ${pkgs_to_install}"
475 [ -n "$pkgs_to_install" ] && smart --data-dir=${target_rootfs}/var/lib/smart install -y ${pkgs_to_install}
476
477 if [ -n "${package_attemptonly}" ]; then
478 echo "Note: installing attempt only packages..."
479 echo "Attempting $pkgs_to_install"
480 echo "Note: see `dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}"
481 translate_oe_to_smart ${sdk_mode} --attemptonly $package_attemptonly
482 echo "Attempting $pkgs_to_install" >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}"
483 smart --data-dir=${target_rootfs}/var/lib/smart install --attempt -y ${pkgs_to_install} >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}" 2>&1 || :
484 fi
485}
486
487# Construct per file dependencies file 15# Construct per file dependencies file
488def write_rpm_perfiledata(srcname, d): 16def write_rpm_perfiledata(srcname, d):
489 workdir = d.getVar('WORKDIR', True) 17 workdir = d.getVar('WORKDIR', True)
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass
index 1a0c2255a9..032dabcd0c 100644
--- a/meta/classes/rootfs_rpm.bbclass
+++ b/meta/classes/rootfs_rpm.bbclass
@@ -24,170 +24,10 @@ do_rootfs[depends] += "createrepo-native:do_populate_sysroot"
24do_rootfs[recrdeptask] += "do_package_write_rpm" 24do_rootfs[recrdeptask] += "do_package_write_rpm"
25rootfs_rpm_do_rootfs[vardepsexclude] += "BUILDNAME" 25rootfs_rpm_do_rootfs[vardepsexclude] += "BUILDNAME"
26 26
27RPM_PREPROCESS_COMMANDS = "package_update_index_rpm; "
28RPM_POSTPROCESS_COMMANDS = "rpm_setup_smart_target_config; "
29
30rpmlibdir = "/var/lib/rpm"
31opkglibdir = "${localstatedir}/lib/opkg"
32
33RPMOPTS="--dbpath ${rpmlibdir}"
34RPM="rpm ${RPMOPTS}"
35
36# RPM doesn't work with multiple rootfs generation at once due to collisions in the use of files 27# RPM doesn't work with multiple rootfs generation at once due to collisions in the use of files
37# in ${DEPLOY_DIR_RPM}. This can be removed if package_update_index_rpm can be called concurrently 28# in ${DEPLOY_DIR_RPM}. This can be removed if package_update_index_rpm can be called concurrently
38do_rootfs[lockfiles] += "${DEPLOY_DIR_RPM}/rpm.lock" 29do_rootfs[lockfiles] += "${DEPLOY_DIR_RPM}/rpm.lock"
39 30
40fakeroot rootfs_rpm_do_rootfs () {
41 ${RPM_PREPROCESS_COMMANDS}
42
43 # install packages
44 # This needs to work in the same way as populate_sdk_rpm.bbclass!
45 export INSTALL_ROOTFS_RPM="${IMAGE_ROOTFS}"
46 export INSTALL_PLATFORM_RPM="$(echo ${TARGET_ARCH} | tr - _)${TARGET_VENDOR}-${TARGET_OS}"
47 export INSTALL_PACKAGES_RPM="${PACKAGE_INSTALL}"
48 export INSTALL_PACKAGES_ATTEMPTONLY_RPM="${PACKAGE_INSTALL_ATTEMPTONLY}"
49 export INSTALL_PACKAGES_LINGUAS_RPM="${LINGUAS_INSTALL}"
50 export INSTALL_PROVIDENAME_RPM=""
51 export INSTALL_TASK_RPM="rootfs_rpm_do_rootfs"
52 export INSTALL_COMPLEMENTARY_RPM=""
53
54 # Setup base system configuration
55 mkdir -p ${INSTALL_ROOTFS_RPM}/etc/rpm/
56
57 # List must be prefered to least preferred order
58 default_extra_rpm=""
59 INSTALL_PLATFORM_EXTRA_RPM=""
60 for os in ${MULTILIB_OS_LIST} ; do
61 old_IFS="$IFS"
62 IFS=":"
63 set -- $os
64 IFS="$old_IFS"
65 mlib=$1
66 mlib_os=$2
67 for prefix in ${MULTILIB_PREFIX_LIST} ; do
68 old_IFS="$IFS"
69 IFS=":"
70 set -- $prefix
71 IFS="$old_IFS"
72 if [ "$mlib" != "$1" ]; then
73 continue
74 fi
75 shift #remove mlib
76 while [ -n "$1" ]; do
77 platform="$(echo $1 | tr - _)-.*-$mlib_os"
78 if [ "$mlib" = "${BBEXTENDVARIANT}" ]; then
79 default_extra_rpm="$default_extra_rpm $platform"
80 else
81 INSTALL_PLATFORM_EXTRA_RPM="$INSTALL_PLATFORM_EXTRA_RPM $platform"
82 fi
83 shift
84 done
85 done
86 done
87 if [ -n "$default_extra_rpm" ]; then
88 INSTALL_PLATFORM_EXTRA_RPM="$default_extra_rpm $INSTALL_PLATFORM_EXTRA_RPM"
89 fi
90 export INSTALL_PLATFORM_EXTRA_RPM
91
92 package_install_internal_rpm
93
94 rootfs_install_complementary
95
96 export D=${IMAGE_ROOTFS}
97 export OFFLINE_ROOT=${IMAGE_ROOTFS}
98 export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
99 export OPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
100
101 ${ROOTFS_POSTINSTALL_COMMAND}
102
103 # Report delayed package scriptlets
104 for i in ${IMAGE_ROOTFS}/etc/rpm-postinsts/*; do
105 if [ -f $i ]; then
106 echo "Delayed package scriptlet: `head -n 3 $i | tail -n 1`"
107 fi
108 done
109
110 install -d ${IMAGE_ROOTFS}/${sysconfdir}
111 echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version
112
113 ${RPM_POSTPROCESS_COMMANDS}
114 ${ROOTFS_POSTPROCESS_COMMAND}
115
116 if ${@base_contains("IMAGE_FEATURES", "read-only-rootfs", "true", "false" ,d)}; then
117 if [ -d ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts ] ; then
118 failed_pkgs=$(ls -A ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts)
119 if [ -n "$failed_pkgs" ] ; then
120 bberror "The following post-install scripts could not be run offline and rootfs is read-only: $failed_pkgs"
121 exit 1
122 fi
123 fi
124 fi
125
126 rm -rf ${IMAGE_ROOTFS}/var/cache2/
127 rm -rf ${IMAGE_ROOTFS}/var/run2/
128 rm -rf ${IMAGE_ROOTFS}/var/log2/
129
130 # remove lock files
131 rm -f ${IMAGE_ROOTFS}${rpmlibdir}/__db.*
132
133 # Remove all remaining resolver files
134 rm -rf ${IMAGE_ROOTFS}/install
135
136 log_check rootfs
137}
138
139rootfs_rpm_do_rootfs[vardeps] += "delayed_postinsts"
140
141delayed_postinsts() {
142 if [ -d ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts ]; then
143 ls ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts
144 fi
145}
146
147save_postinsts() {
148 # this is just a stub. For RPM, the failed postinstalls are already saved in
149 # /etc/rpm-postinsts
150 true
151}
152
153remove_packaging_data_files() {
154 # Save the rpmlib for increment rpm image generation
155 t="${T}/saved_rpmlib/var/lib"
156 rm -fr $t
157 mkdir -p $t
158 mv ${IMAGE_ROOTFS}${rpmlibdir} $t
159 rm -rf ${IMAGE_ROOTFS}${opkglibdir}
160 rm -rf ${IMAGE_ROOTFS}/var/lib/smart
161}
162
163rpm_setup_smart_target_config() {
164 # Set up smart configuration for the target
165 rm -rf ${IMAGE_ROOTFS}/var/lib/smart
166 smart --data-dir=${IMAGE_ROOTFS}/var/lib/smart channel --add rpmsys type=rpm-sys -y
167 package_write_smart_config ${IMAGE_ROOTFS}
168 rm -f ${IMAGE_ROOTFS}/var/lib/smart/config.old
169}
170
171rootfs_install_packages() {
172 # Note - we expect the variables not set here to already have been set
173 export INSTALL_PACKAGES_RPM=""
174 export INSTALL_PACKAGES_ATTEMPTONLY_RPM="`cat $1`"
175 export INSTALL_PROVIDENAME_RPM=""
176 export INSTALL_TASK_RPM="rootfs_install_packages"
177 export INSTALL_COMPLEMENTARY_RPM="1"
178
179 package_install_internal_rpm
180}
181
182rootfs_uninstall_packages() {
183 rpm -e --nodeps --root=${IMAGE_ROOTFS} --dbpath=/var/lib/rpm\
184 --define='_cross_scriptlet_wrapper ${WORKDIR}/scriptlet_wrapper'\
185 --define='_tmppath /install/tmp' $@
186
187 # remove temp directory
188 rm -rf ${IMAGE_ROOTFS}/install
189}
190
191python () { 31python () {
192 if d.getVar('BUILD_IMAGES_FROM_FEEDS', True): 32 if d.getVar('BUILD_IMAGES_FROM_FEEDS', True):
193 flags = d.getVarFlag('do_rootfs', 'recrdeptask') 33 flags = d.getVarFlag('do_rootfs', 'recrdeptask')
@@ -198,28 +38,4 @@ python () {
198 d.setVar('RPM_PREPROCESS_COMMANDS', '') 38 d.setVar('RPM_PREPROCESS_COMMANDS', '')
199 d.setVar('RPM_POSTPROCESS_COMMANDS', '') 39 d.setVar('RPM_POSTPROCESS_COMMANDS', '')
200 40
201 # The following code should be kept in sync w/ the populate_sdk_rpm version.
202
203 # package_arch order is reversed. This ensures the -best- match is listed first!
204 package_archs = d.getVar("PACKAGE_ARCHS", True) or ""
205 package_archs = ":".join(package_archs.split()[::-1])
206 package_os = d.getVar("TARGET_OS", True) or ""
207 ml_prefix_list = "%s:%s" % ('default', package_archs)
208 ml_os_list = "%s:%s" % ('default', package_os)
209 multilibs = d.getVar('MULTILIBS', True) or ""
210 for ext in multilibs.split():
211 eext = ext.split(':')
212 if len(eext) > 1 and eext[0] == 'multilib':
213 localdata = bb.data.createCopy(d)
214 default_tune = localdata.getVar("DEFAULTTUNE_virtclass-multilib-" + eext[1], False)
215 if default_tune:
216 localdata.setVar("DEFAULTTUNE", default_tune)
217 bb.data.update_data(localdata)
218 package_archs = localdata.getVar("PACKAGE_ARCHS", True) or ""
219 package_archs = ":".join([i in "all noarch any".split() and i or eext[1]+"_"+i for i in package_archs.split()][::-1])
220 package_os = localdata.getVar("TARGET_OS", True) or ""
221 ml_prefix_list += " %s:%s" % (eext[1], package_archs)
222 ml_os_list += " %s:%s" % (eext[1], package_os)
223 d.setVar('MULTILIB_PREFIX_LIST', ml_prefix_list)
224 d.setVar('MULTILIB_OS_LIST', ml_os_list)
225} 41}