RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 05-Jun-2008 17:39:38 Branch: rpm-5_1 Handle: 2008060515393800 Modified files: (Branch: rpm-5_1) rpm CHANGES rpm/build spec.c Log: - jbj: add expanded build scripts for --specsrpm --queryformat spewage. Summary: Revision Changes Path 1.2288.2.48 +1 -0 rpm/CHANGES 2.185.2.2 +64 -0 rpm/build/spec.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.2288.2.47 -r1.2288.2.48 CHANGES --- rpm/CHANGES 5 Jun 2008 14:26:39 -0000 1.2288.2.47 +++ rpm/CHANGES 5 Jun 2008 15:39:38 -0000 1.2288.2.48 @@ -17,6 +17,7 @@ - jbj: tests: download popt-1.14 packages for use in tests. - jbj: yaml: fix: single element string arrays had extra "- ". - jbj: yaml: remove the hotwired hack for SRPM dirnames indentation. + - jbj: add expanded build scripts for --specsrpm --queryformat spewage. - jbj: backport --queryformat pipeline syntax from HEAD. - jbj: update Russian PO file (from Translation Project). - jbj: upgrade to db-4.7.25. @@ . patch -p0 <<'@@ .' Index: rpm/build/spec.c ============================================================================ $ cvs diff -u -r2.185.2.1 -r2.185.2.2 spec.c --- rpm/build/spec.c 18 May 2008 14:48:46 -0000 2.185.2.1 +++ rpm/build/spec.c 5 Jun 2008 15:39:38 -0000 2.185.2.2 @@ -757,6 +757,69 @@ } /** + * Add expanded build scriptlet to srpm header. + * @param h srpm header + * @param progTag interpreter tag (0 disables) + * @param scriptTag script tag (0 disables) + * @param sb script body sting buf (NULL disables) + * @return 0 always + */ +static int initSourceHeaderScriptlet(Header h, + rpmTag progTag, rpmTag scriptTag, StringBuf sb) + /[EMAIL PROTECTED] h @*/ +{ + HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he)); + int xx; + + if (progTag !=(rpmTag) 0) { + static const char prog[] = "/bin/sh"; /* XXX FIXME */ + he->tag = progTag; + he->t = RPM_STRING_TYPE; + he->p.str = prog; + he->c = 1; + xx = headerPut(h, he, 0); + } + + if (scriptTag != (rpmTag)0 && sb != NULL) { + he->tag = scriptTag; + he->t = RPM_STRING_TYPE; + he->p.str = getStringBuf(sb); + he->c = 1; + xx = headerPut(h, he, 0); + } + return 0; +} + +/** + * Add expanded build scriptlets to srpm header. + * @param spec spec file control structure + * @return 0 always + */ +static int initSourceHeaderScriptlets(Spec spec) + /[EMAIL PROTECTED] spec->sourceHeader @*/ +{ + int xx; + + if (spec->prep != NULL) + xx = initSourceHeaderScriptlet(spec->sourceHeader, + tagValue("Buildprepprog"), tagValue("Buildprep"), spec->prep); + if (spec->build != NULL) + xx = initSourceHeaderScriptlet(spec->sourceHeader, + tagValue("Buildbuildprog"), tagValue("Buildbuild"), spec->build); + if (spec->install != NULL) + xx = initSourceHeaderScriptlet(spec->sourceHeader, + tagValue("Buildinstallprog"), tagValue("Buildinstall"), spec->install); + if (spec->check != NULL) + xx = initSourceHeaderScriptlet(spec->sourceHeader, + tagValue("Buildcheckprog"), tagValue("Buildcheck"), spec->check); + if (spec->clean != NULL) + xx = initSourceHeaderScriptlet(spec->sourceHeader, + tagValue("Buildcleanprog"), tagValue("Buildclean"), spec->clean); + + return 0; +} + +/** * Parse a spec file, and query the resultant header. * @param ts rpm transaction * @param qva query args @@ -800,6 +863,7 @@ switch (qva->qva_source) { case RPMQV_SPECSRPM: xx = initSourceHeader(spec, NULL); + xx = initSourceHeaderScriptlets(spec); xx = qva->qva_showPackage(qva, ts, spec->sourceHeader); break; default: @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org