Move header INSTALLTID manipulation out of rpmdbAdd()
This commit is contained in:
parent
e23a2bf097
commit
f40ea7e359
14
lib/psm.c
14
lib/psm.c
|
@ -1068,14 +1068,20 @@ static rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
|
|||
case PSM_RPMDB_ADD: {
|
||||
Header h;
|
||||
if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) break;
|
||||
|
||||
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);
|
||||
if (!(rpmtsVSFlags(ts) & RPMVSF_NOHDRCHK))
|
||||
rc = rpmdbAdd(rpmtsGetRdb(ts), rpmtsGetTid(ts), h,
|
||||
ts, headerCheck);
|
||||
rc = rpmdbAdd(rpmtsGetRdb(ts), 0, h, ts, headerCheck);
|
||||
else
|
||||
rc = rpmdbAdd(rpmtsGetRdb(ts), rpmtsGetTid(ts), h,
|
||||
NULL, NULL);
|
||||
rc = rpmdbAdd(rpmtsGetRdb(ts), 0, h, NULL, NULL);
|
||||
(void) rpmswExit(rpmtsOp(ts, RPMTS_OP_DBADD), 0);
|
||||
|
||||
if (rc == RPMRC_OK)
|
||||
|
|
|
@ -2405,15 +2405,6 @@ int rpmdbAdd(rpmdb db, int iid, Header h,
|
|||
memset(&key, 0, sizeof(key));
|
||||
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);
|
||||
|
||||
dbi = rpmdbOpenIndex(db, RPMDBI_PACKAGES, 0);
|
||||
|
|
|
@ -236,7 +236,7 @@ rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
|
|||
/** \ingroup rpmdb
|
||||
* Add package header to rpm database and indices.
|
||||
* @param db rpm database
|
||||
* @param iid install transaction id (iid = 0 or -1 to skip)
|
||||
* @param iid (unused)
|
||||
* @param h header
|
||||
* @param ts (unused) transaction set (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
|
||||
* Remove package header from rpm database and indices.
|
||||
* @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 ts (unused) transaction set (or NULL)
|
||||
* @param (*hdrchk) (unused) headerCheck() vector (or NULL)
|
||||
|
|
|
@ -395,6 +395,7 @@ static int makePubkeyHeader(rpmts ts, rpmPubkey key, Header h)
|
|||
|
||||
{ rpm_tid_t tid = rpmtsGetTid(ts);
|
||||
headerPutUint32(h, RPMTAG_INSTALLTIME, &tid, 1);
|
||||
headerPutUint32(h, RPMTAG_INSTALLTID, &tid, 1);
|
||||
headerPutUint32(h, RPMTAG_BUILDTIME, &tid, 1);
|
||||
}
|
||||
rc = 0;
|
||||
|
@ -429,7 +430,7 @@ rpmRC rpmtsImportPubkey(const rpmts ts, const unsigned char * pkt, size_t pktlen
|
|||
/* Add header to database. */
|
||||
if (rpmtsOpenDB(ts, (O_RDWR|O_CREAT)))
|
||||
goto exit;
|
||||
if (rpmdbAdd(rpmtsGetRdb(ts), rpmtsGetTid(ts), h, NULL, NULL) != 0)
|
||||
if (rpmdbAdd(rpmtsGetRdb(ts), 0, h, NULL, NULL) != 0)
|
||||
goto exit;
|
||||
rc = RPMRC_OK;
|
||||
|
||||
|
|
Loading…
Reference in New Issue