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>
This commit is contained in:
Mark Hatle
2012-06-11 13:18:59 -05:00
committed by Richard Purdie
parent f182f53cc3
commit 9786663f9c

View File

@@ -182,6 +182,7 @@ rpm_update_pkg () {
# been run by now, so don't have to run them(preun, postun, etc.) when # been run by now, so don't have to run them(preun, postun, etc.) when
# erase the pkg # erase the pkg
if [ -s ${target_rootfs}/install/remove.manifest ]; then if [ -s ${target_rootfs}/install/remove.manifest ]; then
echo "# Remove manifest padding...." >> ${target_rootfs}/install/remove.manifest
rpm_common_comand --noscripts --nodeps \ rpm_common_comand --noscripts --nodeps \
-e `cat ${target_rootfs}/install/remove.manifest` -e `cat ${target_rootfs}/install/remove.manifest`
fi fi
@@ -249,7 +250,7 @@ package_install_internal_rpm () {
# Setup manifest of packages to install... # Setup manifest of packages to install...
mkdir -p ${target_rootfs}/install mkdir -p ${target_rootfs}/install
echo "# Install manifest" > ${target_rootfs}/install/install.manifest rm -f ${target_rootfs}/install/install.manifest
# Uclibc builds don't provide this stuff... # Uclibc builds don't provide this stuff...
if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then
@@ -309,12 +310,15 @@ package_install_internal_rpm () {
# Generate an install solution by doing a --justdb install, then recreate it with # Generate an install solution by doing a --justdb install, then recreate it with
# an actual package install! # an actual package install!
${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ if [ -s ${target_rootfs}/install/install.manifest ]; then
--predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \ echo "# Install manifest padding" >> ${target_rootfs}/install/install.manifest
-D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}-base_archs.macro`" \ ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
-D "__dbi_txn create nofsync" \ --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
-U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \ -D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}-base_archs.macro`" \
${target_rootfs}/install/install.manifest -D "__dbi_txn create nofsync" \
-U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
${target_rootfs}/install/install.manifest
fi
if [ ! -z "${package_attemptonly}" ]; then if [ ! -z "${package_attemptonly}" ]; then
echo "Adding attempt only packages..." echo "Adding attempt only packages..."
@@ -407,8 +411,9 @@ package_install_internal_rpm () {
touch ${target_rootfs}/install/install_multilib_solution.manifest touch ${target_rootfs}/install/install_multilib_solution.manifest
if [ -e "${target_rootfs}/install/install_multilib.manifest" ]; then if [ -s "${target_rootfs}/install/install_multilib.manifest" ]; then
# multilib package installation # multilib package installation
echo "# Install multilib manifest padding" >> ${target_rootfs}/install/install_multilib.manifest
# Generate an install solution by doing a --justdb install, then recreate it with # Generate an install solution by doing a --justdb install, then recreate it with
# an actual package install! # an actual package install!
@@ -493,33 +498,37 @@ EOF
if [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f "$pre_btmanifest" ]; then if [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f "$pre_btmanifest" ]; then
echo "Skipping pre install due to exisitng image" echo "Skipping pre install due to exisitng image"
else else
echo "# Initial Install manifest" > ${target_rootfs}/install/initial_install.manifest rm -f ${target_rootfs}/install/initial_install.manifest
echo "Installing base dependencies first (base-passwd, base-files and shadow) since rpm is special" echo "Installing base dependencies first (base-passwd, base-files and shadow) since rpm is special"
grep /base-passwd-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true grep /base-passwd-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true
grep /base-files-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true grep /base-files-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true
grep /shadow-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true grep /shadow-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true
# Generate an install solution by doing a --justdb install, then recreate it with if [ -s ${target_rootfs}/install/initial_install.manifest ]; then
# an actual package install! echo "# Initial Install manifest padding..." >> ${target_rootfs}/install/initial_install.manifest
mkdir -p ${target_rootfs}/initial
${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ # Generate an install solution by doing a --justdb install, then recreate it with
--predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \ # an actual package install!
-D "_dbpath ${target_rootfs}/initial" -D "`cat ${confbase}.macro`" \ mkdir -p ${target_rootfs}/initial
-D "__dbi_txn create nofsync" \
-U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
${target_rootfs}/install/initial_install.manifest
${RPM} -D "_dbpath ${target_rootfs}/initial" -qa --qf "%{packageorigin}\n" \ ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
-D "__dbi_txn create nofsync private" \ --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
> ${target_rootfs}/install/initial_solution.manifest -D "_dbpath ${target_rootfs}/initial" -D "`cat ${confbase}.macro`" \
-D "__dbi_txn create nofsync" \
-U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
${target_rootfs}/install/initial_install.manifest
rpm_update_pkg ${target_rootfs}/install/initial_solution.manifest ${RPM} -D "_dbpath ${target_rootfs}/initial" -qa --qf "%{packageorigin}\n" \
-D "__dbi_txn create nofsync private" \
> ${target_rootfs}/install/initial_solution.manifest
rpm_update_pkg ${target_rootfs}/install/initial_solution.manifest
grep -Fv -f ${target_rootfs}/install/initial_solution.manifest ${target_rootfs}/install/total_solution.manifest > ${target_rootfs}/install/total_solution.manifest.new grep -Fv -f ${target_rootfs}/install/initial_solution.manifest ${target_rootfs}/install/total_solution.manifest > ${target_rootfs}/install/total_solution.manifest.new
mv ${target_rootfs}/install/total_solution.manifest.new ${target_rootfs}/install/total_solution.manifest mv ${target_rootfs}/install/total_solution.manifest.new ${target_rootfs}/install/total_solution.manifest
rm -rf ${target_rootfs}/initial rm -rf ${target_rootfs}/initial
fi
fi fi
echo "Installing main solution manifest (${target_rootfs}/install/total_solution.manifest)" echo "Installing main solution manifest (${target_rootfs}/install/total_solution.manifest)"