All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] run-postinsts refactoring
@ 2013-05-23 13:15 Laurentiu Palcu
  2013-05-23 13:15 ` [PATCH 1/7] systemd: add udev-utils dependency for udev-hwdb Laurentiu Palcu
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: Laurentiu Palcu @ 2013-05-23 13:15 UTC (permalink / raw)
  To: openembedded-core

Hi all,

My work at #4484 revealed that the package managers deb/ipk/rpm handle removal
of PM meta-data (when the PM is not deployed) and the delayed postinstalls
execution in their own way. Currently we have:
 * run-postinsts (for deb/ipk) and rpm-postinsts (for rpm) for running the delayed
   postinstalls on target when the PM is not part of the image;
 * opkg removes the meta-data and some uneeded packages whilst deb/rpm remove
   only the meta-data;
 * both opkg and deb have no way of running the delayed postinstalls on target,
   if package-management is not part of IMAGE_FEATURES, because the meta-data
   was deleted (and it would have been useless anyway since the PM is not installed);

That being said, this patchset tries to create a more unified solution for all
PM backends.

rpm-postinsts recipe is replaced by run-postinsts but I'll keep it in oe-core
for a while (a couple of weeks maybe), just in case the current solution does not
satisfy the RPM users (I doubt it though).

I did tests with core-image-minimal using sysvinit/systemd and with/without delayed
postinstalls. The results are as expected.

Thanks,
Laurentiu

The following changes since commit f7b639e527a65f9ce77aef07651ac5ec1e094e52:

  rpm-postinsts.bb: enable postinst logging (2013-05-23 10:28:05 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib lpalcu/run_postinsts_refactor
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lpalcu/run_postinsts_refactor

Laurentiu Palcu (7):
  systemd: add udev-utils dependency for udev-hwdb
  rootfs_*.bbclass: add some helper functions
  image.bbclass: remove unneeded files from the image
  core-image-minimal: do not remove packaging files in the rootfs
    postprocess
  run-postinsts: make it generic
  rootfs_rpm.bbclas: switch to using run-postinsts
  rpm: replace rpm-postinsts dependency with run-postinsts

 meta/classes/image.bbclass                         |   33 +++++++++++
 meta/classes/rootfs_deb.bbclass                    |   23 +++++++-
 meta/classes/rootfs_ipk.bbclass                    |   39 ++++++-------
 meta/classes/rootfs_rpm.bbclass                    |   25 ++++++++-
 meta/recipes-core/images/core-image-minimal.bb     |    2 -
 meta/recipes-core/systemd/systemd_199.bb           |    2 +
 .../dpkg/run-postinsts/run-postinsts               |   59 ++++++++++++--------
 .../dpkg/run-postinsts/run-postinsts.awk           |   30 ----------
 meta/recipes-devtools/dpkg/run-postinsts_1.0.bb    |    7 +--
 meta/recipes-devtools/rpm/rpm_5.4.9.bb             |    2 +-
 10 files changed, 135 insertions(+), 87 deletions(-)
 delete mode 100644 meta/recipes-devtools/dpkg/run-postinsts/run-postinsts.awk

-- 
1.7.9.5



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/7] systemd: add udev-utils dependency for udev-hwdb
  2013-05-23 13:15 [PATCH 0/7] run-postinsts refactoring Laurentiu Palcu
@ 2013-05-23 13:15 ` Laurentiu Palcu
  2013-05-23 13:15 ` [PATCH 2/7] rootfs_*.bbclass: add some helper functions Laurentiu Palcu
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Laurentiu Palcu @ 2013-05-23 13:15 UTC (permalink / raw)
  To: openembedded-core

udev-hwdb needs udevadm tool to compile the hardware index.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/recipes-core/systemd/systemd_199.bb |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/recipes-core/systemd/systemd_199.bb b/meta/recipes-core/systemd/systemd_199.bb
index b1cc046..09e2171 100644
--- a/meta/recipes-core/systemd/systemd_199.bb
+++ b/meta/recipes-core/systemd/systemd_199.bb
@@ -212,6 +212,8 @@ RDEPENDS_udev += "udev-utils"
 RPROVIDES_udev = "hotplug"
 RRECOMMENDS_udev += "udev-hwdb"
 
+RDEPENDS_udev-hwdb += "udev-utils"
+
 FILES_udev += "${base_sbindir}/udevd \
                ${rootlibexecdir}/systemd/systemd-udevd \
                ${rootlibexecdir}/udev/accelerometer \
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/7] rootfs_*.bbclass: add some helper functions
  2013-05-23 13:15 [PATCH 0/7] run-postinsts refactoring Laurentiu Palcu
  2013-05-23 13:15 ` [PATCH 1/7] systemd: add udev-utils dependency for udev-hwdb Laurentiu Palcu
@ 2013-05-23 13:15 ` Laurentiu Palcu
  2013-05-23 13:15 ` [PATCH 3/7] image.bbclass: remove unneeded files from the image Laurentiu Palcu
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Laurentiu Palcu @ 2013-05-23 13:15 UTC (permalink / raw)
  To: openembedded-core

This patch adds the following helper functions:
 * delayed_postinsts - outputs the list of delayed postinstalls;
 * save_postinsts - this will save the delayed postinstalls for ipk/deb
   in /etc/(ipk|deb)_postinsts;
 * rootfs_remove_packages - removes packages from an image;

Additionaly, this patch will remove a piece of code in
rootfs_ipk_do_rootfs which will be moved to image.bbclass and used for
all backends;

