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:   04-Feb-2008 22:18:33
  Branch: rpm-5_0                          Handle: 2008020421183200

  Modified files:           (Branch: rpm-5_0)
    rpm                     CHANGES
    rpm/rpmio               macro.c

  Log:
    - jbj: backport %{shrink:...} and %{getenv:...} builtin macros.

  Summary:
    Revision    Changes     Path
    1.2054.2.37 +1  -0      rpm/CHANGES
    2.171.2.4   +27 -1      rpm/rpmio/macro.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2054.2.36 -r1.2054.2.37 CHANGES
  --- rpm/CHANGES       4 Feb 2008 16:08:02 -0000       1.2054.2.36
  +++ rpm/CHANGES       4 Feb 2008 21:18:32 -0000       1.2054.2.37
  @@ -1,4 +1,5 @@
   5.0.1 -> 5.0.2:
  +    - jbj: backport %{shrink:...} and %{getenv:...} builtin macros.
       - jbj: updated sv.po (Translation Project).
       - jbj: fix: permit #%patchN comments by forcing single line expansion.
       - jbj: document newer macro builtins ([EMAIL PROTECTED]:...}, 
%{uuid:...}, and %{lua:...} todo).
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/macro.c
  ============================================================================
  $ cvs diff -u -r2.171.2.3 -r2.171.2.4 macro.c
  --- rpm/rpmio/macro.c 1 Feb 2008 07:58:40 -0000       2.171.2.3
  +++ rpm/rpmio/macro.c 4 Feb 2008 21:18:32 -0000       2.171.2.4
  @@ -1240,6 +1240,30 @@
                   b = buf;
               }
           }
  +    } else if (STREQ("getenv", f, fn)) {
  +        char *cp;
  +        if ((cp = getenv(buf)) != NULL)
  +            b = cp;
  +    } else if (STREQ("shrink", f, fn)) {
  +        /* shrink body by removing all leading and trailing whitespaces and
  +           reducing intermediate whitespaces to a single space character */
  +        int i, j, k, was_space = 0;
  +        for (i = 0, j = 0, k = strlen(buf); i < k; ) {
  +            if (xisspace((int)(buf[i]))) {
  +                was_space = 1;
  +                i++;
  +                continue;
  +            }
  +            else if (was_space) {
  +                was_space = 0;
  +                if (j > 0) /* remove leading blanks at all */
  +                    buf[j++] = ' ';
  +                /* fallthrough */
  +            }
  +            buf[j++] = buf[i++];
  +        }
  +        buf[j] = '\0';
  +        b = buf;
       } else if (STREQ("suffix", f, fn)) {
        if ((b = strrchr(buf, '.')) != NULL)
            b++;
  @@ -1589,7 +1613,7 @@
                char *scriptbuf = (char *)xmalloc((lse-ls)+1);
                const char *printbuf;
   
  -             /* Reset the stateful output buffer bfore recursing down. */
  +             /* Reset the stateful output buffer before recursing down. */
                lua->storeprint = 1;
                lua->printbuf = NULL;
                lua->printbufsize = 0;
  @@ -1634,6 +1658,8 @@
        if (STREQ("basename", f, fn) ||
            STREQ("dirname", f, fn) ||
            STREQ("realpath", f, fn) ||
  +         STREQ("getenv", f, fn) ||
  +         STREQ("shrink", f, fn) ||
            STREQ("suffix", f, fn) ||
            STREQ("expand", f, fn) ||
            STREQ("verbose", f, fn) ||
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                [email protected]

Reply via email to