diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-12-19 18:59:38 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-12-19 18:59:38 +0200 |
commit | dd91ff060c2053a482fd540afa8e30c1f874f3ab (patch) | |
tree | f6e7d6d49fe479d1779aea58061ee4d0b381c110 /lib/rpmfi.c | |
parent | 107d941650eb34197d52404859da9ddf4bf02bc9 (diff) | |
download | rpm-dd91ff060c2053a482fd540afa8e30c1f874f3ab.tar.gz rpm-dd91ff060c2053a482fd540afa8e30c1f874f3ab.tar.bz2 rpm-dd91ff060c2053a482fd540afa8e30c1f874f3ab.zip |
Perform relocations *before* filling out rpmfi structure
- no need to fuss about recreating bits and pieces of rpmfi after the fact
Diffstat (limited to 'lib/rpmfi.c')
-rw-r--r-- | lib/rpmfi.c | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/lib/rpmfi.c b/lib/rpmfi.c index 447ecc23f..a4e937f24 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -751,10 +751,9 @@ static char **duparray(char ** src, int size) * Relocate files in header. * @todo multilib file dispositions need to be checked. * @param ts transaction set - * @param fi transaction element file info * @param h package header to relocate */ -static void relocateFileList(const rpmts ts, rpmfi fi, Header h) +static void relocateFileList(const rpmts ts, Header h) { rpmte p = rpmtsRelocateElement(ts); static int _printed = 0; @@ -1127,27 +1126,14 @@ assert(fn != NULL); /* XXX can't happen */ if (rpmtdFromStringArray(&td, RPMTAG_BASENAMES, (const char**) baseNames, fileCount)) { headerMod(h, &td); } - free(fi->bnl); - headerGet(h, RPMTAG_BASENAMES, &td, fi->scareFlags); - fi->fc = rpmtdCount(&td); - fi->bnl = td.data; if (rpmtdFromStringArray(&td, RPMTAG_DIRNAMES, (const char**) dirNames, dirCount)) { headerMod(h, &td); } - free(fi->dnl); - headerGet(h, RPMTAG_DIRNAMES, &td, fi->scareFlags); - fi->dc = rpmtdCount(&td); - fi->dnl = td.data; if (rpmtdFromUint32(&td, RPMTAG_DIRINDEXES, dirIndexes, fileCount)) { headerMod(h, &td); } - headerGet(h, RPMTAG_DIRINDEXES, &td, fi->scareFlags); - /* Ugh, nasty games with how dil is alloced depending on scareMem */ - if (fi->scareFlags & HEADERGET_ALLOC) - free(fi->dil); - fi->dil = td.data; } rpmtdFreeData(&bnames); @@ -1248,7 +1234,6 @@ static scidx_t *cacheTag(strcache cache, Header h, rpmTag tag) rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, rpmfiFlags flags) { - rpmte p; rpmfi fi = NULL; const char * Type; rpm_loff_t *asize = NULL; @@ -1292,6 +1277,14 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, rpmfiFlags flags) if (isBuild) fi->fiflags |= RPMFI_ISBUILD; if (isSource) fi->fiflags |= RPMFI_ISSOURCE; + /* relocate stuff in header if necessary */ + if (ts && !headerIsSource(h) && !headerIsEntry(h, RPMTAG_ORIGBASENAMES)) { + rpmte p = rpmtsRelocateElement(ts); + if (rpmteType(p) == TR_ADDED) { + relocateFileList(ts, h); + } + } + _hgfi(h, RPMTAG_BASENAMES, &td, defFlags, fi->bnl); fi->fc = rpmtdCount(&td); if (fi->fc == 0) { @@ -1382,15 +1375,6 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, rpmfiFlags flags) if (!(flags & RPMFI_NOFILEGROUP)) fi->fgroup = cacheTag(ugcache, h, RPMTAG_FILEGROUPNAME); - if (ts != NULL) - if (fi != NULL) - if ((p = rpmtsRelocateElement(ts)) != NULL && rpmteType(p) == TR_ADDED - && !headerIsSource(h) - && !headerIsEntry(h, RPMTAG_ORIGBASENAMES)) - { - relocateFileList(ts, fi, h); - } - /* lazily alloced from rpmfiFN() */ fi->fn = NULL; |