[OE-core] [PATCH 3/3] opkg: save output of postinst scripts

Kang Kai kai.kang at windriver.com
Wed Feb 20 06:16:36 UTC 2013


When has distro feature "debug-tweak", redirect output of postinstall
scripts to log file /var/log/postinstall.log. And the log file can be
configured.

[Yocto 3223]

Signed-off-by: Kang Kai <kai.kang at windriver.com>
---
 .../opkg/opkg/redirect-output.patch                |   29 ++++++++++++++++++++
 meta/recipes-devtools/opkg/opkg_svn.bb             |    6 +++-
 2 files changed, 34 insertions(+), 1 deletions(-)
 create mode 100644 meta/recipes-devtools/opkg/opkg/redirect-output.patch

diff --git a/meta/recipes-devtools/opkg/opkg/redirect-output.patch b/meta/recipes-devtools/opkg/opkg/redirect-output.patch
new file mode 100644
index 0000000..6710372
--- /dev/null
+++ b/meta/recipes-devtools/opkg/opkg/redirect-output.patch
@@ -0,0 +1,29 @@
+Upstream-Status: Inappropriate [other]
+
+This patch redirect output of post install script to a log file when
+distro feature "debug-tweak" enabled.
+
+[Yocto 3223]
+
+Signed-off-by: Kang Kai <kai.kang at windriver.com>
+
+--- trunk/libopkg/opkg_configure.c.orig	2013-02-18 15:00:42.715289097 +0800
++++ trunk/libopkg/opkg_configure.c	2013-02-18 15:01:43.971291259 +0800
+@@ -26,6 +26,7 @@ int
+ opkg_configure(pkg_t *pkg)
+ {
+     int err;
++    char buf[256];
+ 
+     /* DPKG_INCOMPATIBILITY:
+        dpkg actually does some conffile handling here, rather than at the
+@@ -33,7 +34,8 @@ opkg_configure(pkg_t *pkg)
+     /* DPKG_INCOMPATIBILITY:
+        dpkg actually includes a version number to this script call */
+ 
+-    err = pkg_run_script(pkg, "postinst", "configure");
++    sprintf(buf, "configure | tee %s", LOGFILE);
++    err = pkg_run_script(pkg, "postinst", buf);
+     if (err) {
+         if (!conf->offline_root)
+ 	     opkg_msg(ERROR, "%s.postinst returned %d.\n", pkg->name, err);
diff --git a/meta/recipes-devtools/opkg/opkg_svn.bb b/meta/recipes-devtools/opkg/opkg_svn.bb
index 382bfdd..164af88 100644
--- a/meta/recipes-devtools/opkg/opkg_svn.bb
+++ b/meta/recipes-devtools/opkg/opkg_svn.bb
@@ -3,10 +3,14 @@ require opkg.inc
 SRC_URI = "svn://opkg.googlecode.com/svn;module=trunk;protocol=http \
            file://obsolete_automake_macros.patch \
 "
+SRC_URI += "${@base_contains('DISTRO_FEATURES', 'debug-tweak', 'file://redirect-output.patch', '', d)}"
 
 S = "${WORKDIR}/trunk"
 
 SRCREV = "649"
 PV = "0.1.8+svnr${SRCPV}"
 
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
+
+POSTLOG ?= "/var/log/postinstall.log"
+CFLAGS_append += "${@base_contains('DISTRO_FEATURES', 'debug-tweak', ' -DLOGFILE=\'\"${POSTLOG}\"\'', '', d)}"
-- 
1.7.5.4





More information about the Openembedded-core mailing list