RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/python/ header-py.c rpm/tools/ rpmcache.c

From: Jeff Johnson <jbj@rpm5.org>
Date: Sun 14 Oct 2007 - 20:50:25 CEST
Message-Id: <20071014185025.6009F348466@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   14-Oct-2007 20:50:25
  Branch: HEAD                             Handle: 2007101419502401

  Modified files:
    rpm                     CHANGES
    rpm/python              header-py.c
    rpm/tools               rpmcache.c

  Log:
    - yet more hge fixups.

  Summary:
    Revision    Changes     Path
    1.1704      +1  -0      rpm/CHANGES
    1.60        +54 -30     rpm/python/header-py.c
    2.17        +12 -4      rpm/tools/rpmcache.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1703 -r1.1704 CHANGES
  --- rpm/CHANGES	14 Oct 2007 18:29:08 -0000	1.1703
  +++ rpm/CHANGES	14 Oct 2007 18:50:24 -0000	1.1704
  @@ -1,4 +1,5 @@
   4.5 -> 5.0:
  +    - jbj: yet more hge fixups.
       - jbj: reqprov.c: use headerGetExtension everywhere.
       - jbj: parsePreamble.c: use headerGetExtension everywhere.
       - jbj: pack.c: use headerGetExtension everywhere.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/python/header-py.c
  ============================================================================
  $ cvs diff -u -r1.59 -r1.60 header-py.c
  --- rpm/python/header-py.c	14 Oct 2007 15:15:15 -0000	1.59
  +++ rpm/python/header-py.c	14 Oct 2007 18:50:24 -0000	1.60
  @@ -205,18 +205,22 @@
   static void compressFilelist(Header h)
   	/*@modifies h @*/
   {
  -    HGE_t hge = (HGE_t)headerGetEntryMinMemory;
  +    HGE_t hge = (HGE_t)headerGetExtension;
  +    int_32 he_t = 0;
  +    hRET_t he_p = { .ptr = NULL };
  +    int_32 he_c = 0;
  +    HE_s he_s = { .tag = 0, .t = &he_t, .p = &he_p, .c = &he_c, .freeData = 0 };
  +    HE_t he = &he_s;
       HAE_t hae = (HAE_t)headerAddEntry;
       HRE_t hre = (HRE_t)headerRemoveEntry;
  -    HFD_t hfd = headerFreeData;
  -    char ** fileNames;
  +    const char ** fileNames;
       const char ** dirNames;
       const char ** baseNames;
       int_32 * dirIndexes;
  -    rpmTagType fnt;
       int count;
  -    int i, xx;
       int dirIndex = -1;
  +    int xx;
  +    int i;
   
       /*
        * This assumes the file list is already sorted, and begins with a
  @@ -229,10 +233,12 @@
   	return;		/* Already converted. */
       }
   
  -    if (!hge(h, RPMTAG_OLDFILENAMES, &fnt, &fileNames, &count))
  +    he->tag = RPMTAG_OLDFILENAMES;
  +    xx = hge(h, he->tag, he->t, he->p, he->c);
  +    fileNames = he_p.argv;
  +    count = he_c;
  +    if (!xx || fileNames == NULL || count <= 0)
   	return;		/* no file list */
  -    if (fileNames == NULL || count <= 0)
  -	return;
   
       dirNames = alloca(sizeof(*dirNames) * count);	/* worst case */
       baseNames = alloca(sizeof(*dirNames) * count);
  @@ -289,11 +295,12 @@
   			dirNames, dirIndex + 1);
       }
   
  -    fileNames = hfd(fileNames, fnt);
  +    fileNames = _free(fileNames);
   
       xx = hre(h, RPMTAG_OLDFILENAMES);
   }
   /*@=bounds@*/
  +
   /* make a header with _all_ the tags we need */
   /**
    */
  @@ -332,45 +339,59 @@
    */
   static void providePackageNVR(Header h)
   {
  -    HGE_t hge = (HGE_t)headerGetEntryMinMemory;
  -    HFD_t hfd = headerFreeData;
  -    const char *name, *version, *release;
  -    int_32 * epoch;
  +    HGE_t hge = (HGE_t)headerGetExtension;
  +    int_32 he_t = 0;
  +    hRET_t he_p = { .ptr = NULL };
  +    int_32 he_c = 0;
  +    HE_s he_s = { .tag = 0, .t = &he_t, .p = &he_p, .c = &he_c, .freeData = 0 };
  +    HE_t he = &he_s;
  +    const char *N, *V, *R;
  +    int_32 E;
  +    int gotE;
       const char *pEVR;
       char *p;
       int_32 pFlags = RPMSENSE_EQUAL;
       const char ** provides = NULL;
       const char ** providesEVR = NULL;
  -    rpmTagType pnt, pvt;
       int_32 * provideFlags = NULL;
       int providesCount;
       int i, xx;
       int bingo = 1;
   
  -    /* Generate provides for this package name-version-release. */
  -    xx = headerNEVRA(h, &name, NULL, &version, &release, NULL);
  -    if (!(name && version && release))
  +    /* Generate provides for this package N-V-R. */
  +    xx = headerNEVRA(h, &N, NULL, &V, &R, NULL);
  +    if (!(N && V && R))
   	return;
  -    pEVR = p = alloca(21 + strlen(version) + 1 + strlen(release) + 1);
  +    pEVR = p = alloca(21 + strlen(V) + 1 + strlen(R) + 1);
       *p = '\0';
  -    if (hge(h, RPMTAG_EPOCH, NULL, &epoch, NULL)) {
  -	sprintf(p, "%d:", *epoch);
  -	while (*p != '\0')
  -	    p++;
  +    he->tag = RPMTAG_EPOCH;
  +    gotE = hge(h, he->tag, he->t, he->p, he->c);
  +    E = (he_p.i32p ? *he_p.i32p : 0);
  +    he_p.ptr = _free(he_p.ptr);
  +    if (gotE) {
  +	sprintf(p, "%d:", E);
  +	p += strlen(p);
       }
  -    (void) stpcpy( stpcpy( stpcpy(p, version) , "-") , release);
  +    (void) stpcpy( stpcpy( stpcpy(p, V) , "-") , R);
   
       /*
        * Rpm prior to 3.0.3 does not have versioned provides.
        * If no provides at all are available, we can just add.
        */
  -    if (!hge(h, RPMTAG_PROVIDENAME, &pnt, &provides, &providesCount))
  +    he->tag = RPMTAG_PROVIDENAME;
  +    xx = hge(h, he->tag, he->t, he->p, he->c);
  +    provides = he_p.argv;
  +    providesCount = he_c;
  +    if (!xx)
   	goto exit;
   
       /*
        * Otherwise, fill in entries on legacy packages.
        */
  -    if (!hge(h, RPMTAG_PROVIDEVERSION, &pvt, &providesEVR, NULL)) {
  +    he->tag = RPMTAG_PROVIDEVERSION;
  +    xx = hge(h, he->tag, he->t, he->p, he->c);
  +    providesEVR = he_p.argv;
  +    if (!xx) {
   	for (i = 0; i < providesCount; i++) {
   	    char * vdummy = "";
   	    int_32 fdummy = RPMSENSE_ANY;
  @@ -382,7 +403,9 @@
   	goto exit;
       }
   
  -    xx = hge(h, RPMTAG_PROVIDEFLAGS, NULL, &provideFlags, NULL);
  +    he->tag = RPMTAG_PROVIDEFLAGS;
  +    xx = hge(h, he->tag, he->t, he->p, he->c);
  +    provideFlags = he_p.i32p;
   
       /*@-nullderef@*/	/* LCL: providesEVR is not NULL */
       if (provides && providesEVR && provideFlags)
  @@ -390,7 +413,7 @@
           if (!(provides[i] && providesEVR[i]))
               continue;
   	if (!(provideFlags[i] == RPMSENSE_EQUAL &&
  -	    !strcmp(name, provides[i]) && !strcmp(pEVR, providesEVR[i])))
  +	    !strcmp(N, provides[i]) && !strcmp(pEVR, providesEVR[i])))
   	    continue;
   	bingo = 0;
   	break;
  @@ -398,12 +421,13 @@
       /*@=nullderef@*/
   
   exit:
  -    provides = hfd(provides, pnt);
  -    providesEVR = hfd(providesEVR, pvt);
  +    provides = _free(provides);
  +    providesEVR = _free(providesEVR);
  +    provideFlags = _free(provideFlags);
   
       if (bingo) {
   	xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDENAME, RPM_STRING_ARRAY_TYPE,
  -		&name, 1);
  +		&N, 1);
   	xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS, RPM_INT32_TYPE,
   		&pFlags, 1);
   	xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION, RPM_STRING_ARRAY_TYPE,
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/tools/rpmcache.c
  ============================================================================
  $ cvs diff -u -r2.16 -r2.17 rpmcache.c
  --- rpm/tools/rpmcache.c	11 Oct 2007 19:44:25 -0000	2.16
  +++ rpm/tools/rpmcache.c	14 Oct 2007 18:50:25 -0000	2.17
  @@ -105,7 +105,12 @@
   
   static int ftsCacheUpdate(rpmts ts)
   {
  -    HGE_t hge = (HGE_t)headerGetEntryMinMemory;
  +    HGE_t hge = (HGE_t)headerGetExtension;
  +    int_32 he_t = 0;
  +    hRET_t he_p = { .ptr = NULL };
  +    int_32 he_c = 0;
  +    HE_s he_s = { .tag = 0, .t = &he_t, .p = &he_p, .c = &he_c, .freeData = 0 };
  +    HE_t he = &he_s;
       int_32 tid = rpmtsGetTid(ts);
       rpmdbMatchIterator mi;
       unsigned char * md5;
  @@ -129,13 +134,16 @@
   	}
   
   	/* --- Check that identical package is not already cached. */
  - 	if (!hge(ip->h, RPMTAG_SIGMD5, NULL, (void **) &md5, NULL)
  -	 || md5 == NULL)
  -	{
  +	he->tag = RPMTAG_SIGMD5;
  +	xx = hge(ip->h, he->tag, he->t, he->p, he->c);
  +	md5 = he_p.ui8p;
  + 	if (!xx || md5 == NULL) {
  +	    md5 = _free(md5);
   	    rc = 1;
   	    break;
   	}
           mi = rpmtsInitIterator(ts, RPMTAG_SIGMD5, md5, 16);
  +	md5 = _free(md5);
   	rc = rpmdbGetIteratorCount(mi);
           mi = rpmdbFreeIterator(mi);
   	if (rc) {
  @@ .
Received on Sun Oct 14 20:50:25 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.