* [PATCH 0/3] Redirect output of post-install scripts when "debug-tweak" enabled
@ 2013-02-20 6:16 Kang Kai
2013-02-20 6:16 ` [PATCH 1/3] rpm: redirect output of post install script Kang Kai
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Kang Kai @ 2013-02-20 6:16 UTC (permalink / raw)
To: openembedded-core; +Cc: Zhenfeng.Zhao
The following changes since commit c7b23ab68aafc04d9830ef318015912e5d4f0672:
maintainers.inc: update ownership of recipes (2013-02-17 22:33:30 +0000)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib kangkai/redirect-postinst
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/redirect-postinst
Kang Kai (3):
rpm: redirect output of post install script
dpkg: redirect output of postinstall script
opkg: save output of postinst scripts
.../dpkg/dpkg/redirect-output.patch | 37 +++++++++++++++++++
meta/recipes-devtools/dpkg/dpkg_1.16.9.bb | 8 +++-
.../opkg/opkg/redirect-output.patch | 29 +++++++++++++++
meta/recipes-devtools/opkg/opkg_svn.bb | 6 +++-
.../recipes-devtools/rpm/rpm/redirect-output.patch | 38 ++++++++++++++++++++
meta/recipes-devtools/rpm/rpm_5.4.9.bb | 6 +++-
6 files changed, 120 insertions(+), 4 deletions(-)
create mode 100644 meta/recipes-devtools/dpkg/dpkg/redirect-output.patch
create mode 100644 meta/recipes-devtools/opkg/opkg/redirect-output.patch
create mode 100644 meta/recipes-devtools/rpm/rpm/redirect-output.patch
--
1.7.5.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] rpm: redirect output of post install script
2013-02-20 6:16 [PATCH 0/3] Redirect output of post-install scripts when "debug-tweak" enabled Kang Kai
@ 2013-02-20 6:16 ` Kang Kai
2013-02-21 14:19 ` Martin Donnelly
2013-02-20 6:16 ` [PATCH 2/3] dpkg: redirect output of postinstall script Kang Kai
2013-02-20 6:16 ` [PATCH 3/3] opkg: save output of postinst scripts Kang Kai
2 siblings, 1 reply; 6+ messages in thread
From: Kang Kai @ 2013-02-20 6:16 UTC (permalink / raw)
To: openembedded-core; +Cc: Zhenfeng.Zhao
When distro feature "debug-tweak" enabled, redirect output of post
install script to log file which can be configured.
[Yocto 3223]
Signed-off-by: Kang Kai <kai.kang@windriver.com>
---
.../recipes-devtools/rpm/rpm/redirect-output.patch | 38 ++++++++++++++++++++
meta/recipes-devtools/rpm/rpm_5.4.9.bb | 6 +++-
2 files changed, 43 insertions(+), 1 deletions(-)
create mode 100644 meta/recipes-devtools/rpm/rpm/redirect-output.patch
diff --git a/meta/recipes-devtools/rpm/rpm/redirect-output.patch b/meta/recipes-devtools/rpm/rpm/redirect-output.patch
new file mode 100644
index 0000000..1bc53dc
--- /dev/null
+++ b/meta/recipes-devtools/rpm/rpm/redirect-output.patch
@@ -0,0 +1,38 @@
+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@windriver.com>
+
+--- rpm-5.4.9/lib/psm.c.orig 2013-02-18 11:34:19.646852294 +0800
++++ rpm-5.4.9/lib/psm.c 2013-02-18 13:18:00.291071721 +0800
+@@ -1111,6 +1111,14 @@ assert(he->p.str != NULL);
+ if (ssp != NULL)
+ *ssp |= RPMSCRIPT_STATE_EXEC;
+
++#ifdef RPM_VENDOR_POKY
++ int fd = open(LOGFILE, O_RDWR|O_CREAT|O_APPEND, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
++ if (psm->scriptTag == RPMTAG_POSTIN && fd != -1) {
++ dup2(fd, STDERR_FILENO);
++ dup2(fd, STDOUT_FILENO);
++ }
++#endif
++
+ /* Permit libselinux to do the scriptlet exec. */
+ if (rpmtsSELinuxEnabled(ts) == 1) {
+ if (ssp != NULL)
+@@ -1121,6 +1129,11 @@ assert(he->p.str != NULL);
+ xx = execv(argv[0], (char *const *)argv);
+ /*@=nullstate@*/
+ }
++
++#ifdef RPM_VENDOR_POKY
++ if (fd)
++ close(fd);
++#endif
+ }
+
+ if (ssp != NULL)
diff --git a/meta/recipes-devtools/rpm/rpm_5.4.9.bb b/meta/recipes-devtools/rpm/rpm_5.4.9.bb
index 39b0481..dc43678 100644
--- a/meta/recipes-devtools/rpm/rpm_5.4.9.bb
+++ b/meta/recipes-devtools/rpm/rpm_5.4.9.bb
@@ -43,7 +43,7 @@ LICENSE = "LGPLv2.1"
LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1"
DEPENDS = "libpcre attr acl popt ossp-uuid file bison-native"
-PR = "r61"
+PR = "r62"
# rpm2cpio is a shell script, which is part of the rpm src.rpm. It is needed
# in order to extract the distribution SRPM into a format we can extract...
@@ -85,6 +85,7 @@ SRC_URI = "http://www.rpm5.org/files/rpm/rpm-5.4/rpm-5.4.9-0.20120508.src.rpm;ex
file://rpm-reloc-macros.patch \
file://rpm-platform2.patch \
file://rpm-remove-sykcparse-decl.patch \
+ ${@base_contains('DISTRO_FEATURES', 'debug-tweak', 'file://redirect-output.patch', '', d)} \
"
# Uncomment the following line to enable platform score debugging
@@ -197,6 +198,9 @@ EXTRA_OECONF += "--verbose \
CFLAGS_append = " -DRPM_VENDOR_WINDRIVER -DRPM_VENDOR_POKY -DRPM_VENDOR_OE"
+POSTLOG ?= "/var/log/postinstall.log"
+CFLAGS_append += "${@base_contains('DISTRO_FEATURES', 'debug-tweak', ' -DLOGFILE=\'\"${POSTLOG}\"\'', '', d)}"
+
LDFLAGS_append_libc-uclibc = "-lrt -lpthread"
PACKAGES = "${PN}-dbg ${PN} ${PN}-doc ${PN}-libs ${PN}-dev ${PN}-staticdev ${PN}-common ${PN}-build python-rpm-dbg python-rpm-staticdev python-rpm-dev python-rpm perl-module-rpm perl-module-rpm-dev ${PN}-locale"
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] dpkg: redirect output of postinstall script
2013-02-20 6:16 [PATCH 0/3] Redirect output of post-install scripts when "debug-tweak" enabled Kang Kai
2013-02-20 6:16 ` [PATCH 1/3] rpm: redirect output of post install script Kang Kai
@ 2013-02-20 6:16 ` Kang Kai
2013-02-20 6:16 ` [PATCH 3/3] opkg: save output of postinst scripts Kang Kai
2 siblings, 0 replies; 6+ messages in thread
From: Kang Kai @ 2013-02-20 6:16 UTC (permalink / raw)
To: openembedded-core; +Cc: Zhenfeng.Zhao
When distro feature "debug-tweak" enabled, redirect output of
postinstall script to log file /var/log/postinstall.log which
can be configured.
[Yocto 3223]
Signed-off-by: Kang Kai <kai.kang@windriver.com>
---
.../dpkg/dpkg/redirect-output.patch | 37 ++++++++++++++++++++
meta/recipes-devtools/dpkg/dpkg_1.16.9.bb | 8 +++-
2 files changed, 43 insertions(+), 2 deletions(-)
create mode 100644 meta/recipes-devtools/dpkg/dpkg/redirect-output.patch
diff --git a/meta/recipes-devtools/dpkg/dpkg/redirect-output.patch b/meta/recipes-devtools/dpkg/dpkg/redirect-output.patch
new file mode 100644
index 0000000..584d6ff
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg/redirect-output.patch
@@ -0,0 +1,37 @@
+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@windriver.com>
+
+--- dpkg-1.16.9/src/script.c.orig 2013-02-19 16:05:33.154474040 +0800
++++ dpkg-1.16.9/src/script.c 2013-02-19 16:11:20.438486290 +0800
+@@ -30,6 +30,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdlib.h>
++#include <fcntl.h>
+
+ #include <dpkg/i18n.h>
+ #include <dpkg/dpkg.h>
+@@ -193,8 +166,17 @@ vmaintainer_script_installed(struct pkgi
+ }
+ ohshite(_("unable to stat %s `%.250s'"), buf, scriptpath);
+ }
++
++ int fd = open(LOGFILE, O_RDWR|O_CREAT|O_APPEND, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
++ if (strcmp(desc, "post-installation") == 0 && fd != -1) {
++ dup2(fd, STDERR_FILENO);
++ dup2(fd, STDOUT_FILENO);
++ }
+ do_script(pkg, &pkg->installed, &cmd, &stab, 0);
+
++ if (fd)
++ close(fd);
++
+ command_destroy(&cmd);
+
+ return 1;
diff --git a/meta/recipes-devtools/dpkg/dpkg_1.16.9.bb b/meta/recipes-devtools/dpkg/dpkg_1.16.9.bb
index 9ae4042..c1b23fc 100644
--- a/meta/recipes-devtools/dpkg/dpkg_1.16.9.bb
+++ b/meta/recipes-devtools/dpkg/dpkg_1.16.9.bb
@@ -6,9 +6,13 @@ SRC_URI += "file://noman.patch \
file://check_version.patch \
file://preinst.patch \
file://fix-timestamps.patch \
- file://remove-tar-no-timestamp.patch"
+ file://remove-tar-no-timestamp.patch \
+ ${@base_contains('DISTRO_FEATURES', 'debug-tweak', 'file://redirect-output.patch', '', d)}"
+
+POSTLOG ?= "/var/log/postinstall.log"
+CFLAGS_append += "${@base_contains('DISTRO_FEATURES', 'debug-tweak', ' -DLOGFILE=\'\"${POSTLOG}\"\'', '', d)}"
SRC_URI[md5sum] = "4df9319b2d17e19cdb6fe94dacee44da"
SRC_URI[sha256sum] = "73cd7fba4e54acddd645346b4bc517030b9c35938e82215d3eeb8b4e7af26b7a"
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] opkg: save output of postinst scripts
2013-02-20 6:16 [PATCH 0/3] Redirect output of post-install scripts when "debug-tweak" enabled Kang Kai
2013-02-20 6:16 ` [PATCH 1/3] rpm: redirect output of post install script Kang Kai
2013-02-20 6:16 ` [PATCH 2/3] dpkg: redirect output of postinstall script Kang Kai
@ 2013-02-20 6:16 ` Kang Kai
2 siblings, 0 replies; 6+ messages in thread
From: Kang Kai @ 2013-02-20 6:16 UTC (permalink / raw)
To: openembedded-core; +Cc: Zhenfeng.Zhao
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@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@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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] rpm: redirect output of post install script
2013-02-20 6:16 ` [PATCH 1/3] rpm: redirect output of post install script Kang Kai
@ 2013-02-21 14:19 ` Martin Donnelly
2013-02-22 10:49 ` Kang Kai
0 siblings, 1 reply; 6+ messages in thread
From: Martin Donnelly @ 2013-02-21 14:19 UTC (permalink / raw)
To: Kang Kai; +Cc: openembedded-core
On 20/02/2013 06:16, Kang Kai wrote:
> When distro feature "debug-tweak" enabled, redirect output of post
> install script to log file which can be configured.
Is the DISTRO_FEATURE not "debug-tweaks" here and not "debug-tweak"?
Martin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] rpm: redirect output of post install script
2013-02-21 14:19 ` Martin Donnelly
@ 2013-02-22 10:49 ` Kang Kai
0 siblings, 0 replies; 6+ messages in thread
From: Kang Kai @ 2013-02-22 10:49 UTC (permalink / raw)
To: Martin Donnelly; +Cc: openembedded-core
On 2013年02月21日 22:19, Martin Donnelly wrote:
> On 20/02/2013 06:16, Kang Kai wrote:
>> When distro feature "debug-tweak" enabled, redirect output of post
>> install script to log file which can be configured.
>
> Is the DISTRO_FEATURE not "debug-tweaks" here and not "debug-tweak"?
My mistake. It should be "debug-tweaks". Thanks.
I'll send new patches.
Regards,
Kai
>
> Martin
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-02-22 11:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-20 6:16 [PATCH 0/3] Redirect output of post-install scripts when "debug-tweak" enabled Kang Kai
2013-02-20 6:16 ` [PATCH 1/3] rpm: redirect output of post install script Kang Kai
2013-02-21 14:19 ` Martin Donnelly
2013-02-22 10:49 ` Kang Kai
2013-02-20 6:16 ` [PATCH 2/3] dpkg: redirect output of postinstall script Kang Kai
2013-02-20 6:16 ` [PATCH 3/3] opkg: save output of postinst scripts Kang Kai
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.