RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Ralf S. Engelschall Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 21-Jun-2007 15:53:44 Branch: HEAD Handle: 2007062114534400 Modified files: rpm CHANGES rpm/build parsePrep.c Log: Although %setup and %patch look like regular RPM macros on the first spot they are not real macros, of course. Instead they are parsed and treated very special by RPM internally. Unfortunately, this internal handling didn't allow for any leading whitespaces in front of %setup and %patch in *.spec files. This is a problem if one uses ultra strictly formatted .spec files (as we do in OpenPKG) where all section content is consequently indented. Hence for cosmetics and consistency addicts like me this short-coming in the parsing of %setup and %patch was never acceptable, so I applied this little change to the OpenPKG RPM since six years now. I think it will not cause trouble, but better to let it be reviewed by others first. Summary: Revision Changes Path 1.1386 +1 -0 rpm/CHANGES 2.73 +7 -4 rpm/build/parsePrep.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.1385 -r1.1386 CHANGES --- rpm/CHANGES 21 Jun 2007 12:25:43 -0000 1.1385 +++ rpm/CHANGES 21 Jun 2007 13:53:44 -0000 1.1386 @@ -1,4 +1,5 @@ 4.5 -> 5.0: + - rse: allow leading whitespaces on %setup and %patch lines in *.spec files - rse: resolve portability issue related to double definition of mergesort(3) - rse: fix building under UnixWare (blind port) - rse: fix building under FreeBSD 7-CURRENT @@ . patch -p0 <<'@@ .' Index: rpm/build/parsePrep.c ============================================================================ $ cvs diff -u -r2.72 -r2.73 parsePrep.c --- rpm/build/parsePrep.c 19 Jun 2007 13:48:44 -0000 2.72 +++ rpm/build/parsePrep.c 21 Jun 2007 13:53:44 -0000 2.73 @@ -674,6 +674,7 @@ int nextPart, res, rc; StringBuf sb; char **lines, **saveLines; + char *cp; if (spec->prep != NULL) { rpmError(RPMERR_BADSPEC, _("line %d: second %%prep\n"), spec->lineNum); @@ -713,11 +714,13 @@ /[EMAIL PROTECTED]@*/ for (lines = saveLines; *lines; lines++) { res = 0; + for (cp = *lines; *cp == ' ' || *cp == '\t'; cp++) + ; /[EMAIL PROTECTED]@*/ - if (! strncmp(*lines, "%setup", sizeof("%setup")-1)) { - res = doSetupMacro(spec, *lines); - } else if (! strncmp(*lines, "%patch", sizeof("%patch")-1)) { - res = doPatchMacro(spec, *lines); + if (! strncmp(cp, "%setup", sizeof("%setup")-1)) { + res = doSetupMacro(spec, cp); + } else if (! strncmp(cp, "%patch", sizeof("%patch")-1)) { + res = doPatchMacro(spec, cp); } else { appendLineStringBuf(spec->prep, *lines); } @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org