Move header INSTALLTID manipulation out of rpmdbAdd()

This commit is contained in:
Panu Matilainen 2010-04-07 08:35:14 +03:00
parent e23a2bf097
commit f40ea7e359
4 changed files with 14 additions and 16 deletions

View File

@ -1068,14 +1068,20 @@ static rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
case PSM_RPMDB_ADD: { case PSM_RPMDB_ADD: {
Header h; Header h;
if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) break; if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) break;
h = rpmteHeader(psm->te); h = rpmteHeader(psm->te);
if (!headerIsEntry(h, RPMTAG_INSTALLTID)) {
rpm_tid_t tid = rpmtsGetTid(ts);
if (tid != 0 && tid != (rpm_tid_t)-1)
headerPutUint32(h, RPMTAG_INSTALLTID, &tid, 1);
}
(void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_DBADD), 0); (void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_DBADD), 0);
if (!(rpmtsVSFlags(ts) & RPMVSF_NOHDRCHK)) if (!(rpmtsVSFlags(ts) & RPMVSF_NOHDRCHK))
rc = rpmdbAdd(rpmtsGetRdb(ts), rpmtsGetTid(ts), h, rc = rpmdbAdd(rpmtsGetRdb(ts), 0, h, ts, headerCheck);
ts, headerCheck);
else else
rc = rpmdbAdd(rpmtsGetRdb(ts), rpmtsGetTid(ts), h, rc = rpmdbAdd(rpmtsGetRdb(ts), 0, h, NULL, NULL);
NULL, NULL);
(void) rpmswExit(rpmtsOp(ts, RPMTS_OP_DBADD), 0); (void) rpmswExit(rpmtsOp(ts, RPMTS_OP_DBADD), 0);
if (rc == RPMRC_OK) if (rc == RPMRC_OK)

View File

@ -2405,15 +2405,6 @@ int rpmdbAdd(rpmdb db, int iid, Header h,
memset(&key, 0, sizeof(key)); memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
#ifdef NOTYET /* XXX headerDel() broken on dribbles. */
xx = headerDel(h, RPMTAG_REMOVETID);
#endif
if (iid != 0 && iid != -1) {
rpm_tid_t tid = iid;
if (!headerIsEntry(h, RPMTAG_INSTALLTID))
headerPutUint32(h, RPMTAG_INSTALLTID, &tid, 1);
}
(void) blockSignals(&signalMask); (void) blockSignals(&signalMask);
dbi = rpmdbOpenIndex(db, RPMDBI_PACKAGES, 0); dbi = rpmdbOpenIndex(db, RPMDBI_PACKAGES, 0);

View File

@ -236,7 +236,7 @@ rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
/** \ingroup rpmdb /** \ingroup rpmdb
* Add package header to rpm database and indices. * Add package header to rpm database and indices.
* @param db rpm database * @param db rpm database
* @param iid install transaction id (iid = 0 or -1 to skip) * @param iid (unused)
* @param h header * @param h header
* @param ts (unused) transaction set (or NULL) * @param ts (unused) transaction set (or NULL)
* @param (*hdrchk) (unused) headerCheck() vector (or NULL) * @param (*hdrchk) (unused) headerCheck() vector (or NULL)
@ -248,7 +248,7 @@ int rpmdbAdd(rpmdb db, int iid, Header h, rpmts ts,
/** \ingroup rpmdb /** \ingroup rpmdb
* Remove package header from rpm database and indices. * Remove package header from rpm database and indices.
* @param db rpm database * @param db rpm database
* @param rid (unused) remove transaction id (rid = 0 or -1 to skip) * @param rid (unused)
* @param hdrNum package instance number in database * @param hdrNum package instance number in database
* @param ts (unused) transaction set (or NULL) * @param ts (unused) transaction set (or NULL)
* @param (*hdrchk) (unused) headerCheck() vector (or NULL) * @param (*hdrchk) (unused) headerCheck() vector (or NULL)

View File

@ -395,6 +395,7 @@ static int makePubkeyHeader(rpmts ts, rpmPubkey key, Header h)
{ rpm_tid_t tid = rpmtsGetTid(ts); { rpm_tid_t tid = rpmtsGetTid(ts);
headerPutUint32(h, RPMTAG_INSTALLTIME, &tid, 1); headerPutUint32(h, RPMTAG_INSTALLTIME, &tid, 1);
headerPutUint32(h, RPMTAG_INSTALLTID, &tid, 1);
headerPutUint32(h, RPMTAG_BUILDTIME, &tid, 1); headerPutUint32(h, RPMTAG_BUILDTIME, &tid, 1);
} }
rc = 0; rc = 0;
@ -429,7 +430,7 @@ rpmRC rpmtsImportPubkey(const rpmts ts, const unsigned char * pkt, size_t pktlen
/* Add header to database. */ /* Add header to database. */
if (rpmtsOpenDB(ts, (O_RDWR|O_CREAT))) if (rpmtsOpenDB(ts, (O_RDWR|O_CREAT)))
goto exit; goto exit;
if (rpmdbAdd(rpmtsGetRdb(ts), rpmtsGetTid(ts), h, NULL, NULL) != 0) if (rpmdbAdd(rpmtsGetRdb(ts), 0, h, NULL, NULL) != 0)
goto exit; goto exit;
rc = RPMRC_OK; rc = RPMRC_OK;