RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/build/ files.c pack.c parseSpec.c rpm/lib/...

From: Jeff Johnson <jbj@rpm5.org>
Date: Sun 14 Oct 2007 - 02:36:22 CEST
Message-Id: <20071014003622.D1ED9348474@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 02:36:22
  Branch: HEAD                             Handle: 2007101401362101

  Modified files:
    rpm                     CHANGES
    rpm/build               files.c pack.c parseSpec.c
    rpm/lib                 transaction.c
    rpm/python              header-py.c

  Log:
    - use (*hge), not headerGetExtension, everywhere.

  Summary:
    Revision    Changes     Path
    1.1691      +1  -0      rpm/CHANGES
    1.268       +11 -4      rpm/build/files.c
    2.233       +11 -5      rpm/build/pack.c
    2.105       +11 -5      rpm/build/parseSpec.c
    1.340       +24 -10     rpm/lib/transaction.c
    1.58        +41 -23     rpm/python/header-py.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1690 -r1.1691 CHANGES
  --- rpm/CHANGES	13 Oct 2007 23:57:36 -0000	1.1690
  +++ rpm/CHANGES	14 Oct 2007 00:36:21 -0000	1.1691
  @@ -1,4 +1,5 @@
   4.5 -> 5.0:
  +    - jbj: use (*hge), not headerGetExtension, everywhere.
       - jbj: psm.c: use headerGetExtension everywhere.
       - jbj: rpminstall.c: use headerGetExtension everywhere.
       - jbj: rpmfc.c: use headerGetExtension everywhere.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/files.c
  ============================================================================
  $ cvs diff -u -r1.267 -r1.268 files.c
  --- rpm/build/files.c	12 Oct 2007 18:53:48 -0000	1.267
  +++ rpm/build/files.c	14 Oct 2007 00:36:21 -0000	1.268
  @@ -2664,13 +2664,19 @@
   	/*@globals check_fileList @*/
   	/*@modifies check_fileList @*/
   {
  +    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;
       Package pkg;
       int res = 0;
  +    int xx;
       
       check_fileList = newStringBuf();
       
       for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
  -	const char *NVRA = NULL;
   	int rc;
   
   	if (pkg->fileList == NULL)
  @@ -2678,9 +2684,10 @@
   
   	(void) headerMacrosLoad(pkg->header);
   
  -	(void) headerGetExtension(pkg->header, RPMTAG_NVRA, NULL, &NVRA, NULL);
  -	rpmlog(RPMLOG_NOTICE, _("Processing files: %s\n"), NVRA);
  -	NVRA = _free(NVRA);
  +	he->tag = RPMTAG_NVRA;
  +	xx = hge(pkg->header, he->tag, he->t, he->p, he->c);
  +	rpmlog(RPMLOG_NOTICE, _("Processing files: %s\n"), he_p.str);
  +	he_p.ptr = _free(he_p.ptr);
   		   
   	if ((rc = processPackageFiles(spec, pkg, installSpecialDoc, test)))
   	    res = rc;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/pack.c
  ============================================================================
  $ cvs diff -u -r2.232 -r2.233 pack.c
  --- rpm/build/pack.c	11 Oct 2007 19:44:21 -0000	2.232
  +++ rpm/build/pack.c	14 Oct 2007 00:36:21 -0000	2.233
  @@ -837,11 +837,18 @@
   /*@-boundswrite@*/
   int packageBinaries(Spec spec)
   {
  +    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;
       struct cpioSourceArchive_s csabuf;
       CSA_t csa = &csabuf;
       int rc;
       const char *errorString;
       Package pkg;
  +    int xx;
   
       for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
   	const char *fn;
  @@ -884,12 +891,11 @@
   			       rpmHeaderFormats, &errorString);
   	    binFormat = _free(binFormat);
   	    if (binRpm == NULL) {
  -		const char *NVRA = NULL;
  -		(void) headerGetExtension(pkg->header, RPMTAG_NVRA,
  -			NULL, &NVRA, NULL);
  +		he->tag = RPMTAG_NVRA;
  +		xx = hge(pkg->header, he->tag, he->t, he->p, he->c);
   		rpmlog(RPMLOG_ERR, _("Could not generate output "
  -		     "filename for package %s: %s\n"), NVRA, errorString);
  -		NVRA = _free(NVRA);
  +		     "filename for package %s: %s\n"), he_p.str, errorString);
  +		he_p.ptr = _free(he_p.ptr);
   		return RPMRC_FAIL;
   	    }
   	    fn = rpmGetPath("%{_rpmdir}/", binRpm, NULL);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/parseSpec.c
  ============================================================================
  $ cvs diff -u -r2.104 -r2.105 parseSpec.c
  --- rpm/build/parseSpec.c	11 Oct 2007 19:14:36 -0000	2.104
  +++ rpm/build/parseSpec.c	14 Oct 2007 00:36:21 -0000	2.105
  @@ -434,10 +434,17 @@
   		int recursing, const char *passPhrase,
   		const char *cookie, int anyarch, int force, int verify)
   {
  +    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;
       rpmParseState parsePart = PART_PREAMBLE;
       int initialPackage = 1;
       Package pkg;
       Spec spec;
  +    int xx;
       
       /* Set up a new Spec structure with no packages. */
       spec = newSpec();
  @@ -600,12 +607,11 @@
   
       for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
   	if (!headerIsEntry(pkg->header, RPMTAG_DESCRIPTION)) {
  -	    const char * NVRA = NULL;
  -	    (void) headerGetExtension(pkg->header, RPMTAG_NVRA,
  -			NULL, &NVRA, NULL);
  +	    he->tag = RPMTAG_NVRA;
  +	    xx = hge(pkg->header, he->tag, he->t, he->p, he->c);
   	    rpmlog(RPMLOG_ERR, _("Package has no %%description: %s\n"),
  -			NVRA);
  -	    NVRA = _free(NVRA);
  +			he_p.str);
  +	    he_p.ptr = _free(he_p.ptr);
   	    spec = freeSpec(spec);
   	    return RPMRC_FAIL;
   	}
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/transaction.c
  ============================================================================
  $ cvs diff -u -r1.339 -r1.340 transaction.c
  --- rpm/lib/transaction.c	13 Oct 2007 18:15:03 -0000	1.339
  +++ rpm/lib/transaction.c	14 Oct 2007 00:36:22 -0000	1.340
  @@ -100,12 +100,18 @@
   	/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
   	/*@modifies ts, p, fi, rpmGlobalMacroContext, fileSystem, internalState @*/
   {
  +    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 * altNVRA = NULL;
       uint_32 tscolor = rpmtsColor(ts);
       uint_32 prefcolor = rpmtsPrefColor(ts);
       uint_32 otecolor, tecolor;
       uint_32 oFColor, FColor;
       uint_32 oFFlags, FFlags;
  -    hRET_t altNVRA = { .ptr = NULL };
       rpmfi otherFi = NULL;
       rpmps ps;
       int xx;
  @@ -118,8 +124,10 @@
   	mi = rpmtsInitIterator(ts, RPMDBI_PACKAGES,
   			&shared->otherPkg, sizeof(shared->otherPkg));
   	while ((h = rpmdbNextIterator(mi)) != NULL) {
  -	    xx = headerGetExtension(h, RPMTAG_NVRA, NULL, &altNVRA, NULL);
  -assert(altNVRA.str != NULL);
  +	    he->tag = RPMTAG_NVRA;
  +	    xx = hge(h, he->tag, he->t, he->p, he->c);
  +assert(he_p.str != NULL);
  +	    altNVRA = he_p.str;
   	    otherFi = rpmfiNew(ts, h, RPMTAG_BASENAMES, scareMem);
   	    break;
   	}
  @@ -200,7 +208,7 @@
   		rpmpsAppend(ps, RPMPROB_FILE_CONFLICT,
   			rpmteNEVRA(p), rpmteKey(p),
   			rpmfiDN(fi), rpmfiBN(fi),
  -			altNVRA.str,
  +			altNVRA,
   			0);
   	    }
   
  @@ -224,7 +232,7 @@
       }
       ps = rpmpsFree(ps);
   
  -    altNVRA.ptr = _free(altNVRA.ptr);
  +    altNVRA = _free(altNVRA);
       otherFi = rpmfiFree(otherFi);
   
       p->replaced = xrealloc(p->replaced,
  @@ -603,6 +611,12 @@
   		const rpmte p, const Header h)
   	/*@modifies ts @*/
   {
  +    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 reqFlags = (RPMSENSE_LESS | RPMSENSE_EQUAL);
       const char * reqEVR;
       rpmds req;
  @@ -628,15 +642,15 @@
   
       if (rc == 0) {
   	rpmps ps = rpmtsProblems(ts);
  -	hRET_t altNVRA = { .ptr = NULL };
  -	rc = headerGetExtension(h, RPMTAG_NVRA, NULL, &altNVRA, NULL);
  -assert(altNVRA.str != NULL);
  +	he->tag = RPMTAG_NVRA;
  +	rc = hge(h, he->tag, he->t, he->p, he->c);
  +assert(he_p.str != NULL);
   	rpmpsAppend(ps, RPMPROB_OLDPACKAGE,
   		rpmteNEVR(p), rpmteKey(p),
   		NULL, NULL,
  -		altNVRA.str,
  +		he_p.str,
   		0);
  -	altNVRA.ptr = _free(altNVRA.ptr);
  +	he_p.ptr = _free(he_p.ptr);
   	ps = rpmpsFree(ps);
   	rc = 1;
       } else
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/python/header-py.c
  ============================================================================
  $ cvs diff -u -r1.57 -r1.58 header-py.c
  --- rpm/python/header-py.c	12 Oct 2007 18:55:58 -0000	1.57
  +++ rpm/python/header-py.c	14 Oct 2007 00:36:22 -0000	1.58
  @@ -171,6 +171,12 @@
   static void expandFilelist(Header h)
           /*@modifies h @*/
   {
  +    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;
       hRET_t fileNames = { .ptr = NULL };
  @@ -179,12 +185,12 @@
   
       /*@-branchstate@*/
       if (!headerIsEntry(h, RPMTAG_OLDFILENAMES)) {
  -	headerGetExtension(h, RPMTAG_FILEPATHS, NULL, &fileNames, &count);
  -	if (fileNames.ptr == NULL || count <= 0)
  +	he->tag = RPMTAG_FILEPATHS;
  +	xx = hge(h, he->tag, he->t, he->p, he->c);
  +	if (he_p.ptr == NULL || he_c <= 0)
   	    return;
  -	xx = hae(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
  -			fileNames.ptr, count);
  -	fileNames.ptr = _free(fileNames.ptr);
  +	xx = hae(h, RPMTAG_OLDFILENAMES, he_t, he_p.ptr, he_c);
  +	he_p.ptr = _free(he_p.ptr);
       }
       /*@=branchstate@*/
   
  @@ -296,24 +302,30 @@
   static void mungeFilelist(Header h)
   	/*@*/
   {
  -    hRET_t fileNames = { .ptr = NULL };
  +    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 count = 0;
  +    int xx;
   
       if (!headerIsEntry (h, RPMTAG_BASENAMES)
   	|| !headerIsEntry (h, RPMTAG_DIRNAMES)
   	|| !headerIsEntry (h, RPMTAG_DIRINDEXES))
   	compressFilelist(h);
   
  -    headerGetExtension(h, RPMTAG_FILEPATHS, NULL, &fileNames, &count);
  +    he->tag = RPMTAG_FILEPATHS;
  +    xx = hge(h, he->tag, he->t, he->p, he->c);
   
  -    if (fileNames.ptr == NULL || count <= 0)
  +    if (he_p.ptr == NULL || he_c <= 0)
   	return;
   
       /* XXX Legacy tag needs to go away. */
  -    headerAddEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
  -			fileNames.ptr, count);
  +    headerAddEntry(h, RPMTAG_OLDFILENAMES, he_t, he_p.ptr, he_c);
   
  -    fileNames.ptr = _free(fileNames.ptr);
  +    he_p.ptr = _free(he_p.ptr);
   }
   
   /**
  @@ -663,20 +675,26 @@
   		/*@out@*/ void **p, /*@out@*/ int_32 *c)
   	/*@modifies *type, *p, *c @*/
   {
  +    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 xx;
  +
       switch (tag) {
       case RPMTAG_OLDFILENAMES:
  -    {	hRET_t fl = { .ptr = NULL };
  -	int count;
  -	int xx;
  -	xx = headerGetExtension(h, RPMTAG_FILEPATHS, NULL, &fl, &count);
  -	if (count > 0) {
  -	    *p = fl.ptr;
  -	    if (c)	*c = count;
  -	    if (type)	*type = RPM_STRING_ARRAY_TYPE;
  -	    return 1;
  -	}
  -	if (c)	*c = 0;
  -	return 0;
  +    {	
  +	he->tag = RPMTAG_FILEPATHS;
  +	xx = hge(h, he->tag, he->t, he->p, he->c);
  +	if (p)
  +	    *p = he_p.ptr;
  +	else
  +	    he_p.ptr = _free(he_p.ptr);
  +	if (c)	*c = he_c;
  +	if (type)	*type = he_t;
  +	return (he_c > 0 ? 1 : 0);
       }	/*@notreached@*/ break;
   
       case RPMTAG_GROUP:
  @@ .
Received on Sun Oct 14 02:36:22 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.