[YOCTO #4484]

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/classes/rootfs_deb.bbclass |   23 +++++++++++++++++++++--
 meta/classes/rootfs_ipk.bbclass |   39 ++++++++++++++++++---------------------
 meta/classes/rootfs_rpm.bbclass |   23 +++++++++++++++++++++--
 3 files changed, 60 insertions(+), 25 deletions(-)

diff --git a/meta/classes/rootfs_deb.bbclass b/meta/classes/rootfs_deb.bbclass
index e642cf3..edd1037 100644
--- a/meta/classes/rootfs_deb.bbclass
+++ b/meta/classes/rootfs_deb.bbclass
@@ -85,7 +85,7 @@ fakeroot rootfs_deb_do_rootfs () {
 	${ROOTFS_POSTPROCESS_COMMAND}
 
 	if ${@base_contains("IMAGE_FEATURES", "read-only-rootfs", "true", "false" ,d)}; then
-		if grep Status:.install.ok.unpacked ${IMAGE_ROOTFS}/var/lib/dpkg/status; then
+		if [ -n "$(delayed_postinsts)" ]; then
 			bberror "Some packages could not be configured offline and rootfs is read-only."
 			exit 1
 		fi
@@ -94,9 +94,22 @@ fakeroot rootfs_deb_do_rootfs () {
 	log_check rootfs
 }
 
+rootfs_deb_do_rootfs[vardeps] += "delayed_postinsts"
+
+delayed_postinsts () {
+	cat ${IMAGE_ROOTFS}/var/lib/dpkg/status|grep -e "^Package:" -e "^Status:"|sed -ne 'N;s/Package: \(.*\)\nStatus:.*unpacked/\1/p'
+}
+
+save_postinsts () {
+	for p in $(delayed_postinsts); do
+		install -d ${IMAGE_ROOTFS}${sysconfdir}/deb-postinsts
+		cp ${IMAGE_ROOTFS}/var/lib/dpkg/info/$p.postinst ${IMAGE_ROOTFS}${sysconfdir}/deb-postinsts/$p
+	done
+}
+
 remove_packaging_data_files() {
 	rm -rf ${IMAGE_ROOTFS}${opkglibdir}
-	rm -rf ${IMAGE_ROOTFS}/usr/dpkg/
+	rm -rf ${IMAGE_ROOTFS}/var/lib/dpkg/
 }
 
 rootfs_install_packages() {
@@ -105,3 +118,9 @@ rootfs_install_packages() {
 	# Mark all packages installed
 	sed -i -e "s/Status: install ok unpacked/Status: install ok installed/;" $INSTALL_ROOTFS_DEB/var/lib/dpkg/status
 }
+
+rootfs_remove_packages() {
+	# for some reason, --root doesn't really work here... We use --admindir&--instdir instead.
+	${STAGING_BINDIR_NATIVE}/dpkg --admindir=${IMAGE_ROOTFS}/var/lib/dpkg --instdir=${IMAGE_ROOTFS} -r --force-depends $@
+}
+
diff --git a/meta/classes/rootfs_ipk.bbclass b/meta/classes/rootfs_ipk.bbclass
index 3e1f959..1403422 100644
--- a/meta/classes/rootfs_ipk.bbclass
+++ b/meta/classes/rootfs_ipk.bbclass
@@ -91,36 +91,29 @@ fakeroot rootfs_ipk_do_rootfs () {
 	${ROOTFS_POSTPROCESS_COMMAND}
 
 	if ${@base_contains("IMAGE_FEATURES", "read-only-rootfs", "true", "false" ,d)}; then
-		if grep Status:.install.ok.unpacked ${STATUS}; then
+		if [ -n "$(delayed_postinsts)" ]; then
 			bberror "Some packages could not be configured offline and rootfs is read-only."
 			exit 1
 		fi
 	fi
 
 	rm -f ${IMAGE_ROOTFS}${OPKGLIBDIR}/opkg/lists/*
-	if ${@base_contains("IMAGE_FEATURES", "package-management", "false", "true", d)}; then
-		if ! grep Status:.install.ok.unpacked ${STATUS}; then
-			# All packages were successfully configured.
-			# update-rc.d, base-passwd, run-postinsts are no further use, remove them now
-			remove_run_postinsts=false
-			if [ -e ${IMAGE_ROOTFS}${sysconfdir}/init.d/run-postinsts ]; then
-				remove_run_postinsts=true
-			fi
-			opkg-cl ${OPKG_ARGS} --force-depends remove update-rc.d base-passwd ${ROOTFS_BOOTSTRAP_INSTALL} || true
-
-			# Need to remove rc.d files for run-postinsts by hand since opkg won't
-			# call postrm scripts in offline root mode.
-			if $remove_run_postinsts; then
-				update-rc.d -f -r ${IMAGE_ROOTFS} run-postinsts remove
-			fi
-
-			# Also delete the status files
-			remove_packaging_data_files
-		fi
-	fi
 	log_check rootfs
 }
 
+rootfs_ipk_do_rootfs[vardeps] += "delayed_postinsts"
+
+delayed_postinsts () {
+	cat ${STATUS}|grep -e "^Package:" -e "^Status:"|sed -ne 'N;s/Package: \(.*\)\nStatus:.*unpacked/\1/p'
+}
+
+save_postinsts () {
+	for p in $(delayed_postinsts); do
+		install -d ${IMAGE_ROOTFS}${sysconfdir}/ipk-postinsts
+		cp ${IMAGE_ROOTFS}${OPKGLIBDIR}/opkg/info/$p.postinst ${IMAGE_ROOTFS}${sysconfdir}/ipk-postinsts/$p
+	done
+}
+
 rootfs_ipk_write_manifest() {
 	manifest=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.manifest
 	cp ${IMAGE_ROOTFS}${OPKGLIBDIR}/opkg/status $manifest
@@ -145,6 +138,10 @@ rootfs_install_packages() {
 	opkg-cl ${OPKG_ARGS} install `cat $1`
 }
 
+rootfs_remove_packages() {
+	opkg-cl ${OPKG_ARGS} --force-depends remove $@
+}
+
 ipk_insert_feed_uris () {
 
 	echo "Building from feeds activated!"
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass
index d373dab..d1d6eff 100644
--- a/meta/classes/rootfs_rpm.bbclass
+++ b/meta/classes/rootfs_rpm.bbclass
@@ -114,8 +114,8 @@ fakeroot rootfs_rpm_do_rootfs () {
 	${ROOTFS_POSTPROCESS_COMMAND}
 
 	if ${@base_contains("IMAGE_FEATURES", "read-only-rootfs", "true", "false" ,d)}; then
-		if [ -d ${IMAGE_ROOTFS}/etc/rpm-postinsts ] ; then
-			if [ "`ls -A ${IMAGE_ROOTFS}/etc/rpm-postinsts`" != "" ] ; then
+		if [ -d ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts ] ; then
+			if [ "`ls -A ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts`" != "" ] ; then
 				bberror "Some packages could not be configured offline and rootfs is read-only."
 				exit 1
 			fi
@@ -135,6 +135,20 @@ fakeroot rootfs_rpm_do_rootfs () {
 	log_check rootfs
 }
 
+rootfs_rpm_do_rootfs[vardeps] += "delayed_postinsts"
+
+delayed_postinsts() {
+	if [ -d ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts ]; then
+		ls ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts
+	fi
+}
+
+save_postinsts() {
+	# this is just a stub. For RPM, the failed postinstalls are already saved in
+	# /etc/rpm-postinsts
+	true
+}
+
 remove_packaging_data_files() {
 	# Save the rpmlib for increment rpm image generation
 	t="${T}/saved_rpmlib/var/lib"
@@ -165,6 +179,11 @@ rootfs_install_packages() {
 	package_install_internal_rpm
 }
 
+rootfs_remove_packages() {
+	echo rpm -e --nodeps --root=${IMAGE_ROOTFS} --dbpath=/var/lib/rpm $@
+	rpm -e --nodeps --root=${IMAGE_ROOTFS} --dbpath=/var/lib/rpm $@
+}
+
 python () {
     if d.getVar('BUILD_IMAGES_FROM_FEEDS', True):
         flags = d.getVarFlag('do_rootfs', 'recrdeptask')
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/7] image.bbclass: remove unneeded files from the image
  2013-05-23 13:15 [PATCH 0/7] run-postinsts refactoring Laurentiu Palcu
  2013-05-23 13:15 ` [PATCH 1/7] systemd: add udev-utils dependency for udev-hwdb Laurentiu Palcu
  2013-05-23 13:15 ` [PATCH 2/7] rootfs_*.bbclass: add some helper functions Laurentiu Palcu
@ 2013-05-23 13:15 ` Laurentiu Palcu
  2013-05-23 13:15 ` [PATCH 4/7] core-image-minimal: do not remove packaging files in the rootfs postprocess Laurentiu Palcu
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Laurentiu Palcu @ 2013-05-23 13:15 UTC (permalink / raw)
  To: openembedded-core

This patch creates a new function, rootfs_remove_unneeded(), that will
be called after rootfs_*_do_rootfs is called and which will handle
delayed postinstalls in a generic fashion, for all backends in the same
way.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/classes/image.bbclass |   33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 04db533..380ed8e 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -303,6 +303,9 @@ fakeroot do_rootfs () {
 
 	rootfs_${IMAGE_PKGTYPE}_do_rootfs
 
+	# remove unneeded packages/files from the final image
+	rootfs_remove_unneeded
+
 	insert_feed_uris
 
 	if [ "x${LDCONFIGDEPEND}" != "x" ]; then
@@ -463,6 +466,36 @@ rootfs_install_complementary() {
     fi
 }
 
+rootfs_remove_unneeded () {
+	if ${@base_contains("IMAGE_FEATURES", "package-management", "false", "true", d)}; then
+		if [ -z "$(delayed_postinsts)" ]; then
+			# All packages were successfully configured.
+			# update-rc.d, base-passwd, run-postinsts are no further use, remove them now
+			remove_run_postinsts=false
+			if [ -e ${IMAGE_ROOTFS}${sysconfdir}/init.d/run-postinsts ]; then
+				remove_run_postinsts=true
+			fi
+			rootfs_remove_packages update-rc.d base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}
+
+			# Need to remove rc.d files for run-postinsts by hand since opkg won't
+			# call postrm scripts in offline root mode.
+			if $remove_run_postinsts; then
+				update-rc.d -f -r ${IMAGE_ROOTFS} run-postinsts remove
+			fi
+		else
+			# Some packages were not successfully configured, save them only
+			# if we have run-postinsts script present. Otherwise, they're
+			# useless
+			if [ -e ${IMAGE_ROOTFS}${sysconfdir}/init.d/run-postinsts ]; then
+				save_postinsts
+			fi
+		fi
+
+		# Since no package manager is present in the image the metadata is not needed
+		remove_packaging_data_files
+	fi
+}
+
 # set '*' as the root password so the images
 # can decide if they want it or not
 zap_root_password () {
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 4/7] core-image-minimal: do not remove packaging files in the rootfs postprocess
  2013-05-23 13:15 [PATCH 0/7] run-postinsts refactoring Laurentiu Palcu
                   ` (2 preceding siblings ...)
  2013-05-23 13:15 ` [PATCH 3/7] image.bbclass: remove unneeded files from the image Laurentiu Palcu
@ 2013-05-23 13:15 ` Laurentiu Palcu
  2013-05-23 13:15 ` [PATCH 5/7] run-postinsts: make it generic Laurentiu Palcu
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Laurentiu Palcu @ 2013-05-23 13:15 UTC (permalink / raw)
  To: openembedded-core

Since the removal of PM's meta-data was moved in image.bbclass, after
rootfs_*_do_rootfs() runs, there's no need to remove the files in rootfs
postprocess stage. Also, if the meta-data is removed then there's no way
we can save the postinstalls to /etc/(deb|ipk)-postinsts later.

For RPM, it doesn't really matter since the postinstalls are saved to
/etc/rpm-postinsts as soon as the postinstall fails.

[YOCTO #4484]

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/recipes-core/images/core-image-minimal.bb |    2 --
 1 file changed, 2 deletions(-)

diff --git a/meta/recipes-core/images/core-image-minimal.bb b/meta/recipes-core/images/core-image-minimal.bb
index 0d2613e..0b56cc8 100644
--- a/meta/recipes-core/images/core-image-minimal.bb
+++ b/meta/recipes-core/images/core-image-minimal.bb
@@ -10,5 +10,3 @@ inherit core-image
 
 IMAGE_ROOTFS_SIZE = "8192"
 
-# remove not needed ipkg informations
-ROOTFS_POSTPROCESS_COMMAND += "remove_packaging_data_files ; "
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 5/7] run-postinsts: make it generic
  2013-05-23 13:15 [PATCH 0/7] run-postinsts refactoring Laurentiu Palcu
                   ` (3 preceding siblings ...)
  2013-05-23 13:15 ` [PATCH 4/7] core-image-minimal: do not remove packaging files in the rootfs postprocess Laurentiu Palcu
@ 2013-05-23 13:15 ` Laurentiu Palcu
  2013-05-23 15:19   ` Burton, Ross
  2013-05-23 13:15 ` [PATCH 6/7] rootfs_rpm.bbclas: switch to using run-postinsts Laurentiu Palcu
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Laurentiu Palcu @ 2013-05-23 13:15 UTC (permalink / raw)
  To: openembedded-core

This recipe is used only when the package manager is not deployed on
target and there still are delayed postinstalls that need to be run on
target. At the moment, run-postinsts is targeted to dpkg/opkg. RPM uses another
recipe, called rpm-postinsts which, in turn, is used even when the rpm
package is deployed.

This patch intends to make run-postinsts generic and deprecate
rpm-postinsts. Here's why:
 * when opkg/dpkg are not deplyed, the meta-data files are useless.
   Hence, the awk script is not needed. The postinstall files are already
   saved in /etc/(deb|ipk)-postinsts directory and we can use the same
   procedure as in rpm's case;

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 .../dpkg/run-postinsts/run-postinsts               |   59 ++++++++++++--------
 .../dpkg/run-postinsts/run-postinsts.awk           |   30 ----------
 meta/recipes-devtools/dpkg/run-postinsts_1.0.bb    |    7 +--
 3 files changed, 38 insertions(+), 58 deletions(-)
 delete mode 100644 meta/recipes-devtools/dpkg/run-postinsts/run-postinsts.awk

diff --git a/meta/recipes-devtools/dpkg/run-postinsts/run-postinsts b/meta/recipes-devtools/dpkg/run-postinsts/run-postinsts
index 5f6442c..2593066 100755
--- a/meta/recipes-devtools/dpkg/run-postinsts/run-postinsts
+++ b/meta/recipes-devtools/dpkg/run-postinsts/run-postinsts
@@ -5,32 +5,43 @@
 # Author: Richard Purdie <rpurdie@openedhand.com>
 #
 
-PKGSYSTEM=/var/lib/dpkg
+# The following script will run all the scriptlets found in #SYSCONFDIR#/deb-postinsts or
+# #SYSCONFDIR#/ipk-postinsts
 
-if [ ! -e $PKGSYSTEM/status ]; then
-  if [ -e /var/lib/opkg/status ]; then
-    PKGSYSTEM=/var/lib/opkg
-  else
-    echo "No package system found"
-    exit 1
-  fi
-fi
+pi_dir=""
+for pm in rpm deb ipk; do
+	if [ -d "#SYSCONFDIR#/${pm}-postinsts" ]; then
+		pi_dir=#SYSCONFDIR#/${pm}-postinsts
+		break
+	fi
+done
 
-STAMP=$PKGSYSTEM/postinsts-done
-STATFILE=$PKGSYSTEM/status
-STATFILE2=$PKGSYSTEM/status2
+[ -z "$pi_dir" ] && exit 0
 
-if [ -e $STAMP ]; then
-  exit 0
-fi
+[ -e #SYSCONFDIR#/default/postinst ] && . #SYSCONFDIR#/default/postinst
+
+remove_pi_dir=1
+for i in `ls $pi_dir`; do
+	i=$pi_dir/$i
+	echo "Running postinst $i..."
+	if [ -x $i ]; then
+		if [ "$POSTINST_LOGGING" = "1" ]; then
+			sh -c $i >>$LOGFILE 2&>1
+		else
+			sh -c $i
+		fi
+		rm $i
+	else
+		echo "ERROR: postinst $i failed."
+		remove_pi_dir=0
+	fi
+done
 
-awk -f /usr/share/run-postinsts/run-postinsts.awk $STATFILE > $STATFILE2
-if [ $? = 0 ]; then
-  mv $STATFILE2 $STATFILE
-  touch $STAMP
-  exit 0
-else
-  rm -f $STATFILE2
-  rm -f $STAMP
-  exit 1
+# since all postinstalls executed successfully, remove the postinstalls directory
+# and the rcS.d link
+if [ $remove_pi_dir = 1 ]; then
+	rm -rf $pi_dir
+	if [ -n "`which update-rc.d`" ]; then
+		update-rc.d -f run-postinsts remove
+	fi
 fi
diff --git a/meta/recipes-devtools/dpkg/run-postinsts/run-postinsts.awk b/meta/recipes-devtools/dpkg/run-postinsts/run-postinsts.awk
deleted file mode 100644
index cbc8d1a..0000000
--- a/meta/recipes-devtools/dpkg/run-postinsts/run-postinsts.awk
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Copyright 2007 Openedhand Ltd.
-#
-# Author: Richard Purdie <rpurdie@openedhand.com>
-#
-# Rather hacky proof of concept
-#
-
-BEGIN {
-  rc=system("test -d /var/lib/dpkg/info/")
-  if (rc==0)
-    pkgdir="/var/lib/dpkg/info"
-  else
-    pkgdir="/var/lib/opkg/info"
-  package=""
-}
-/Package:.*/ {
-  package = substr($0, 10)
-}
-/Status:.*unpacked.*/ {
-  print "Configuring: " package > "/dev/stderr"
-  ret = system(pkgdir "/" package ".postinst 1>&2")
-  if (ret == 0)
-    $0 = gensub("unpacked", "installed", 1)
-  else
-    print "Postinstall failed for " package > "/dev/stderr"
-}
-{
-  print $0
-}
diff --git a/meta/recipes-devtools/dpkg/run-postinsts_1.0.bb b/meta/recipes-devtools/dpkg/run-postinsts_1.0.bb
index 4c9b2fd..5dd1709 100644
--- a/meta/recipes-devtools/dpkg/run-postinsts_1.0.bb
+++ b/meta/recipes-devtools/dpkg/run-postinsts_1.0.bb
@@ -1,11 +1,11 @@
-DESCRIPTION = "Run postinstall scripts on device using awk"
+DESCRIPTION = "Run postinstall scripts on device"
 SECTION = "devel"
 PR = "r9"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \
                     file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
-SRC_URI = "file://run-postinsts file://run-postinsts.awk"
+SRC_URI = "file://run-postinsts"
 
 INITSCRIPT_NAME = "run-postinsts"
 INITSCRIPT_PARAMS = "start 98 S ."
@@ -24,6 +24,5 @@ do_install() {
 	install -d ${D}${sysconfdir}/init.d/
 	install -m 0755 ${WORKDIR}/run-postinsts ${D}${sysconfdir}/init.d/
 
-	install -d ${D}${datadir}/${BPN}/
-	install -m 0644 ${WORKDIR}/run-postinsts.awk ${D}${datadir}/${BPN}/
+	sed -i -e 's:#SYSCONFDIR#:${sysconfdir}:g' ${D}${sysconfdir}/init.d/run-postinsts
 }
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 6/7] rootfs_rpm.bbclas: switch to using run-postinsts
  2013-05-23 13:15 [PATCH 0/7] run-postinsts refactoring Laurentiu Palcu
                   ` (4 preceding siblings ...)
  2013-05-23 13:15 ` [PATCH 5/7] run-postinsts: make it generic Laurentiu Palcu
@ 2013-05-23 13:15 ` Laurentiu Palcu
  2013-05-23 13:15 ` [PATCH 7/7] rpm: replace rpm-postinsts dependency with run-postinsts Laurentiu Palcu
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Laurentiu Palcu @ 2013-05-23 13:15 UTC (permalink / raw)
  To: openembedded-core

Since run-postinsts was made generic, use it for RPM too.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/classes/rootfs_rpm.bbclass |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass
index d1d6eff..5027cee 100644
--- a/meta/classes/rootfs_rpm.bbclass
+++ b/meta/classes/rootfs_rpm.bbclass
@@ -3,7 +3,7 @@
 #
 
 ROOTFS_PKGMANAGE = "rpm smartpm"
-ROOTFS_PKGMANAGE_BOOTSTRAP = "rpm-postinsts"
+ROOTFS_PKGMANAGE_BOOTSTRAP = "run-postinsts"
 
 # Add 50Meg of extra space for Smart
 IMAGE_ROOTFS_EXTRA_SPACE_append = "${@base_contains("PACKAGE_INSTALL", "smartpm", " + 51200", "" ,d)}"
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 7/7] rpm: replace rpm-postinsts dependency with run-postinsts
  2013-05-23 13:15 [PATCH 0/7] run-postinsts refactoring Laurentiu Palcu
                   ` (5 preceding siblings ...)
  2013-05-23 13:15 ` [PATCH 6/7] rootfs_rpm.bbclas: switch to using run-postinsts Laurentiu Palcu
@ 2013-05-23 13:15 ` Laurentiu Palcu
  2013-05-24  3:38 ` [PATCH 0/7] run-postinsts refactoring Saul Wold
  2013-06-06  7:41 ` [PATCH v2 " Laurentiu Palcu
  8 siblings, 0 replies; 15+ messages in thread
From: Laurentiu Palcu @ 2013-05-23 13:15 UTC (permalink / raw)
  To: openembedded-core

run-postinsts is generic and will handle rpm delayed postinsts just
fine. No need to use another recipe.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/recipes-devtools/rpm/rpm_5.4.9.bb |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/rpm/rpm_5.4.9.bb b/meta/recipes-devtools/rpm/rpm_5.4.9.bb
index 2dbdca6..0e3a883 100644
--- a/meta/recipes-devtools/rpm/rpm_5.4.9.bb
+++ b/meta/recipes-devtools/rpm/rpm_5.4.9.bb
@@ -310,7 +310,7 @@ FILES_${PN}-build = "${prefix}/src/rpm \
 		${libdir}/rpm/vpkg-provides2.sh \
 		${libdir}/rpm/perfile_rpmdeps.sh \
 		"
-RDEPENDS_${PN} = "base-files ${PN}-postinsts"
+RDEPENDS_${PN} = "base-files run-postinsts"
 RDEPENDS_${PN}_class-native = ""
 RDEPENDS_${PN}-build = "file"
 
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 5/7] run-postinsts: make it generic
  2013-05-23 13:15 ` [PATCH 5/7] run-postinsts: make it generic Laurentiu Palcu
@ 2013-05-23 15:19   ` Burton, Ross
  0 siblings, 0 replies; 15+ messages in thread
From: Burton, Ross @ 2013-05-23 15:19 UTC (permalink / raw)
  To: Laurentiu Palcu; +Cc: openembedded-core

On 23 May 2013 14:15, Laurentiu Palcu <laurentiu.palcu@intel.com> wrote:
> This patch intends to make run-postinsts generic and deprecate
> rpm-postinsts. Here's why:

If it's generic, please move it out of the dpkg/ directory in oe-core.

Ross


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 0/7] run-postinsts refactoring
  2013-05-23 13:15 [PATCH 0/7] run-postinsts refactoring Laurentiu Palcu
                   ` (6 preceding siblings ...)
  2013-05-23 13:15 ` [PATCH 7/7] rpm: replace rpm-postinsts dependency with run-postinsts Laurentiu Palcu
@ 2013-05-24  3:38 ` Saul Wold
  2013-05-24 10:35   ` Laurentiu Palcu
  2013-06-06  7:41 ` [PATCH v2 " Laurentiu Palcu
  8 siblings, 1 reply; 15+ messages in thread
From: Saul Wold @ 2013-05-24  3:38 UTC (permalink / raw)
  To: Laurentiu Palcu; +Cc: openembedded-core

On 05/23/2013 06:15 AM, Laurentiu Palcu wrote:
> Hi all,
>
> My work at #4484 revealed that the package managers deb/ipk/rpm handle removal
> of PM meta-data (when the PM is not deployed) and the delayed postinstalls
> execution in their own way. Currently we have:
>   * run-postinsts (for deb/ipk) and rpm-postinsts (for rpm) for running the delayed
>     postinstalls on target when the PM is not part of the image;
>   * opkg removes the meta-data and some uneeded packages whilst deb/rpm remove
>     only the meta-data;
>   * both opkg and deb have no way of running the delayed postinstalls on target,
>     if package-management is not part of IMAGE_FEATURES, because the meta-data
>     was deleted (and it would have been useless anyway since the PM is not installed);
>
> That being said, this patchset tries to create a more unified solution for all
> PM backends.
>
> rpm-postinsts recipe is replaced by run-postinsts but I'll keep it in oe-core
> for a while (a couple of weeks maybe), just in case the current solution does not
> satisfy the RPM users (I doubt it though).
>
> I did tests with core-image-minimal using sysvinit/systemd and with/without delayed
> postinstalls. The results are as expected.
>
This seems to have a problem building on the auto builder, most of the 
failures are due to the following:

/usr/sbin/update-rc.d: /bin/sh: bad interpreter: No such file or directory

Details here:

> | log_check: Using /srv/home/pokybuild/yocto-autobuilder-new/yocto-slave/nightly-ppc/build/build/tmp/work/qemuppc-poky-linux/core-image-minimal-dev/1.0-r0/temp/log.do_rootfs.32640 as logfile
> | Logfile is clean
> | rpm -e --nodeps --root=/srv/home/pokybuild/yocto-autobuilder-new/yocto-slave/nightly-ppc/build/build/tmp/work/qemuppc-poky-linux/core-image-minimal-dev/1.0-r0/rootfs --dbpath=/var/lib/rpm update-rc.d base-passwd run-postinsts
> | /srv/home/pokybuild/yocto-autobuilder-new/yocto-slave/nightly-ppc/build/build/tmp/sysroots/x86_64-linux/var/tmp/rpm-tmp.67450: /usr/sbin/update-rc.d: /bin/sh: bad interpreter: No such file or directory
> | error: %postun(run-postinsts-1.0-r9.ppc603e) scriptlet failed, exit status 126
> | ERROR: Function failed: do_rootfs (see /srv/home/pokybuild/yocto-autobuilder-new/yocto-slave/nightly-ppc/build/build/tmp/work/qemuppc-poky-linux/core-image-minimal-dev/1.0-r0/temp/log.do_rootfs.32640 for further information)
> NOTE: recipe core-image-minimal-dev-1.0-r0: task do_rootfs: Failed
> ERROR: Task 71 (/srv/home/pokybuild/yocto-autobuilder-new/yocto-slave/nightly-ppc/bu

Sau!



> Thanks,
> Laurentiu
>
> The following changes since commit f7b639e527a65f9ce77aef07651ac5ec1e094e52:
>
>    rpm-postinsts.bb: enable postinst logging (2013-05-23 10:28:05 +0100)
>
> are available in the git repository at:
>
>    git://git.yoctoproject.org/poky-contrib lpalcu/run_postinsts_refactor
>    http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lpalcu/run_postinsts_refactor
>
> Laurentiu Palcu (7):
>    systemd: add udev-utils dependency for udev-hwdb
>    rootfs_*.bbclass: add some helper functions
>    image.bbclass: remove unneeded files from the image
>    core-image-minimal: do not remove packaging files in the rootfs
>      postprocess
>    run-postinsts: make it generic
>    rootfs_rpm.bbclas: switch to using run-postinsts
>    rpm: replace rpm-postinsts dependency with run-postinsts
>
>   meta/classes/image.bbclass                         |   33 +++++++++++
>   meta/classes/rootfs_deb.bbclass                    |   23 +++++++-
>   meta/classes/rootfs_ipk.bbclass                    |   39 ++++++-------
>   meta/classes/rootfs_rpm.bbclass                    |   25 ++++++++-
>   meta/recipes-core/images/core-image-minimal.bb     |    2 -
>   meta/recipes-core/systemd/systemd_199.bb           |    2 +
>   .../dpkg/run-postinsts/run-postinsts               |   59 ++++++++++++--------
>   .../dpkg/run-postinsts/run-postinsts.awk           |   30 ----------
>   meta/recipes-devtools/dpkg/run-postinsts_1.0.bb    |    7 +--
>   meta/recipes-devtools/rpm/rpm_5.4.9.bb             |    2 +-
>   10 files changed, 135 insertions(+), 87 deletions(-)
>   delete mode 100644 meta/recipes-devtools/dpkg/run-postinsts/run-postinsts.awk
>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 0/7] run-postinsts refactoring
  2013-05-24  3:38 ` [PATCH 0/7] run-postinsts refactoring Saul Wold
@ 2013-05-24 10:35   ` Laurentiu Palcu
  0 siblings, 0 replies; 15+ messages in thread
From: Laurentiu Palcu @ 2013-05-24 10:35 UTC (permalink / raw)
  To: Saul Wold; +Cc: openembedded-core



On 05/24/2013 06:38 AM, Saul Wold wrote:
> On 05/23/2013 06:15 AM, Laurentiu Palcu wrote:
>> Hi all,
>>
>> My work at #4484 revealed that the package managers deb/ipk/rpm handle removal
>> of PM meta-data (when the PM is not deployed) and the delayed postinstalls
>> execution in their own way. Currently we have:
>>   * run-postinsts (for deb/ipk) and rpm-postinsts (for rpm) for running the delayed
>>     postinstalls on target when the PM is not part of the image;
>>   * opkg removes the meta-data and some uneeded packages whilst deb/rpm remove
>>     only the meta-data;
>>   * both opkg and deb have no way of running the delayed postinstalls on target,
>>     if package-management is not part of IMAGE_FEATURES, because the meta-data
>>     was deleted (and it would have been useless anyway since the PM is not installed);
>>
>> That being said, this patchset tries to create a more unified solution for all
>> PM backends.
>>
>> rpm-postinsts recipe is replaced by run-postinsts but I'll keep it in oe-core
>> for a while (a couple of weeks maybe), just in case the current solution does not
>> satisfy the RPM users (I doubt it though).
>>
>> I did tests with core-image-minimal using sysvinit/systemd and with/without delayed
>> postinstalls. The results are as expected.
>>
> This seems to have a problem building on the auto builder, most of the 
> failures are due to the following:
> 
> /usr/sbin/update-rc.d: /bin/sh: bad interpreter: No such file or directory
I gave it a run on our local AB and saw no issues. However, from the log
you sent, it appears to be a problem in run-postinsts postrm scriptlet
when it's being removed from the image at do_rootfs time. The
update-rc.d in the native sysroot is called, which uses /bin/sh.

I'm pretty sure that you'll get the same failure, without my patches, if
you set AB to create ipk images (because the code I made generic for all
backends was taken from the current rootfs_ipk.bbclass). Currently, if
I'm not mistaken, the AB images default to using RPM as the backend.

This is my first hunch... since it works an a local AB we have here,
with Ubuntu server (/bin/sh -> dash).

Thanks,
Laurentiu

> 
> Details here:
> 
>> | log_check: Using /srv/home/pokybuild/yocto-autobuilder-new/yocto-slave/nightly-ppc/build/build/tmp/work/qemuppc-poky-linux/core-image-minimal-dev/1.0-r0/temp/log.do_rootfs.32640 as logfile
>> | Logfile is clean
>> | rpm -e --nodeps --root=/srv/home/pokybuild/yocto-autobuilder-new/yocto-slave/nightly-ppc/build/build/tmp/work/qemuppc-poky-linux/core-image-minimal-dev/1.0-r0/rootfs --dbpath=/var/lib/rpm update-rc.d base-passwd run-postinsts
>> | /srv/home/pokybuild/yocto-autobuilder-new/yocto-slave/nightly-ppc/build/build/tmp/sysroots/x86_64-linux/var/tmp/rpm-tmp.67450: /usr/sbin/update-rc.d: /bin/sh: bad interpreter: No such file or directory
>> | error: %postun(run-postinsts-1.0-r9.ppc603e) scriptlet failed, exit status 126
>> | ERROR: Function failed: do_rootfs (see /srv/home/pokybuild/yocto-autobuilder-new/yocto-slave/nightly-ppc/build/build/tmp/work/qemuppc-poky-linux/core-image-minimal-dev/1.0-r0/temp/log.do_rootfs.32640 for further information)
>> NOTE: recipe core-image-minimal-dev-1.0-r0: task do_rootfs: Failed
>> ERROR: Task 71 (/srv/home/pokybuild/yocto-autobuilder-new/yocto-slave/nightly-ppc/bu
> 
> Sau!
> 
> 
> 
>> Thanks,
>> Laurentiu
>>
>> The following changes since commit f7b639e527a65f9ce77aef07651ac5ec1e094e52:
>>
>>    rpm-postinsts.bb: enable postinst logging (2013-05-23 10:28:05 +0100)
>>
>> are available in the git repository at:
>>
>>    git://git.yoctoproject.org/poky-contrib lpalcu/run_postinsts_refactor
>>    http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lpalcu/run_postinsts_refactor
>>
>> Laurentiu Palcu (7):
>>    systemd: add udev-utils dependency for udev-hwdb
>>    rootfs_*.bbclass: add some helper functions
>>    image.bbclass: remove unneeded files from the image
>>    core-image-minimal: do not remove packaging files in the rootfs
>>      postprocess
>>    run-postinsts: make it generic
>>    rootfs_rpm.bbclas: switch to using run-postinsts
>>    rpm: replace rpm-postinsts dependency with run-postinsts
>>
>>   meta/classes/image.bbclass                         |   33 +++++++++++
>>   meta/classes/rootfs_deb.bbclass                    |   23 +++++++-
>>   meta/classes/rootfs_ipk.bbclass                    |   39 ++++++-------
>>   meta/classes/rootfs_rpm.bbclass                    |   25 ++++++++-
>>   meta/recipes-core/images/core-image-minimal.bb     |    2 -
>>   meta/recipes-core/systemd/systemd_199.bb           |    2 +
>>   .../dpkg/run-postinsts/run-postinsts               |   59 ++++++++++++--------
>>   .../dpkg/run-postinsts/run-postinsts.awk           |   30 ----------
>>   meta/recipes-devtools/dpkg/run-postinsts_1.0.bb    |    7 +--
>>   meta/recipes-devtools/rpm/rpm_5.4.9.bb             |    2 +-
>>   10 files changed, 135 insertions(+), 87 deletions(-)
>>   delete mode 100644 meta/recipes-devtools/dpkg/run-postinsts/run-postinsts.awk
>>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v2 0/7] run-postinsts refactoring
  2013-05-23 13:15 [PATCH 0/7] run-postinsts refactoring Laurentiu Palcu
                   ` (7 preceding siblings ...)
  2013-05-24  3:38 ` [PATCH 0/7] run-postinsts refactoring Saul Wold
@ 2013-06-06  7:41 ` Laurentiu Palcu
  2013-06-06 16:43   ` Mark Hatle
  8 siblings, 1 reply; 15+ messages in thread
From: Laurentiu Palcu @ 2013-06-06  7:41 UTC (permalink / raw)
  To: openembedded-core; +Cc: paul.eggleton

(cover letter only)

Changes in v2:
 * addressed an RPM issue that happened on AB. Interestingly, it happened only on
   certain distros. Our internal AB (running on Ubuntu server 12.04), didn't show
   any issues. So, what was the problem? We use a scriptlet wrapper to run the
   pre/post install scriptlets. What I missed in the previous patchset was that I
   didn't use the scriptlet wrapper when running the pre/post remove scriptlets
   and the context in which they ran was not correct. Hence, the update-rc.d used
   was the host's...
 * addresses Ross's request to move run-postinsts recipe out of dpkg directory,
   since it's generic now;

Paul, Mark would you please review the RPM changes please?

Thanks,
Laurentiu

Changes in v1:
Hi all,

My work at #4484 revealed that the package managers deb/ipk/rpm handle removal
of PM meta-data (when the PM is not deployed) and the delayed postinstalls
execution in their own way. Currently we have:
 * run-postinsts (for deb/ipk) and rpm-postinsts (for rpm) for running the delayed
   postinstalls on target when the PM is not part of the image;
 * opkg removes the meta-data and some uneeded packages whilst deb/rpm remove
   only the meta-data;
 * both opkg and deb have no way of running the delayed postinstalls on target,
   if package-management is not part of IMAGE_FEATURES, because the meta-data
   was deleted (and it would have been useless anyway since the PM is not installed);

That being said, this patchset tries to create a more unified solution for all
PM backends.

rpm-postinsts recipe is replaced by run-postinsts but I'll keep it in oe-core
for a while (a couple of weeks maybe), just in case the current solution does not
satisfy the RPM users (I doubt it though).

I did tests with core-image-minimal using sysvinit/systemd and with/without delayed
postinstalls. The results are as expected.

Thanks,
Laurentiu

The following changes since commit a62aed41f2d8f874f7ae24d0e5be5dbc66ea2199:

  lrzsz: check locale.h in configure (2013-06-04 15:55:46 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib lpalcu/run_postinsts_refactor_v2
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lpalcu/run_postinsts_refactor_v2

Laurentiu Palcu (7):
  rootfs_*.bbclass: add some helper functions
  image.bbclass: remove unneeded files from the image
  core-image-minimal: do not remove packaging files in the rootfs
    postprocess
  run-postinsts: make it generic
  rootfs_rpm.bbclass: switch to using run-postinsts
  package_rpm.bbclass: handle pre/post remove scriptlets
  rpm: replace rpm-postinsts dependency with run-postinsts

 meta/classes/image.bbclass                         |   33 ++++++++++++++
 meta/classes/package_rpm.bbclass                   |   16 ++++---
 meta/classes/rootfs_deb.bbclass                    |   23 +++++++++-
 meta/classes/rootfs_ipk.bbclass                    |   39 ++++++++--------
 meta/classes/rootfs_rpm.bbclass                    |   29 ++++++++++--
 meta/recipes-core/images/core-image-minimal.bb     |    2 -
 .../dpkg/run-postinsts/run-postinsts               |   36 ---------------
 .../dpkg/run-postinsts/run-postinsts.awk           |   30 -------------
 meta/recipes-devtools/rpm/rpm_5.4.9.bb             |    2 +-
 .../run-postinsts/run-postinsts/run-postinsts      |   47 ++++++++++++++++++++
 .../{dpkg => run-postinsts}/run-postinsts_1.0.bb   |    7 ++-
 11 files changed, 159 insertions(+), 105 deletions(-)
 delete mode 100755 meta/recipes-devtools/dpkg/run-postinsts/run-postinsts
 delete mode 100644 meta/recipes-devtools/dpkg/run-postinsts/run-postinsts.awk
 create mode 100755 meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
 rename meta/recipes-devtools/{dpkg => run-postinsts}/run-postinsts_1.0.bb (68%)

-- 
1.7.9.5



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 0/7] run-postinsts refactoring
  2013-06-06  7:41 ` [PATCH v2 " Laurentiu Palcu
@ 2013-06-06 16:43   ` Mark Hatle
  2013-06-06 18:09     ` Laurentiu Palcu
  0 siblings, 1 reply; 15+ messages in thread
From: Mark Hatle @ 2013-06-06 16:43 UTC (permalink / raw)
  To: Laurentiu Palcu; +Cc: paul.eggleton, openembedded-core

Comments below....

On 6/6/13 2:41 AM, Laurentiu Palcu wrote:
> (cover letter only)
>
> Changes in v2:
>   * addressed an RPM issue that happened on AB. Interestingly, it happened only on
>     certain distros. Our internal AB (running on Ubuntu server 12.04), didn't show
>     any issues. So, what was the problem? We use a scriptlet wrapper to run the
>     pre/post install scriptlets. What I missed in the previous patchset was that I
>     didn't use the scriptlet wrapper when running the pre/post remove scriptlets
>     and the context in which they ran was not correct. Hence, the update-rc.d used
>     was the host's...
>   * addresses Ross's request to move run-postinsts recipe out of dpkg directory,
>     since it's generic now;
>
> Paul, Mark would you please review the RPM changes please?
>
> Thanks,
> Laurentiu
>
> Changes in v1:
> Hi all,
>
> My work at #4484 revealed that the package managers deb/ipk/rpm handle removal
> of PM meta-data (when the PM is not deployed) and the delayed postinstalls
> execution in their own way. Currently we have:
>   * run-postinsts (for deb/ipk) and rpm-postinsts (for rpm) for running the delayed
>     postinstalls on target when the PM is not part of the image;
>   * opkg removes the meta-data and some uneeded packages whilst deb/rpm remove
>     only the meta-data;
>   * both opkg and deb have no way of running the delayed postinstalls on target,
>     if package-management is not part of IMAGE_FEATURES, because the meta-data
>     was deleted (and it would have been useless anyway since the PM is not installed);
>
> That being said, this patchset tries to create a more unified solution for all
> PM backends.
>
> rpm-postinsts recipe is replaced by run-postinsts but I'll keep it in oe-core
> for a while (a couple of weeks maybe), just in case the current solution does not
> satisfy the RPM users (I doubt it though).
>
> I did tests with core-image-minimal using sysvinit/systemd and with/without delayed
> postinstalls. The results are as expected.
>
> Thanks,
> Laurentiu
>
> The following changes since commit a62aed41f2d8f874f7ae24d0e5be5dbc66ea2199:
>
>    lrzsz: check locale.h in configure (2013-06-04 15:55:46 +0100)
>
> are available in the git repository at:
>
>    git://git.yoctoproject.org/poky-contrib lpalcu/run_postinsts_refactor_v2
>    http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lpalcu/run_postinsts_refactor_v2
>
> Laurentiu Palcu (7):
>    rootfs_*.bbclass: add some helper functions
>    image.bbclass: remove unneeded files from the image
>    core-image-minimal: do not remove packaging files in the rootfs
>      postprocess
>    run-postinsts: make it generic
>    rootfs_rpm.bbclass: switch to using run-postinsts
>    package_rpm.bbclass: handle pre/post remove scriptlets
>    rpm: replace rpm-postinsts dependency with run-postinsts
>
>   meta/classes/image.bbclass                         |   33 ++++++++++++++
>   meta/classes/package_rpm.bbclass                   |   16 ++++---
>   meta/classes/rootfs_deb.bbclass                    |   23 +++++++++-
>   meta/classes/rootfs_ipk.bbclass                    |   39 ++++++++--------
>   meta/classes/rootfs_rpm.bbclass                    |   29 ++++++++++--
>   meta/recipes-core/images/core-image-minimal.bb     |    2 -
>   .../dpkg/run-postinsts/run-postinsts               |   36 ---------------
>   .../dpkg/run-postinsts/run-postinsts.awk           |   30 -------------
>   meta/recipes-devtools/rpm/rpm_5.4.9.bb             |    2 +-
>   .../run-postinsts/run-postinsts/run-postinsts      |   47 ++++++++++++++++++++
>   .../{dpkg => run-postinsts}/run-postinsts_1.0.bb   |    7 ++-
>   11 files changed, 159 insertions(+), 105 deletions(-)
>   delete mode 100755 meta/recipes-devtools/dpkg/run-postinsts/run-postinsts
>   delete mode 100644 meta/recipes-devtools/dpkg/run-postinsts/run-postinsts.awk
>   create mode 100755 meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
>   rename meta/recipes-devtools/{dpkg => run-postinsts}/run-postinsts_1.0.bb (68%)
>

> +rootfs_remove_unneeded () {
> +	if ${@base_contains("IMAGE_FEATURES", "package-management", "false", "true", d)}; then
> +		if [ -z "$(delayed_postinsts)" ]; then
> +			# All packages were successfully configured.
> +			# update-rc.d, base-passwd, run-postinsts are no further use, remove them now
> +			remove_run_postinsts=false
> +			if [ -e ${IMAGE_ROOTFS}${sysconfdir}/init.d/run-postinsts ]; then
> +				remove_run_postinsts=true
> +			fi
> +			rootfs_remove_packages update-rc.d base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}
> +
> +			# Need to remove rc.d files for run-postinsts by hand since opkg won't
> +			# call postrm scripts in offline root mode.
> +			if $remove_run_postinsts; then
> +				update-rc.d -f -r ${IMAGE_ROOTFS} run-postinsts remove
> +			fi

The above runs unconditionally for all package types.  Will this cause an issue 
w/ RPM or deb?  (I don't think it will, but I'm slightly worried about RPM and 
it's removal scripts.)

> +		else
> +			# Some packages were not successfully configured, save them only
> +			# if we have run-postinsts script present. Otherwise, they're
> +			# useless
> +			if [ -e ${IMAGE_ROOTFS}${sysconfdir}/init.d/run-postinsts ]; then
> +				save_postinsts
> +			fi
> +		fi
> +
> +		# Since no package manager is present in the image the metadata is not needed
> +		remove_packaging_data_files
> +	fi
> +}
> +

Everything else looks fine.

Reviewed-by: Mark Hatle <mark.hatle@windriver.com>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 0/7] run-postinsts refactoring
  2013-06-06 16:43   ` Mark Hatle
@ 2013-06-06 18:09     ` Laurentiu Palcu
  2013-06-06 18:22       ` Mark Hatle
  0 siblings, 1 reply; 15+ messages in thread
From: Laurentiu Palcu @ 2013-06-06 18:09 UTC (permalink / raw)
  To: Mark Hatle; +Cc: paul.eggleton, openembedded-core



On 06/06/2013 07:43 PM, Mark Hatle wrote:
> Comments below....
> 
> On 6/6/13 2:41 AM, Laurentiu Palcu wrote:
>> (cover letter only)
>>
>> Changes in v2:
>>   * addressed an RPM issue that happened on AB. Interestingly, it happened only on
>>     certain distros. Our internal AB (running on Ubuntu server 12.04), didn't show
>>     any issues. So, what was the problem? We use a scriptlet wrapper to run the
>>     pre/post install scriptlets. What I missed in the previous patchset was that I
>>     didn't use the scriptlet wrapper when running the pre/post remove scriptlets
>>     and the context in which they ran was not correct. Hence, the update-rc.d used
>>     was the host's...
>>   * addresses Ross's request to move run-postinsts recipe out of dpkg directory,
>>     since it's generic now;
>>
>> Paul, Mark would you please review the RPM changes please?
>>
>> Thanks,
>> Laurentiu
>>
>> Changes in v1:
>> Hi all,
>>
>> My work at #4484 revealed that the package managers deb/ipk/rpm handle removal
>> of PM meta-data (when the PM is not deployed) and the delayed postinstalls
>> execution in their own way. Currently we have:
>>   * run-postinsts (for deb/ipk) and rpm-postinsts (for rpm) for running the delayed
>>     postinstalls on target when the PM is not part of the image;
>>   * opkg removes the meta-data and some uneeded packages whilst deb/rpm remove
>>     only the meta-data;
>>   * both opkg and deb have no way of running the delayed postinstalls on target,
>>     if package-management is not part of IMAGE_FEATURES, because the meta-data
>>     was deleted (and it would have been useless anyway since the PM is not installed);
>>
>> That being said, this patchset tries to create a more unified solution for all
>> PM backends.
>>
>> rpm-postinsts recipe is replaced by run-postinsts but I'll keep it in oe-core
>> for a while (a couple of weeks maybe), just in case the current solution does not
>> satisfy the RPM users (I doubt it though).
>>
>> I did tests with core-image-minimal using sysvinit/systemd and with/without delayed
>> postinstalls. The results are as expected.
>>
>> Thanks,
>> Laurentiu
>>
>> The following changes since commit a62aed41f2d8f874f7ae24d0e5be5dbc66ea2199:
>>
>>    lrzsz: check locale.h in configure (2013-06-04 15:55:46 +0100)
>>
>> are available in the git repository at:
>>
>>    git://git.yoctoproject.org/poky-contrib lpalcu/run_postinsts_refactor_v2
>>    http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lpalcu/run_postinsts_refactor_v2
>>
>> Laurentiu Palcu (7):
>>    rootfs_*.bbclass: add some helper functions
>>    image.bbclass: remove unneeded files from the image
>>    core-image-minimal: do not remove packaging files in the rootfs
>>      postprocess
>>    run-postinsts: make it generic
>>    rootfs_rpm.bbclass: switch to using run-postinsts
>>    package_rpm.bbclass: handle pre/post remove scriptlets
>>    rpm: replace rpm-postinsts dependency with run-postinsts
>>
>>   meta/classes/image.bbclass                         |   33 ++++++++++++++
>>   meta/classes/package_rpm.bbclass                   |   16 ++++---
>>   meta/classes/rootfs_deb.bbclass                    |   23 +++++++++-
>>   meta/classes/rootfs_ipk.bbclass                    |   39 ++++++++--------
>>   meta/classes/rootfs_rpm.bbclass                    |   29 ++++++++++--
>>   meta/recipes-core/images/core-image-minimal.bb     |    2 -
>>   .../dpkg/run-postinsts/run-postinsts               |   36 ---------------
>>   .../dpkg/run-postinsts/run-postinsts.awk           |   30 -------------
>>   meta/recipes-devtools/rpm/rpm_5.4.9.bb             |    2 +-
>>   .../run-postinsts/run-postinsts/run-postinsts      |   47 ++++++++++++++++++++
>>   .../{dpkg => run-postinsts}/run-postinsts_1.0.bb   |    7 ++-
>>   11 files changed, 159 insertions(+), 105 deletions(-)
>>   delete mode 100755 meta/recipes-devtools/dpkg/run-postinsts/run-postinsts
>>   delete mode 100644 meta/recipes-devtools/dpkg/run-postinsts/run-postinsts.awk
>>   create mode 100755 meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
>>   rename meta/recipes-devtools/{dpkg => run-postinsts}/run-postinsts_1.0.bb (68%)
>>
> 
>> +rootfs_remove_unneeded () {
>> +	if ${@base_contains("IMAGE_FEATURES", "package-management", "false", "true", d)}; then
>> +		if [ -z "$(delayed_postinsts)" ]; then
>> +			# All packages were successfully configured.
>> +			# update-rc.d, base-passwd, run-postinsts are no further use, remove them now
>> +			remove_run_postinsts=false
>> +			if [ -e ${IMAGE_ROOTFS}${sysconfdir}/init.d/run-postinsts ]; then
>> +				remove_run_postinsts=true
>> +			fi
>> +			rootfs_remove_packages update-rc.d base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}
>> +
>> +			# Need to remove rc.d files for run-postinsts by hand since opkg won't
>> +			# call postrm scripts in offline root mode.
>> +			if $remove_run_postinsts; then
>> +				update-rc.d -f -r ${IMAGE_ROOTFS} run-postinsts remove
>> +			fi
> 
> The above runs unconditionally for all package types.  Will this cause an issue 
> w/ RPM or deb?  (I don't think it will, but I'm slightly worried about RPM and 
> it's removal scripts.)
I believe I missed to remove the opkg from the comment since I pasted
this piece of code from rootfs_ipk.bbclass. However, during my tests, I
saw no issues with rpm/deb. Is there anything in particular you think I
should check for RPM to rule out your concerns?

Thanks,
Laurentiu
> 
>> +		else
>> +			# Some packages were not successfully configured, save them only
>> +			# if we have run-postinsts script present. Otherwise, they're
>> +			# useless
>> +			if [ -e ${IMAGE_ROOTFS}${sysconfdir}/init.d/run-postinsts ]; then
>> +				save_postinsts
>> +			fi
>> +		fi
>> +
>> +		# Since no package manager is present in the image the metadata is not needed
>> +		remove_packaging_data_files
>> +	fi
>> +}
>> +
> 
> Everything else looks fine.
> 
> Reviewed-by: Mark Hatle <mark.hatle@windriver.com>
> 


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 0/7] run-postinsts refactoring
  2013-06-06 18:09     ` Laurentiu Palcu
@ 2013-06-06 18:22       ` Mark Hatle
  0 siblings, 0 replies; 15+ messages in thread
From: Mark Hatle @ 2013-06-06 18:22 UTC (permalink / raw)
  To: Laurentiu Palcu; +Cc: paul.eggleton, openembedded-core

On 6/6/13 1:09 PM, Laurentiu Palcu wrote:
>
>
> On 06/06/2013 07:43 PM, Mark Hatle wrote:
>> Comments below....
>>
>> On 6/6/13 2:41 AM, Laurentiu Palcu wrote:
>>> (cover letter only)
>>>
>>> Changes in v2:
>>>    * addressed an RPM issue that happened on AB. Interestingly, it happened only on
>>>      certain distros. Our internal AB (running on Ubuntu server 12.04), didn't show
>>>      any issues. So, what was the problem? We use a scriptlet wrapper to run the
>>>      pre/post install scriptlets. What I missed in the previous patchset was that I
>>>      didn't use the scriptlet wrapper when running the pre/post remove scriptlets
>>>      and the context in which they ran was not correct. Hence, the update-rc.d used
>>>      was the host's...
>>>    * addresses Ross's request to move run-postinsts recipe out of dpkg directory,
>>>      since it's generic now;
>>>
>>> Paul, Mark would you please review the RPM changes please?
>>>
>>> Thanks,
>>> Laurentiu
>>>
>>> Changes in v1:
>>> Hi all,
>>>
>>> My work at #4484 revealed that the package managers deb/ipk/rpm handle removal
>>> of PM meta-data (when the PM is not deployed) and the delayed postinstalls
>>> execution in their own way. Currently we have:
>>>    * run-postinsts (for deb/ipk) and rpm-postinsts (for rpm) for running the delayed
>>>      postinstalls on target when the PM is not part of the image;
>>>    * opkg removes the meta-data and some uneeded packages whilst deb/rpm remove
>>>      only the meta-data;
>>>    * both opkg and deb have no way of running the delayed postinstalls on target,
>>>      if package-management is not part of IMAGE_FEATURES, because the meta-data
>>>      was deleted (and it would have been useless anyway since the PM is not installed);
>>>
>>> That being said, this patchset tries to create a more unified solution for all
>>> PM backends.
>>>
>>> rpm-postinsts recipe is replaced by run-postinsts but I'll keep it in oe-core
>>> for a while (a couple of weeks maybe), just in case the current solution does not
>>> satisfy the RPM users (I doubt it though).
>>>
>>> I did tests with core-image-minimal using sysvinit/systemd and with/without delayed
>>> postinstalls. The results are as expected.
>>>
>>> Thanks,
>>> Laurentiu
>>>
>>> The following changes since commit a62aed41f2d8f874f7ae24d0e5be5dbc66ea2199:
>>>
>>>     lrzsz: check locale.h in configure (2013-06-04 15:55:46 +0100)
>>>
>>> are available in the git repository at:
>>>
>>>     git://git.yoctoproject.org/poky-contrib lpalcu/run_postinsts_refactor_v2
>>>     http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lpalcu/run_postinsts_refactor_v2
>>>
>>> Laurentiu Palcu (7):
>>>     rootfs_*.bbclass: add some helper functions
>>>     image.bbclass: remove unneeded files from the image
>>>     core-image-minimal: do not remove packaging files in the rootfs
>>>       postprocess
>>>     run-postinsts: make it generic
>>>     rootfs_rpm.bbclass: switch to using run-postinsts
>>>     package_rpm.bbclass: handle pre/post remove scriptlets
>>>     rpm: replace rpm-postinsts dependency with run-postinsts
>>>
>>>    meta/classes/image.bbclass                         |   33 ++++++++++++++
>>>    meta/classes/package_rpm.bbclass                   |   16 ++++---
>>>    meta/classes/rootfs_deb.bbclass                    |   23 +++++++++-
>>>    meta/classes/rootfs_ipk.bbclass                    |   39 ++++++++--------
>>>    meta/classes/rootfs_rpm.bbclass                    |   29 ++++++++++--
>>>    meta/recipes-core/images/core-image-minimal.bb     |    2 -
>>>    .../dpkg/run-postinsts/run-postinsts               |   36 ---------------
>>>    .../dpkg/run-postinsts/run-postinsts.awk           |   30 -------------
>>>    meta/recipes-devtools/rpm/rpm_5.4.9.bb             |    2 +-
>>>    .../run-postinsts/run-postinsts/run-postinsts      |   47 ++++++++++++++++++++
>>>    .../{dpkg => run-postinsts}/run-postinsts_1.0.bb   |    7 ++-
>>>    11 files changed, 159 insertions(+), 105 deletions(-)
>>>    delete mode 100755 meta/recipes-devtools/dpkg/run-postinsts/run-postinsts
>>>    delete mode 100644 meta/recipes-devtools/dpkg/run-postinsts/run-postinsts.awk
>>>    create mode 100755 meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
>>>    rename meta/recipes-devtools/{dpkg => run-postinsts}/run-postinsts_1.0.bb (68%)
>>>
>>
>>> +rootfs_remove_unneeded () {
>>> +	if ${@base_contains("IMAGE_FEATURES", "package-management", "false", "true", d)}; then
>>> +		if [ -z "$(delayed_postinsts)" ]; then
>>> +			# All packages were successfully configured.
>>> +			# update-rc.d, base-passwd, run-postinsts are no further use, remove them now
>>> +			remove_run_postinsts=false
>>> +			if [ -e ${IMAGE_ROOTFS}${sysconfdir}/init.d/run-postinsts ]; then
>>> +				remove_run_postinsts=true
>>> +			fi
>>> +			rootfs_remove_packages update-rc.d base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}
>>> +
>>> +			# Need to remove rc.d files for run-postinsts by hand since opkg won't
>>> +			# call postrm scripts in offline root mode.
>>> +			if $remove_run_postinsts; then
>>> +				update-rc.d -f -r ${IMAGE_ROOTFS} run-postinsts remove
>>> +			fi
>>
>> The above runs unconditionally for all package types.  Will this cause an issue
>> w/ RPM or deb?  (I don't think it will, but I'm slightly worried about RPM and
>> it's removal scripts.)
> I believe I missed to remove the opkg from the comment since I pasted
> this piece of code from rootfs_ipk.bbclass. However, during my tests, I
> saw no issues with rpm/deb. Is there anything in particular you think I
> should check for RPM to rule out your concerns?

Simply that the update-rc.d will be run by the RPM rule, and rerun in the above.

As long as that doesn't cause a problem, I'm fine with the change.

--Mark

> Thanks,
> Laurentiu
>>
>>> +		else
>>> +			# Some packages were not successfully configured, save them only
>>> +			# if we have run-postinsts script present. Otherwise, they're
>>> +			# useless
>>> +			if [ -e ${IMAGE_ROOTFS}${sysconfdir}/init.d/run-postinsts ]; then
>>> +				save_postinsts
>>> +			fi
>>> +		fi
>>> +
>>> +		# Since no package manager is present in the image the metadata is not needed
>>> +		remove_packaging_data_files
>>> +	fi
>>> +}
>>> +
>>
>> Everything else looks fine.
>>
>> Reviewed-by: Mark Hatle <mark.hatle@windriver.com>
>>



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-06-06 18:22 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-23 13:15 [PATCH 0/7] run-postinsts refactoring Laurentiu Palcu
2013-05-23 13:15 ` [PATCH 1/7] systemd: add udev-utils dependency for udev-hwdb Laurentiu Palcu
2013-05-23 13:15 ` [PATCH 2/7] rootfs_*.bbclass: add some helper functions Laurentiu Palcu
2013-05-23 13:15 ` [PATCH 3/7] image.bbclass: remove unneeded files from the image Laurentiu Palcu
2013-05-23 13:15 ` [PATCH 4/7] core-image-minimal: do not remove packaging files in the rootfs postprocess Laurentiu Palcu
2013-05-23 13:15 ` [PATCH 5/7] run-postinsts: make it generic Laurentiu Palcu
2013-05-23 15:19   ` Burton, Ross
2013-05-23 13:15 ` [PATCH 6/7] rootfs_rpm.bbclas: switch to using run-postinsts Laurentiu Palcu
2013-05-23 13:15 ` [PATCH 7/7] rpm: replace rpm-postinsts dependency with run-postinsts Laurentiu Palcu
2013-05-24  3:38 ` [PATCH 0/7] run-postinsts refactoring Saul Wold
2013-05-24 10:35   ` Laurentiu Palcu
2013-06-06  7:41 ` [PATCH v2 " Laurentiu Palcu
2013-06-06 16:43   ` Mark Hatle
2013-06-06 18:09     ` Laurentiu Palcu
2013-06-06 18:22       ` Mark Hatle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.