Scaffholding for dumping full headers carried through transaction.

CVS patchset: 5119
CVS date: 2001/10/18 16:39:54
This commit is contained in:
jbj 2001-10-18 16:39:54 +00:00
parent d57a29baac
commit 73df151e8f
10 changed files with 884 additions and 174 deletions

View File

@ -5,6 +5,7 @@ AUTOMAKE_OPTIONS = 1.4 foreign
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/rpmdb \
-I$(top_srcdir)/rpmio \
-I$(top_srcdir)/popt \
@INCPATH@

View File

@ -1333,7 +1333,8 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
char * a, * d;
fi->type = TR_ADDED;
loadFi(h, fi);
/* XXX add trnsaction set */
loadFi(NULL, fi, h, 1);
fi->dnl = _free(fi->dnl);
fi->bnl = _free(fi->bnl);

View File

@ -7,6 +7,7 @@
*/
#include <header.h>
#include <rpmhash.h>
/** \ingroup rpmdep
* Dependncy ordering information.
@ -139,6 +140,7 @@ struct rpmTransactionSet_s {
/*@dependent@*/ const char ** filesystems; /*!< Mounted filesystem names. */
/*@only@*/ struct diskspaceInfo * di; /*!< Per filesystem disk/inode usage. */
/*@kept@*/ /*@null@*/ rpmdb rpmdb; /*!< Database handle. */
/*@only@*/ hashTable ht; /*!< Fingerprint hash table. */
/*@only@*/ int * removedPackages; /*!< Set of packages being removed. */
int numRemovedPackages; /*!< No. removed rpmdb instances. */
int allocedRemovedPackages; /*!< Size of removed packages array. */

View File

@ -298,12 +298,12 @@ static /*@only@*/ void * dnlInitIterator(/*@special@*/ const FSM_t fsm,
if (j == 0) {
j = 1;
rpmMessage(RPMMESS_DEBUG,
_("========= Directories not explictly included in package:\n"));
_("========== Directories not explictly included in package:\n"));
}
rpmMessage(RPMMESS_DEBUG, _("%9d %s\n"), i, fi->dnl[i]);
rpmMessage(RPMMESS_DEBUG, _("%10d %s\n"), i, fi->dnl[i]);
}
if (j)
rpmMessage(RPMMESS_DEBUG, "=========\n");
rpmMessage(RPMMESS_DEBUG, "==========\n");
}
}
return dnli;

View File

