diff options
Diffstat (limited to 'meta/classes/package_rpm.bbclass')
-rw-r--r-- | meta/classes/package_rpm.bbclass | 531 |
1 files changed, 90 insertions, 441 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 | ||
19 | RPMCONF_TARGET_BASE = "${DEPLOY_DIR_RPM}/solvedb" | ||
20 | RPMCONF_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 | # |
24 | package_update_index_rpm () { | 22 | package_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 | |||
39 | package_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 | # | ||
68 | package_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 | |||
76 | package_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 | ||
103 | rpm_log_check() { | 42 | rpm_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 | # | ||
128 | resolve_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 | ||
142 | rpm_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 | ||
158 | rpm_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 | |||
203 | process_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 | ||
276 | package_install_internal_rpm () { | 88 | package_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 | ||
143 | set_data_dir . | ||
144 | set_create_dir . | ||
145 | set_lg_dir ./log | ||
146 | set_tmp_dir ./tmp | ||
147 | set_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 | 150 | set_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 | 155 | set_cachesize 0 1048576 0 | |
350 | # Generate an install solution by doing a --justdb install, then recreate it with | 156 | set_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..." | 159 | set_lk_max_locks 16384 |
365 | process_pkg_list_rpm attemptonly ${package_attemptonly} | 160 | set_lk_max_lockers 16384 |
366 | cat ${target_rootfs}/install/install_attemptonly.manifest | while read pkg_name | 161 | set_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 | 165 | EOF |
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 | |||
491 | EOF | 216 | EOF |
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 | ||
503 | set_data_dir . | ||
504 | set_create_dir . | ||
505 | set_lg_dir ./log | ||
506 | set_tmp_dir ./tmp | ||
507 | set_flags db_log_autoremove on | ||
508 | |||
509 | # -- thread_count must be >= 8 | ||
510 | set_thread_count 64 | ||
511 | |||
512 | # ================ Logging | ||
513 | 222 | ||
514 | # ================ Memory Pool | 223 | if [ ! -z "${package_attemptonly}" ]; then |
515 | set_cachesize 0 1048576 0 | 224 | echo "Installing attempt only packages..." |
516 | set_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 |
519 | set_lk_max_locks 16384 | 228 | done |
520 | set_lk_max_lockers 16384 | ||
521 | set_lk_max_objects 16384 | ||
522 | mutex_set_max 163840 | ||
523 | |||
524 | # ================ Replication | ||
525 | EOF | ||
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 | ||
583 | python write_specfile () { | 232 | python write_specfile () { |