summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/package_rpm.bbclass531
-rw-r--r--meta/classes/populate_sdk_rpm.bbclass51
-rw-r--r--meta/classes/rootfs_rpm.bbclass34
3 files changed, 121 insertions, 495 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 293c52c629..4b81b68bf7 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -16,88 +16,27 @@ python package_rpm_install () {
16 bb.fatal("package_rpm_install not implemented!") 16 bb.fatal("package_rpm_install not implemented!")
17} 17}
18 18
19RPMCONF_TARGET_BASE = "${DEPLOY_DIR_RPM}/solvedb"
20RPMCONF_HOST_BASE = "${DEPLOY_DIR_RPM}/solvedb-sdk"
21# 19#
22# Update the Packages depsolver db in ${DEPLOY_DIR_RPM} 20# Update the packages indexes ${DEPLOY_DIR_RPM}
23# 21#
24package_update_index_rpm () { 22package_update_index_rpm () {
25 if [ ! -z "${DEPLOY_KEEP_PACKAGES}" -o ! -e "${DEPLOY_DIR_RPM}" ]; then 23 if [ ! -z "${DEPLOY_KEEP_PACKAGES}" -o ! -e "${DEPLOY_DIR_RPM}" ]; then
26 return 24 return
27 fi 25 fi
28 26
29 # Update target packages
30 base_archs="`echo ${PACKAGE_ARCHS} | sed 's/-/_/g'`" 27 base_archs="`echo ${PACKAGE_ARCHS} | sed 's/-/_/g'`"
31 ml_archs="`echo ${MULTILIB_PACKAGE_ARCHS} | sed 's/-/_/g'`" 28 ml_archs="`echo ${MULTILIB_PACKAGE_ARCHS} | sed 's/-/_/g'`"
32 package_update_index_rpm_common "${RPMCONF_TARGET_BASE}" base_archs ml_archs 29 sdk_archs="`echo ${SDK_PACKAGE_ARCHS} | sed 's/-/_/g'`"
33 30
34 # Update SDK packages 31 archs=`for arch in $base_archs $ml_archs $sdk_archs ; do
35 base_archs="`echo ${SDK_PACKAGE_ARCHS} | sed 's/-/_/g'`" 32 echo $arch
36 package_update_index_rpm_common "${RPMCONF_HOST_BASE}" base_archs 33 done | sort | uniq`
37}
38
39package_update_index_rpm_common () {
40 rpmconf_base="$1"
41 shift
42
43 createdirs=""
44 for archvar in "$@"; do
45 eval archs=\${${archvar}}
46 packagedirs=""
47 for arch in $archs; do
48 packagedirs="${DEPLOY_DIR_RPM}/$arch $packagedirs"
49 rm -rf ${DEPLOY_DIR_RPM}/$arch/solvedb.done
50 done
51
52 cat /dev/null > ${rpmconf_base}-${archvar}.conf
53 for pkgdir in $packagedirs; do
54 if [ -e $pkgdir/ ]; then
55 echo "Generating solve db for $pkgdir..."
56 echo $pkgdir/solvedb >> ${rpmconf_base}-${archvar}.conf
57 createdirs="$createdirs $pkgdir"
58 fi
59 done
60 done
61 rpm-createsolvedb.py "${RPM}" $createdirs
62}
63
64#
65# Generate an rpm configuration suitable for use against the
66# generated depsolver db's...
67#
68package_generate_rpm_conf () {
69 # Update target packages
70 package_generate_rpm_conf_common "${RPMCONF_TARGET_BASE}" base_archs ml_archs
71
72 # Update SDK packages
73 package_generate_rpm_conf_common "${RPMCONF_HOST_BASE}" base_archs
74}
75
76package_generate_rpm_conf_common() {
77 rpmconf_base="$1"
78 shift
79 34
80 printf "_solve_dbpath " > ${rpmconf_base}.macro 35 for arch in $archs; do
81 o_colon="false" 36 if [ -d ${DEPLOY_DIR_RPM}/$arch ] ; then
82 37 createrepo --update -q ${DEPLOY_DIR_RPM}/$arch
83 for archvar in "$@"; do 38 fi
84 printf "_solve_dbpath " > ${rpmconf_base}-${archvar}.macro
85 colon="false"
86 for each in `cat ${rpmconf_base}-${archvar}.conf` ; do
87 if [ "$o_colon" = "true" ]; then
88 printf ":" >> ${rpmconf_base}.macro
89 fi
90 if [ "$colon" = "true" ]; then
91 printf ":" >> ${rpmconf_base}-${archvar}.macro
92 fi
93 printf "%s" $each >> ${rpmconf_base}.macro
94 o_colon="true"
95 printf "%s" $each >> ${rpmconf_base}-${archvar}.macro
96 colon="true"
97 done
98 printf "\n" >> ${rpmconf_base}-${archvar}.macro
99 done 39 done
100 printf "\n" >> ${rpmconf_base}.macro
101} 40}
102 41
103rpm_log_check() { 42rpm_log_check() {
@@ -122,150 +61,23 @@ rpm_log_check() {
122 61
123 62
124# 63#
125# Resolve package names to filepaths
126# resolve_pacakge <pkgname> <solvdb conffile>
127#
128resolve_package_rpm () {
129 local conffile="$1"
130 shift
131 local pkg_name=""
132 for solve in `cat ${conffile}`; do
133 pkg_name=$(${RPM} -D "_dbpath $solve" -D "__dbi_txn create nofsync" -q --qf "%{packageorigin}\n" "$@" | grep -v "is not installed" || true)
134 if [ -n "$pkg_name" -a "$pkg_name" != "(none)" ]; then
135 echo $pkg_name
136 break;
137 fi
138 done
139}
140
141# rpm common command and options
142rpm_common_comand () {
143
144 local target_rootfs="${INSTALL_ROOTFS_RPM}"
145
146 ${RPM} --root ${target_rootfs} \
147 --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
148 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
149 -D "_var ${localstatedir}" \
150 -D "_dbpath ${rpmlibdir}" \
151 -D "_tmppath /install/tmp" \
152 --noparentdirs --nolinktos \
153 -D "__dbi_txn create nofsync private" \
154 -D "_cross_scriptlet_wrapper ${WORKDIR}/scriptlet_wrapper" $@
155}
156
157# install or remove the pkg
158rpm_update_pkg () {
159
160 manifest=$1
161 # The manifest filename, e.g. total_solution.manifest
162 m_name=${manifest##/*/}
163 local target_rootfs="${INSTALL_ROOTFS_RPM}"
164 installdir=$target_rootfs/install
165 pre_btmanifest=$installdir/pre_bt.manifest
166 cur_btmanifest=$installdir/cur_bt.manifest
167
168 # Install/remove the different pkgs when total_solution.manifest is
169 # comming and incremental image generation is enabled.
170 if [ "${INC_RPM_IMAGE_GEN}" = "1" -a -d "${target_rootfs}${rpmlibdir}" \
171 -a "$m_name" = "total_solution.manifest" \
172 -a "${INSTALL_COMPLEMENTARY_RPM}" != "1" ]; then
173 # Get the previous installed list
174 rpm --root $target_rootfs --dbpath ${rpmlibdir} \
175 -qa --qf '%{PACKAGEORIGIN} %{BUILDTIME}\n' | sort -u -o $pre_btmanifest
176 # Get the current installed list (based on install/var/lib/rpm)
177 rpm --root $installdir -D "_dbpath $installdir" \
178 -qa --qf '%{PACKAGEORIGIN} %{BUILDTIME}\n' | sort -u -o $cur_btmanifest
179 comm -1 -3 $cur_btmanifest $pre_btmanifest | sed 's#.*/\(.*\)\.rpm .*#\1#' > \
180 $installdir/remove.manifest
181 comm -2 -3 $cur_btmanifest $pre_btmanifest | awk '{print $1}' > \
182 $installdir/incremental.manifest
183
184 # Attempt to remove unwanted pkgs, the scripts(pre, post, etc.) has not
185 # been run by now, so don't have to run them(preun, postun, etc.) when
186 # erase the pkg
187 if [ -s $installdir/remove.manifest ]; then
188 rpm_common_comand --noscripts --nodeps \
189 -e `cat $installdir/remove.manifest`
190 fi
191
192 # Attempt to install the incremental pkgs
193 if [ -s $installdir/incremental.manifest ]; then
194 rpm_common_comand --replacefiles --replacepkgs \
195 -Uvh $installdir/incremental.manifest
196 fi
197 else
198 # Attempt to install
199 rpm_common_comand --replacepkgs -Uhv $manifest
200 fi
201}
202
203process_pkg_list_rpm() {
204 local insttype=$1
205 shift
206 # $@ is special POSIX linear array can not be assigned
207 # to a local variable directly in dash since its separated by
208 # space and dash expands it before assignment
209 # and local x=1 2 3 and not x="1 2 3"
210 local pkgs
211 pkgs="$@"
212 local confbase=${INSTALL_CONFBASE_RPM}
213
214 printf "" > ${target_rootfs}/install/base_archs.pkglist
215 printf "" > ${target_rootfs}/install/ml_archs.pkglist
216
217 for pkg in $pkgs; do
218 echo "Processing $pkg..."
219
220 archvar=base_archs
221 ml_pkg=$pkg
222 for i in ${MULTILIB_PREFIX_LIST} ; do
223 subst=${pkg#${i}-}
224 if [ $subst != $pkg ] ; then
225 ml_pkg=$subst
226 archvar=ml_archs
227 break
228 fi
229 done
230
231 echo $ml_pkg >> ${target_rootfs}/install/$archvar.pkglist
232 done
233
234 local manifestpfx="install"
235 local extraopt=""
236 if [ "$insttype" = "attemptonly" ] ; then
237 manifestpfx="install_attemptonly"
238 extraopt="-i"
239 fi
240
241 rpmresolve $extraopt ${confbase}-base_archs.conf ${target_rootfs}/install/base_archs.pkglist -o ${target_rootfs}/install/${manifestpfx}.manifest
242 if [ -s ${target_rootfs}/install/ml_archs.pkglist ] ; then
243 rpmresolve $extraopt ${confbase}-ml_archs.conf ${target_rootfs}/install/ml_archs.pkglist -o ${target_rootfs}/install/${manifestpfx}_multilib.manifest
244 fi
245}
246
247#
248# Install a bunch of packages using rpm. 64# Install a bunch of packages using rpm.
249# There are 3 solutions in an image's FRESH generation: 65# There are two solutions in an image's FRESH generation:
250# 1) initial_solution 66# 1) main package solution
251# 2) total_solution 67# 2) complementary solution
252# 3) COMPLEMENTARY solution
253# 68#
254# It is different when incremental image generation is enabled in the 69# It is different when incremental image generation is enabled:
255# SECOND generation: 70# 1) The incremental image generation takes action during the main package
256# 1) The initial_solution is skipped. 71# installation, the previous installed complementary packages would
257# 2) The incremental image generation takes action during the total_solution 72# usually be removed here, and the new complementary ones would be
258# installation, the previous installed COMPLEMENTARY pkgs usually would be 73# installed in the next step.
259# removed here, the new COMPLEMENTARY ones would be installed in the next 74# 2) The complementary would always be installed since it is
260# step. 75# generated based on the first step's image.
261# 3) The COMPLEMENTARY would always be installed since it is
262# generated based on the second step's image.
263# 76#
264# the following shell variables needs to be set before calling this func: 77# the following shell variables needs to be set before calling this func:
265# INSTALL_ROOTFS_RPM - install root dir 78# INSTALL_ROOTFS_RPM - install root dir
266# INSTALL_PLATFORM_RPM - main platform 79# INSTALL_PLATFORM_RPM - main platform
267# INSTALL_PLATFORM_EXTRA_RPM - extra platform 80# INSTALL_PLATFORM_EXTRA_RPM - extra platform
268# INSTALL_CONFBASE_RPM - configuration file base name
269# INSTALL_PACKAGES_RPM - packages to be installed 81# INSTALL_PACKAGES_RPM - packages to be installed
270# INSTALL_PACKAGES_ATTEMPTONLY_RPM - packages attemped to be installed only 82# INSTALL_PACKAGES_ATTEMPTONLY_RPM - packages attemped to be installed only
271# INSTALL_PACKAGES_LINGUAS_RPM - additional packages for uclibc 83# INSTALL_PACKAGES_LINGUAS_RPM - additional packages for uclibc
@@ -275,15 +87,20 @@ process_pkg_list_rpm() {
275 87
276package_install_internal_rpm () { 88package_install_internal_rpm () {
277 89
278 local target_rootfs="${INSTALL_ROOTFS_RPM}" 90 local target_rootfs="$INSTALL_ROOTFS_RPM"
279 local platform="`echo ${INSTALL_PLATFORM_RPM} | sed 's#-#_#g'`" 91 local platform="`echo $INSTALL_PLATFORM_RPM | sed 's#-#_#g'`"
280 local platform_extra="`echo ${INSTALL_PLATFORM_EXTRA_RPM} | sed 's#-#_#g'`" 92 local platform_extra="`echo $INSTALL_PLATFORM_EXTRA_RPM | sed 's#-#_#g'`"
281 local confbase="${INSTALL_CONFBASE_RPM}" 93 local package_to_install="$INSTALL_PACKAGES_RPM"
282 local package_to_install="${INSTALL_PACKAGES_RPM}" 94 local package_attemptonly="$INSTALL_PACKAGES_ATTEMPTONLY_RPM"
283 local package_attemptonly="${INSTALL_PACKAGES_ATTEMPTONLY_RPM}" 95 local package_linguas="$INSTALL_PACKAGES_LINGUAS_RPM"
284 local package_linguas="${INSTALL_PACKAGES_LINGUAS_RPM}" 96 local providename="$INSTALL_PROVIDENAME_RPM"
285 local providename="${INSTALL_PROVIDENAME_RPM}" 97 local task="$INSTALL_TASK_RPM"
286 local task="${INSTALL_TASK_RPM}" 98
99 # Configure internal RPM environment when using Smart
100 export RPM_ETCRPM=${target_rootfs}/etc/rpm
101
102 # Setup temporary directory -- install...
103 mkdir -p ${target_rootfs}/install
287 104
288 if [ "${INSTALL_COMPLEMENTARY_RPM}" != "1" ] ; then 105 if [ "${INSTALL_COMPLEMENTARY_RPM}" != "1" ] ; then
289 # Setup base system configuration 106 # Setup base system configuration
@@ -306,166 +123,74 @@ package_install_internal_rpm () {
306 # Tell RPM that the "/" directory exist and is available 123 # Tell RPM that the "/" directory exist and is available
307 mkdir -p ${target_rootfs}/etc/rpm/sysinfo 124 mkdir -p ${target_rootfs}/etc/rpm/sysinfo
308 echo "/" >${target_rootfs}/etc/rpm/sysinfo/Dirnames 125 echo "/" >${target_rootfs}/etc/rpm/sysinfo/Dirnames
126
309 if [ ! -z "$providename" ]; then 127 if [ ! -z "$providename" ]; then
310 cat /dev/null > ${target_rootfs}/etc/rpm/sysinfo/Providename 128 cat /dev/null > ${target_rootfs}/etc/rpm/sysinfo/Providename
311 for provide in $providename ; do 129 for provide in $providename ; do
312 echo $provide >> ${target_rootfs}/etc/rpm/sysinfo/Providename 130 echo $provide >> ${target_rootfs}/etc/rpm/sysinfo/Providename
313 done 131 done
314 fi 132 fi
315 else
316 # We may run through the complementary installs multiple times. For each time
317 # we should add the previous solution manifest to the full "original" set to
318 # avoid duplicate install steps.
319 echo "Update original solution..."
320 for m in ${target_rootfs}/install/initial_solution.manifest \
321 ${target_rootfs}/install/total_solution.manifest; do
322 if [ -s $m ]; then
323 cat $m >> ${target_rootfs}/install/original_solution.manifest
324 rm -f $m
325 fi
326 done
327 sort -u ${target_rootfs}/install/original_solution.manifest -o ${target_rootfs}/install/original_solution.manifest.new
328 mv ${target_rootfs}/install/original_solution.manifest.new ${target_rootfs}/install/original_solution.manifest
329 fi
330 133
331 # Setup manifest of packages to install... 134 # Configure RPM... we enforce these settings!
332 mkdir -p ${target_rootfs}/install 135 mkdir -p ${target_rootfs}${rpmlibdir}
333 rm -f ${target_rootfs}/install/install.manifest 136 mkdir -p ${target_rootfs}${rpmlibdir}/log
334 rm -f ${target_rootfs}/install/install_multilib.manifest 137 # After change the __db.* cache size, log file will not be generated automatically,
335 rm -f ${target_rootfs}/install/install_attemptonly.manifest 138 # that will raise some warnings, so touch a bare log for rpm write into it.
139 touch ${target_rootfs}${rpmlibdir}/log/log.0000000001
140 if [ ! -e ${target_rootfs}${rpmlibdir}/DB_CONFIG ]; then
141 cat > ${target_rootfs}${rpmlibdir}/DB_CONFIG << EOF
142# ================ Environment
143set_data_dir .
144set_create_dir .
145set_lg_dir ./log
146set_tmp_dir ./tmp
147set_flags db_log_autoremove on
336 148
337 # Uclibc builds don't provide this stuff... 149# -- thread_count must be >= 8
338 if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then 150set_thread_count 64
339 if [ ! -z "${package_linguas}" ]; then
340 process_pkg_list_rpm linguas ${package_linguas}
341 fi
342 fi
343 151
344 if [ ! -z "${package_to_install}" ]; then 152# ================ Logging
345 process_pkg_list_rpm default ${package_to_install}
346 fi
347 153
348 # Normal package installation 154# ================ Memory Pool
349 155set_cachesize 0 1048576 0
350 # Generate an install solution by doing a --justdb install, then recreate it with 156set_mp_mmapsize 268435456
351 # an actual package install!
352 if [ -s ${target_rootfs}/install/install.manifest ]; then
353 echo "# Install manifest padding" >> ${target_rootfs}/install/install.manifest
354 ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
355 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
356 --root "${target_rootfs}/install" \
357 -D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}-base_archs.macro`" \
358 -D "__dbi_txn create nofsync" \
359 -U --justdb --replacepkgs --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
360 ${target_rootfs}/install/install.manifest
361 fi
362 157
363 if [ ! -z "${package_attemptonly}" ]; then 158# ================ Locking
364 echo "Adding attempt only packages..." 159set_lk_max_locks 16384
365 process_pkg_list_rpm attemptonly ${package_attemptonly} 160set_lk_max_lockers 16384
366 cat ${target_rootfs}/install/install_attemptonly.manifest | while read pkg_name 161set_lk_max_objects 16384
367 do 162 mutex_set_max 163840
368 echo "Attempting $pkg_name..." >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}"
369 ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
370 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
371 --root "${target_rootfs}/install" \
372 -D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \
373 -D "__dbi_txn create nofsync private" \
374 -U --justdb --replacepkgs --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
375 $pkg_name >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}" 2>&1 || true
376 done
377 fi
378 163
379 #### Note: 'Recommends' is an arbitrary tag that means _SUGGESTS_ in OE-core.. 164# ================ Replication
380 # Add any recommended packages to the image 165EOF
381 # RPM does not solve for recommended packages because they are optional... 166 fi
382 # So we query them and tree them like the ATTEMPTONLY packages above...
383 # Change the loop to "1" to run this code...
384 loop=0
385 if [ $loop -eq 1 ]; then
386 echo "Processing recommended packages..."
387 cat /dev/null > ${target_rootfs}/install/recommend.list
388 while [ $loop -eq 1 ]; do
389 # Dump the full set of recommends...
390 ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
391 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
392 --root "${target_rootfs}/install" \
393 -D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \
394 -D "__dbi_txn create nofsync private" \
395 -qa --qf "[%{RECOMMENDS}\n]" | sort -u > ${target_rootfs}/install/recommend
396 # Did we add more to the list?
397 grep -v -x -F -f ${target_rootfs}/install/recommend.list ${target_rootfs}/install/recommend > ${target_rootfs}/install/recommend.new || true
398 # We don't want to loop unless there is a change to the list!
399 loop=0
400 cat ${target_rootfs}/install/recommend.new | \
401 while read pkg ; do
402 # Ohh there was a new one, we'll need to loop again...
403 loop=1
404 echo "Processing $pkg..."
405 found=0
406 for archvar in base_archs ml_archs ; do
407 pkg_name=$(resolve_package_rpm ${confbase}-${archvar}.conf ${pkg})
408 if [ -n "$pkg_name" ]; then
409 found=1
410 break
411 fi
412 done
413 167
414 if [ $found -eq 0 ]; then 168 # Create database so that smart doesn't complain (lazy init)
415 echo "Note: Unable to find package $pkg -- suggests" 169 rpm --root $target_rootfs --dbpath /var/lib/rpm -qa > /dev/null
416 echo "Unable to find package $pkg." >> "`dirname ${BB_LOGFILE}`/log.do_${task}_recommend.${PID}" 170
417 continue 171 # Configure smart
172 rm -rf ${target_rootfs}/var/lib/smart
173 smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-root=${target_rootfs}
174 smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-dbpath=${rpmlibdir}
175 smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-nolinktos=1
176 smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-noparentdirs=1
177 smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-extra-macros._var=${localstatedir}
178 smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-extra-macros._tmppath=/install/tmp
179 smart --data-dir=${target_rootfs}/var/lib/smart channel --add rpmsys type=rpm-sys -y
180
181 for arch in $platform_extra ; do
182 if [ -d ${DEPLOY_DIR_RPM}/$arch -a ! -e ${target_rootfs}/install/channel.$arch.stamp ] ; then
183 smart --data-dir=${target_rootfs}/var/lib/smart channel --add $arch type=rpm-md type=rpm-md baseurl=${DEPLOY_DIR_RPM}/$arch -y
184 touch ${target_rootfs}/install/channel.$arch.stamp
418 fi 185 fi
419 echo "Attempting $pkg_name..." >> "`dirname ${BB_LOGFILE}`/log.do_{task}_recommend.${PID}"
420 ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
421 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
422 --root "${target_rootfs}/install" \
423 -D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \
424 -D "__dbi_txn create nofsync private" \
425 -U --justdb --replacepkgs --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
426 $pkg_name >> "`dirname ${BB_LOGFILE}`/log.do_${task}_recommend.${PID}" 2>&1 || true
427 done 186 done
428 cat ${target_rootfs}/install/recommend.list ${target_rootfs}/install/recommend.new | sort -u > ${target_rootfs}/install/recommend.new.list
429 mv -f ${target_rootfs}/install/recommend.new.list ${target_rootfs}/install/recommend.list
430 rm ${target_rootfs}/install/recommend ${target_rootfs}/install/recommend.new
431 done
432 fi 187 fi
433 188
434 # Now that we have a solution, pull out a list of what to install... 189 # Uclibc builds don't provide this stuff...
435 echo "Manifest: ${target_rootfs}/install/install_solution.manifest" 190 if [ x${TARGET_OS} != "xlinux" ] && [ x${TARGET_OS} != "xlinux-gnueabi" ] ; then
436 ${RPM} -D "_dbpath ${target_rootfs}/install" -qa --qf "%{packageorigin}\n" \ 191 package_linguas=""
437 --root "${target_rootfs}/install" \
438 -D "__dbi_txn create nofsync private" \
439 > ${target_rootfs}/install/install_solution.manifest
440
441 touch ${target_rootfs}/install/install_multilib_solution.manifest
442
443 if [ -s "${target_rootfs}/install/install_multilib.manifest" ]; then
444 # multilib package installation
445 echo "# Install multilib manifest padding" >> ${target_rootfs}/install/install_multilib.manifest
446
447 # Generate an install solution by doing a --justdb install, then recreate it with
448 # an actual package install!
449 ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
450 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
451 --root "${target_rootfs}/install" \
452 -D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}-ml_archs.macro`" \
453 -D "__dbi_txn create nofsync" \
454 -U --justdb --replacepkgs --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
455 ${target_rootfs}/install/install_multilib.manifest
456
457 # Now that we have a solution, pull out a list of what to install...
458 echo "Manifest: ${target_rootfs}/install/install_multilib.manifest"
459 ${RPM} -D "_dbpath ${target_rootfs}/install" -qa --qf "%{packageorigin}\n" \
460 --root "${target_rootfs}/install" \
461 -D "__dbi_txn create nofsync private" \
462 > ${target_rootfs}/install/install_multilib_solution.manifest
463
464 fi 192 fi
465 193
466 cat ${target_rootfs}/install/install_solution.manifest \
467 ${target_rootfs}/install/install_multilib_solution.manifest | sort -u > ${target_rootfs}/install/total_solution.manifest
468
469 # Construct install scriptlet wrapper 194 # Construct install scriptlet wrapper
470 cat << EOF > ${WORKDIR}/scriptlet_wrapper 195 cat << EOF > ${WORKDIR}/scriptlet_wrapper
471#!/bin/bash 196#!/bin/bash
@@ -491,93 +216,17 @@ fi
491EOF 216EOF
492 217
493 chmod 0755 ${WORKDIR}/scriptlet_wrapper 218 chmod 0755 ${WORKDIR}/scriptlet_wrapper
219 smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-extra-macros._cross_scriptlet_wrapper=${WORKDIR}/scriptlet_wrapper
494 220
495 # Configure RPM... we enforce these settings! 221 smart --data-dir=${target_rootfs}/var/lib/smart install -y ${package_to_install} ${package_linguas}
496 mkdir -p ${target_rootfs}${rpmlibdir}
497 mkdir -p ${target_rootfs}${rpmlibdir}/log
498 # After change the __db.* cache size, log file will not be generated automatically,
499 # that will raise some warnings, so touch a bare log for rpm write into it.
500 touch ${target_rootfs}${rpmlibdir}/log/log.0000000001
501 cat > ${target_rootfs}${rpmlibdir}/DB_CONFIG << EOF
502# ================ Environment
503set_data_dir .
504set_create_dir .
505set_lg_dir ./log
506set_tmp_dir ./tmp
507set_flags db_log_autoremove on
508
509# -- thread_count must be >= 8
510set_thread_count 64
511
512# ================ Logging
513 222
514# ================ Memory Pool 223 if [ ! -z "${package_attemptonly}" ]; then
515set_cachesize 0 1048576 0 224 echo "Installing attempt only packages..."
516set_mp_mmapsize 268435456 225 for pkg_name in ${package_attemptonly} ; do
517 226 echo "Attempting $pkg_name..." >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}"
518# ================ Locking 227 smart --data-dir=${target_rootfs}/var/lib/smart install -y $pkg_name >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}" 2>&1 || true
519set_lk_max_locks 16384 228 done
520set_lk_max_lockers 16384
521set_lk_max_objects 16384
522mutex_set_max 163840
523
524# ================ Replication
525EOF
526
527 if [ "${INSTALL_COMPLEMENTARY_RPM}" = "1" ] ; then
528 # Only install packages not already installed (dependency calculation will
529 # almost certainly have added some that have been)
530 sort -u ${target_rootfs}/install/original_solution.manifest > ${target_rootfs}/install/original_solution_sorted.manifest
531 sort -u ${target_rootfs}/install/total_solution.manifest > ${target_rootfs}/install/total_solution_sorted.manifest
532 comm -2 -3 ${target_rootfs}/install/total_solution_sorted.manifest \
533 ${target_rootfs}/install/original_solution_sorted.manifest > \
534 ${target_rootfs}/install/diff.manifest
535 mv ${target_rootfs}/install/diff.manifest ${target_rootfs}/install/total_solution.manifest
536 elif [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f "${target_rootfs}/etc/passwd" ]; then
537 echo "Skipping pre install due to existing image"
538 else
539 # RPM is special. It can't handle dependencies and preinstall scripts correctly. Its
540 # probably a feature. The only way to convince rpm to actually run the preinstall scripts
541 # for base-passwd and shadow first before installing packages that depend on these packages
542 # is to do two image installs, installing one set of packages, then the other.
543 rm -f ${target_rootfs}/install/initial_install.manifest
544 echo "Installing base dependencies first (base-passwd, base-files and shadow) since rpm is special"
545 grep /base-passwd-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true
546 grep /base-files-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true
547 grep /shadow-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true
548
549 if [ -s ${target_rootfs}/install/initial_install.manifest ]; then
550 echo "# Initial Install manifest padding..." >> ${target_rootfs}/install/initial_install.manifest
551
552 # Generate an install solution by doing a --justdb install, then recreate it with
553 # an actual package install!
554 mkdir -p ${target_rootfs}/initial
555
556 ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
557 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
558 --root "${target_rootfs}/install" \
559 -D "_dbpath ${target_rootfs}/initial" -D "`cat ${confbase}.macro`" \
560 -D "__dbi_txn create nofsync" \
561 -U --justdb --replacepkgs --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
562 ${target_rootfs}/install/initial_install.manifest
563
564 ${RPM} -D "_dbpath ${target_rootfs}/initial" -qa --qf "%{packageorigin}\n" \
565 -D "__dbi_txn create nofsync private" \
566 --root "${target_rootfs}/install" \
567 > ${target_rootfs}/install/initial_solution.manifest
568
569 rpm_update_pkg ${target_rootfs}/install/initial_solution.manifest
570
571 grep -Fv -f ${target_rootfs}/install/initial_solution.manifest ${target_rootfs}/install/total_solution.manifest > ${target_rootfs}/install/total_solution.manifest.new
572 mv ${target_rootfs}/install/total_solution.manifest.new ${target_rootfs}/install/total_solution.manifest
573
574 rm -rf ${target_rootfs}/initial
575 fi
576 fi 229 fi
577
578 echo "Installing main solution manifest (${target_rootfs}/install/total_solution.manifest)"
579
580 rpm_update_pkg ${target_rootfs}/install/total_solution.manifest
581} 230}
582 231
583python write_specfile () { 232python write_specfile () {
diff --git a/meta/classes/populate_sdk_rpm.bbclass b/meta/classes/populate_sdk_rpm.bbclass
index b5aa601f5d..d26867fa9a 100644
--- a/meta/classes/populate_sdk_rpm.bbclass
+++ b/meta/classes/populate_sdk_rpm.bbclass
@@ -1,10 +1,20 @@
1# Smart is python based, so be sure python-native is available to us.
2EXTRANATIVEPATH += "python-native"
3
1do_populate_sdk[depends] += "rpm-native:do_populate_sysroot" 4do_populate_sdk[depends] += "rpm-native:do_populate_sysroot"
2do_populate_sdk[depends] += "rpmresolve-native:do_populate_sysroot" 5do_populate_sdk[depends] += "rpmresolve-native:do_populate_sysroot"
6do_populate_sdk[depends] += "python-smartpm-native:do_populate_sysroot"
7
8# Needed for update-alternatives
9do_populate_sdk[depends] += "opkg-native:do_populate_sysroot"
10
11# Creating the repo info in do_rootfs
3do_populate_sdk[depends] += "createrepo-native:do_populate_sysroot" 12do_populate_sdk[depends] += "createrepo-native:do_populate_sysroot"
13
4do_populate_sdk[recrdeptask] += "do_package_write_rpm" 14do_populate_sdk[recrdeptask] += "do_package_write_rpm"
5 15
6rpmlibdir = "/var/lib/rpm" 16rpmlibdir = "/var/lib/rpm"
7RPMOPTS="--dbpath ${rpmlibdir} --define='_openall_before_chroot 1'" 17RPMOPTS="--dbpath ${rpmlibdir}"
8RPM="rpm ${RPMOPTS}" 18RPM="rpm ${RPMOPTS}"
9 19
10do_populate_sdk[lockfiles] += "${DEPLOY_DIR_RPM}/rpm.lock" 20do_populate_sdk[lockfiles] += "${DEPLOY_DIR_RPM}/rpm.lock"
@@ -16,28 +26,24 @@ populate_sdk_post_rpm () {
16 # remove lock files 26 # remove lock files
17 rm -f ${target_rootfs}/__db.* 27 rm -f ${target_rootfs}/__db.*
18 28
19 # Move manifests into the directory with the logs
20 mv ${target_rootfs}/install/*.manifest ${T}/
21
22 # Remove all remaining resolver files 29 # Remove all remaining resolver files
23 rm -rf ${target_rootfs}/install 30 rm -rf ${target_rootfs}/install
31 rm -rf ${target_rootfs}/var/lib/smart
24} 32}
25 33
26populate_sdk_rpm () { 34populate_sdk_rpm () {
27 35
28 package_update_index_rpm 36 package_update_index_rpm
29 package_generate_rpm_conf
30 37
31 ## install target ## 38 ## install target ##
32 # This needs to work in the same way as rootfs_rpm.bbclass! 39 # This needs to work in the same way as rootfs_rpm.bbclass!
33 # 40 #
34 export INSTALL_ROOTFS_RPM="${SDK_OUTPUT}/${SDKTARGETSYSROOT}" 41 export INSTALL_ROOTFS_RPM="${SDK_OUTPUT}/${SDKTARGETSYSROOT}"
35 export INSTALL_PLATFORM_RPM="${TARGET_ARCH}" 42 export INSTALL_PLATFORM_RPM="${TARGET_ARCH}"
36 export INSTALL_CONFBASE_RPM="${RPMCONF_TARGET_BASE}"
37 export INSTALL_PACKAGES_RPM="${TOOLCHAIN_TARGET_TASK}" 43 export INSTALL_PACKAGES_RPM="${TOOLCHAIN_TARGET_TASK}"
38 export INSTALL_PACKAGES_ATTEMPTONLY_RPM="${TOOLCHAIN_TARGET_TASK_ATTEMPTONLY}" 44 export INSTALL_PACKAGES_ATTEMPTONLY_RPM="${TOOLCHAIN_TARGET_TASK_ATTEMPTONLY}"
39 export INSTALL_PACKAGES_LINGUAS_RPM="" 45 export INSTALL_PACKAGES_LINGUAS_RPM=""
40 export INSTALL_PROVIDENAME_RPM="/bin/sh /bin/bash /usr/bin/env /usr/bin/perl pkgconfig pkgconfig(pkg-config)" 46 export INSTALL_PROVIDENAME_RPM=""
41 export INSTALL_TASK_RPM="populate_sdk-target" 47 export INSTALL_TASK_RPM="populate_sdk-target"
42 export INSTALL_COMPLEMENTARY_RPM="" 48 export INSTALL_COMPLEMENTARY_RPM=""
43 export INTERCEPT_DIR=${WORKDIR}/intercept_scripts 49 export INTERCEPT_DIR=${WORKDIR}/intercept_scripts
@@ -45,31 +51,6 @@ populate_sdk_rpm () {
45 51
46 # Setup base system configuration 52 # Setup base system configuration
47 mkdir -p ${INSTALL_ROOTFS_RPM}/etc/rpm/ 53 mkdir -p ${INSTALL_ROOTFS_RPM}/etc/rpm/
48 mkdir -p ${INSTALL_ROOTFS_RPM}${rpmlibdir}
49 mkdir -p ${INSTALL_ROOTFS_RPM}${rpmlibdir}/log
50 cat > ${INSTALL_ROOTFS_RPM}${rpmlibdir}/DB_CONFIG << EOF
51# ================ Environment
52set_data_dir .
53set_create_dir .
54set_lg_dir ./log
55set_tmp_dir ./tmp
56
57# -- thread_count must be >= 8
58set_thread_count 64
59
60# ================ Logging
61
62# ================ Memory Pool
63set_mp_mmapsize 268435456
64
65# ================ Locking
66set_lk_max_locks 16384
67set_lk_max_lockers 16384
68set_lk_max_objects 16384
69mutex_set_max 163840
70
71# ================ Replication
72EOF
73 54
74 # List must be prefered to least preferred order 55 # List must be prefered to least preferred order
75 INSTALL_PLATFORM_EXTRA_RPM="" 56 INSTALL_PLATFORM_EXTRA_RPM=""
@@ -86,7 +67,6 @@ EOF
86 echo "Installing NATIVESDK packages" 67 echo "Installing NATIVESDK packages"
87 export INSTALL_ROOTFS_RPM="${SDK_OUTPUT}" 68 export INSTALL_ROOTFS_RPM="${SDK_OUTPUT}"
88 export INSTALL_PLATFORM_RPM="${SDK_ARCH}" 69 export INSTALL_PLATFORM_RPM="${SDK_ARCH}"
89 export INSTALL_CONFBASE_RPM="${RPMCONF_HOST_BASE}"
90 export INSTALL_PACKAGES_RPM="${TOOLCHAIN_HOST_TASK}" 70 export INSTALL_PACKAGES_RPM="${TOOLCHAIN_HOST_TASK}"
91 export INSTALL_PACKAGES_ATTEMPTONLY_RPM="${TOOLCHAIN_TARGET_HOST_ATTEMPTONLY}" 71 export INSTALL_PACKAGES_ATTEMPTONLY_RPM="${TOOLCHAIN_TARGET_HOST_ATTEMPTONLY}"
92 export INSTALL_PACKAGES_LINGUAS_RPM="" 72 export INSTALL_PACKAGES_LINGUAS_RPM=""
@@ -114,11 +94,6 @@ EOF
114 rm -rf ${SDK_OUTPUT}/etc 94 rm -rf ${SDK_OUTPUT}/etc
115 95
116 populate_sdk_log_check populate_sdk 96 populate_sdk_log_check populate_sdk
117
118 # Workaround so the parser knows we need the resolve_package function!
119 if false ; then
120 resolve_package_rpm foo ${RPMCONF_TARGET_BASE}.conf || true
121 fi
122} 97}
123 98
124python () { 99python () {
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass
index 2bb1b08740..d0b0d5793f 100644
--- a/meta/classes/rootfs_rpm.bbclass
+++ b/meta/classes/rootfs_rpm.bbclass
@@ -7,11 +7,15 @@ ROOTFS_PKGMANAGE = "rpm zypper"
7# Add 50Meg of extra space for zypper database space 7# Add 50Meg of extra space for zypper database space
8IMAGE_ROOTFS_EXTRA_SPACE_append = "${@base_contains("PACKAGE_INSTALL", "zypper", " + 51200", "" ,d)}" 8IMAGE_ROOTFS_EXTRA_SPACE_append = "${@base_contains("PACKAGE_INSTALL", "zypper", " + 51200", "" ,d)}"
9 9
10# Smart is python based, so be sure python-native is available to us.
11EXTRANATIVEPATH += "python-native"
12
10# Postinstalls on device are handled within this class at present 13# Postinstalls on device are handled within this class at present
11ROOTFS_PKGMANAGE_BOOTSTRAP = "" 14ROOTFS_PKGMANAGE_BOOTSTRAP = ""
12 15
13do_rootfs[depends] += "rpm-native:do_populate_sysroot" 16do_rootfs[depends] += "rpm-native:do_populate_sysroot"
14do_rootfs[depends] += "rpmresolve-native:do_populate_sysroot" 17do_rootfs[depends] += "rpmresolve-native:do_populate_sysroot"
18do_rootfs[depends] += "python-smartpm-native:do_populate_sysroot"
15 19
16# Needed for update-alternatives 20# Needed for update-alternatives
17do_rootfs[depends] += "opkg-native:do_populate_sysroot" 21do_rootfs[depends] += "opkg-native:do_populate_sysroot"
@@ -21,8 +25,8 @@ do_rootfs[depends] += "createrepo-native:do_populate_sysroot"
21 25
22do_rootfs[recrdeptask] += "do_package_write_rpm" 26do_rootfs[recrdeptask] += "do_package_write_rpm"
23 27
24RPM_PREPROCESS_COMMANDS = "package_update_index_rpm; package_generate_rpm_conf; " 28RPM_PREPROCESS_COMMANDS = "package_update_index_rpm; "
25RPM_POSTPROCESS_COMMANDS = "" 29RPM_POSTPROCESS_COMMANDS = "rpm_setup_smart_target_config; "
26 30
27# 31#
28# Allow distributions to alter when [postponed] package install scripts are run 32# Allow distributions to alter when [postponed] package install scripts are run
@@ -32,7 +36,7 @@ POSTINSTALL_INITPOSITION ?= "98"
32rpmlibdir = "/var/lib/rpm" 36rpmlibdir = "/var/lib/rpm"
33opkglibdir = "${localstatedir}/lib/opkg" 37opkglibdir = "${localstatedir}/lib/opkg"
34 38
35RPMOPTS="--dbpath ${rpmlibdir} --define='_openall_before_chroot 1'" 39RPMOPTS="--dbpath ${rpmlibdir}"
36RPM="rpm ${RPMOPTS}" 40RPM="rpm ${RPMOPTS}"
37 41
38# RPM doesn't work with multiple rootfs generation at once due to collisions in the use of files 42# RPM doesn't work with multiple rootfs generation at once due to collisions in the use of files
@@ -42,13 +46,10 @@ do_rootfs[lockfiles] += "${DEPLOY_DIR_RPM}/rpm.lock"
42fakeroot rootfs_rpm_do_rootfs () { 46fakeroot rootfs_rpm_do_rootfs () {
43 ${RPM_PREPROCESS_COMMANDS} 47 ${RPM_PREPROCESS_COMMANDS}
44 48
45 #createrepo "${DEPLOY_DIR_RPM}"
46
47 # install packages 49 # install packages
48 # This needs to work in the same way as populate_sdk_rpm.bbclass! 50 # This needs to work in the same way as populate_sdk_rpm.bbclass!
49 export INSTALL_ROOTFS_RPM="${IMAGE_ROOTFS}" 51 export INSTALL_ROOTFS_RPM="${IMAGE_ROOTFS}"
50 export INSTALL_PLATFORM_RPM="${TARGET_ARCH}" 52 export INSTALL_PLATFORM_RPM="${TARGET_ARCH}"
51 export INSTALL_CONFBASE_RPM="${RPMCONF_TARGET_BASE}"
52 export INSTALL_PACKAGES_RPM="${PACKAGE_INSTALL}" 53 export INSTALL_PACKAGES_RPM="${PACKAGE_INSTALL}"
53 export INSTALL_PACKAGES_ATTEMPTONLY_RPM="${PACKAGE_INSTALL_ATTEMPTONLY}" 54 export INSTALL_PACKAGES_ATTEMPTONLY_RPM="${PACKAGE_INSTALL_ATTEMPTONLY}"
54 export INSTALL_PACKAGES_LINGUAS_RPM="${LINGUAS_INSTALL}" 55 export INSTALL_PACKAGES_LINGUAS_RPM="${LINGUAS_INSTALL}"
@@ -114,18 +115,10 @@ EOF
114 # remove lock files 115 # remove lock files
115 rm -f ${IMAGE_ROOTFS}${rpmlibdir}/__db.* 116 rm -f ${IMAGE_ROOTFS}${rpmlibdir}/__db.*
116 117
117 # Move manifests into the directory with the logs
118 mv ${IMAGE_ROOTFS}/install/*.manifest ${T}/
119
120 # Remove all remaining resolver files 118 # Remove all remaining resolver files
121 rm -rf ${IMAGE_ROOTFS}/install 119 rm -rf ${IMAGE_ROOTFS}/install
122 120
123 log_check rootfs 121 log_check rootfs
124
125 # Workaround so the parser knows we need the resolve_package function!
126 if false ; then
127 resolve_package_rpm foo ${RPMCONF_TARGET_BASE}.conf || true
128 fi
129} 122}
130 123
131remove_packaging_data_files() { 124remove_packaging_data_files() {
@@ -135,10 +128,19 @@ remove_packaging_data_files() {
135 mkdir -p $t 128 mkdir -p $t
136 mv ${IMAGE_ROOTFS}${rpmlibdir} $t 129 mv ${IMAGE_ROOTFS}${rpmlibdir} $t
137 rm -rf ${IMAGE_ROOTFS}${opkglibdir} 130 rm -rf ${IMAGE_ROOTFS}${opkglibdir}
131 rm -rf ${IMAGE_ROOTFS}/var/lib/smart
132}
133
134rpm_setup_smart_target_config() {
135 # Set up smart configuration for the target
136 rm -rf ${IMAGE_ROOTFS}/var/lib/smart
137 smart --data-dir=${IMAGE_ROOTFS}/var/lib/smart channel --add rpmsys type=rpm-sys -y
138 smart --data-dir=${IMAGE_ROOTFS}/var/lib/smart config --set rpm-nolinktos=1
139 smart --data-dir=${IMAGE_ROOTFS}/var/lib/smart config --set rpm-noparentdirs=1
140 rm -f ${IMAGE_ROOTFS}/var/lib/smart/config.old
138} 141}
139 142
140RPM_QUERY_CMD = '${RPM} --root $INSTALL_ROOTFS_RPM -D "_dbpath ${rpmlibdir}" \ 143RPM_QUERY_CMD = '${RPM} --root $INSTALL_ROOTFS_RPM -D "_dbpath ${rpmlibdir}"'
141 -D "__dbi_txn create nofsync private"'
142 144
143list_installed_packages() { 145list_installed_packages() {
144 GET_LIST=$(${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH} %{PACKAGEORIGIN} %{Platform}\n]") 146 GET_LIST=$(${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH} %{PACKAGEORIGIN} %{Platform}\n]")