@ -247,7 +247,9 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
break;
}
/*@-sizeoftype@*/
size += 2 * sizeof(int_32); /* count of index entries */
/*@=sizeoftype@*/
for (i = 0, entry = h->index; i < h->indexUsed; i++, entry++) {
unsigned diff;
@ -257,8 +259,10 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
if (ENTRY_IS_REGION(entry)) {
size += entry->length;
/* XXX Legacy regions do not include the region tag and data. */
/*@-sizeoftype@*/
if (i == 0 && (h->flags & HEADERFLAG_LEGACY))
size += sizeof(struct entryInfo) + entry->info.count;
/*@=sizeoftype@*/
continue;
}
@ -276,7 +280,9 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
}
}
/*@-sizeoftype@*/
size += sizeof(struct entryInfo) + entry->length;
/*@=sizeoftype@*/
}
return size;
@ -426,8 +432,10 @@ static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl,
} else {
tprev = dataStart;
/* XXX HEADER_IMAGE tags don't include region sub-tag. */
/*@-sizeoftype@*/
if (ie.info.tag != HEADER_IMMUTABLE)
tprev -= REGION_TAG_COUNT;
/*@=sizeoftype@*/
}
/* Perform endian conversions */
@ -462,8 +470,10 @@ static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl,
* 1) tl is 16b (i.e. REGION_TAG_COUNT) short while doing headerReload().
* 2) the 8/98 rpm bug with inserting i18n tags needs to use tl, not dl.
*/
/*@-sizeoftype@*/
if (tl+REGION_TAG_COUNT == dl)
tl += REGION_TAG_COUNT;
/*@=sizeoftype@*/
return dl;
}
@ -697,8 +707,10 @@ t = te;
src = entry->data;
while (count--) {
*((int_32 *)te) = htonl(*((int_32 *)src));
/*@-sizeoftype@*/
te += sizeof(int_32);
src += sizeof(int_32);
/*@=sizeoftype@*/
}
/*@switchbreak@*/ break;
@ -707,8 +719,10 @@ t = te;
src = entry->data;
while (count--) {
*((int_16 *)te) = htons(*((int_16 *)src));
/*@-sizeoftype@*/
te += sizeof(int_16);
src += sizeof(int_16);
/*@=sizeoftype@*/
}
/*@switchbreak@*/ break;
@ -861,8 +875,10 @@ Header headerLoad(/*@kept@*/ void * uh)
int_32 * ei = (int_32 *) uh;
int_32 il = ntohl(ei[0]); /* index length */
int_32 dl = ntohl(ei[1]); /* data length */
/*@-sizeoftype@*/
size_t pvlen = sizeof(il) + sizeof(dl) +
(il * sizeof(struct entryInfo)) + dl;
/*@=sizeoftype@*/
void * pv = uh;
Header h = NULL;
entryInfo pe;
@ -911,7 +927,9 @@ Header headerLoad(/*@kept@*/ void * uh)
h->flags |= HEADERFLAG_LEGACY;
entry->info.type = REGION_TAG_TYPE;
entry->info.tag = HEADER_IMAGE;
/*@-sizeoftype@*/
entry->info.count = REGION_TAG_COUNT;
/*@=sizeoftype@*/
entry->info.offset = ((char *)pe - dataStart); /* negative offset */
/*@-assignexpose@*/
@ -954,7 +972,9 @@ Header headerLoad(/*@kept@*/ void * uh)
entry->info.tag = htonl(pe->tag);
} else {
ril = il;
/*@-sizeoftype@*/
rdl = (ril * sizeof(struct entryInfo));
/*@=sizeoftype@*/
entry->info.tag = HEADER_IMAGE;
}
}
@ -1071,8 +1091,10 @@ Header headerCopyLoad(const void * uh)
int_32 * ei = (int_32 *) uh;
int_32 il = ntohl(ei[0]); /* index length */
int_32 dl = ntohl(ei[1]); /* data length */
/*@-sizeoftype@*/
size_t pvlen = sizeof(il) + sizeof(dl) +
(il * sizeof(struct entryInfo)) + dl;
/*@=sizeoftype@*/
void * nuh = NULL;
Header h = NULL;
@ -1133,7 +1155,9 @@ Header headerRead(FD_t fd, enum hMagic magicp)
il = ntohl(block[i++]);
dl = ntohl(block[i++]);
/*@-sizeoftype@*/
len = sizeof(il) + sizeof(dl) + (il * sizeof(struct entryInfo)) + dl;
/*@=sizeoftype@*/
/* Sanity checks on header intro. */
if (hdrchkTags(il) || hdrchkData(dl) || len > headerMaxbytes)
@ -1186,7 +1210,9 @@ int headerWrite(FD_t fd, /*@null@*/ Header h, enum hMagic magicp)
return 1;
switch (magicp) {
case HEADER_MAGIC_YES:
/*@-sizeoftype@*/
nb = Fwrite(header_magic, sizeof(char), sizeof(header_magic), fd);
/*@=sizeoftype@*/
if (nb != sizeof(header_magic))
goto exit;
break;
@ -1194,7 +1220,9 @@ int headerWrite(FD_t fd, /*@null@*/ Header h, enum hMagic magicp)
break;
}
/*@-sizeoftype@*/
nb = Fwrite(uh, sizeof(char), length, fd);
/*@=sizeoftype@*/
exit:
uh = _free(uh);
@ -1249,6 +1277,7 @@ static int copyEntry(const indexEntry entry,
int_32 rdl = -entry->info.offset; /* negative offset */
int_32 ril = rdl/sizeof(*pe);
/*@-sizeoftype@*/
count = 2 * sizeof(*ei) + (ril * sizeof(*pe)) +
entry->rdlen + REGION_TAG_COUNT;
*p = xmalloc(count);
@ -1260,6 +1289,7 @@ static int copyEntry(const indexEntry entry,
/*@=castexpose@*/
dataStart = (char *) memcpy(pe + ril, dataStart,
(entry->rdlen + REGION_TAG_COUNT));
/*@=sizeoftype@*/
rc = regionSwab(NULL, ril, 0, pe, dataStart, 0);
/* XXX 1 on success. */
@ -1280,7 +1310,9 @@ static int copyEntry(const indexEntry entry,
case RPM_STRING_ARRAY_TYPE:
case RPM_I18NSTRING_TYPE:
{ const char ** ptrEntry;
/*@-sizeoftype@*/
int tableSize = count * sizeof(char *);
/*@=sizeoftype@*/
char * t;
int i;
@ -2753,7 +2785,9 @@ allocateExtensionCache(const headerSprintfExtension extensions)
ext++;
}
/*@-sizeoftype@*/
return xcalloc(i, sizeof(struct extensionCache));
/*@=sizeoftype@*/
}
/**
@ -3062,7 +3096,7 @@ HSTATIC
HeaderIterator headerInitIterator(Header h)
/*@modifies h */
{
HeaderIterator hi = xmalloc(sizeof(struct headerIteratorS));
HeaderIterator hi = xmalloc(sizeof(*hi));
headerSort(h);

630
lib/psm.c
View File

@ -16,14 +16,17 @@
#include "debug.h"
/*@access Header @*/ /* compared with NULL */
/*@access rpmTransactionSet @*/ /* compared with NULL */
/*@access rpmdbMatchIterator @*/ /* compared with NULL */
/*@access TFI_t @*/ /* compared with NULL */
/*@access FSM_t @*/ /* compared with NULL */
/*@access PSM_t @*/ /* compared with NULL */
/*@access FD_t @*/ /* compared with NULL */
/*@access rpmdb @*/ /* compared with NULL */
/*@access rpmTransactionSet @*/
/*@access TFI_t @*/
/*@access rpmProblemSet@*/
/*@access rpmProblem@*/
/*@access PSM_t @*/
/*@-redecl -declundef -exportheadervar@*/
/*@unchecked@*/
extern const char * chroot_prefix;
@ -65,7 +68,531 @@ int rpmVersionCompare(Header first, Header second)
return rpmvercmp(one, two);
}
void loadFi(Header h, TFI_t fi)
rpmProblemSet psCreate(void)
{
rpmProblemSet probs;
probs = xcalloc(1, sizeof(*probs)); /* XXX memory leak */
probs->numProblems = probs->numProblemsAlloced = 0;
probs->probs = NULL;
return probs;
}
void psAppend(rpmProblemSet probs, rpmProblemType type,
const struct availablePackage * alp,
const char * dn, const char * bn,
Header altH, unsigned long ulong1)
{
rpmProblem p;
char *t;
if (probs->numProblems == probs->numProblemsAlloced) {
if (probs->numProblemsAlloced)
probs->numProblemsAlloced *= 2;
else
probs->numProblemsAlloced = 2;
probs->probs = xrealloc(probs->probs,
probs->numProblemsAlloced * sizeof(*probs->probs));
}
p = probs->probs + probs->numProblems;
probs->numProblems++;
memset(p, 0, sizeof(*p));
p->type = type;
/*@-assignexpose@*/
p->key = alp->key;
/*@=assignexpose@*/
p->ulong1 = ulong1;
p->ignoreProblem = 0;
p->str1 = NULL;
p->h = NULL;
p->pkgNEVR = NULL;
p->altNEVR = NULL;
if (dn || bn) {
p->str1 =
t = xcalloc(1, (dn ? strlen(dn) : 0) + (bn ? strlen(bn) : 0) + 1);
if (dn) t = stpcpy(t, dn);
if (bn) t = stpcpy(t, bn);
}
if (alp) {
p->h = headerLink(alp->h);
p->pkgNEVR =
t = xcalloc(1, strlen(alp->name) +
strlen(alp->version) +
strlen(alp->release) + sizeof("--"));
t = stpcpy(t, alp->name);
t = stpcpy(t, "-");
t = stpcpy(t, alp->version);
t = stpcpy(t, "-");
t = stpcpy(t, alp->release);
}
if (altH) {
const char * n, * v, * r;
(void) headerNVR(altH, &n, &v, &r);
p->altNEVR =
t = xcalloc(1, strlen(n) + strlen(v) + strlen(r) + sizeof("--"));
t = stpcpy(t, n);
t = stpcpy(t, "-");
t = stpcpy(t, v);
t = stpcpy(t, "-");
t = stpcpy(t, r);
}
}
/**
*/
static /*@observer@*/ const char *const ftstring (fileTypes ft)
/*@*/
{
switch (ft) {
case XDIR: return "directory";
case CDEV: return "char dev";
case BDEV: return "block dev";
case LINK: return "link";
case SOCK: return "sock";
case PIPE: return "fifo/pipe";
case REG: return "file";
default: return "unknown file type";
}
/*@notreached@*/
}
fileTypes whatis(uint_16 mode)
{
if (S_ISDIR(mode)) return XDIR;
if (S_ISCHR(mode)) return CDEV;
if (S_ISBLK(mode)) return BDEV;
if (S_ISLNK(mode)) return LINK;
if (S_ISSOCK(mode)) return SOCK;
if (S_ISFIFO(mode)) return PIPE;
return REG;
}
#define alloca_strdup(_s) strcpy(alloca(strlen(_s)+1), (_s))
Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
struct availablePackage * alp,
Header origH, fileAction * actions)
{
HGE_t hge = fi->hge;
HAE_t hae = fi->hae;
HME_t hme = fi->hme;
HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
static int _printed = 0;
int allowBadRelocate = (ts->ignoreSet & RPMPROB_FILTER_FORCERELOCATE);
rpmRelocation * rawRelocations = alp->relocs;
rpmRelocation * relocations = NULL;
int numRelocations;
const char ** validRelocations;
rpmTagType validType;
int numValid;
const char ** baseNames;
const char ** dirNames;
int_32 * dirIndexes;
int_32 * newDirIndexes;
int_32 fileCount;
int_32 dirCount;
uint_32 * fFlags = NULL;
uint_16 * fModes = NULL;
char * skipDirList;
Header h;
int nrelocated = 0;
int fileAlloced = 0;
char * fn = NULL;
int haveRelocatedFile = 0;
int reldel = 0;
int len;
int i, j, xx;
if (!hge(origH, RPMTAG_PREFIXES, &validType,
(void **) &validRelocations, &numValid))
numValid = 0;
numRelocations = 0;
if (rawRelocations)
while (rawRelocations[numRelocations].newPath ||
rawRelocations[numRelocations].oldPath)
numRelocations++;
/*
* If no relocations are specified (usually the case), then return the
* original header. If there are prefixes, however, then INSTPREFIXES
* should be added, but, since relocateFileList() can be called more
* than once for the same header, don't bother if already present.
*/
if (rawRelocations == NULL || numRelocations == 0) {
if (numValid) {
if (!headerIsEntry(origH, RPMTAG_INSTPREFIXES))
xx = hae(origH, RPMTAG_INSTPREFIXES,
validType, validRelocations, numValid);
validRelocations = hfd(validRelocations, validType);
}
/* XXX FIXME multilib file actions need to be checked. */
return headerLink(origH);
}
h = headerLink(origH);
relocations = alloca(sizeof(*relocations) * numRelocations);
/* Build sorted relocation list from raw relocations. */
for (i = 0; i < numRelocations; i++) {
char * t;
/*
* Default relocations (oldPath == NULL) are handled in the UI,
* not rpmlib.
*/
if (rawRelocations[i].oldPath == NULL) continue; /* XXX can't happen */
/* FIXME: Trailing /'s will confuse us greatly. Internal ones will
too, but those are more trouble to fix up. :-( */
t = alloca_strdup(rawRelocations[i].oldPath);
/*@-branchstate@*/
relocations[i].oldPath = (t[0] == '/' && t[1] == '\0')
? t
: stripTrailingChar(t, '/');
/*@=branchstate@*/
/* An old path w/o a new path is valid, and indicates exclusion */
if (rawRelocations[i].newPath) {
int del;
t = alloca_strdup(rawRelocations[i].newPath);
/*@-branchstate@*/
relocations[i].newPath = (t[0] == '/' && t[1] == '\0')
? t
: stripTrailingChar(t, '/');
/*@=branchstate@*/
/*@-nullpass@*/ /* FIX: relocations[i].oldPath == NULL */
/* Verify that the relocation's old path is in the header. */
for (j = 0; j < numValid; j++)
if (!strcmp(validRelocations[j], relocations[i].oldPath))
/*@innerbreak@*/ break;
/* XXX actions check prevents problem from being appended twice. */
if (j == numValid && !allowBadRelocate && actions)
psAppend(ts->probs, RPMPROB_BADRELOCATE, alp,
relocations[i].oldPath, NULL, NULL, 0);
del =
strlen(relocations[i].newPath) - strlen(relocations[i].oldPath);
/*@=nullpass@*/
if (del > reldel)
reldel = del;
} else {
relocations[i].newPath = NULL;
}
}
/* stupid bubble sort, but it's probably faster here */
for (i = 0; i < numRelocations; i++) {
int madeSwap;
madeSwap = 0;
for (j = 1; j < numRelocations; j++) {
rpmRelocation tmpReloc;
if (relocations[j - 1].oldPath == NULL || /* XXX can't happen */
relocations[j ].oldPath == NULL || /* XXX can't happen */
strcmp(relocations[j - 1].oldPath, relocations[j].oldPath) <= 0)
/*@innercontinue@*/ continue;
/*@-usereleased@*/ /* LCL: ??? */
tmpReloc = relocations[j - 1];
relocations[j - 1] = relocations[j];
relocations[j] = tmpReloc;
/*@=usereleased@*/
madeSwap = 1;
}
if (!madeSwap) break;
}
if (!_printed) {
_printed = 1;
rpmMessage(RPMMESS_DEBUG, _("========== relocations\n"));
for (i = 0; i < numRelocations; i++) {
if (relocations[i].oldPath == NULL) continue; /* XXX can't happen */
if (relocations[i].newPath == NULL)
rpmMessage(RPMMESS_DEBUG, _("%5d exclude %s\n"),
i, relocations[i].oldPath);
else
rpmMessage(RPMMESS_DEBUG, _("%5d relocate %s -> %s\n"),
i, relocations[i].oldPath, relocations[i].newPath);
}
}
/* Add relocation values to the header */
if (numValid) {
const char ** actualRelocations;
int numActual;
actualRelocations = xmalloc(numValid * sizeof(*actualRelocations));
numActual = 0;
for (i = 0; i < numValid; i++) {
for (j = 0; j < numRelocations; j++) {
if (relocations[j].oldPath == NULL || /* XXX can't happen */
strcmp(validRelocations[i], relocations[j].oldPath))
/*@innercontinue@*/ continue;
/* On install, a relocate to NULL means skip the path. */
if (relocations[j].newPath) {
actualRelocations[numActual] = relocations[j].newPath;
numActual++;
}
/*@innerbreak@*/ break;
}
if (j == numRelocations) {
actualRelocations[numActual] = validRelocations[i];
numActual++;
}
}
if (numActual)
xx = hae(h, RPMTAG_INSTPREFIXES, RPM_STRING_ARRAY_TYPE,
(void **) actualRelocations, numActual);
actualRelocations = _free(actualRelocations);
validRelocations = hfd(validRelocations, validType);
}
xx = hge(h, RPMTAG_BASENAMES, NULL, (void **) &baseNames, &fileCount);
xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
xx = hge(h, RPMTAG_DIRNAMES, NULL, (void **) &dirNames, &dirCount);
xx = hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fFlags, NULL);
xx = hge(h, RPMTAG_FILEMODES, NULL, (void **) &fModes, NULL);
skipDirList = alloca(dirCount * sizeof(*skipDirList));
memset(skipDirList, 0, dirCount * sizeof(*skipDirList));
newDirIndexes = alloca(sizeof(*newDirIndexes) * fileCount);
memcpy(newDirIndexes, dirIndexes, sizeof(*newDirIndexes) * fileCount);
dirIndexes = newDirIndexes;
/*
* For all relocations, we go through sorted file/relocation lists
* backwards so that /usr/local relocations take precedence over /usr
* ones.
*/
/* Relocate individual paths. */
for (i = fileCount - 1; i >= 0; i--) {
fileTypes ft;
int fnlen;
/*
* If only adding libraries of different arch into an already
* installed package, skip all other files.
*/
if (alp->multiLib && !isFileMULTILIB((fFlags[i]))) {
if (actions) {
actions[i] = FA_SKIPMULTILIB;
rpmMessage(RPMMESS_DEBUG, _("excluding multilib path %s%s\n"),
dirNames[dirIndexes[i]], baseNames[i]);
}
continue;
}
len = reldel +
strlen(dirNames[dirIndexes[i]]) + strlen(baseNames[i]) + 1;
/*@-branchstate@*/
if (len >= fileAlloced) {
fileAlloced = len * 2;
fn = xrealloc(fn, fileAlloced);
}
/*@=branchstate@*/
*fn = '\0';
fnlen = stpcpy( stpcpy(fn, dirNames[dirIndexes[i]]), baseNames[i]) - fn;
/*
* See if this file path needs relocating.
*/
/*
* XXX FIXME: Would a bsearch of the (already sorted)
* relocation list be a good idea?
*/
for (j = numRelocations - 1; j >= 0; j--) {
if (relocations[j].oldPath == NULL) /* XXX can't happen */
/*@innercontinue@*/ continue;
len = strcmp(relocations[j].oldPath, "/")
? strlen(relocations[j].oldPath)
: 0;
if (fnlen < len)
/*@innercontinue@*/ continue;
/*
* Only subdirectories or complete file paths may be relocated. We
* don't check for '\0' as our directory names all end in '/'.
*/
if (!(fn[len] == '/' || fnlen == len))
/*@innercontinue@*/ continue;
if (strncmp(relocations[j].oldPath, fn, len))
/*@innercontinue@*/ continue;
/*@innerbreak@*/ break;
}
if (j < 0) continue;
ft = whatis(fModes[i]);
/* On install, a relocate to NULL means skip the path. */
if (relocations[j].newPath == NULL) {
if (ft == XDIR) {
/* Start with the parent, looking for directory to exclude. */
for (j = dirIndexes[i]; j < dirCount; j++) {
len = strlen(dirNames[j]) - 1;
while (len > 0 && dirNames[j][len-1] == '/') len--;
if (fnlen != len)
/*@innercontinue@*/ continue;
if (strncmp(fn, dirNames[j], fnlen))
/*@innercontinue@*/ continue;
/*@innerbreak@*/ break;
}
if (j < dirCount)
skipDirList[j] = 1;
}
if (actions) {
actions[i] = FA_SKIPNSTATE;
rpmMessage(RPMMESS_DEBUG, _("excluding %s %s\n"),
ftstring(ft), fn);
}
continue;
}
/* Relocation on full paths only, please. */
if (fnlen != len) continue;
if (actions)
rpmMessage(RPMMESS_DEBUG, _("relocating %s to %s\n"),
fn, relocations[j].newPath);
nrelocated++;
strcpy(fn, relocations[j].newPath);
{ char * te = strrchr(fn, '/');
if (te) {
if (te > fn) te++; /* root is special */
fnlen = te - fn;
} else
te = fn + strlen(fn);
/*@-nullpass -nullderef@*/ /* LCL: te != NULL here. */
if (strcmp(baseNames[i], te)) /* basename changed too? */
baseNames[i] = alloca_strdup(te);
*te = '\0'; /* terminate new directory name */
/*@=nullpass =nullderef@*/
}
/* Does this directory already exist in the directory list? */
for (j = 0; j < dirCount; j++) {
if (fnlen != strlen(dirNames[j]))
/*@innercontinue@*/ continue;
if (strncmp(fn, dirNames[j], fnlen))
/*@innercontinue@*/ continue;
/*@innerbreak@*/ break;
}
if (j < dirCount) {
dirIndexes[i] = j;
continue;
}
/* Creating new paths is a pita */
if (!haveRelocatedFile) {
const char ** newDirList;
haveRelocatedFile = 1;
newDirList = xmalloc((dirCount + 1) * sizeof(*newDirList));
for (j = 0; j < dirCount; j++)
newDirList[j] = alloca_strdup(dirNames[j]);
dirNames = hfd(dirNames, RPM_STRING_ARRAY_TYPE);
dirNames = newDirList;
} else {
dirNames = xrealloc(dirNames,
sizeof(*dirNames) * (dirCount + 1));
}
dirNames[dirCount] = alloca_strdup(fn);
dirIndexes[i] = dirCount;
dirCount++;
}
/* Finish off by relocating directories. */
for (i = dirCount - 1; i >= 0; i--) {
for (j = numRelocations - 1; j >= 0; j--) {
if (relocations[j].oldPath == NULL) /* XXX can't happen */
/*@innercontinue@*/ continue;
len = strcmp(relocations[j].oldPath, "/")
? strlen(relocations[j].oldPath)
: 0;
if (len && strncmp(relocations[j].oldPath, dirNames[i], len))
/*@innercontinue@*/ continue;
/*
* Only subdirectories or complete file paths may be relocated. We
* don't check for '\0' as our directory names all end in '/'.
*/
if (dirNames[i][len] != '/')
/*@innercontinue@*/ continue;
if (relocations[j].newPath) { /* Relocate the path */
const char * s = relocations[j].newPath;
char * t = alloca(strlen(s) + strlen(dirNames[i]) - len + 1);
(void) stpcpy( stpcpy(t, s) , dirNames[i] + len);
if (actions)
rpmMessage(RPMMESS_DEBUG,
_("relocating directory %s to %s\n"), dirNames[i], t);
dirNames[i] = t;
nrelocated++;
}
}
}
/* Save original filenames in header and replace (relocated) filenames. */
if (nrelocated) {
int c;
void * p;
rpmTagType t;
p = NULL;
xx = hge(h, RPMTAG_BASENAMES, &t, &p, &c);
xx = hae(h, RPMTAG_ORIGBASENAMES, t, p, c);
p = hfd(p, t);
p = NULL;
xx = hge(h, RPMTAG_DIRNAMES, &t, &p, &c);
xx = hae(h, RPMTAG_ORIGDIRNAMES, t, p, c);
p = hfd(p, t);
p = NULL;
xx = hge(h, RPMTAG_DIRINDEXES, &t, &p, &c);
xx = hae(h, RPMTAG_ORIGDIRINDEXES, t, p, c);
p = hfd(p, t);
xx = hme(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE,
baseNames, fileCount);
fi->bnl = hfd(fi->bnl, RPM_STRING_ARRAY_TYPE);
xx = hge(h, RPMTAG_BASENAMES, NULL, (void **) &fi->bnl, &fi->fc);
xx = hme(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
dirNames, dirCount);
fi->dnl = hfd(fi->dnl, RPM_STRING_ARRAY_TYPE);
xx = hge(h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc);
xx = hme(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE,
dirIndexes, fileCount);
xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL);
}
baseNames = hfd(baseNames, RPM_STRING_ARRAY_TYPE);
dirNames = hfd(dirNames, RPM_STRING_ARRAY_TYPE);
fn = _free(fn);
return h;
}
void loadFi(const rpmTransactionSet ts, TFI_t fi, Header h, int scareMem)
{
HGE_t hge;
HFD_t hfd;
@ -78,7 +605,7 @@ void loadFi(Header h, TFI_t fi)
fi->fsm = newFSM();
/* XXX avoid gcc noise on pointer (4th arg) cast(s) */
hge = (fi->type == TR_ADDED)
hge = (scareMem && fi->type == TR_ADDED)
? (HGE_t) headerGetEntryMinMemory : (HGE_t) headerGetEntry;
fi->hge = hge;
fi->hae = (HAE_t) headerAddEntry;
@ -101,6 +628,7 @@ void loadFi(Header h, TFI_t fi)
/* -1 means not found */
rc = hge(fi->h, RPMTAG_EPOCH, NULL, (void **) &uip, NULL);
fi->epoch = (rc ? *uip : -1);
/* 0 means unknown */
rc = hge(fi->h, RPMTAG_ARCHIVESIZE, NULL, (void **) &uip, NULL);
fi->archiveSize = (rc ? *uip : 0);
@ -111,11 +639,14 @@ void loadFi(Header h, TFI_t fi)
return;
}
rc = hge(fi->h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL);
rc = hge(fi->h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc);
rc = hge(fi->h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL);
rc = hge(fi->h, RPMTAG_FILEMODES, NULL, (void **) &fi->fmodes, NULL);
rc = hge(fi->h, RPMTAG_FILEFLAGS, NULL, (void **) &fi->fflags, NULL);
rc = hge(fi->h, RPMTAG_FILESIZES, NULL, (void **) &fi->fsizes, NULL);
/* XXX initialized to NULL for TR_ADDED? */
rc = hge(fi->h, RPMTAG_FILESTATES, NULL, (void **) &fi->fstates, NULL);
fi->action = FA_UNKNOWN;
@ -129,15 +660,47 @@ void loadFi(Header h, TFI_t fi)
case TR_ADDED:
fi->mapflags =
CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID;
rc = hge(fi->h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL);
rc = hge(fi->h, RPMTAG_FILELINKTOS, NULL, (void **) &fi->flinks, NULL);
rc = hge(fi->h, RPMTAG_FILELANGS, NULL, (void **) &fi->flangs, NULL);
rc = hge(fi->h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL);
rc = hge(fi->h, RPMTAG_FILEMTIMES, NULL, (void **) &fi->fmtimes, NULL);
rc = hge(fi->h, RPMTAG_FILERDEVS, NULL, (void **) &fi->frdevs, NULL);
/* 0 makes for noops */
fi->replacedSizes = xcalloc(fi->fc, sizeof(*fi->replacedSizes));
if (fi->h != NULL && ts != NULL)
{ Header foo = relocateFileList(ts, fi, fi->ap, fi->h, fi->actions);
foo = headerFree(foo);
}
if (!scareMem) {
fprintf(stderr, "*** %s-%s-%s scareMem\n", fi->name, fi->version, fi->release);
fi->fmtimes = memcpy(xmalloc(fi->fc * sizeof(*fi->fmtimes)),
fi->fmtimes, fi->fc * sizeof(*fi->fmtimes));
fi->frdevs = memcpy(xmalloc(fi->fc * sizeof(*fi->frdevs)),
fi->frdevs, fi->fc * sizeof(*fi->frdevs));
fi->fsizes = memcpy(xmalloc(fi->fc * sizeof(*fi->fsizes)),
fi->fsizes, fi->fc * sizeof(*fi->fsizes));
fi->fflags = memcpy(xmalloc(fi->fc * sizeof(*fi->fflags)),
fi->fflags, fi->fc * sizeof(*fi->fflags));
fi->fmodes = memcpy(xmalloc(fi->fc * sizeof(*fi->fmodes)),
fi->fmodes, fi->fc * sizeof(*fi->fmodes));
/* XXX there's a tedious segfault here for some version(s) of rpm */
if (fi->fstates)
fi->fstates = memcpy(xmalloc(fi->fc * sizeof(*fi->fstates)),
fi->fstates, fi->fc * sizeof(*fi->fstates));
else
fi->fstates = xcalloc(1, fi->fc * sizeof(*fi->fstates));
fi->dil = memcpy(xmalloc(fi->fc * sizeof(*fi->dil)),
fi->dil, fi->fc * sizeof(*fi->dil));
fi->h = headerFree(fi->h);
}
break;
case TR_REMOVED:
fi->mapflags =
@ -178,9 +741,7 @@ void loadFi(Header h, TFI_t fi)
fi->dperms = 0755;
fi->fperms = 0644;
/*@-nullstate@*/ /* FIX: fi->h is NULL for TR_REMOVED */
return;
/*@=nullstate@*/
}
void freeFi(TFI_t fi)
@ -213,6 +774,15 @@ void freeFi(TFI_t fi)
switch (fi->type) {
case TR_ADDED:
if (fi->h == NULL) {
fi->fmtimes = hfd(fi->fmtimes, -1);
fi->frdevs = hfd(fi->frdevs, -1);
fi->fsizes = hfd(fi->fsizes, -1);
fi->fflags = hfd(fi->fflags, -1);
fi->fmodes = hfd(fi->fmodes, -1);
fi->fstates = hfd(fi->fstates, -1);
fi->dil = hfd(fi->dil, -1);
}
break;
case TR_REMOVED:
fi->fsizes = hfd(fi->fsizes, -1);
@ -652,11 +1222,12 @@ rpmRC rpmInstallSourcePackage(const char * rootDir, FD_t fd,
fi->type = TR_ADDED;
fi->ap = ts->addedPackages.list;
loadFi(h, fi);
loadFi(ts, fi, h, 1);
hge = fi->hge;
hfd = (fi->hfd ? fi->hfd : headerFreeData);
h = headerFree(h); /* XXX reference held by transaction set */
if (fi->h != NULL) /* XXX can't happen */
(void) rpmInstallLoadMacros(fi, fi->h);
memset(psm, 0, sizeof(*psm));
@ -692,12 +1263,15 @@ rpmRC rpmInstallSourcePackage(const char * rootDir, FD_t fd,
fi->actions[i] = FA_CREATE;
}
i = fi->fc;
if (fi->h != NULL) { /* XXX can't happen */
rpmBuildFileList(fi->h, &fi->apath, NULL);
i = fi->fc;
if (headerIsEntry(fi->h, RPMTAG_COOKIE))
for (i = 0; i < fi->fc; i++)
if (fi->fflags[i] & RPMFILE_SPECFILE) break;
}
if (i == fi->fc) {
/* Find the spec file by name. */
@ -850,9 +1424,12 @@ static int runScript(PSM_t psm, Header h,
rpmRC rc = RPMRC_OK;
const char *n, *v, *r;
if (!progArgv && !script)
if (progArgv == NULL && script == NULL)
return 0;
rpmMessage(RPMMESS_DEBUG, _("%s: running %s scriptlet\n"),
psm->stepName, tag2sln(psm->scriptTag));
if (!progArgv) {
argv = alloca(5 * sizeof(*argv));
argv[0] = "/bin/sh";
@ -1060,8 +1637,8 @@ static rpmRC runInstScript(PSM_t psm)
TFI_t fi = psm->fi;
HGE_t hge = fi->hge;
HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
void ** programArgv;
int programArgc;
void ** progArgv;
int progArgc;
const char ** argv;
rpmTagType ptt, stt;
const char * script;
@ -1072,22 +1649,26 @@ static rpmRC runInstScript(PSM_t psm)
* headerGetEntry() sets the data pointer to NULL if the entry does
* not exist.
*/
xx = hge(fi->h, psm->progTag, &ptt, (void **) &programArgv, &programArgc);
xx = hge(fi->h, psm->scriptTag, &stt, (void **) &script, NULL);
xx = hge(fi->h, psm->progTag, &ptt, (void **) &progArgv, &progArgc);
if (progArgv == NULL && script == NULL)
goto exit;
/*@-branchstate@*/
if (programArgv && ptt == RPM_STRING_TYPE) {
if (progArgv && ptt == RPM_STRING_TYPE) {
argv = alloca(sizeof(*argv));
*argv = (const char *) programArgv;
*argv = (const char *) progArgv;
} else {
argv = (const char **) programArgv;
argv = (const char **) progArgv;
}
/*@=branchstate@*/
rc = runScript(psm, fi->h, tag2sln(psm->scriptTag), programArgc, argv,
if (fi->h != NULL) /* XXX can't happen */
rc = runScript(psm, fi->h, tag2sln(psm->scriptTag), progArgc, argv,
script, psm->scriptArg, -1);
programArgv = hfd(programArgv, ptt);
exit:
progArgv = hfd(progArgv, ptt);
script = hfd(script, stt);
return rc;
}
@ -1230,6 +1811,7 @@ static int runTriggers(PSM_t psm)
if (numPackage < 0)
return 1;
if (fi->h != NULL) /* XXX can't happen */
{ Header triggeredH;
rpmdbMatchIterator mi;
int countCorrection = psm->countCorrection;
@ -1270,6 +1852,8 @@ static int runImmedTriggers(PSM_t psm)
unsigned char * triggersRun;
rpmRC rc = RPMRC_OK;
if (fi->h == NULL) return 0; /* XXX can't happen */
if (!( hge(fi->h, RPMTAG_TRIGGERNAME, &tnt,
(void **) &triggerNames, &numTriggers) &&
hge(fi->h, RPMTAG_TRIGGERINDEX, &tit,
@ -1348,6 +1932,7 @@ static int runImmedTriggers(PSM_t psm)
* @todo Packages w/o files never get a callback, hence don't get displayed
* on install with -v.
*/
/*@-nullpass@*/ /* FIX: testing null annotation for fi->h */
int psmStage(PSM_t psm, pkgStage stage)
{
const rpmTransactionSet ts = psm->ts;
@ -1720,6 +2305,7 @@ assert(psm->mi == NULL);
if (psm->goal == PSM_PKGINSTALL) {
int_32 installTime = (int_32) time(NULL);
if (fi->h == NULL) break; /* XXX can't happen */
if (fi->fstates != NULL && fi->fc > 0)
xx = headerAddEntry(fi->h, RPMTAG_FILESTATES, RPM_CHAR_TYPE,
fi->fstates, fi->fc);
@ -1934,8 +2520,10 @@ assert(psm->mi == NULL);
}
break;
case PSM_SCRIPT:
#ifdef DYING
rpmMessage(RPMMESS_DEBUG, _("%s: running %s script(s) (if any)\n"),
psm->stepName, tag2sln(psm->scriptTag));
#endif
rc = runInstScript(psm);
break;
case PSM_TRIGGERS:
@ -1980,6 +2568,7 @@ fprintf(stderr, "*** PSM_RDB_LOAD: header #%u not found\n", fi->record);
break;
case PSM_RPMDB_ADD:
if (ts->transFlags & RPMTRANS_FLAG_TEST) break;
if (fi->h != NULL) /* XXX can't happen */
rc = rpmdbAdd(ts->rpmdb, ts->id, fi->h);
break;
case PSM_RPMDB_REMOVE:
@ -1996,3 +2585,4 @@ fprintf(stderr, "*** PSM_RDB_LOAD: header #%u not found\n", fi->record);
return rc;
/*@=nullstate@*/
}
/*@=nullpass@*/

View File

@ -31,7 +31,7 @@ struct transactionFileInfo_s {
HME_t hme; /*!< Vector to headerModifyEntry() */
HRE_t hre; /*!< Vector to headerRemoveEntry() */
HFD_t hfd; /*!< Vector to headerFreeData() */
Header h; /*!< Package header */
/*@null@*/ Header h; /*!< Package header */
/*@owned@*/ const char * name;
/*@owned@*/ const char * version;
/*@owned@*/ const char * release;
@ -133,8 +133,10 @@ typedef enum pkgStage_e {
/**
*/
struct psm_s {
/*@kept@*/ rpmTransactionSet ts;/*!< transaction set */
/*@kept@*/ TFI_t fi; /*!< transaction element file info */
/*@kept@*/
rpmTransactionSet ts; /*!< transaction set */
/*@kept@*/
TFI_t fi; /*!< transaction element file info */
FD_t cfd; /*!< Payload file handle. */
FD_t fd; /*!< Repackage file handle. */
Header oh; /*!< Repackage/multilib header. */
@ -164,12 +166,55 @@ extern "C" {
#endif
/**
* Load data from header into transaction file element info.
* @param h header
* @param fi transaction element file info
* Create problem set.
*/
void loadFi(Header h, TFI_t fi)
/*@modifies h, fi @*/;
rpmProblemSet psCreate(void)
/*@*/;
/**
* Append problem to set.
*/
void psAppend(rpmProblemSet probs, rpmProblemType type,
const struct availablePackage * alp,
const char * dn, const char * bn,
Header altH, unsigned long ulong1)
/*@modifies probs, alp @*/;
/**
* Return file type from mode_t.
* @param mode file mode bits (from header)
* @return file type
*/
fileTypes whatis(uint_16 mode)
/*@*/;
/**
* Relocate files in header.
* @todo multilib file dispositions need to be checked.
* @param ts transaction set
* @param fi transaction element file info
* @param alp available package
* @param origH package header
* @param actions file dispositions
* @return header with relocated files
*/
Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
struct availablePackage * alp,
Header origH, fileAction * actions)
/*@globals fileSystem @*/
/*@modifies ts, fi, alp, origH, actions, fileSystem @*/;
/**
* Load data from header into transaction file element info.
* @param ts transaction set
* @param fi transaction element file info
* @param h header
* @param scareMem use header memory?
*/
void loadFi(/*@null@*/ const rpmTransactionSet ts, TFI_t fi,
Header h, int scareMem)
/*@globals fileSystem @*/
/*@modifies ts, fi, h, fileSystem @*/;
/**
* Destroy transaction element file info.

View File

@ -8,7 +8,6 @@
#include <rpmmacro.h> /* XXX for rpmExpand */
#include "fprint.h"
#include "rpmhash.h"
#include "misc.h" /* XXX stripTrailingChar, splitString, currentDirectory */
#include "rpmdb.h"
@ -136,6 +135,7 @@ int rpmtransGetKeys(const rpmTransactionSet ts, const void *** ep, int * nep)
return rc;
}
#ifdef DYING
/**
*/
static rpmProblemSet psCreate(void)
@ -216,6 +216,7 @@ static void psAppend(rpmProblemSet probs, rpmProblemType type,
t = stpcpy(t, r);
}
}
#endif /* DYING */
/**
*/
@ -291,6 +292,7 @@ void rpmProblemSetFree(rpmProblemSet probs)
free(probs);
}
#ifdef DYING
/**
*/
static /*@observer@*/ const char *const ftstring (fileTypes ft)
@ -345,7 +347,6 @@ static Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
HME_t hme = fi->hme;
HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
static int _printed = 0;
rpmProblemSet probs = ts->probs;
int allowBadRelocate = (ts->ignoreSet & RPMPROB_FILTER_FORCERELOCATE);
rpmRelocation * rawRelocations = alp->relocs;
rpmRelocation * relocations = NULL;
@ -439,7 +440,7 @@ static Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
/*@innerbreak@*/ break;
/* XXX actions check prevents problem from being appended twice. */
if (j == numValid && !allowBadRelocate && actions)
psAppend(probs, RPMPROB_BADRELOCATE, alp,
psAppend(ts->probs, RPMPROB_BADRELOCATE, alp,
relocations[i].oldPath, NULL, NULL, 0);
del =
strlen(relocations[i].newPath) - strlen(relocations[i].oldPath);
@ -755,6 +756,7 @@ static Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
return h;
}
#endif /* DYING */
/**
* Filter a problem set.
@ -943,16 +945,18 @@ static int filecmp(short mode1, const char * md51, const char * link1,
/**
*/
static int handleInstInstalledFiles(TFI_t fi, /*@null@*/ rpmdb db,
/* XXX ts->{probs,rpmdb} modified, could be const ... ts */
static int handleInstInstalledFiles(const rpmTransactionSet ts, TFI_t fi,
struct sharedFileInfo * shared,
int sharedCount, int reportConflicts,
rpmProblemSet probs,
rpmtransFlags transFlags)
int sharedCount, int reportConflicts)
/*@globals fileSystem @*/
/*@modifies fi, db, probs, fileSystem @*/
/*@modifies ts, fi, fileSystem @*/
{
HGE_t hge = fi->hge;
HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
rpmdb db = ts->rpmdb;
rpmProblemSet probs = ts->probs;
rpmtransFlags transFlags = ts->transFlags;
rpmTagType oltype, omtype;
Header h;
int i;
@ -1043,13 +1047,14 @@ static int handleInstInstalledFiles(TFI_t fi, /*@null@*/ rpmdb db,
/**
*/
static int handleRmvdInstalledFiles(TFI_t fi, /*@null@*/ rpmdb db,
struct sharedFileInfo * shared,
int sharedCount)
/* XXX ts->rpmdb modified, could be const ... ts */
static int handleRmvdInstalledFiles(const rpmTransactionSet ts, TFI_t fi,
struct sharedFileInfo * shared, int sharedCount)
/*@globals fileSystem @*/
/*@modifies fi, db, fileSystem @*/
/*@modifies ts, fi, fileSystem @*/
{
HGE_t hge = fi->hge;
rpmdb db = ts->rpmdb;
Header h;
const char * otherStates;
int i, xx;
@ -1085,16 +1090,20 @@ static int handleRmvdInstalledFiles(TFI_t fi, /*@null@*/ rpmdb db,
/**
* Update disk space needs on each partition for this package.
*/
static void handleOverlappedFiles(TFI_t fi, hashTable ht,
rpmProblemSet probs, struct diskspaceInfo * dsl)
/* XXX ts->{probs,di} modified, could be const ... ts */
static void handleOverlappedFiles(const rpmTransactionSet ts, TFI_t fi)
/*@globals fileSystem @*/
/*@modifies fi, probs, dsl, fileSystem @*/
/*@modifies ts, fi, fileSystem @*/
{
int i, j;
struct diskspaceInfo * dsl = ts->di;
rpmProblemSet probs = (ts->ignoreSet & RPMPROB_FILTER_REPLACENEWFILES)
? NULL : ts->probs;
hashTable ht = ts->ht;
struct diskspaceInfo * ds = NULL;
uint_32 fixupSize = 0;
char * filespec = NULL;
int fileSpecAlloced = 0;
int i, j;
for (i = 0; i < fi->fc; i++) {
int otherPkgNum, otherFileNum;
@ -1597,7 +1606,6 @@ int rpmRunTransactions( rpmTransactionSet ts,
int ourrc = 0;
struct availablePackage * alp;
int totalFileCount = 0;
hashTable ht;
TFI_t fi;
struct diskspaceInfo * dip;
struct sharedFileInfo * shared, * sharedList;
@ -1782,17 +1790,22 @@ int rpmRunTransactions( rpmTransactionSet ts,
/*@-branchstate@*/
switch (fi->type) {
case TR_ADDED:
#ifdef DYING
i = ts->order[oc].u.addedIndex;
#endif
/* XXX watchout: fi->type must be set for tsGetAlp() to "work" */
fi->ap = tsGetAlp(tsi);
fi->record = 0;
loadFi(fi->ap->h, fi);
loadFi(ts, fi, fi->ap->h, 1);
/* XXX free fi->ap->h here */
if (fi->fc == 0)
continue;
#ifdef DYING
{ Header foo = relocateFileList(ts, fi, fi->ap, fi->h, fi->actions);
foo = headerFree(foo);
}
#endif
/* Skip netshared paths, not our i18n files, and excluded docs */
skipFiles(ts, fi);
@ -1800,6 +1813,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
case TR_REMOVED:
fi->ap = NULL;
fi->record = ts->order[oc].u.removed.dboffset;
/* Retrieve erased package header from the database. */
{ rpmdbMatchIterator mi;
mi = rpmdbInitIterator(ts->rpmdb, RPMDBI_PACKAGES,
@ -1813,7 +1827,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
continue;
}
/* XXX header arg unused. */
loadFi(fi->h, fi);
loadFi(ts, fi, fi->h, 0);
/*@switchbreak@*/ break;
}
/*@=branchstate@*/
@ -1837,7 +1851,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
/*@=onlytrans@*/
}
ht = htCreate(totalFileCount * 2, 0, 0, fpHashFunction, fpEqual);
ts->ht = htCreate(totalFileCount * 2, 0, 0, fpHashFunction, fpEqual);
fpc = fpCacheCreate(totalFileCount);
/* ===============================================
@ -1850,7 +1864,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
if (XFA_SKIPPING(fi->actions[i]))
/*@innercontinue@*/ continue;
/*@-dependenttrans@*/
htAddEntry(ht, fi->fps + i, fi);
htAddEntry(ts->ht, fi->fps + i, fi);
/*@=dependenttrans@*/
}
}
@ -1946,13 +1960,12 @@ int rpmRunTransactions( rpmTransactionSet ts,
/* Determine the fate of each file. */
switch (fi->type) {
case TR_ADDED:
xx = handleInstInstalledFiles(fi, ts->rpmdb, shared, nexti - i,
!(beingRemoved || (ts->ignoreSet & RPMPROB_FILTER_REPLACEOLDFILES)),
ts->probs, ts->transFlags);
xx = handleInstInstalledFiles(ts, fi, shared, nexti - i,
!(beingRemoved || (ts->ignoreSet & RPMPROB_FILTER_REPLACEOLDFILES)));
/*@switchbreak@*/ break;
case TR_REMOVED:
if (!beingRemoved)
xx = handleRmvdInstalledFiles(fi, ts->rpmdb, shared, nexti - i);
xx = handleRmvdInstalledFiles(ts, fi, shared, nexti - i);
/*@switchbreak@*/ break;
}
}
@ -1960,9 +1973,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
free(sharedList);
/* Update disk space needs on each partition for this package. */
handleOverlappedFiles(fi, ht,
((ts->ignoreSet & RPMPROB_FILTER_REPLACENEWFILES)
? NULL : ts->probs), ts->di);
handleOverlappedFiles(ts, fi);
/* Check added package has sufficient space on each partition used. */
switch (fi->type) {
@ -2025,7 +2036,8 @@ int rpmRunTransactions( rpmTransactionSet ts,
tsi = tsFreeIterator(tsi);
fpCacheFree(fpc);
htFree(ht);
htFree(ts->ht);
ts->ht = NULL;
/* ===============================================
* If unfiltered problems exist, free memory and return.
@ -2079,7 +2091,9 @@ int rpmRunTransactions( rpmTransactionSet ts,
assert(alp == fi->ap);
i = alp - ts->addedPackages.list;
h = headerLink(fi->h);
rpmMessage(RPMMESS_DEBUG, "========== +++ %s-%s-%s\n",
fi->name, fi->version, fi->release);
h = (fi->h ? headerLink(fi->h) : NULL);
/*@-branchstate@*/
if (alp->fd == NULL) {
alp->fd = ts->notify(fi->h, RPMCALLBACK_INST_OPEN_FILE, 0, 0,
@ -2099,7 +2113,7 @@ assert(alp == fi->ap);
/*@=noeffectuncon @*/
alp->fd = NULL;
ourrc++;
} else {
} else if (fi->h != NULL) {
Header foo = relocateFileList(ts, fi, alp, h, NULL);
h = headerFree(h);
h = headerLink(foo);
@ -2116,8 +2130,24 @@ assert(alp == fi->ap);
if (fi->h) {
hsave = headerLink(fi->h);
fi->h = headerFree(fi->h);
}
fi->h = headerLink(h);
} else {
char * fstates = fi->fstates;
fileAction * actions = fi->actions;
fi->fstates = NULL;
fi->actions = NULL;
freeFi(fi);
oc = tsGetOc(tsi);
fi->magic = TFIMAGIC;
fi->type = ts->order[oc].type;
fi->ap = tsGetAlp(tsi);
fi->record = 0;
loadFi(ts, fi, h, 1);
fi->fstates = _free(fi->fstates);
fi->fstates = fstates;
fi->actions = _free(fi->actions);
fi->actions = actions;
}
if (alp->multiLib)
ts->transFlags |= RPMTRANS_FLAG_MULTILIB;
@ -2145,16 +2175,18 @@ assert(alp == fi->ap);
/*@=noeffectuncon @*/
alp->fd = NULL;
}
freeFi(fi);
/*@switchbreak@*/ break;
case TR_REMOVED:
rpmMessage(RPMMESS_DEBUG, "========== --- %s-%s-%s\n",
fi->name, fi->version, fi->release);
oc = tsGetOc(tsi);
/* If install failed, then we shouldn't erase. */
if (ts->order[oc].u.removed.dependsOnIndex == lastFailed)
/*@switchbreak@*/ break;
if (ts->order[oc].u.removed.dependsOnIndex != lastFailed) {
if (psmStage(psm, PSM_PKGERASE))
ourrc++;
}
freeFi(fi);
/*@switchbreak@*/ break;
}
xx = rpmdbSync(ts->rpmdb);

View File

@ -289,7 +289,7 @@ int rpmVerifyScript(const char * rootDir, Header h, /*@null@*/ FD_t scriptFd)
ts->scriptFd = fdLink(scriptFd, "rpmVerifyScript");
/*@=type@*/
fi->magic = TFIMAGIC;
loadFi(h, fi);
loadFi(ts, fi, h, 1);
memset(psm, 0, sizeof(*psm));
psm->ts = ts;
psm->fi = fi;

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2001-10-17 12:38-0400\n"
"POT-Creation-Date: 2001-10-18 12:38-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -1393,88 +1393,88 @@ msgstr ""
msgid "Symlink points to BuildRoot: %s -> %s\n"
msgstr ""
#: build/files.c:1487
#: build/files.c:1488
#, c-format
msgid "File doesn't match prefix (%s): %s\n"
msgstr ""
#: build/files.c:1511
#: build/files.c:1512
#, c-format
msgid "File not found: %s\n"
msgstr ""
#: build/files.c:1554 build/files.c:2166 build/parsePrep.c:50
#: build/files.c:1555 build/files.c:2167 build/parsePrep.c:50
#, c-format
msgid "Bad owner/group: %s\n"
msgstr ""
#: build/files.c:1566
#: build/files.c:1567
#, c-format
msgid "File %4d: %07o %s.%s\t %s\n"
msgstr ""
#: build/files.c:1670
#: build/files.c:1671
#, c-format
msgid "File needs leading \"/\": %s\n"
msgstr ""
#: build/files.c:1693
#: build/files.c:1694
#, c-format
msgid "Glob not permitted: %s\n"
msgstr ""
#: build/files.c:1708
#: build/files.c:1709
#, c-format
msgid "File not found by glob: %s\n"
msgstr ""
#: build/files.c:1770
#: build/files.c:1771
#, c-format
msgid "Could not open %%files file %s: %s\n"
msgstr ""
#: build/files.c:1781 build/pack.c:150
#: build/files.c:1782 build/pack.c:150
#, c-format
msgid "line: %s\n"
msgstr ""
#: build/files.c:2154
#: build/files.c:2155
#, c-format
msgid "Bad file: %s: %s\n"
msgstr ""
#. XXX this error message is probably not seen.
#: build/files.c:2228
#: build/files.c:2229
#, c-format
msgid "Couldn't exec %s: %s\n"
msgstr ""
#: build/files.c:2233
#: build/files.c:2234
#, c-format
msgid "Couldn't fork %s: %s\n"
msgstr ""
#: build/files.c:2317
#: build/files.c:2318
#, c-format
msgid "%s failed\n"
msgstr ""
#: build/files.c:2321
#: build/files.c:2322
#, c-format
msgid "failed to write all data to %s\n"
msgstr ""
#: build/files.c:2457
#: build/files.c:2458
#, c-format
msgid "Finding %s: (using %s)...\n"
msgstr ""
#: build/files.c:2483 build/files.c:2497
#: build/files.c:2484 build/files.c:2498
#, c-format
msgid "Failed to find %s:\n"
msgstr ""
#: build/files.c:2618
#: build/files.c:2619
#, c-format
msgid "Processing files: %s-%s-%s\n"
msgstr ""
@ -1613,7 +1613,7 @@ msgstr ""
msgid "Could not open %s: %s\n"
msgstr ""
#: build/pack.c:595 lib/psm.c:1562
#: build/pack.c:595 lib/psm.c:2147
#, c-format
msgid "Unable to write package: %s\n"
msgstr ""
@ -1643,7 +1643,7 @@ msgstr ""
msgid "Unable to write payload to %s: %s\n"
msgstr ""
#: build/pack.c:675 lib/psm.c:1827
#: build/pack.c:675 lib/psm.c:2413
#, c-format
msgid "Wrote: %s\n"
msgstr ""
@ -2173,7 +2173,7 @@ msgid "========== continuing tsort ...\n"
msgstr ""
#: lib/formats.c:28 lib/formats.c:54 lib/formats.c:85 lib/formats.c:160
#: lib/header.c:2869 lib/header.c:2890 lib/header.c:2912
#: lib/header.c:2902 lib/header.c:2923 lib/header.c:2945
msgid "(not a number)"
msgstr ""
@ -2211,12 +2211,12 @@ msgid "file %s is on an unknown device\n"
msgstr ""
#: lib/fsm.c:301
msgid "========= Directories not explictly included in package:\n"
msgid "========== Directories not explictly included in package:\n"
msgstr ""
#: lib/fsm.c:303
#, c-format
msgid "%9d %s\n"
msgid "%10d %s\n"
msgstr ""
#: lib/fsm.c:1163
@ -2256,88 +2256,88 @@ msgstr ""
#. This should not be allowed
#. @-modfilesys@
#: lib/header.c:309
#: lib/header.c:314
msgid "dataLength() RPM_STRING_TYPE count must be 1.\n"
msgstr ""
#. @-modfilesys@
#: lib/header.c:346 lib/header_internal.c:161 lib/psm.c:401
#: lib/header.c:351 lib/header_internal.c:161 lib/psm.c:971
#, c-format
msgid "Data type %d not supported\n"
msgstr ""
#. @-observertrans -readonlytrans@
#: lib/header.c:2155
#: lib/header.c:2186
#, c-format
msgid "missing { after %"
msgstr ""
#. @-observertrans -readonlytrans@
#: lib/header.c:2185
#: lib/header.c:2216
msgid "missing } after %{"
msgstr ""
#. @-observertrans -readonlytrans@
#: lib/header.c:2199
#: lib/header.c:2230
msgid "empty tag format"
msgstr ""
#. @-observertrans -readonlytrans@
#: lib/header.c:2213
#: lib/header.c:2244
msgid "empty tag name"
msgstr ""
#. @-observertrans -readonlytrans@
#: lib/header.c:2230
#: lib/header.c:2261
msgid "unknown tag"
msgstr ""
#. @-observertrans -readonlytrans@
#: lib/header.c:2257
#: lib/header.c:2288
msgid "] expected at end of array"
msgstr ""
#. @-observertrans -readonlytrans@
#: lib/header.c:2275
#: lib/header.c:2306
msgid "unexpected ]"
msgstr ""
#. @-observertrans -readonlytrans@
#: lib/header.c:2279
#: lib/header.c:2310
msgid "unexpected }"
msgstr ""
#. @-observertrans -readonlytrans@
#: lib/header.c:2345
#: lib/header.c:2376
msgid "? expected in expression"
msgstr ""
#. @-observertrans -readonlytrans@
#: lib/header.c:2354
#: lib/header.c:2385
msgid "{ expected after ? in expression"
msgstr ""
#. @-observertrans -readonlytrans@
#: lib/header.c:2367 lib/header.c:2409
#: lib/header.c:2398 lib/header.c:2440
msgid "} expected in expression"
msgstr ""
#. @-observertrans -readonlytrans@
#: lib/header.c:2377
#: lib/header.c:2408
msgid ": expected following ? subexpression"
msgstr ""
#. @-observertrans -readonlytrans@
#: lib/header.c:2394
#: lib/header.c:2425
msgid "{ expected after : in expression"
msgstr ""
#. @-observertrans -readonlytrans@
#: lib/header.c:2419
#: lib/header.c:2450
msgid "| expected at end of expression"
msgstr ""
#: lib/header.c:2615
#: lib/header.c:2646
msgid "(unknown type)"
msgstr ""
@ -2799,74 +2799,113 @@ msgstr ""
msgid "unknown error %d encountered while manipulating package %s"
msgstr ""
#: lib/psm.c:598
#: lib/psm.c:313 lib/transaction.c:478
msgid "========== relocations\n"
msgstr ""
#: lib/psm.c:317 lib/transaction.c:482
#, c-format
msgid "%5d exclude %s\n"
msgstr ""
#: lib/psm.c:320 lib/transaction.c:485
#, c-format
msgid "%5d relocate %s -> %s\n"
msgstr ""
#: lib/psm.c:390 lib/transaction.c:555
#, c-format
msgid "excluding multilib path %s%s\n"
msgstr ""
#: lib/psm.c:456 lib/transaction.c:621
#, c-format
msgid "excluding %s %s\n"
msgstr ""
#: lib/psm.c:466 lib/transaction.c:631
#, c-format
msgid "relocating %s to %s\n"
msgstr ""
#: lib/psm.c:545 lib/transaction.c:710
#, c-format
msgid "relocating directory %s to %s\n"
msgstr ""
#: lib/psm.c:1168
#, c-format
msgid "cannot create %%%s %s\n"
msgstr ""
#: lib/psm.c:604
#: lib/psm.c:1174
#, c-format
msgid "cannot write to %%%s %s\n"
msgstr ""
#: lib/psm.c:642
#: lib/psm.c:1212
msgid "source package expected, binary found\n"
msgstr ""
#: lib/psm.c:749
#: lib/psm.c:1323
msgid "source package contains no .spec file\n"
msgstr ""
#: lib/psm.c:1021
#: lib/psm.c:1430
#, c-format
msgid "%s: running %s scriptlet\n"
msgstr ""
#: lib/psm.c:1598
#, c-format
msgid "execution of %s scriptlet from %s-%s-%s failed, waitpid returned %s\n"
msgstr ""
#: lib/psm.c:1028
#: lib/psm.c:1605
#, c-format
msgid "execution of %s scriptlet from %s-%s-%s failed, exit status %d\n"
msgstr ""
#: lib/psm.c:1367
#: lib/psm.c:1952
#, c-format
msgid "%s: %s-%s-%s has %d files, test = %d\n"
msgstr ""
#: lib/psm.c:1484
#: lib/psm.c:2069
#, c-format
msgid "%s: %s scriptlet failed (%d), skipping %s-%s-%s\n"
msgstr ""
#: lib/psm.c:1599
#: lib/psm.c:2184
#, c-format
msgid "user %s does not exist - using root\n"
msgstr ""
#: lib/psm.c:1608
#: lib/psm.c:2193
#, c-format
msgid "group %s does not exist - using root\n"
msgstr ""
#: lib/psm.c:1649
#: lib/psm.c:2234
#, c-format
msgid "unpacking of archive failed%s%s: %s\n"
msgstr ""
#: lib/psm.c:1650
#: lib/psm.c:2235
msgid " on file "
msgstr ""
#: lib/psm.c:1835
#: lib/psm.c:2421
#, c-format
msgid "%s failed on file %s: %s\n"
msgstr ""
#: lib/psm.c:1838
#: lib/psm.c:2424
#, c-format
msgid "%s failed: %s\n"
msgstr ""
#: lib/psm.c:1937
#: lib/psm.c:2524
#, c-format
msgid "%s: running %s script(s) (if any)\n"
msgstr ""
@ -3389,47 +3428,13 @@ msgstr ""
msgid "You must set \"%%_pgp_name\" in your macro file\n"
msgstr ""
#: lib/transaction.c:477
msgid "========== relocations\n"
msgstr ""
#: lib/transaction.c:481
#, c-format
msgid "%5d exclude %s\n"
msgstr ""
#: lib/transaction.c:484
#, c-format
msgid "%5d relocate %s -> %s\n"
msgstr ""
#: lib/transaction.c:554
#, c-format
msgid "excluding multilib path %s%s\n"
msgstr ""
#: lib/transaction.c:620
#, c-format
msgid "excluding %s %s\n"
msgstr ""
#: lib/transaction.c:630
#, c-format
msgid "relocating %s to %s\n"
msgstr ""
#: lib/transaction.c:709
#, c-format
msgid "relocating directory %s to %s\n"
msgstr ""
#: lib/transaction.c:855
#: lib/transaction.c:857
#, c-format
msgid "%s skipped due to missingok flag\n"
msgstr ""
#. @innercontinue@
#: lib/transaction.c:1476
#: lib/transaction.c:1485
#, c-format
msgid "excluding directory %s\n"
msgstr ""