summaryrefslogtreecommitdiffstats
path: root/meta/classes/package_rpm.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/package_rpm.bbclass')
-rw-r--r--meta/classes/package_rpm.bbclass68
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 () {
158rpm_update_pkg () { 158rpm_update_pkg () {
159 159
160 manifest=$1 160 manifest=$1
161 btmanifest=$manifest.bt.manifest 161 # The manifest filename, e.g. total_solution.manifest
162 pre_btmanifest=${T}/${btmanifest##/*/} 162 m_name=${manifest##/*/}
163 local target_rootfs="${INSTALL_ROOTFS_RPM}" 163 local target_rootfs="${INSTALL_ROOTFS_RPM}"
164 164 installdir=$target_rootfs/install
165 # Save the rpm's build time for incremental image generation, and the file 165 pre_btmanifest=$installdir/pre_bt.manifest
166 # would be moved to ${T} 166 cur_btmanifest=$installdir/cur_bt.manifest
167 for i in `cat $manifest`; do 167
168 # Use "rpm" rather than "${RPM}" here, since we don't need the 168 # Install/remove the different pkgs when total_solution.manifest is
169 # '--dbpath' option 169 # comming and incremental image generation is enabled.
170 echo "$i `rpm -qp --qf '%{BUILDTIME}\n' $i`" 170 if [ "${INC_RPM_IMAGE_GEN}" = "1" -a -d "${target_rootfs}${rpmlibdir}" \
171 done | sort -u > $btmanifest 171 -a "$m_name" = "total_solution.manifest" \
172 172 -a "${INSTALL_COMPLEMENTARY_RPM}" != "1" ]; then
173 # Only install the different pkgs if incremental image generation is set 173 # Get the previous installed list
174 if [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f "$pre_btmanifest" -a \ 174 rpm --root $target_rootfs --dbpath ${rpmlibdir} \
175 "${IMAGE_PKGTYPE}" = "rpm" ]; then 175 -qa --qf '%{PACKAGEORIGIN} %{BUILDTIME}\n' | sort -u -o $pre_btmanifest
176 comm -1 -3 $btmanifest $pre_btmanifest | sed 's#.*/\(.*\)\.rpm .*#\1#' > \ 176 # Get the current installed list (based on install/var/lib/rpm)
177 ${target_rootfs}/install/remove.manifest 177 rpm --root $installdir -D "_dbpath $installdir" \
178 comm -2 -3 $btmanifest $pre_btmanifest | awk '{print $1}' > \ 178 -qa --qf '%{PACKAGEORIGIN} %{BUILDTIME}\n' | sort -u -o $cur_btmanifest
179 ${target_rootfs}/install/incremental.manifest 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
180 183
181 # Attempt to remove unwanted pkgs, the scripts(pre, post, etc.) has not 184 # Attempt to remove unwanted pkgs, the scripts(pre, post, etc.) has not
182 # been run by now, so don't have to run them(preun, postun, etc.) when 185 # been run by now, so don't have to run them(preun, postun, etc.) when
183 # erase the pkg 186 # erase the pkg
184 if [ -s ${target_rootfs}/install/remove.manifest ]; then 187 if [ -s $installdir/remove.manifest ]; then
185 rpm_common_comand --noscripts --nodeps \ 188 rpm_common_comand --noscripts --nodeps \
186 -e `cat ${target_rootfs}/install/remove.manifest` 189 -e `cat $installdir/remove.manifest`
187 fi 190 fi
188 191
189 # Attempt to install the incremental pkgs 192 # Attempt to install the incremental pkgs
190 if [ -s ${target_rootfs}/install/incremental.manifest ]; then 193 if [ -s $installdir/incremental.manifest ]; then
191 rpm_common_comand --nodeps --replacefiles --replacepkgs \ 194 rpm_common_comand --nodeps --replacefiles --replacepkgs \
192 -Uvh ${target_rootfs}/install/incremental.manifest 195 -Uvh $installdir/incremental.manifest
193 fi 196 fi
194 else 197 else
195 # Attempt to install 198 # Attempt to install
@@ -242,7 +245,22 @@ process_pkg_list_rpm() {
242} 245}
243 246
244# 247#
245# install a bunch of packages using rpm 248# Install a bunch of packages using rpm.
249# There are 3 solutions in an image's FRESH generation:
250# 1) initial_solution
251# 2) total_solution
252# 3) COMPLEMENTARY solution
253#
254# It is different when incremental image generation is enabled in the
255# SECOND generation:
256# 1) The initial_solution is skipped.
257# 2) The incremental image generation takes action during the total_solution
258# installation, the previous installed COMPLEMENTARY pkgs usually would be
259# removed here, the new COMPLEMENTARY ones would be installed in the next
260# step.
261# 3) The COMPLEMENTARY would always be installed since it is
262# generated based on the second step's image.
263#
246# the following shell variables needs to be set before calling this func: 264# the following shell variables needs to be set before calling this func:
247# INSTALL_ROOTFS_RPM - install root dir 265# INSTALL_ROOTFS_RPM - install root dir
248# INSTALL_PLATFORM_RPM - main platform 266# INSTALL_PLATFORM_RPM - main platform
@@ -496,10 +514,10 @@ EOF
496 sort ${target_rootfs}/install/original_solution.manifest > ${target_rootfs}/install/original_solution_sorted.manifest 514 sort ${target_rootfs}/install/original_solution.manifest > ${target_rootfs}/install/original_solution_sorted.manifest
497 sort ${target_rootfs}/install/total_solution.manifest > ${target_rootfs}/install/total_solution_sorted.manifest 515 sort ${target_rootfs}/install/total_solution.manifest > ${target_rootfs}/install/total_solution_sorted.manifest
498 comm -2 -3 ${target_rootfs}/install/total_solution_sorted.manifest \ 516 comm -2 -3 ${target_rootfs}/install/total_solution_sorted.manifest \
499 ${target_rootfs}/install/original_solution_sorted.manifest | awk '{print $1}' > \ 517 ${target_rootfs}/install/original_solution_sorted.manifest > \
500 ${target_rootfs}/install/diff.manifest 518 ${target_rootfs}/install/diff.manifest
501 mv ${target_rootfs}/install/diff.manifest ${target_rootfs}/install/total_solution.manifest 519 mv ${target_rootfs}/install/diff.manifest ${target_rootfs}/install/total_solution.manifest
502 elif [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f "$pre_btmanifest" ]; then 520 elif [ "${INC_RPM_IMAGE_GEN}" = "1" -a -d "${target_rootfs}${rpmlibdir}" ]; then
503 echo "Skipping pre install due to existing image" 521 echo "Skipping pre install due to existing image"
504 else 522 else
505 # RPM is special. It can't handle dependencies and preinstall scripts correctly. Its 523 # RPM is special. It can't handle dependencies and preinstall scripts correctly. Its