RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 30-May-2009 22:37:20 Branch: HEAD Handle: 2009053020371900 Modified files: rpm CHANGES rpm/build build.c pack.c Log: - build: add build scriptlet status/duration to SRPM headers. Summary: Revision Changes Path 1.3005 +1 -0 rpm/CHANGES 2.136 +11 -0 rpm/build/build.c 2.312 +24 -0 rpm/build/pack.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.3004 -r1.3005 CHANGES --- rpm/CHANGES 30 May 2009 14:07:43 -0000 1.3004 +++ rpm/CHANGES 30 May 2009 20:37:19 -0000 1.3005 @@ -1,5 +1,6 @@ 5.2b1 -> 5.3a1 + - jbj: build: add build scriptlet status/duration to SRPM headers. - jbj: build: use rpmsqExecve to run build scriptlets. - jbj: build: tear down _pkgPool/_specPool before exiting. - jbj: rpmsw: add an output FILE * argument. @@ . patch -p0 <<'@@ .' Index: rpm/build/build.c ============================================================================ $ cvs diff -u -r2.135 -r2.136 build.c --- rpm/build/build.c 30 May 2009 19:41:58 -0000 2.135 +++ rpm/build/build.c 30 May 2009 20:37:19 -0000 2.136 @@ -103,6 +103,7 @@ FILE * fp = NULL; urlinfo u = NULL; rpmop op = NULL; + int ix = -1; FD_t fd; FD_t xfd; @@ -115,6 +116,7 @@ name = "%prep"; iob = spec->prep; op = memset(alloca(sizeof(*op)), 0, sizeof(*op)); + ix = RPMSCRIPT_PREP; mTemplate = "%{__spec_prep_template}"; mPost = "%{__spec_prep_post}"; mCmd = "%{__spec_prep_cmd}"; @@ -123,6 +125,7 @@ name = "%build"; iob = spec->build; op = memset(alloca(sizeof(*op)), 0, sizeof(*op)); + ix = RPMSCRIPT_BUILD; mTemplate = "%{__spec_build_template}"; mPost = "%{__spec_build_post}"; mCmd = "%{__spec_build_cmd}"; @@ -131,6 +134,7 @@ name = "%install"; iob = spec->install; op = memset(alloca(sizeof(*op)), 0, sizeof(*op)); + ix = RPMSCRIPT_INSTALL; mTemplate = "%{__spec_install_template}"; mPost = "%{__spec_install_post}"; mCmd = "%{__spec_install_cmd}"; @@ -139,6 +143,7 @@ name = "%check"; iob = spec->check; op = memset(alloca(sizeof(*op)), 0, sizeof(*op)); + ix = RPMSCRIPT_CHECK; mTemplate = "%{__spec_check_template}"; mPost = "%{__spec_check_post}"; mCmd = "%{__spec_check_cmd}"; @@ -270,6 +275,9 @@ (void) rpmswEnter(op, 0); status = rpmsqExecve(argv); + if (ix >= 0 && ix < RPMSCRIPT_MAX) + spec->sstates[ix] = + (RPMSCRIPT_STATE_EXEC | RPMSCRIPT_STATE_REAPED) | (status & 0xffff); if (!WIFEXITED(status) || WEXITSTATUS(status)) { rpmlog(RPMLOG_ERR, _("Bad exit status from %s (%s)\n"), @@ -279,8 +287,11 @@ rc = RPMRC_OK; if (op != NULL) { + static unsigned int scale = 1000; (void) rpmswExit(op, 0); rpmswPrint(name, op, NULL); + if (ix >= 0 && ix < RPMSCRIPT_MAX) + spec->smetrics[ix] = op->usecs * scale; } exit: @@ . patch -p0 <<'@@ .' Index: rpm/build/pack.c ============================================================================ $ cvs diff -u -r2.311 -r2.312 pack.c --- rpm/build/pack.c 8 May 2009 14:28:41 -0000 2.311 +++ rpm/build/pack.c 30 May 2009 20:37:19 -0000 2.312 @@ -1165,7 +1165,31 @@ he->c = 1; xx = headerPut(spec->sourceHeader, he, 0); #endif + + /* Add build scriptlet status/time (if any) to SRPM's. */ + { int ix; + for (ix = 0; ix < RPMSCRIPT_MAX; ix++) { + if (spec->sstates[ix] == 0) + continue; + if (spec->smetrics[ix] == 0) + continue; + break; + } + if (ix >= 0 && ix < RPMSCRIPT_MAX) { + he->tag = RPMTAG_SCRIPTSTATES; + he->t = RPM_UINT32_TYPE; + he->p.ui32p = spec->sstates; + he->c = RPMSCRIPT_MAX; + xx = headerPut(spec->sourceHeader, he, 0); + he->tag = RPMTAG_SCRIPTMETRICS; + he->t = RPM_UINT32_TYPE; + he->p.ui32p = spec->smetrics; + he->c = RPMSCRIPT_MAX; + xx = headerPut(spec->sourceHeader, he, 0); + } + } + /* Add macros used during build to SRPM's. */ { const char ** av = NULL; (void)rpmGetMacroEntries(NULL, NULL, 1, &av); if (av != NULL && av[0] != NULL) { @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org