* [PATCH 0/4] Postinstall fixes
@ 2013-04-22 8:01 Laurentiu Palcu
2013-04-22 8:01 ` [PATCH 1/4] fontcache.bbclass: do not exit with 1 after installing intercept hook Laurentiu Palcu
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Laurentiu Palcu @ 2013-04-22 8:01 UTC (permalink / raw)
To: openembedded-core
Hi all,
Because RPM saves the postinstalls in /etc/rpm-postinsts only if the
postinstall fails, the intercept hooks machanism was implemented so that the
postinstalls always return 1, in order for the rpm to save the scriptlet.
Unfortunately, this is not such a good idea when a recipe needs to install more
than one hook.
This patchset changes the logic in order to allow installing multiple hooks in
the same postinstall. The postinstall is extracted after the package is
installed and some sed magic is needed in order to extract the postinstall
scriptlets from rpm.
Thanks,
Laurentiu
The following changes since commit 3b2d8e52ee4391802cff7baf3f343700499859ce:
build-appliance: Update to latest dylan revision for release (2013-04-18 22:02:43 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib lpalcu/postinsts_issue_fix
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lpalcu/postinsts_issue_fix
Laurentiu Palcu (4):
fontcache.bbclass: do not exit with 1 after installing intercept hook
gtk-icon-cache.bbclass: do not exit 1 after installing intercept hook
pixbufcache.bbclass: do not exit 1 after installing intercept hook
image.bbclass: change the logic when intercepts fail
meta/classes/fontcache.bbclass | 10 ++------
meta/classes/gtk-icon-cache.bbclass | 47 +++++++++++++++--------------------
meta/classes/image.bbclass | 32 ++++++++++++++++--------
meta/classes/pixbufcache.bbclass | 29 +++++++++------------
4 files changed, 56 insertions(+), 62 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] fontcache.bbclass: do not exit with 1 after installing intercept hook
2013-04-22 8:01 [PATCH 0/4] Postinstall fixes Laurentiu Palcu
@ 2013-04-22 8:01 ` Laurentiu Palcu
2013-04-22 8:01 ` [PATCH 2/4] gtk-icon-cache.bbclass: do not exit " Laurentiu Palcu
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Laurentiu Palcu @ 2013-04-22 8:01 UTC (permalink / raw)
To: openembedded-core
This will allow to register, in a single postinstall, multiple hooks.
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
meta/classes/fontcache.bbclass | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/meta/classes/fontcache.bbclass b/meta/classes/fontcache.bbclass
index 0bc309a..9136c5a 100644
--- a/meta/classes/fontcache.bbclass
+++ b/meta/classes/fontcache.bbclass
@@ -8,19 +8,13 @@ inherit qemu
FONT_PACKAGES ??= "${PN}"
-#
-# On host, the postinstall MUST return 1 because we do not know if the intercept
-# hook will succeed. If it does succeed, than the packages will be marked as
-# installed.
-#
fontcache_common() {
if [ "x$D" != "x" ] ; then
$INTERCEPT_DIR/postinst_intercept update_font_cache ${PKG} bindir=${bindir} \
libdir=${libdir} base_libdir=${base_libdir}
- exit 1
+else
+ fc-cache
fi
-
-fc-cache
}
python populate_packages_append() {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] gtk-icon-cache.bbclass: do not exit 1 after installing intercept hook
2013-04-22 8:01 [PATCH 0/4] Postinstall fixes Laurentiu Palcu
2013-04-22 8:01 ` [PATCH 1/4] fontcache.bbclass: do not exit with 1 after installing intercept hook Laurentiu Palcu
@ 2013-04-22 8:01 ` Laurentiu Palcu
2013-04-22 8:01 ` [PATCH 3/4] pixbufcache.bbclass: " Laurentiu Palcu
2013-04-22 8:01 ` [PATCH 4/4] image.bbclass: change the logic when intercepts fail Laurentiu Palcu
3 siblings, 0 replies; 5+ messages in thread
From: Laurentiu Palcu @ 2013-04-22 8:01 UTC (permalink / raw)
To: openembedded-core
This will allow to register, in a single postinstall, multiple hooks.
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
meta/classes/gtk-icon-cache.bbclass | 47 +++++++++++++++--------------------
1 file changed, 20 insertions(+), 27 deletions(-)
diff --git a/meta/classes/gtk-icon-cache.bbclass b/meta/classes/gtk-icon-cache.bbclass
index b53c0bc..7f24d49 100644
--- a/meta/classes/gtk-icon-cache.bbclass
+++ b/meta/classes/gtk-icon-cache.bbclass
@@ -2,41 +2,34 @@ FILES_${PN} += "${datadir}/icons/hicolor"
DEPENDS += "${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']} gtk-update-icon-cache-native"
-#
-# On host, the postinstall MUST return 1 because we do not know if the intercept
-# hook will succeed. If it does succeed, than the packages will be marked as
-# installed.
-#
gtk_icon_cache_postinst() {
if [ "x$D" != "x" ]; then
- $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} libdir=${libdir} \
- base_libdir=${base_libdir}
- exit 1
+ $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} libdir=${libdir} \
+ base_libdir=${base_libdir}
+else
+
+ # Update the pixbuf loaders in case they haven't been registered yet
+ GDK_PIXBUF_MODULEDIR=${libdir}/gdk-pixbuf-2.0/2.10.0/loaders gdk-pixbuf-query-loaders --update-cache
+
+ for icondir in /usr/share/icons/* ; do
+ if [ -d $icondir ] ; then
+ gtk-update-icon-cache -fqt $icondir
+ fi
+ done
fi
-
-# Update the pixbuf loaders in case they haven't been registered yet
-GDK_PIXBUF_MODULEDIR=${libdir}/gdk-pixbuf-2.0/2.10.0/loaders gdk-pixbuf-query-loaders --update-cache
-
-for icondir in /usr/share/icons/* ; do
- if [ -d $icondir ] ; then
- gtk-update-icon-cache -fqt $icondir
- fi
-done
}
gtk_icon_cache_postrm() {
if [ "x$D" != "x" ]; then
- $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} libdir=${libdir} \
- base_libdir=${base_libdir}
-
- exit 1
+ $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} libdir=${libdir} \
+ base_libdir=${base_libdir}
+else
+ for icondir in /usr/share/icons/* ; do
+ if [ -d $icondir ] ; then
+ gtk-update-icon-cache -qt $icondir
+ fi
+ done
fi
-
-for icondir in /usr/share/icons/* ; do
- if [ -d $icondir ] ; then
- gtk-update-icon-cache -qt $icondir
- fi
-done
}
python populate_packages_append () {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] pixbufcache.bbclass: do not exit 1 after installing intercept hook
2013-04-22 8:01 [PATCH 0/4] Postinstall fixes Laurentiu Palcu
2013-04-22 8:01 ` [PATCH 1/4] fontcache.bbclass: do not exit with 1 after installing intercept hook Laurentiu Palcu
2013-04-22 8:01 ` [PATCH 2/4] gtk-icon-cache.bbclass: do not exit " Laurentiu Palcu
@ 2013-04-22 8:01 ` Laurentiu Palcu
2013-04-22 8:01 ` [PATCH 4/4] image.bbclass: change the logic when intercepts fail Laurentiu Palcu
3 siblings, 0 replies; 5+ messages in thread
From: Laurentiu Palcu @ 2013-04-22 8:01 UTC (permalink / raw)
To: openembedded-core
This will allow to register, in a single postinstall, multiple hooks.
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
meta/classes/pixbufcache.bbclass | 29 ++++++++++++-----------------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/meta/classes/pixbufcache.bbclass b/meta/classes/pixbufcache.bbclass
index 3c34557..4e0f577 100644
--- a/meta/classes/pixbufcache.bbclass
+++ b/meta/classes/pixbufcache.bbclass
@@ -8,27 +8,22 @@ inherit qemu
PIXBUF_PACKAGES ??= "${PN}"
-#
-# On host, the postinstall MUST return 1 because we do not know if the intercept
-# hook will succeed. If it does succeed, than the packages will be marked as
-# installed.
-#
pixbufcache_common() {
if [ "x$D" != "x" ]; then
$INTERCEPT_DIR/postinst_intercept update_pixbuf_cache ${PKG} libdir=${libdir} \
bindir=${bindir} base_libdir=${base_libdir}
- exit 1
-fi
-
-# Update the pixbuf loaders in case they haven't been registered yet
-GDK_PIXBUF_MODULEDIR=${libdir}/gdk-pixbuf-2.0/2.10.0/loaders gdk-pixbuf-query-loaders --update-cache
-
-if [ -x ${bindir}/gtk-update-icon-cache ] && [ -d ${datadir}/icons ]; then
- for icondir in /usr/share/icons/*; do
- if [ -d ${icondir} ]; then
- gtk-update-icon-cache -t -q ${icondir}
- fi
- done
+else
+
+ # Update the pixbuf loaders in case they haven't been registered yet
+ GDK_PIXBUF_MODULEDIR=${libdir}/gdk-pixbuf-2.0/2.10.0/loaders gdk-pixbuf-query-loaders --update-cache
+
+ if [ -x ${bindir}/gtk-update-icon-cache ] && [ -d ${datadir}/icons ]; then
+ for icondir in /usr/share/icons/*; do
+ if [ -d ${icondir} ]; then
+ gtk-update-icon-cache -t -q ${icondir}
+ fi
+ done
+ fi
fi
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] image.bbclass: change the logic when intercepts fail
2013-04-22 8:01 [PATCH 0/4] Postinstall fixes Laurentiu Palcu
` (2 preceding siblings ...)
2013-04-22 8:01 ` [PATCH 3/4] pixbufcache.bbclass: " Laurentiu Palcu
@ 2013-04-22 8:01 ` Laurentiu Palcu
3 siblings, 0 replies; 5+ messages in thread
From: Laurentiu Palcu @ 2013-04-22 8:01 UTC (permalink / raw)
To: openembedded-core
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.
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
meta/classes/image.bbclass | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 4e9c29c..ffb372a 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -187,21 +187,32 @@ run_intercept_scriptlets () {
[ "$script" = "*" ] && break
[ "$script" = "postinst_intercept" ] || [ ! -x "$script" ] && continue
echo "> Executing $script"
- ./$script || { echo "WARNING: intercept script \"$script\" failed, falling back to running postinstalls at first boot" && continue; };
+ ./$script && continue
+ echo "WARNING: intercept script \"$script\" failed, falling back to running postinstalls at first boot"
#
- # If we got here, than the intercept was successful. Next, we must
- # mark the postinstalls as "installed". For rpm is a little bit
- # different, we just have to delete the saved postinstalls from
+ # If we got here, than the intercept has failed. Next, we must
+ # mark the postinstalls as "unpacked". For rpm is a little bit
+ # different, we just have to save the package postinstalls in
# /etc/rpm-postinsts
#
pkgs="$(cat ./$script|grep "^##PKGS"|cut -d':' -f2)" || continue
case ${IMAGE_PKGTYPE} in
"rpm")
- for pi in ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/*; do
- pkg_name="$(cat $pi|sed -n -e "s/^.*postinst_intercept $script \([^ ]*\).*/\1/p")"
- if [ -n "$pkg_name" -a -n "$(echo "$pkgs"|grep " $pkg_name ")" ]; then
- rm $pi
- fi
+ [ -d ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/ ] || mkdir ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/
+ v_expr=$(echo ${MULTILIB_GLOBAL_VARIANTS}|tr ' ' '|')
+ for p in $pkgs; do
+ # remove any multilib prefix from the package name (RPM
+ # does not use it like this)
+ new_p=$(echo $p | sed -r "s/^($v_expr)-//")
+
+ # extract the postinstall scriptlet from rpm package and
+ # save it in /etc/rpm-postinsts
+ echo " * postponing $new_p"
+ rpm -q --scripts --root=${IMAGE_ROOTFS} --dbpath=/var/lib/rpm $new_p |\
+ sed -n -e '/^postinstall scriptlet (using .*):$/,/^.* scriptlet (using .*):$/ {/.*/p}' |\
+ sed -e 's/postinstall scriptlet (using \(.*\)):$/#!\1/' -e '/^.* scriptlet (using .*):$/d'\
+ > ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/$new_p
+ chmod +x ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/$new_p
done
# move to the next intercept script
continue
@@ -216,7 +227,8 @@ run_intercept_scriptlets () {
# the next piece of code is run only for ipk/dpkg
sed_expr=""
for p in $pkgs; do
- sed_expr="$sed_expr -e \"/^Package: ${p}$/,/^Status: install.* unpacked$/ {s/unpacked/installed/}\""
+ echo " * postponing $p"
+ sed_expr="$sed_expr -e \"/^Package: ${p}$/,/^Status: install.* installed$/ {s/installed/unpacked/}\""
done
eval sed -i $sed_expr $status_file
done
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-04-22 8:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-22 8:01 [PATCH 0/4] Postinstall fixes Laurentiu Palcu
2013-04-22 8:01 ` [PATCH 1/4] fontcache.bbclass: do not exit with 1 after installing intercept hook Laurentiu Palcu
2013-04-22 8:01 ` [PATCH 2/4] gtk-icon-cache.bbclass: do not exit " Laurentiu Palcu
2013-04-22 8:01 ` [PATCH 3/4] pixbufcache.bbclass: " Laurentiu Palcu
2013-04-22 8:01 ` [PATCH 4/4] image.bbclass: change the logic when intercepts fail Laurentiu Palcu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox