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:   16-Feb-2010 16:12:21
  Branch: HEAD                             Handle: 2010021615122001

  Modified files:
    rpm                     CHANGES
    rpm/build               parseDescription.c spec.c

  Log:
    - fix: split NV iff V starts with digit string in lookupPackage().
    - fix: remove the inheirited %description before adding explicitly.

  Summary:
    Revision    Changes     Path
    1.3270      +2  -0      rpm/CHANGES
    2.44        +9  -10     rpm/build/parseDescription.c
    2.207       +17 -14     rpm/build/spec.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.3269 -r1.3270 CHANGES
  --- rpm/CHANGES       10 Feb 2010 18:36:16 -0000      1.3269
  +++ rpm/CHANGES       16 Feb 2010 15:12:20 -0000      1.3270
  @@ -1,5 +1,7 @@
   
   5.2b1 -> 5.3a1
  +    - jbj: fix: split NV iff V starts with digit string in lookupPackage().
  +    - jbj: fix: remove the inheirited %description before adding explicitly.
       - jbj: use a Bloom filter so that build sanity checks scale.
       - jbj: fix rpmInstallSourcePackage() refcnts and memory leaks.
       - jbj: fix: don't segfault on --rebuild. the better fix is to eliminate
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/parseDescription.c
  ============================================================================
  $ cvs diff -u -r2.43 -r2.44 parseDescription.c
  --- rpm/build/parseDescription.c      4 Apr 2009 03:37:51 -0000       2.43
  +++ rpm/build/parseDescription.c      16 Feb 2010 15:12:21 -0000      2.44
  @@ -89,17 +89,16 @@
        goto exit;
       }
   
  -
  -    /******************/
  -
  -#if 0    
  -    if (headerIsEntry(pkg->header, RPMTAG_DESCRIPTION)) {
  -     rpmlog(RPMLOG_ERR, _("line %d: Second description\n"),
  -             spec->lineNum);
  -     goto exit;
  +    /* Lose the inheirited %description (if present). */
  +    {        HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
  +     int xx;
  +     he->tag = RPMTAG_DESCRIPTION;
  +     xx = headerGet(pkg->header, he, 0);
  +     he->p.ptr = _free(he->p.ptr);
  +     if (xx && he->t == RPM_STRING_TYPE)
  +         xx = headerDel(pkg->header, he, 0);
       }
  -#endif
  -
  +    
       t = stashSt(spec, pkg->header, RPMTAG_DESCRIPTION, lang);
       
       iob = rpmiobNew(0);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/spec.c
  ============================================================================
  $ cvs diff -u -r2.206 -r2.207 spec.c
  --- rpm/build/spec.c  10 Feb 2010 18:36:17 -0000      2.206
  +++ rpm/build/spec.c  16 Feb 2010 15:12:21 -0000      2.207
  @@ -73,21 +73,20 @@
       return NULL;
   }
   
  -rpmRC lookupPackage(Spec spec, const char *name, int flag, 
/*...@out@*/Package *pkg)
  +rpmRC lookupPackage(Spec spec, const char *name, int flag, 
/*...@out@*/Package *pkgp)
   {
       HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
       char *NV = NULL;
       char *N = NULL;
       char *V = NULL;
  -    Package p, lastp;
  +    Package p;
  +    Package lastp = spec->packages;
  +    rpmRC rc = RPMRC_OK;
       int xx;
       
       /* "main" package */
  -    if (name == NULL) {
  -     if (pkg)
  -         *pkg = spec->packages;
  -     return RPMRC_OK;
  -    }
  +    if (name == NULL)
  +     goto exit;
   
       /* Construct package name */
       if (flag == PART_SUBNAME) {
  @@ -98,10 +97,12 @@
        he->p.ptr = _free(he->p.ptr);
       } else {
        N = xstrdup(name);
  -     if ((V = strrchr(N, '-')) != NULL) {
  +     /* XXX restrict V to leading digit to prevent NV split ambiguity. */
  +     if ((V = strrchr(N, '-')) != NULL && xisdigit(V[1])) {
            NV = xstrdup(N);
            *V++ = '\0';
  -     }
  +     } else
  +         V = NULL;
       }
   
       /* Match last package with same N or same {N,V} */
  @@ -129,7 +130,7 @@
            if (!strcmp(N, n))
                lastp = p;
        } else {
  -         if (!strcmp(NV, nv) ||  !strcmp(NV, n)
  +         if (!strcmp(NV, nv) || !strcmp(NV, n)
            || (!strcmp(N, n) && (V == NULL || !strcmp(V, v))))
                lastp = p;
        }
  @@ -139,12 +140,14 @@
        nv = _free(nv);
   /*...@=usereleased@*/
       }
  -
  -    if (pkg)
  -     /*...@-dependenttrans@*/ *pkg = lastp; /*...@=dependenttrans@*/
  +    rc = (lastp == NULL ? RPMRC_FAIL : RPMRC_OK);
       NV = _free(NV);
       N = _free(N);
  -    return ((lastp == NULL) ? RPMRC_FAIL : RPMRC_OK);
  +
  +exit:
  +    if (pkgp)
  +     /*...@-dependenttrans@*/ *pkgp = lastp; /*...@=dependenttrans@*/
  +    return rc;
   }
   
   static void pkgFini(void * _pkg)
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                [email protected]

Reply via email to