RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/lib/ psm.c rpmchecksig.c rpmts.c transacti...

From: Jeff Johnson <jbj@rpm5.org>
Date: Sat 29 Sep 2007 - 21:29:02 CEST
Message-Id: <20070929192902.8D3C334845F@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:   29-Sep-2007 21:29:02
  Branch: HEAD                             Handle: 2007092920290002

  Modified files:
    rpm                     CHANGES
    rpm/lib                 psm.c rpmchecksig.c rpmts.c transaction.c
    rpm/rpmdb               rpmdb.c rpmdb.h
    rpm/tools               rpmcache.c

  Log:
    - eliminate (*hdrchk) vector everywhere, use headerCheck() instead.

  Summary:
    Revision    Changes     Path
    1.1649      +1  -0      rpm/CHANGES
    2.231       +3  -4      rpm/lib/psm.c
    1.146       +1  -1      rpm/lib/rpmchecksig.c
    2.102       +3  -3      rpm/lib/rpmts.c
    1.334       +1  -1      rpm/lib/transaction.c
    1.161       +13 -23     rpm/rpmdb/rpmdb.c
    1.66        +4  -12     rpm/rpmdb/rpmdb.h
    2.15        +4  -1      rpm/tools/rpmcache.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1648 -r1.1649 CHANGES
  --- rpm/CHANGES	29 Sep 2007 18:18:57 -0000	1.1648
  +++ rpm/CHANGES	29 Sep 2007 19:29:00 -0000	1.1649
  @@ -1,4 +1,5 @@
   4.5 -> 5.0:
  +    - jbj: eliminate (*hdrchk) vector everywhere, use headerCheck() instead.
       - jbj: add metadata header stubs to pkgio.c.
       - jbj: move rpmtsFindPubkey() and rpmtsOp() to rpmdb for forward linkage.
       - jbj: add _RPMTS_PRINT to keep rpmrollback.c happy.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/psm.c
  ============================================================================
  $ cvs diff -u -r2.230 -r2.231 psm.c
  --- rpm/lib/psm.c	29 Sep 2007 18:18:57 -0000	2.230
  +++ rpm/lib/psm.c	29 Sep 2007 19:29:01 -0000	2.231
  @@ -2277,9 +2277,9 @@
   		? hLoadTID(fi->h, RPMTAG_INSTALLTID) : rpmtsGetTid(ts));
   	    (void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_DBADD), 0);
   	    if (!(rpmtsVSFlags(ts) & RPMVSF_NOHDRCHK))
  -		rc = rpmdbAdd(rpmtsGetRdb(ts), tid, fi->h, ts, headerCheck);
  +		rc = rpmdbAdd(rpmtsGetRdb(ts), tid, fi->h, ts);
   	    else
  -		rc = rpmdbAdd(rpmtsGetRdb(ts), tid, fi->h, NULL, NULL);
  +		rc = rpmdbAdd(rpmtsGetRdb(ts), tid, fi->h, NULL);
   	    (void) rpmswExit(rpmtsOp(ts, RPMTS_OP_DBADD), 0);
   	}
   
  @@ -2299,8 +2299,7 @@
   	if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)	break;
   
   	(void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_DBREMOVE), 0);
  -	rc = rpmdbRemove(rpmtsGetRdb(ts), rpmtsGetTid(ts), fi->record,
  -				NULL, NULL);
  +	rc = rpmdbRemove(rpmtsGetRdb(ts), rpmtsGetTid(ts), fi->record, NULL);
   	(void) rpmswExit(rpmtsOp(ts, RPMTS_OP_DBREMOVE), 0);
   
   	if (rc != RPMRC_OK) break;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmchecksig.c
  ============================================================================
  $ cvs diff -u -r1.145 -r1.146 rpmchecksig.c
  --- rpm/lib/rpmchecksig.c	9 Sep 2007 20:32:42 -0000	1.145
  +++ rpm/lib/rpmchecksig.c	29 Sep 2007 19:29:01 -0000	1.146
  @@ -568,7 +568,7 @@
   #endif
   
       /* Add header to database. */
  -    xx = rpmdbAdd(rpmtsGetRdb(ts), rpmtsGetTid(ts), h, NULL, NULL);
  +    xx = rpmdbAdd(rpmtsGetRdb(ts), rpmtsGetTid(ts), h, NULL);
       if (xx != 0)
   	goto exit;
       rc = RPMRC_OK;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmts.c
  ============================================================================
  $ cvs diff -u -r2.101 -r2.102 rpmts.c
  --- rpm/lib/rpmts.c	29 Sep 2007 17:06:25 -0000	2.101
  +++ rpm/lib/rpmts.c	29 Sep 2007 19:29:01 -0000	2.102
  @@ -142,9 +142,9 @@
       void *lock = rpmtsAcquireLock(ts);
       int rc;
       if (!(rpmtsVSFlags(ts) & RPMVSF_NOHDRCHK))
  -	rc = rpmdbRebuild(ts->rootDir, ts, headerCheck);
  +	rc = rpmdbRebuild(ts->rootDir, ts);
       else
  -	rc = rpmdbRebuild(ts->rootDir, NULL, NULL);
  +	rc = rpmdbRebuild(ts->rootDir, NULL);
       lock = rpmtsFreeLock(lock);
       return rc;
   }
  @@ -228,7 +228,7 @@
   
       /* Verify header signature/digest during retrieve (if not disabled). */
       if (mi && !(rpmtsVSFlags(ts) & RPMVSF_NOHDRCHK))
  -	(void) rpmdbSetHdrChk(mi, ts, headerCheck);
  +	(void) rpmdbSetHdrChk(mi, ts);
   
       /* Select specified arch only. */
       if (arch != NULL)
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/transaction.c
  ============================================================================
  $ cvs diff -u -r1.333 -r1.334 transaction.c
  --- rpm/lib/transaction.c	28 Sep 2007 22:26:49 -0000	1.333
  +++ rpm/lib/transaction.c	29 Sep 2007 19:29:01 -0000	1.334
  @@ -995,7 +995,7 @@
   		continue;
   	    rc = rpmdbRemove(rpmtsGetRdb(rbts),
   			rpmtsGetTid(rbts),
  -			te->u.removed.dboffset, NULL, NULL);
  +			te->u.removed.dboffset, NULL);
   	    if (rc != RPMRC_OK) {
   		rpmMessage(RPMMESS_ERROR, _("rpmdb erase failed. NEVRA: %s\n"),
   			rpmteNEVRA(te));
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmdb.c
  ============================================================================
  $ cvs diff -u -r1.160 -r1.161 rpmdb.c
  --- rpm/rpmdb/rpmdb.c	29 Sep 2007 01:20:52 -0000	1.160
  +++ rpm/rpmdb/rpmdb.c	29 Sep 2007 19:29:02 -0000	1.161
  @@ -720,9 +720,6 @@
       miRE		mi_re;
   /*@null@*/
       rpmts		mi_ts;
  -/*@null@*/
  -    rpmRC (*mi_hdrchk) (rpmts ts, const void * uh, size_t uc, const char ** msg)
  -	/*@modifies ts, *msg @*/;
   
   };
   
  @@ -1871,11 +1868,11 @@
   	}
   
   	/* Check header digest/signature on blob export (if requested). */
  -	if (mi->mi_hdrchk && mi->mi_ts) {
  +	if (mi->mi_ts) {
   	    const char * msg = NULL;
   	    int lvl;
   
  -	    rpmrc = (*mi->mi_hdrchk) (mi->mi_ts, data->data, data->size, &msg);
  +	    rpmrc = headerCheck(mi->mi_ts, data->data, data->size, &msg);
   	    lvl = (rpmrc == RPMRC_FAIL ? RPMMESS_ERROR : RPMMESS_DEBUG);
   	    rpmMessage(lvl, "%s h#%8u %s",
   		(rpmrc == RPMRC_FAIL ? _("miFreeHeader: skipping") : "write"),
  @@ -2295,15 +2292,13 @@
       return rc;
   }
   
  -int rpmdbSetHdrChk(rpmdbMatchIterator mi, rpmts ts,
  -	rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
  +int rpmdbSetHdrChk(rpmdbMatchIterator mi, rpmts ts)
   {
       int rc = 0;
       if (mi == NULL)
   	return 0;
   /*@-assignexpose -newreftrans @*/ /* XXX forward linkage prevents rpmtsLink */
   /*@i@*/ mi->mi_ts = ts;
  -    mi->mi_hdrchk = hdrchk;
   /*@=assignexpose =newreftrans @*/
       return rc;
   }
  @@ -2438,7 +2433,7 @@
   
       /* Check header digest/signature once (if requested). */
   /*@-boundsread -branchstate -sizeoftype @*/
  -    if (mi->mi_hdrchk && mi->mi_ts) {
  +    if (mi->mi_ts) {
   	rpmRC rpmrc = RPMRC_NOTFOUND;
   
   	/* Don't bother re-checking a previously read header. */
  @@ -2456,7 +2451,7 @@
   	    const char * msg = NULL;
   	    int lvl;
   
  -	    rpmrc = (*mi->mi_hdrchk) (mi->mi_ts, uh, uhlen, &msg);
  +	    rpmrc = headerCheck(mi->mi_ts, uh, uhlen, &msg);
   	    lvl = (rpmrc == RPMRC_FAIL ? RPMMESS_ERROR : RPMMESS_DEBUG);
   	    rpmMessage(lvl, "%s h#%8u %s",
   		(rpmrc == RPMRC_FAIL ? _("rpmdbNextIterator: skipping") : " read"),
  @@ -2803,15 +2798,13 @@
       mi->mi_re = NULL;
   
       mi->mi_ts = NULL;
  -    mi->mi_hdrchk = NULL;
   
   /*@i@*/ return mi;
   }
   
   /* XXX psm.c */
   int rpmdbRemove(rpmdb db, /*@unused@*/ int rid, unsigned int hdrNum,
  -		/*@unused@*/ rpmts ts,
  -		/*@unused@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
  +		/*@unused@*/ rpmts ts)
   {
   DBC * dbcursor = NULL;
   DBT * key = alloca(sizeof(*key));
  @@ -3129,9 +3122,7 @@
   }
   
   /* XXX install.c */
  -int rpmdbAdd(rpmdb db, int iid, Header h,
  -		/*@unused@*/ rpmts ts,
  -		/*@unused@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
  +int rpmdbAdd(rpmdb db, int iid, Header h, /*@unused@*/ rpmts ts)
   {
   DBC * dbcursor = NULL;
   DBT * key = alloca(sizeof(*key));
  @@ -3332,11 +3323,11 @@
   }
   
   		/* Check header digest/signature on blob export. */
  -		if (hdrchk && ts) {
  +		if (ts) {
   		    const char * msg = NULL;
   		    int lvl;
   
  -		    rpmrc = (*hdrchk) (ts, data->data, data->size, &msg);
  +		    rpmrc = headerCheck(ts, data->data, data->size, &msg);
   		    lvl = (rpmrc == RPMRC_FAIL ? RPMMESS_ERROR : RPMMESS_DEBUG);
   		    rpmMessage(lvl, "%s h#%8u %s",
   			(rpmrc == RPMRC_FAIL ? _("rpmdbAdd: skipping") : "  +++"),
  @@ -3913,8 +3904,7 @@
       return rc;
   }
   
  -int rpmdbRebuild(const char * prefix, rpmts ts,
  -		rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
  +int rpmdbRebuild(const char * prefix, rpmts ts)
   	/*@globals _rebuildinprogress @*/
   	/*@modifies _rebuildinprogress @*/
   {
  @@ -4034,8 +4024,8 @@
   #define	_RECNUM	rpmdbGetIteratorOffset(mi)
   
   	mi = rpmdbInitIterator(olddb, RPMDBI_PACKAGES, NULL, 0);
  -	if (ts && hdrchk)
  -	    (void) rpmdbSetHdrChk(mi, ts, hdrchk);
  +	if (ts)
  +	    (void) rpmdbSetHdrChk(mi, ts);
   
   	while ((h = rpmdbNextIterator(mi)) != NULL) {
   
  @@ -4088,7 +4078,7 @@
   	    /* Deleted entries are eliminated in legacy headers by copy. */
   	    {	Header nh = (headerIsEntry(h, RPMTAG_HEADERIMAGE)
   				? headerCopy(h) : NULL);
  -		rc = rpmdbAdd(newdb, -1, (nh ? nh : h), ts, hdrchk);
  +		rc = rpmdbAdd(newdb, -1, (nh ? nh : h), ts);
   		nh = headerFree(nh);
   	    }
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmdb.h
  ============================================================================
  $ cvs diff -u -r1.65 -r1.66 rpmdb.h
  --- rpm/rpmdb/rpmdb.h	29 Sep 2007 17:06:25 -0000	1.65
  +++ rpm/rpmdb/rpmdb.h	29 Sep 2007 19:29:02 -0000	1.66
  @@ -1107,11 +1107,9 @@
    * Modify iterator to verify retrieved header blobs.
    * @param mi		rpm database iterator
    * @param ts		transaction set
  - * @param (*hdrchk)	headerCheck() vector
    * @return		0 always
    */
  -int rpmdbSetHdrChk(/*@null@*/ rpmdbMatchIterator mi, /*@null@*/ rpmts ts,
  -		/*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void * uh, size_t uc, const char ** msg))
  +int rpmdbSetHdrChk(/*@null@*/ rpmdbMatchIterator mi, /*@null@*/ rpmts ts)
   	/*@modifies mi @*/;
   
   /** \ingroup rpmdb
  @@ -1176,11 +1174,9 @@
    * @param iid		install transaction id (iid = 0 or -1 to skip)
    * @param h		header
    * @param ts		(unused) transaction set (or NULL)
  - * @param (*hdrchk)	(unused) headerCheck() vector (or NULL)
    * @return		0 on success
    */
  -int rpmdbAdd(/*@null@*/ rpmdb db, int iid, Header h, /*@null@*/ rpmts ts,
  -		/*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
  +int rpmdbAdd(/*@null@*/ rpmdb db, int iid, Header h, /*@null@*/ rpmts ts)
   	/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
   	/*@modifies db, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
   
  @@ -1190,12 +1186,10 @@
    * @param rid		(unused) remove transaction id (rid = 0 or -1 to skip)
    * @param hdrNum	package instance number in database
    * @param ts		(unused) transaction set (or NULL)
  - * @param (*hdrchk)	(unused) headerCheck() vector (or NULL)
    * @return		0 on success
    */
   int rpmdbRemove(/*@null@*/ rpmdb db, /*@unused@*/ int rid, unsigned int hdrNum,
  -		/*@null@*/ rpmts ts,
  -		/*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
  +		/*@null@*/ rpmts ts)
   	/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
   	/*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
   
  @@ -1203,11 +1197,9 @@
    * Rebuild database indices from package headers.
    * @param prefix	path to top of install tree
    * @param ts		transaction set (or NULL)
  - * @param (*hdrchk)	headerCheck() vector (or NULL)
    * @return		0 on success
    */
  -int rpmdbRebuild(/*@null@*/ const char * prefix, /*@null@*/ rpmts ts,
  -		/*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
  +int rpmdbRebuild(/*@null@*/ const char * prefix, /*@null@*/ rpmts ts)
   	/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
   	/*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/tools/rpmcache.c
  ============================================================================
  $ cvs diff -u -r2.14 -r2.15 rpmcache.c
  --- rpm/tools/rpmcache.c	18 Sep 2007 06:47:55 -0000	2.14
  +++ rpm/tools/rpmcache.c	29 Sep 2007 19:29:02 -0000	2.15
  @@ -158,7 +158,10 @@
   	if (rc != 1) break;
   
   	/* --- Add new cache header to database. */
  -	rc = rpmdbAdd(rpmtsGetRdb(ts), tid, ip->h, NULL, NULL);
  +	if (!(rpmtsVSFlags(ts) & RPMVSF_NOHDRCHK))
  +	    rc = rpmdbAdd(rpmtsGetRdb(ts), tid, ip->h, ts);
  +	else
  +	    rc = rpmdbAdd(rpmtsGetRdb(ts), tid, ip->h, NULL);
   	if (rc) break;
   
       }
  @@ .
Received on Sat Sep 29 21:29:02 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.