Move transscripts stuff from rpmfi to rpmte
- transaction scripts have zero to do with files...
This commit is contained in:
parent
dc8f991671
commit
c8d0ea1c72
|
@ -1341,14 +1341,6 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, rpmfiFlags flags)
|
|||
if (isBuild) fi->fiflags |= RPMFI_ISBUILD;
|
||||
if (isSource) fi->fiflags |= RPMFI_ISSOURCE;
|
||||
|
||||
/* See if we have pre/posttrans scripts. */
|
||||
fi->transscripts |= (headerIsEntry(h, RPMTAG_PRETRANS) &&
|
||||
headerIsEntry(h, RPMTAG_PRETRANSPROG)) ?
|
||||
RPMFI_HAVE_PRETRANS : 0;
|
||||
fi->transscripts |= (headerIsEntry(h, RPMTAG_POSTTRANS) &&
|
||||
headerIsEntry(h, RPMTAG_POSTTRANSPROG)) ?
|
||||
RPMFI_HAVE_POSTTRANS : 0;
|
||||
|
||||
_hgfi(h, RPMTAG_BASENAMES, &td, defFlags, fi->bnl);
|
||||
fi->fc = rpmtdCount(&td);
|
||||
if (fi->fc == 0) {
|
||||
|
|
|
@ -94,10 +94,6 @@ struct rpmfi_s {
|
|||
pgpHashAlgo digestalgo; /*!< File checksum algorithm */
|
||||
unsigned char * digests; /*!< File checksums in binary. */
|
||||
|
||||
#define RPMFI_HAVE_PRETRANS (1 << 0)
|
||||
#define RPMFI_HAVE_POSTTRANS (1 << 1)
|
||||
int transscripts; /*!< pre/posttrans script existence */
|
||||
|
||||
char * fn; /*!< File name buffer. */
|
||||
|
||||
size_t striplen;
|
||||
|
|
|
@ -145,6 +145,14 @@ static void addTE(rpmts ts, rpmte p, Header h,
|
|||
p->fi = rpmfiNew(ts, h, RPMTAG_BASENAMES, fiflags);
|
||||
(void) rpmtsSetRelocateElement(ts, savep);
|
||||
|
||||
/* See if we have pre/posttrans scripts. */
|
||||
p->transscripts |= (headerIsEntry(h, RPMTAG_PRETRANS) &&
|
||||
headerIsEntry(h, RPMTAG_PRETRANSPROG)) ?
|
||||
RPMTE_HAVE_PRETRANS : 0;
|
||||
p->transscripts |= (headerIsEntry(h, RPMTAG_POSTTRANS) &&
|
||||
headerIsEntry(h, RPMTAG_POSTTRANSPROG)) ?
|
||||
RPMTE_HAVE_POSTTRANS : 0;
|
||||
|
||||
rpmteColorDS(p, RPMTAG_PROVIDENAME);
|
||||
rpmteColorDS(p, RPMTAG_REQUIRENAME);
|
||||
return;
|
||||
|
|
|
@ -62,6 +62,10 @@ struct rpmte_s {
|
|||
int nrelocs; /*!< (TR_ADDED) No. of relocations. */
|
||||
FD_t fd; /*!< (TR_ADDED) Payload file descriptor. */
|
||||
|
||||
#define RPMTE_HAVE_PRETRANS (1 << 0)
|
||||
#define RPMTE_HAVE_POSTTRANS (1 << 1)
|
||||
int transscripts; /*!< pre/posttrans script existence */
|
||||
|
||||
rpmalKey pkgKey;
|
||||
};
|
||||
|
||||
|
|
|
@ -847,16 +847,13 @@ static int runTransScripts(rpmts ts, rpmTag stag)
|
|||
rpmTag progtag = RPMTAG_NOT_FOUND;
|
||||
int havescript = 0;
|
||||
|
||||
if ((fi = rpmtsiFi(pi)) == NULL)
|
||||
continue; /* XXX can't happen */
|
||||
|
||||
switch (stag) {
|
||||
case RPMTAG_PRETRANS:
|
||||
havescript = fi->transscripts & RPMFI_HAVE_PRETRANS;
|
||||
havescript = p->transscripts & RPMTE_HAVE_PRETRANS;
|
||||
progtag = RPMTAG_PRETRANSPROG;
|
||||
break;
|
||||
case RPMTAG_POSTTRANS:
|
||||
havescript = fi->transscripts & RPMFI_HAVE_POSTTRANS;
|
||||
havescript = p->transscripts & RPMTE_HAVE_POSTTRANS;
|
||||
progtag = RPMTAG_POSTTRANSPROG;
|
||||
break;
|
||||
default:
|
||||
|
@ -869,6 +866,9 @@ static int runTransScripts(rpmts ts, rpmTag stag)
|
|||
if (!havescript)
|
||||
continue;
|
||||
|
||||
if ((fi = rpmtsiFi(pi)) == NULL)
|
||||
continue; /* XXX can't happen */
|
||||
|
||||
if (rpmteOpen(p, ts)) {
|
||||
p->fi = rpmfiFree(p->fi);
|
||||
fi = rpmfiNew(ts, p->h, RPMTAG_BASENAMES, RPMFI_KEEPHEADER);
|
||||
|
|
Loading…
Reference in New Issue