diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2012-08-21 14:48:48 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-08-21 12:12:09 +0100 |
commit | 5d8ca498e09438bd91654fa8b8b2c970956d88e3 (patch) | |
tree | cb2da5b6fec8e691ee456c77e02f953ba57b9a80 /meta/classes/package_rpm.bbclass | |
parent | 72a924d0686389d648338efd3f675fc85ee2d181 (diff) | |
download | openembedded-core-5d8ca498e09438bd91654fa8b8b2c970956d88e3.tar.gz openembedded-core-5d8ca498e09438bd91654fa8b8b2c970956d88e3.tar.bz2 openembedded-core-5d8ca498e09438bd91654fa8b8b2c970956d88e3.zip |
package_rpm.bbclass: fix and enhance the incremental rpm generation
The incremental rpm generation usually broke when package_rpm.bbclass
changed, change its implementation to make it more stable:
* It depended on the previous and current saved manifest files in
the past, it would break when the manifest changed. Now query the
previous and current installed pkgs from rootfs/var/lib and
rootfs/install/, this would be more reliable, the manifest's change
would not affect it any more.
* Add explanations before package_install_internal_rpm to explain what
does the function do.
* Remove an unwanted "awk '{print $1}'".
[YOCTO #2906]
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package_rpm.bbclass')
-rw-r--r-- | meta/classes/package_rpm.bbclass | 68 |
1 files changed, 43 insertions, 25 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index d0f69bf40f..9abad5e093 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass @@ -158,38 +158,41 @@ rpm_common_comand () { rpm_update_pkg () { manifest=$1 - btmanifest=$manifest.bt.manifest - pre_btmanifest=${T}/${btmanifest##/*/} + # The manifest filename, e.g. total_solution.manifest + m_name=${manifest##/*/} local target_rootfs="${INSTALL_ROOTFS_RPM}" - - # Save the rpm's build time for incremental image generation, and the file - # would be moved to ${T} - for i in `cat $manifest`; do - # Use "rpm" rather than "${RPM}" here, since we don't need the - # '--dbpath' option - echo "$i `rpm -qp --qf '%{BUILDTIME}\n' $i`" - done | sort -u > $btmanifest - - # Only install the different pkgs if incremental image generation is set - if [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f "$pre_btmanifest" -a \ - "${IMAGE_PKGTYPE}" = "rpm" ]; then - comm -1 -3 $btmanifest $pre_btmanifest | sed 's#.*/\(.*\)\.rpm .*#\1#' > \ - ${target_rootfs}/install/remove.manifest - comm -2 -3 $btmanifest $pre_btmanifest | awk '{print $1}' > \ - ${target_rootfs}/install/incremental.manifest + installdir=$target_rootfs/install + pre_btmanifest=$installdir/pre_bt.manifest + cur_btmanifest=$installdir/cur_bt.manifest + + # Install/remove the different pkgs when total_solution.manifest is + # comming and incremental image generation is enabled. + if [ "${INC_RPM_IMAGE_GEN}" = "1" -a -d "${target_rootfs}${rpmlibdir}" \ + -a "$m_name" = "total_solution.manifest" \ + -a "${INSTALL_COMPLEMENTARY_RPM}" != "1" ]; then + # Get the previous installed list + rpm --root $target_rootfs --dbpath ${rpmlibdir} \ + -qa --qf '%{PACKAGEORIGIN} %{BUILDTIME}\n' | sort -u -o $pre_btmanifest + # Get the current installed list (based on install/var/lib/rpm) + rpm --root $installdir -D "_dbpath $installdir" \ + -qa --qf '%{PACKAGEORIGIN} %{BUILDTIME}\n' | sort -u -o $cur_btmanifest + comm -1 -3 $cur_btmanifest $pre_btmanifest | sed 's#.*/\(.*\)\.rpm .*#\1#' > \ + $installdir/remove.manifest + comm -2 -3 $cur_btmanifest $pre_btmanifest | awk '{print $1}' > \ + $installdir/incremental.manifest # Attempt to remove unwanted pkgs, the scripts(pre, post, etc.) has not # been run by now, so don't have to run them(preun, postun, etc.) when # erase the pkg - if [ -s ${target_rootfs}/install/remove.manifest ]; then + if [ -s $installdir/remove.manifest ]; then rpm_common_comand --noscripts --nodeps \ - -e `cat ${target_rootfs}/install/remove.manifest` + -e `cat $installdir/remove.manifest` fi # Attempt to install the incremental pkgs - if [ -s ${target_rootfs}/install/incremental.manifest ]; then + if [ -s $installdir/incremental.manifest ]; then rpm_common_comand --nodeps --replacefiles --replacepkgs \ - -Uvh ${target_rootfs}/install/incremental.manifest + -Uvh $installdir/incremental.manifest fi else # Attempt to install @@ -242,7 +245,22 @@ process_pkg_list_rpm() { } # -# install a bunch of packages using rpm +# Install a bunch of packages using rpm. +# There are 3 solutions in an image's FRESH generation: +# 1) initial_solution +# 2) total_solution +# 3) COMPLEMENTARY solution +# +# It is different when incremental image generation is enabled in the +# SECOND generation: +# 1) The initial_solution is skipped. +# 2) The incremental image generation takes action during the total_solution +# installation, the previous installed COMPLEMENTARY pkgs usually would be +# removed here, the new COMPLEMENTARY ones would be installed in the next +# step. +# 3) The COMPLEMENTARY would always be installed since it is +# generated based on the second step's image. +# # the following shell variables needs to be set before calling this func: # INSTALL_ROOTFS_RPM - install root dir # INSTALL_PLATFORM_RPM - main platform @@ -496,10 +514,10 @@ EOF sort ${target_rootfs}/install/original_solution.manifest > ${target_rootfs}/install/original_solution_sorted.manifest sort ${target_rootfs}/install/total_solution.manifest > ${target_rootfs}/install/total_solution_sorted.manifest comm -2 -3 ${target_rootfs}/install/total_solution_sorted.manifest \ - ${target_rootfs}/install/original_solution_sorted.manifest | awk '{print $1}' > \ + ${target_rootfs}/install/original_solution_sorted.manifest > \ ${target_rootfs}/install/diff.manifest mv ${target_rootfs}/install/diff.manifest ${target_rootfs}/install/total_solution.manifest - elif [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f "$pre_btmanifest" ]; then + elif [ "${INC_RPM_IMAGE_GEN}" = "1" -a -d "${target_rootfs}${rpmlibdir}" ]; then echo "Skipping pre install due to existing image" else # RPM is special. It can't handle dependencies and preinstall scripts correctly. Its |