summaryrefslogtreecommitdiffstats
path: root/meta/classes/package_rpm.bbclass
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2011-12-28 17:16:11 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-01-11 10:36:22 +0000
commit9d1823b2a0193b3c20fa30f0a118b4ee80a20027 (patch)
tree9121080b49eabb7cb29db155de82f2e6a1e45445 /meta/classes/package_rpm.bbclass
parent489cde8eb0e19ef6fe8078148199eaf5b52631ae (diff)
downloadpoky-9d1823b2a0193b3c20fa30f0a118b4ee80a20027.tar.gz
Incremental rpm image generation
Incremental rpm image generation, the rootfs would be totally removed and re-created in the second generation by default, but with INC_RPM_IMAGE_GEN = "1", the rpm based rootfs would be kept, and will do update(remove/add some pkgs) on it. NOTE: This is not suggested when you want to create a productive rootfs For example: 1) Add the follow config option to a conf file: INC_RPM_IMAGE_GEN = "1" 2) bitbake core-image-sato modify a package bitbake core-image-sato The rootfs would not be totally removed and re-created in the second generation, it would be simply updated based on the "package". Implatation: 1) Figure out the pkg which need to be removed or re-installed, then use 'rpm -e to remove the old one. Use the rpm's BUILDTIME to determine which pkg has been rebuilt. 2) Figure out the pkg which is newly added, and use 'rpm -U' to install it. This only for the rpm based rootfs, the deb and ipk based rootfs would be done later. [YOCTO #1651] (From OE-Core rev: 575ba3c9e153a1d8ac228a99a03ca2df5fbca151) 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.bbclass73
1 files changed, 63 insertions, 10 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index d03dc3f883..2d92efe272 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -147,6 +147,67 @@ resolve_package_rpm () {
147 echo $pkg_name 147 echo $pkg_name
148} 148}
149 149
150# rpm common command and options
151rpm_common_comand () {
152
153 local target_rootfs="${INSTALL_ROOTFS_RPM}"
154 local extra_args="$@"
155
156 ${RPM} --root ${target_rootfs} \
157 --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
158 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
159 -D "_var ${localstatedir}" \
160 -D "_dbpath ${rpmlibdir}" \
161 --noparentdirs --nolinktos \
162 -D "__dbi_txn create nofsync private" \
163 -D "_cross_scriptlet_wrapper ${WORKDIR}/scriptlet_wrapper" $extra_args
164}
165
166# install or remove the pkg
167rpm_update_pkg () {
168
169 local target_rootfs="${INSTALL_ROOTFS_RPM}"
170
171 # Save the rpm's build time for incremental image generation, and the file
172 # would be moved to ${T}
173 rm -f ${target_rootfs}/install/total_solution_bt.manifest
174 for i in `cat ${target_rootfs}/install/total_solution.manifest`; do
175 # Use "rpm" rather than "${RPM}" here, since we don't need the
176 # '--dbpath' option
177 echo "$i `rpm -qp --qf '%{BUILDTIME}\n' $i`" >> \
178 ${target_rootfs}/install/total_solution_bt.manifest
179 done
180
181 # 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 "${IMAGE_PKGTYPE}" = "rpm" ]; then
184 cur_list="${target_rootfs}/install/total_solution_bt.manifest"
185 pre_list="${T}/total_solution_bt.manifest"
186 sort -u $cur_list -o $cur_list
187 sort -u $pre_list -o $pre_list
188 comm -1 -3 $cur_list $pre_list | sed 's#.*/\(.*\)\.rpm .*#\1#' > \
189 ${target_rootfs}/install/remove.manifest
190 comm -2 -3 $cur_list $pre_list | awk '{print $1}' > \
191 ${target_rootfs}/install/incremental.manifest
192
193 # Attempt to remove unwanted pkgs, the scripts(pre, post, etc.) has not
194 # been run by now, so don't have to run them(preun, postun, etc.) when
195 # erase the pkg
196 if [ -s ${target_rootfs}/install/remove.manifest ]; then
197 rpm_common_comand --noscripts --nodeps \
198 -e `cat ${target_rootfs}/install/remove.manifest`
199 fi
200
201 # Attempt to install the incremental pkgs
202 rpm_common_comand --nodeps --replacefiles --replacepkgs \
203 -Uvh ${target_rootfs}/install/incremental.manifest
204 else
205 # Attempt to install
206 rpm_common_comand --replacepkgs \
207 -Uhv ${target_rootfs}/install/total_solution.manifest
208 fi
209}
210
150# 211#
151# install a bunch of packages using rpm 212# install a bunch of packages using rpm
152# the following shell variables needs to be set before calling this func: 213# the following shell variables needs to be set before calling this func:
@@ -406,16 +467,8 @@ EOF
406 467
407 chmod 0755 ${WORKDIR}/scriptlet_wrapper 468 chmod 0755 ${WORKDIR}/scriptlet_wrapper
408 469
409 # Attempt install 470 rpm_update_pkg
410 ${RPM} --root ${target_rootfs} \ 471
411 --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
412 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
413 -D "_var ${localstatedir}" \
414 -D "_dbpath ${rpmlibdir}" \
415 --noparentdirs --nolinktos --replacepkgs \
416 -D "__dbi_txn create nofsync private" \
417 -D "_cross_scriptlet_wrapper ${WORKDIR}/scriptlet_wrapper" \
418 -Uhv ${target_rootfs}/install/total_solution.manifest
419} 472}
420 473
421python write_specfile () { 474python write_specfile () {