RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ VENDOR rpm/build/ parsePreamble.c

From: Ralf S. Engelschall <rse@rpm5.org>
Date: Thu 27 Dec 2007 - 16:32:32 CET
Message-Id: <20071227153232.3AA20348484@rpm5.org>
  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@*/
  @@ .
Received on Thu Dec 27 16:32:32 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.