diff options
author | Laurentiu Palcu <laurentiu.palcu@intel.com> | 2013-04-22 11:01:25 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-04-22 14:45:02 +0100 |
commit | d9f153f48927e71b357f9546e28fd04e128e920c (patch) | |
tree | 5138af496985c1726a61e698824b5110dd92a65b /meta/classes | |
parent | 5e702edaa4306ba8630d2f06a6672abd24153dc8 (diff) | |
download | poky-d9f153f48927e71b357f9546e28fd04e128e920c.tar.gz |
image.bbclass: change the logic when intercepts fail
Due to some issues with postinstalls that register hooks, we changed the
logic a bit. Now, all postinstalls that register hooks will return
successfully and only after, if hooks fail, mark the package as unpacked.
(From OE-Core rev: 82dae98d0eb771c05e57635f0f8763b118d8177e)
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/image.bbclass | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 4e9c29cb8b..ffb372aebb 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass | |||
@@ -187,21 +187,32 @@ run_intercept_scriptlets () { | |||
187 | [ "$script" = "*" ] && break | 187 | [ "$script" = "*" ] && break |
188 | [ "$script" = "postinst_intercept" ] || [ ! -x "$script" ] && continue | 188 | [ "$script" = "postinst_intercept" ] || [ ! -x "$script" ] && continue |
189 | echo "> Executing $script" | 189 | echo "> Executing $script" |
190 | ./$script || { echo "WARNING: intercept script \"$script\" failed, falling back to running postinstalls at first boot" && continue; }; | 190 | ./$script && continue |
191 | echo "WARNING: intercept script \"$script\" failed, falling back to running postinstalls at first boot" | ||
191 | # | 192 | # |
192 | # If we got here, than the intercept was successful. Next, we must | 193 | # If we got here, than the intercept has failed. Next, we must |
193 | # mark the postinstalls as "installed". For rpm is a little bit | 194 | # mark the postinstalls as "unpacked". For rpm is a little bit |
194 | # different, we just have to delete the saved postinstalls from | 195 | # different, we just have to save the package postinstalls in |
195 | # /etc/rpm-postinsts | 196 | # /etc/rpm-postinsts |
196 | # | 197 | # |
197 | pkgs="$(cat ./$script|grep "^##PKGS"|cut -d':' -f2)" || continue | 198 | pkgs="$(cat ./$script|grep "^##PKGS"|cut -d':' -f2)" || continue |
198 | case ${IMAGE_PKGTYPE} in | 199 | case ${IMAGE_PKGTYPE} in |
199 | "rpm") | 200 | "rpm") |
200 | for pi in ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/*; do | 201 | [ -d ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/ ] || mkdir ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/ |
201 | pkg_name="$(cat $pi|sed -n -e "s/^.*postinst_intercept $script \([^ ]*\).*/\1/p")" | 202 | v_expr=$(echo ${MULTILIB_GLOBAL_VARIANTS}|tr ' ' '|') |
202 | if [ -n "$pkg_name" -a -n "$(echo "$pkgs"|grep " $pkg_name ")" ]; then | 203 | for p in $pkgs; do |
203 | rm $pi | 204 | # remove any multilib prefix from the package name (RPM |
204 | fi | 205 | # does not use it like this) |
206 | new_p=$(echo $p | sed -r "s/^($v_expr)-//") | ||
207 | |||
208 | # extract the postinstall scriptlet from rpm package and | ||
209 | # save it in /etc/rpm-postinsts | ||
210 | echo " * postponing $new_p" | ||
211 | rpm -q --scripts --root=${IMAGE_ROOTFS} --dbpath=/var/lib/rpm $new_p |\ | ||
212 | sed -n -e '/^postinstall scriptlet (using .*):$/,/^.* scriptlet (using .*):$/ {/.*/p}' |\ | ||
213 | sed -e 's/postinstall scriptlet (using \(.*\)):$/#!\1/' -e '/^.* scriptlet (using .*):$/d'\ | ||
214 | > ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/$new_p | ||
215 | chmod +x ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/$new_p | ||
205 | done | 216 | done |
206 | # move to the next intercept script | 217 | # move to the next intercept script |
207 | continue | 218 | continue |
@@ -216,7 +227,8 @@ run_intercept_scriptlets () { | |||
216 | # the next piece of code is run only for ipk/dpkg | 227 | # the next piece of code is run only for ipk/dpkg |
217 | sed_expr="" | 228 | sed_expr="" |
218 | for p in $pkgs; do | 229 | for p in $pkgs; do |
219 | sed_expr="$sed_expr -e \"/^Package: ${p}$/,/^Status: install.* unpacked$/ {s/unpacked/installed/}\"" | 230 | echo " * postponing $p" |
231 | sed_expr="$sed_expr -e \"/^Package: ${p}$/,/^Status: install.* installed$/ {s/installed/unpacked/}\"" | ||
220 | done | 232 | done |
221 | eval sed -i $sed_expr $status_file | 233 | eval sed -i $sed_expr $status_file |
222 | done | 234 | done |