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:   22-Sep-2007 19:40:54
  Branch: HEAD                             Handle: 2007092218405400

  Modified files:
    rpm                     CHANGES build.c

  Log:
    - don't punish monkeys who insist on "My Widdle .spec" naming.
    - permit -ta spec file extraction from zip/lzo/lzma compressed balls.
    - add %{?__tar_wildcards} to pass Fedora automated regression tests.
    - use %{__tar} with -ta builds to assist morons who cannot set PATH.

  Summary:
    Revision    Changes     Path
    1.1637      +4  -0      rpm/CHANGES
    2.108       +20 -19     rpm/build.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1636 -r1.1637 CHANGES
  --- rpm/CHANGES       22 Sep 2007 16:06:05 -0000      1.1636
  +++ rpm/CHANGES       22 Sep 2007 17:40:54 -0000      1.1637
  @@ -1,4 +1,8 @@
   4.5 -> 5.0:
  +    - jbj: don't punish monkeys who insist on "My Widdle .spec" naming.
  +    - jbj: permit -ta spec file extraction from zip/lzo/lzma compressed 
balls.
  +    - jbj: add %{?__tar_wildcards} to pass Fedora automated regression tests.
  +    - jbj: use %{__tar} with -ta builds to assist morons who cannot set PATH.
       - jbj: add %{mkstemp: ... } macro primitive.
       - rse: fix po/POTFILES.in and tools/Makefile.am to reflect recent 
changes (fixes "make dist", too)
       - rpm.org: cleanup main() definitions in tests and tools
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build.c
  ============================================================================
  $ cvs diff -u -r2.107 -r2.108 build.c
  --- rpm/build.c       22 Sep 2007 16:06:05 -0000      2.107
  +++ rpm/build.c       22 Sep 2007 17:40:54 -0000      2.108
  @@ -126,48 +126,49 @@
        const char * specDir;
        char * tmpSpecFile;
        char * cmd, * s;
  -     rpmCompressedMagic res = COMPRESSED_OTHER;
  -     /[EMAIL PROTECTED]@*/ static const char *zcmds[] =
  -             { "cat", "gunzip", "bunzip2", "cat" };
  +     int xx;
   
        specDir = rpmGetPath("%{_specdir}", NULL);
   
        tmpSpecFile = (char *) rpmGetPath(_specfn, NULL);
   
  -     (void) isCompressed(arg, &res);
  +     cmd = rpmExpand("%{uncompress:", arg, "} | %{__tar} -xOvf - 
%{?__tar_wildcards} ", "Specfile", " 2>&1 > '", tmpSpecFile, "'", NULL);
   
  -     cmd = alloca(strlen(arg) + 50 + strlen(tmpSpecFile));
  -     sprintf(cmd, "%s < %s | tar xOvf - Specfile 2>&1 > %s",
  -                     zcmds[res & 0x3], arg, tmpSpecFile);
  -     if (!(fp = popen(cmd, "r"))) {
  +     if ((fp = popen(cmd, "r")) == NULL) {
            rpmError(RPMERR_POPEN, _("Failed to open tar pipe: %m\n"));
  -         specDir = _free(specDir);
  +         cmd = _free(cmd);
            tmpSpecFile = _free(tmpSpecFile);
  +         specDir = _free(specDir);
            return 1;
        }
  -     if ((!fgets(buf, sizeof(buf) - 1, fp)) || !strchr(buf, '/')) {
  +     s = fgets(buf, sizeof(buf) - 1, fp);
  +     if (!s || !*s || strstr(s, ": Not found in archive")) {
            /* Try again */
            (void) pclose(fp);
  +         cmd = _free(cmd);
   
  -         sprintf(cmd, "%s < %s | tar xOvf - \\*.spec 2>&1 > %s",
  -                 zcmds[res & 0x3], arg, tmpSpecFile);
  +         cmd = rpmExpand("%{uncompress:", arg, "} | %{__tar} -xOvf - 
%{?__tar_wildcards} ", "\\*.spec", " 2>&1 > '", tmpSpecFile, "'", NULL);
            if (!(fp = popen(cmd, "r"))) {
                rpmError(RPMERR_POPEN, _("Failed to open tar pipe: %m\n"));
  -             specDir = _free(specDir);
  +             cmd = _free(cmd);
                tmpSpecFile = _free(tmpSpecFile);
  +             specDir = _free(specDir);
                return 1;
            }
  -         if (!fgets(buf, sizeof(buf) - 1, fp)) {
  +         s = fgets(buf, sizeof(buf) - 1, fp);
  +         if (!s || !*s || strstr(s, ": Not found in archive")) {
                /* Give up */
                rpmError(RPMERR_READ, _("Failed to read spec file from %s\n"),
                        arg);
  -             (void) unlink(tmpSpecFile);
  -             specDir = _free(specDir);
  +             xx = unlink(tmpSpecFile);
  +             cmd = _free(cmd);
                tmpSpecFile = _free(tmpSpecFile);
  +             specDir = _free(specDir);
                return 1;
            }
        }
        (void) pclose(fp);
  +     cmd = _free(cmd);
   
        cmd = s = buf;
        while (*cmd != '\0') {
  @@ -183,13 +184,13 @@
   
        specURL = s = alloca(strlen(specDir) + strlen(cmd) + 5);
        sprintf(s, "%s/%s", specDir, cmd);
  -     res = rename(tmpSpecFile, s);
  +     xx = Rename(tmpSpecFile, s);
        specDir = _free(specDir);
        
  -     if (res) {
  +     if (xx) {
            rpmError(RPMERR_RENAME, _("Failed to rename %s to %s: %m\n"),
                        tmpSpecFile, s);
  -         (void) unlink(tmpSpecFile);
  +         xx = Unlink(tmpSpecFile);
            tmpSpecFile = _free(tmpSpecFile);
            return 1;
        }
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to