This patch. although more convoluted than simple,
is likelier a better forward looking approach to
accessing metadata uniformly no matter what
the RPM_FOO_TYPE, or whether its a macro or a tag
or an array or lua or ....
https://lists.dulug.duke.edu/pipermail/rpm-maint/2007-November/
000567.html
The patch is integrated (although largely untested
and unused other than as a means to popuate
RPMTAG_BUILDMACROS so far).
hth Happy hacking!
73 de Jeff
On Dec 27, 2007, at 10:43 AM, Jeff Johnson wrote:
> Multiple items like
> Class: foo
> Class: bar
> was the already implemented intent.
>
> (hysterical) The comma is treated as white space
> almost (just in case there is some weird corner
> case I fergit) everwhere identical to the more usual
> white space characters \0x20 \t \n through rpmbuild.
>
> Very b0rken and awkward when everyone's primary
> MUSTHAVE demand is "legacy compatibility".
>
> I dinna have the luxury of design wrto *.spec, feel free
> to add whatever additional hackery as you see fit. I'm
> all about bulldozing existing spec files by adding
> sparkly and glittery suger loaded syntax until everyone
> cries "Uncle!" many years now.
>
> 73 de Jeff
>
> On Dec 27, 2007, at 10:32 AM, Ralf S. Engelschall wrote:
>
>> RPM Package Manager, CVS Repository
>> http://rpm5.org/cvs/
>>
>> _____________________________________________________________________
>> _______
>>
>> Server: rpm5.org Name: Ralf S.
>> Engelschall
>> Root: /v/rpm/cvs Email: rse@rpm5.org
>> Module: rpm Date: 27-Dec-2007
>> 16:32:32
>> Branch: HEAD Handle: 2007122715323101
>>
>> Modified files:
>> rpm VENDOR
>> rpm/build parsePreamble.c
>>
>> Log:
>> - OpenPKG-specific change "make-class-available-as-macro":
>> Do not treat "Class" tag as a fully arbitrary tag. In
>> OpenPKG some
>> .spec processing depends on the macro %{class} to be filled
>> from
>> the value of the "Class" tag, hence make sure it is not treated
>> fully arbitrary (or else the macro would be not available). As
>> %_arbitrary_tags restricts the allowed tags anyway, best
>> would be to
>> export also arbitrary tags as macros!
>>
>> - OpenPKG-specific change "append-tag-value-to-macro"
>> Instead of overwriting macro "foo" with the latest value
>> "quux" in
>> case of tag "Foo: bar" followed by tag "Foo: quux", set the
>> macro
>> "foo" to the comma-separated list "bar, quux". This allows
>> one to get
>> the values of all(!) tags instead of just the last one. In
>> OpenPKG we
>> use this to fetch the value of tags like BuildPreReq or
>> NoSource.
>>
>> Summary:
>> Revision Changes Path
>> 2.20 +20 -0 rpm/VENDOR
>> 2.166 +17 -0 rpm/build/parsePreamble.c
>>
>> _____________________________________________________________________
>> _______
>>
>> patch -p0 <<'@@ .'
>> Index: rpm/VENDOR
>>
>> =====================================================================
>> =======
>> $ cvs diff -u -r2.19 -r2.20 VENDOR
>> --- rpm/VENDOR 25 Dec 2007 19:22:34 -0000 2.19
>> +++ rpm/VENDOR 27 Dec 2007 15:32:31 -0000 2.20
>> @@ -328,4 +328,24 @@
>> expanded macro text already terminates
>> with a newline
>> Reason: Using e.g. rpm --eval "%{lua: print('foo\
>> \n') }" should
>> not lead to an extra trailing blank line.
>> +
>> _____________________________________________________________________
>> ___
>> +
>> + Change: make-class-available-as-macro
>> + Purpose: Do not treat "Class" tag as a fully
>> arbitrary tag.
>> + Reason: In OpenPKG some .spec processing depends
>> on the
>> + macro %{class} to be filled from the value
>> of the
>> + "Class" tag, hence make sure it is not
>> treated fully
>> + arbitrary (or else the macro would be not
>> available).
>> + Hint: As %_arbitrary_tags restricts the allowed
>> tags anyway,
>> + best would be to export also arbitrary
>> tags as macros!
>> +
>> _____________________________________________________________________
>> ___
>> +
>> + Change: append-tag-value-to-macro
>> + Purpose: Instead of overwriting macro "foo" with
>> the latest
>> + value "quux" in case of tag "Foo: bar"
>> followed
>> + by tag "Foo: quux", set the macro "foo" to
>> the
>> + comma-separated list "bar, quux".
>> + Reason: This allows one to get the values of all
>> (!) tags
>> + instead of just the last one. In OpenPKG
>> we use this
>> + to fetch the value of tags like
>> BuildPreReq or NoSource.
>>
>> @@ .
>> patch -p0 <<'@@ .'
>> Index: rpm/build/parsePreamble.c
>>
>> =====================================================================
>> =======
>> $ cvs diff -u -r2.165 -r2.166 parsePreamble.c
>> --- rpm/build/parsePreamble.c 26 Dec 2007 09:36:35 -0000 2.165
>> +++ rpm/build/parsePreamble.c 27 Dec 2007 15:32:32 -0000 2.166
>> @@ -608,6 +608,9 @@
>> break;
>> case RPMTAG_GROUP:
>> case RPMTAG_SUMMARY:
>> +#if defined(RPM_VENDOR_OPENPKG) /* make-class-available-as-
>> macro */
>> + case RPMTAG_CLASS:
>> +#endif
>> (void) stashSt(spec, pkg->header, tag, lang);
>> /*@fallthrough@*/
>> case RPMTAG_DISTRIBUTION:
>> @@ -807,7 +810,18 @@
>> }
>>
>> if (macro)
>> +#if defined(RPM_VENDOR_OPENPKG) /* append-tag-value-to-macro */
>> + {
>> + char *value = rpmExpand("%{?", macro, ":%{", macro,
>> "}, }", NULL);
>> + size_t value_len = strlen(value);
>> + value = xrealloc(value, value_len + strlen(field) + 1);
>> + strcpy(value+value_len, field);
>> + addMacro(spec->macros, macro, NULL, value, RMIL_SPEC);
>> + value = _free(value);
>> + }
>> +#else
>> addMacro(spec->macros, macro, NULL, field, RMIL_SPEC);
>> +#endif
>>
>> return RPMRC_OK;
>> }
>> @@ -884,6 +898,9 @@
>> {RPMTAG_KEYWORDS, 0, 0, "keywords"},
>> {RPMTAG_KEYWORDS, 0, 0, "keyword"},
>> {RPMTAG_BUILDPLATFORMS, 0, 0, "buildplatforms"},
>> +#if defined(RPM_VENDOR_OPENPKG) /* make-class-available-as-
>> macro */
>> + {RPMTAG_CLASS, 0, 0, "class"},
>> +#endif
>> /*@-nullassign@*/ /* LCL: can't add null annotation */
>> {0, 0, 0, 0}
>> /*@=nullassign@*/
>> @@ .
>> _____________________________________________________________________
>> _
>> RPM Package Manager http://
>> rpm5.org
>> CVS Sources Repository rpm-
>> cvs@rpm5.org
>
> ______________________________________________________________________
> RPM Package Manager http://rpm5.org
> Developer Communication List rpm-devel@rpm5.org
Received on Thu Dec 27 17:01:46 2007