diff options
Diffstat (limited to 'meta/classes/package_rpm.bbclass')
-rw-r--r-- | meta/classes/package_rpm.bbclass | 73 |
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 | ||
151 | rpm_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 | ||
167 | rpm_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 | ||
421 | python write_specfile () { | 474 | python write_specfile () { |