summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2012-06-11 18:18:59 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-06-12 10:10:36 (GMT)
commit9786663f9ce531f1f9f32deeef0276bda5604e1c (patch)
treefc5e83bf56e04c5688139ecfd4476b25d510288f
parentf182f53cc399a1d4a7b53ad5d3a0c16a51c50876 (diff)
downloadpoky-9786663f9ce531f1f9f32deeef0276bda5604e1c.tar.gz
package_rpm: Verify that the package manifests are not empty
An empty manifest will cause a failure condition. We ensure that any install actions occur only with a manifest larger then size 0. Also ensure that padding is added to the end of the manifest, instead of the beginning to enable this size check. (Padding is required for very small manifest files..) (From OE-Core rev: 9b115181a8b10ec1eb8eac355405695f63e2e011) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/package_rpm.bbclass59
1 files changed, 34 insertions, 25 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index b84c044..d5406c2 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -182,6 +182,7 @@ rpm_update_pkg () {
182 # been run by now, so don't have to run them(preun, postun, etc.) when 182 # been run by now, so don't have to run them(preun, postun, etc.) when
183 # erase the pkg 183 # erase the pkg
184 if [ -s ${target_rootfs}/install/remove.manifest ]; then 184 if [ -s ${target_rootfs}/install/remove.manifest ]; then
185 echo "# Remove manifest padding...." >> ${target_rootfs}/install/remove.manifest
185 rpm_common_comand --noscripts --nodeps \ 186 rpm_common_comand --noscripts --nodeps \
186 -e `cat ${target_rootfs}/install/remove.manifest` 187 -e `cat ${target_rootfs}/install/remove.manifest`
187 fi 188 fi
@@ -249,7 +250,7 @@ package_install_internal_rpm () {
249 250
250 # Setup manifest of packages to install... 251 # Setup manifest of packages to install...
251 mkdir -p ${target_rootfs}/install 252 mkdir -p ${target_rootfs}/install
252 echo "# Install manifest" > ${target_rootfs}/install/install.manifest 253 rm -f ${target_rootfs}/install/install.manifest
253 254
254 # Uclibc builds don't provide this stuff... 255 # Uclibc builds don't provide this stuff...
255 if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then 256 if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then
@@ -309,12 +310,15 @@ package_install_internal_rpm () {
309 310
310 # Generate an install solution by doing a --justdb install, then recreate it with 311 # Generate an install solution by doing a --justdb install, then recreate it with
311 # an actual package install! 312 # an actual package install!
312 ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ 313 if [ -s ${target_rootfs}/install/install.manifest ]; then
313 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \ 314 echo "# Install manifest padding" >> ${target_rootfs}/install/install.manifest
314 -D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}-base_archs.macro`" \ 315 ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
315 -D "__dbi_txn create nofsync" \ 316 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
316 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \ 317 -D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}-base_archs.macro`" \
317 ${target_rootfs}/install/install.manifest 318 -D "__dbi_txn create nofsync" \
319 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
320 ${target_rootfs}/install/install.manifest
321 fi
318 322
319 if [ ! -z "${package_attemptonly}" ]; then 323 if [ ! -z "${package_attemptonly}" ]; then
320 echo "Adding attempt only packages..." 324 echo "Adding attempt only packages..."
@@ -407,8 +411,9 @@ package_install_internal_rpm () {
407 411
408 touch ${target_rootfs}/install/install_multilib_solution.manifest 412 touch ${target_rootfs}/install/install_multilib_solution.manifest
409 413
410 if [ -e "${target_rootfs}/install/install_multilib.manifest" ]; then 414 if [ -s "${target_rootfs}/install/install_multilib.manifest" ]; then
411 # multilib package installation 415 # multilib package installation
416 echo "# Install multilib manifest padding" >> ${target_rootfs}/install/install_multilib.manifest
412 417
413 # Generate an install solution by doing a --justdb install, then recreate it with 418 # Generate an install solution by doing a --justdb install, then recreate it with
414 # an actual package install! 419 # an actual package install!
@@ -493,33 +498,37 @@ EOF
493 if [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f "$pre_btmanifest" ]; then 498 if [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f "$pre_btmanifest" ]; then
494 echo "Skipping pre install due to exisitng image" 499 echo "Skipping pre install due to exisitng image"
495 else 500 else
496 echo "# Initial Install manifest" > ${target_rootfs}/install/initial_install.manifest 501 rm -f ${target_rootfs}/install/initial_install.manifest
497 echo "Installing base dependencies first (base-passwd, base-files and shadow) since rpm is special" 502 echo "Installing base dependencies first (base-passwd, base-files and shadow) since rpm is special"
498 grep /base-passwd-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true 503 grep /base-passwd-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true
499 grep /base-files-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true 504 grep /base-files-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true
500 grep /shadow-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true 505 grep /shadow-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true
501 506
502 # Generate an install solution by doing a --justdb install, then recreate it with 507 if [ -s ${target_rootfs}/install/initial_install.manifest ]; then
503 # an actual package install! 508 echo "# Initial Install manifest padding..." >> ${target_rootfs}/install/initial_install.manifest
504 mkdir -p ${target_rootfs}/initial
505 509
506 ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ 510 # Generate an install solution by doing a --justdb install, then recreate it with
507 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \ 511 # an actual package install!
508 -D "_dbpath ${target_rootfs}/initial" -D "`cat ${confbase}.macro`" \ 512 mkdir -p ${target_rootfs}/initial
509 -D "__dbi_txn create nofsync" \
510 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
511 ${target_rootfs}/install/initial_install.manifest
512 513
513 ${RPM} -D "_dbpath ${target_rootfs}/initial" -qa --qf "%{packageorigin}\n" \ 514 ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
514 -D "__dbi_txn create nofsync private" \ 515 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
515 > ${target_rootfs}/install/initial_solution.manifest 516 -D "_dbpath ${target_rootfs}/initial" -D "`cat ${confbase}.macro`" \
517 -D "__dbi_txn create nofsync" \
518 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
519 ${target_rootfs}/install/initial_install.manifest
520
521 ${RPM} -D "_dbpath ${target_rootfs}/initial" -qa --qf "%{packageorigin}\n" \
522 -D "__dbi_txn create nofsync private" \
523 > ${target_rootfs}/install/initial_solution.manifest
516 524
517 rpm_update_pkg ${target_rootfs}/install/initial_solution.manifest 525 rpm_update_pkg ${target_rootfs}/install/initial_solution.manifest
518 526
519 grep -Fv -f ${target_rootfs}/install/initial_solution.manifest ${target_rootfs}/install/total_solution.manifest > ${target_rootfs}/install/total_solution.manifest.new 527 grep -Fv -f ${target_rootfs}/install/initial_solution.manifest ${target_rootfs}/install/total_solution.manifest > ${target_rootfs}/install/total_solution.manifest.new
520 mv ${target_rootfs}/install/total_solution.manifest.new ${target_rootfs}/install/total_solution.manifest 528 mv ${target_rootfs}/install/total_solution.manifest.new ${target_rootfs}/install/total_solution.manifest
521 529
522 rm -rf ${target_rootfs}/initial 530 rm -rf ${target_rootfs}/initial
531 fi
523 fi 532 fi
524 533
525 echo "Installing main solution manifest (${target_rootfs}/install/total_solution.manifest)" 534 echo "Installing main solution manifest (${target_rootfs}/install/total_solution.manifest)"