summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-11 21:31:20 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-11 23:24:35 (GMT)
commit0923ee40ae59133c91a95e0727eb1ab95aca13b8 (patch)
tree08ef598967bfb7b1634652bc5164591643421d2f
parent9789ed626bc69f348b55cfa5f1a79abbdc994204 (diff)
downloadpoky-0923ee40ae59133c91a95e0727eb1ab95aca13b8.tar.gz
package_rpm: Fix useradd preinst ordering issues1.2_M4.rc3
We were already having occasional ordering issues with package_rpm. Fixing the ldconfig postinstall issue pushed rpm over the cliff and totally broke rpm builds with the packages getting installed in effectively a random order and the useradd preinstalls getting executed out of order and breaking. The only explanation I can find for this is that rpm is special. It will happily run a preinst for a package without any of that package's dependencies being present regardless of whether there are any circular dependency issues or not. I attempted various ways of solving this such as ordering the total_solution.manifest in creative ways but the bottom line is RPM ignores this. It takes little account of any request to ignore /bin/sh dependencies for the purposes of constructing the final image. The end result is we're having to install the base-passwd, base-files and shadow packages first (if there is a request to install them), then install any other packages. It this wasn't in the middle of a release I'd be rewriting this bbclass file, its horrible. (From OE-Core rev: 2c136255a7db8c57ab595a9c2ee1f32aebefc480) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/package_rpm.bbclass63
1 files changed, 47 insertions, 16 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 16a2c87..6033332 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -166,22 +166,23 @@ rpm_common_comand () {
166# install or remove the pkg 166# install or remove the pkg
167rpm_update_pkg () { 167rpm_update_pkg () {
168 168
169 manifest=$1
170 btmanifest=$manifest.bt
169 local target_rootfs="${INSTALL_ROOTFS_RPM}" 171 local target_rootfs="${INSTALL_ROOTFS_RPM}"
170 172
171 # Save the rpm's build time for incremental image generation, and the file 173 # Save the rpm's build time for incremental image generation, and the file
172 # would be moved to ${T} 174 # would be moved to ${T}
173 rm -f ${target_rootfs}/install/total_solution_bt.manifest 175 rm -f $btmanifest
174 for i in `cat ${target_rootfs}/install/total_solution.manifest`; do 176 for i in `cat $manifest`; do
175 # Use "rpm" rather than "${RPM}" here, since we don't need the 177 # Use "rpm" rather than "${RPM}" here, since we don't need the
176 # '--dbpath' option 178 # '--dbpath' option
177 echo "$i `rpm -qp --qf '%{BUILDTIME}\n' $i`" >> \ 179 echo "$i `rpm -qp --qf '%{BUILDTIME}\n' $i`" >> $btmanifest
178 ${target_rootfs}/install/total_solution_bt.manifest
179 done 180 done
180 181
181 # Only install the different pkgs if incremental image generation is set 182 # Only install the different pkgs if incremental image generation is set
182 if [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f ${T}/total_solution_bt.manifest -a \ 183 if [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f ${T}/total_solution_bt.manifest -a \
183 "${IMAGE_PKGTYPE}" = "rpm" ]; then 184 "${IMAGE_PKGTYPE}" = "rpm" ]; then
184 cur_list="${target_rootfs}/install/total_solution_bt.manifest" 185 cur_list="$btmanifest"
185 pre_list="${T}/total_solution_bt.manifest" 186 pre_list="${T}/total_solution_bt.manifest"
186 sort -u $cur_list -o $cur_list 187 sort -u $cur_list -o $cur_list
187 sort -u $pre_list -o $pre_list 188 sort -u $pre_list -o $pre_list
@@ -203,8 +204,7 @@ rpm_update_pkg () {
203 -Uvh ${target_rootfs}/install/incremental.manifest 204 -Uvh ${target_rootfs}/install/incremental.manifest
204 else 205 else
205 # Attempt to install 206 # Attempt to install
206 rpm_common_comand --replacepkgs \ 207 rpm_common_comand --replacepkgs -Uhv $manifest
207 -Uhv ${target_rootfs}/install/total_solution.manifest
208 fi 208 fi
209} 209}
210 210
@@ -440,14 +440,7 @@ package_install_internal_rpm () {
440 440
441 fi 441 fi
442 442
443 # If base-passwd or shadow are in the list of packages to install, 443 cat ${target_rootfs}/install/install_solution.manifest > ${target_rootfs}/install/total_solution.manifest
444 # ensure they are installed first to support later packages that
445 # may create custom users/groups (fixes Yocto bug #2127)
446 infile=${target_rootfs}/install/install_solution.manifest
447 outfile=${target_rootfs}/install/total_solution.manifest
448 cat $infile | grep /base-passwd-[0-9] > $outfile || true
449 cat $infile | grep /shadow-[0-9] >> $outfile || true
450 cat $infile | grep -v /shadow-[0-9] | grep -v /base-passwd-[0-9] >> $outfile || true
451 cat ${target_rootfs}/install/install_multilib_solution.manifest >> ${target_rootfs}/install/total_solution.manifest 444 cat ${target_rootfs}/install/install_multilib_solution.manifest >> ${target_rootfs}/install/total_solution.manifest
452 445
453 # Construct install scriptlet wrapper 446 # Construct install scriptlet wrapper
@@ -474,8 +467,46 @@ EOF
474 467
475 chmod 0755 ${WORKDIR}/scriptlet_wrapper 468 chmod 0755 ${WORKDIR}/scriptlet_wrapper
476 469
477 rpm_update_pkg 470 # RPM is special. It can't handle dependencies and preinstall scripts correctly. Its
471 # probably a feature. The only way to convince rpm to actually run the preinstall scripts
472 # for base-passwd and shadow first before installing packages that depend on these packages
473 # is to do two image installs, installing one set of packages, then the other.
474 if [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f ${T}/total_solution_bt.manifest ]; then
475 echo "Skipping pre install due to exisitng image"
476 else
477 echo "# Initial Install manifest" > ${target_rootfs}/install/initial_install.manifest
478 echo "Installing base dependencies first (base-passwd, base-files and shadow) since rpm is special"
479 grep /base-passwd-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true
480 grep /base-files-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true
481 grep /shadow-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true
478 482
483 # Generate an install solution by doing a --justdb install, then recreate it with
484 # an actual package install!
485 mkdir -p ${target_rootfs}/initial
486
487 ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
488 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
489 -D "_dbpath ${target_rootfs}/initial" -D "`cat ${confbase}-base_archs.macro`" \
490 -D "`cat ${confbase}-ml_archs.macro`" \
491 -D "__dbi_txn create nofsync" \
492 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
493 ${target_rootfs}/install/initial_install.manifest
494
495 ${RPM} -D "_dbpath ${target_rootfs}/initial" -qa --yaml \
496 -D "__dbi_txn create nofsync private" \
497 | grep -i 'Packageorigin' | cut -d : -f 2 > ${target_rootfs}/install/initial_solution.manifest
498
499 rpm_update_pkg ${target_rootfs}/install/initial_solution.manifest
500
501 grep -Fv -f ${target_rootfs}/install/initial_solution.manifest ${target_rootfs}/install/total_solution.manifest > ${target_rootfs}/install/total_solution.manifest.new
502 mv ${target_rootfs}/install/total_solution.manifest.new ${target_rootfs}/install/total_solution.manifest
503
504 rm -rf ${target_rootfs}/initial
505 fi
506
507 echo "Installing main solution manifest (${target_rootfs}/install/total_solution.manifest)"
508
509 rpm_update_pkg ${target_rootfs}/install/total_solution.manifest
479} 510}
480 511
481python write_specfile () { 512python write_specfile () {