#include "debug.h"
-/*@access TFI_t @*/ /* XXX abstraction wrappers needed */
/*@access tsortInfo @*/
+/*@access transactionElement @*/
/*@access rpmTransactionSet @*/
/*@access alKey @*/ /* XXX for reordering and RPMAL_NOMATCH assign */
{
rpmdbMatchIterator mi = NULL;
teIterator pi = NULL; transactionElement p;
- char * fn = NULL;
- int fileAlloced = 0;
int closeatexit = 0;
int xx;
int rc;
if (rc)
goto exit;
- fi = tfiInit(p->fi, 0);
- if (fi == NULL)
- continue;
- if (fi->bnl == NULL)
- continue; /* XXX can't happen */
- if (fi->dnl == NULL)
- continue; /* XXX can't happen */
- if (fi->dil == NULL)
- continue; /* XXX can't happen */
rc = 0;
+ if ((fi = tfiInit(p->fi, 0)) != NULL)
while (tfiNext(fi) >= 0) {
- int len;
+ const char * fn = tfiGetFN(fi);
- len = strlen(fi->bnl[fi->i]) + 1 +
- strlen(fi->dnl[fi->dil[fi->i]]);
- if (len > fileAlloced) {
- fileAlloced = len * 2;
- fn = xrealloc(fn, fileAlloced);
- }
- *fn = '\0';
- (void) stpcpy( stpcpy(fn, fi->dnl[fi->dil[fi->i]]), fi->bnl[fi->i]);
/* Erasing: check filename against requiredby matches. */
if (!checkDependentPackages(ts, fn))
/*@innercontinue@*/ continue;
rc = 0;
exit:
- fn = _free(fn);
mi = rpmdbFreeIterator(mi);
pi = teFreeIterator(pi);
/*@-branchstate@*/
#if defined(_NEED_TEITERATOR)
/*@access teIterator @*/
-/*@access TFI_t @*/
/*@access transactionElement @*/
/*@access rpmTransactionSet @*/
}
/**
- * Return transaction element's file info.
- * @todo Take a TFI_t refcount here.
- * @param tei transaction element iterator
- * @return transaction element file info
- */
-/*@unused@*/ static inline /*@null@*/
-TFI_t teGetFi(teIterator tei)
- /*@modifies tei @*/
-{
- TFI_t fi = NULL;
-
- if (tei != NULL && tei->ocsave != -1) {
- transactionElement te = tei->ts->order + tei->ocsave;
- if ((fi = te->fi) != NULL)
- fi->te = te;
- }
- /*@-compdef -refcounttrans -usereleased @*/
- return fi;
- /*@=compdef =refcounttrans =usereleased @*/
-}
-
-/**
* Destroy transaction element iterator.
* @param tei transaction element iterator
* @return NULL always
typedef /*@abstract@*/ struct availablePackage_s * availablePackage;
+/*@unchecked@*/
+static int _al_debug = 0;
+
/*@access alKey @*/
/*@access alNum @*/
/*@access availableList @*/
/*@access fnpyKey @*/ /* XXX suggestedKeys array */
-/*@access TFI_t @*/ /* XXX abstraction wrappers needed */
-
/** \ingroup rpmdep
* Info about a single package to be installed.
*/
/*@refcounted@*/ /*@null@*/
rpmDepSet provides; /*!< Provides: dependencies. */
/*@refcounted@*/ /*@null@*/
- TFI_t fi; /*!< File info set. */
+ TFI_t fi; /*!< File info set. */
#ifdef DYING
uint_32 multiLib; /* MULTILIB */
* A file to be installed/removed.
*/
struct fileIndexEntry_s {
-/*@dependent@*/
+/*@dependent@*/ /*@null@*/
const char * baseName; /*!< File basename. */
int baseNameLen;
alNum pkgNum; /*!< Containing package index. */
* A directory to be installed/removed.
*/
struct dirInfo_s {
-/*@owned@*/
+/*@owned@*/ /*@null@*/
const char * dirName; /*!< Directory path (+ trailing '/'). */
int dirNameLen; /*!< No. bytes in directory path. */
/*@owned@*/
dirInfo dirs; /*!< Set of directories. */
};
-/*@unchecked@*/
-static int _al_debug = 0;
-
/**
* Destroy available item index.
* @param al available list
/*@=castexpose@*/
int lenchk = a->dirNameLen - b->dirNameLen;
- if (lenchk)
+ if (lenchk || a->dirNameLen == 0)
+ return lenchk;
+
+ if (a->dirName == NULL || b->dirName == NULL)
return lenchk;
/* XXX FIXME: this might do "backward" strcmp for speed */
if (lenchk)
return lenchk;
+ if (a->baseName == NULL || b->baseName == NULL)
+ return lenchk;
+
/* XXX FIXME: this might do "backward" strcmp for speed */
return strcmp(a->baseName, b->baseName);
}
/* Delete directory/file info entries from added package list. */
if ((fi = alp->fi) != NULL)
- if (fi->bnl != NULL && fi->fc > 0) {
+ if (tfiGetFC(fi) > 0) {
int origNumDirs = al->numDirs;
- int dirNum;
+ int dx;
dirInfo dieNeedle =
memset(alloca(sizeof(*dieNeedle)), 0, sizeof(*dieNeedle));
dirInfo die;
/* XXX FIXME: We ought to relocate the directory list here */
if (al->dirs != NULL)
- if (fi->dnl != NULL)
- for (dirNum = fi->dc - 1; dirNum >= 0; dirNum--) {
+ for (dx = tfiGetDC(fi) - 1; dx >= 0; dx--)
+ {
fileIndexEntry fie;
+ (void) tfiSetDX(fi, dx);
+
/*@-assignexpose@*/
- dieNeedle->dirName = (char *) fi->dnl[dirNum];
+ dieNeedle->dirName = (char *) tfiGetDN(fi);
/*@=assignexpose@*/
- dieNeedle->dirNameLen = strlen(dieNeedle->dirName);
+ dieNeedle->dirNameLen = (dieNeedle->dirName != NULL
+ ? strlen(dieNeedle->dirName) : 0);
die = bsearch(dieNeedle, al->dirs, al->numDirs,
sizeof(*dieNeedle), dieCompare);
if (die == NULL)
fi = rpmfiLink(alp->fi, "Files index (alAddPackage)");
if ((fi = tfiInit(fi, 0)) != NULL)
- if (fi->bnl != NULL) /* XXX can't happen */
- if (fi->dil != NULL) /* XXX can't happen */
- if (fi->dnl != NULL) /* XXX can't happen */
- if (fi->fflags != NULL) /* XXX can't happen */
- if (fi->fc > 0) {
+ if (tfiGetFC(fi) > 0) {
int * dirMapping;
dirInfo dieNeedle =
memset(alloca(sizeof(*dieNeedle)), 0, sizeof(*dieNeedle));
dirInfo die;
- int first, dirNum;
+ int first;
int origNumDirs;
+ int dx;
+ int dc;
+
+ dc = tfiGetDC(fi);
/* XXX FIXME: We ought to relocate the directory list here */
- dirMapping = alloca(sizeof(*dirMapping) * fi->dc);
+ dirMapping = alloca(sizeof(*dirMapping) * dc);
/*
* Allocated enough space for all the directories we could possible
* need to add
*/
- al->dirs = xrealloc(al->dirs,
- (al->numDirs + fi->dc) * sizeof(*al->dirs));
+ al->dirs = xrealloc(al->dirs, (al->numDirs + dc) * sizeof(*al->dirs));
origNumDirs = al->numDirs;
- if (fi->dnl != NULL)
- for (dirNum = 0; dirNum < fi->dc; dirNum++) {
+ for (dx = 0; dx < dc; dx++) {
+
+ (void) tfiSetDX(fi, dx);
+
/*@-assignexpose@*/
- dieNeedle->dirName = (char *) fi->dnl[dirNum];
+ dieNeedle->dirName = (char *) tfiGetDN(fi);
/*@=assignexpose@*/
- dieNeedle->dirNameLen = strlen(fi->dnl[dirNum]);
+ dieNeedle->dirNameLen = (dieNeedle->dirName != NULL
+ ? strlen(dieNeedle->dirName) : 0);
die = bsearch(dieNeedle, al->dirs, origNumDirs,
sizeof(*dieNeedle), dieCompare);
if (die) {
- dirMapping[dirNum] = die - al->dirs;
+ dirMapping[dx] = die - al->dirs;
} else {
- dirMapping[dirNum] = al->numDirs;
+ dirMapping[dx] = al->numDirs;
die = al->dirs + al->numDirs;
- die->dirName = xstrdup(fi->dnl[dirNum]);
- die->dirNameLen = strlen(die->dirName);
+ if (dieNeedle->dirName != NULL)
+ die->dirName = xstrdup(dieNeedle->dirName);
+ die->dirNameLen = dieNeedle->dirNameLen;
die->files = NULL;
die->numFiles = 0;
+/*@-modfilesys@*/
+if (_al_debug)
+fprintf(stderr, "+++ die[%3d] %p [%d] %s\n", al->numDirs, die, die->dirNameLen, die->dirName);
+/*@=modfilesys@*/
+
al->numDirs++;
}
}
int next;
/* Find the first file of the next directory. */
+ dx = tfiGetDX(fi);
while ((next = tfiNext(fi)) >= 0) {
- if (fi->dil[first] != fi->dil[next])
+ if (dx != tfiGetDX(fi))
/*@innerbreak@*/ break;
}
- if (next < 0) next = fi->fc; /* XXX reset end-of-list */
+ if (next < 0) next = tfiGetFC(fi); /* XXX reset end-of-list */
- die = al->dirs + dirMapping[fi->dil[first]];
+ die = al->dirs + dirMapping[dx];
die->files = xrealloc(die->files,
(die->numFiles + next - first) * sizeof(*die->files));
fie = die->files + die->numFiles;
fi = tfiInit(fi, first);
if (fi != NULL)
while ((first = tfiNext(fi)) >= 0 && first < next) {
- /*@-assignexpose@*/
- fie->baseName = fi->bnl[fi->i];
- fie->baseNameLen = strlen(fi->bnl[fi->i]);
- /*@=assignexpose@*/
+ /*@-assignexpose -onlytrans @*/
+ fie->baseName = tfiGetBN(fi);
+ /*@=assignexpose =onlytrans @*/
+ fie->baseNameLen = (fie->baseName ? strlen(fie->baseName) : 0);
fie->pkgNum = pkgNum;
- fie->fileFlags = fi->fflags[fi->i];
+ fie->fileFlags = tfiGetFFlags(fi);
die->numFiles++;
fie++;
}
die++)
{
+/*@-modfilesys@*/
+if (_al_debug)
+fprintf(stderr, "==> die %p %s\n", die, (die->dirName ? die->dirName : "(nil)"));
+/*@=modfilesys@*/
+
fieNeedle->baseName = baseName;
fieNeedle->baseNameLen = strlen(fieNeedle->baseName);
fie = bsearch(fieNeedle, die->files, die->numFiles,
if (fie == NULL)
continue; /* XXX shouldn't happen */
+/*@-modfilesys@*/
+if (_al_debug)
+fprintf(stderr, "==> fie %p %s\n", fie, (fie->baseName ? fie->baseName : "(nil)"));
+/*@=modfilesys@*/
+
#ifdef DYING /* XXX FIXME: multilib colored dependency search */
/*
* If a file dependency would be satisfied by a file
/*@*/;
/**
- * Return current dependency Flags.
+ * Return current dependency flags.
* @param ds dependency set
- * @return current dependency EVR, 0 on invalid
+ * @return current dependency flags, 0 on invalid
*/
int_32 dsiGetFlags(/*@null@*/ rpmDepSet ds)
/*@*/;
/**
- * Notify of results of dependency match;
+ * Notify of results of dependency match.
* @param ds dependency set
* @param where where dependency was resolved (or NULL)
* @param rc 0 == YES, otherwise NO
return fi->te->key;
}
+int tfiGetFC(TFI_t fi)
+{
+ return (fi != NULL ? fi->fc : 0);
+}
+
+int tfiGetDC(TFI_t fi)
+{
+ return (fi != NULL ? fi->dc : 0);
+}
+
+#ifdef NOTYET
+int tfiGetDI(TFI_t fi)
+{
+}
+#endif
+
+int tfiGetFX(TFI_t fi)
+{
+ return (fi != NULL ? fi->i : -1);
+}
+
+int tfiSetFX(TFI_t fi, int fx)
+{
+ int i = -1;
+
+ if (fi != NULL && fx >= 0 && fx < fi->fc) {
+ i = fi->i;
+ fi->i = fx;
+ fi->j = fi->dil[fi->i];
+ }
+ return i;
+}
+
+int tfiGetDX(TFI_t fi)
+{
+ return (fi != NULL ? fi->j : -1);
+}
+
+int tfiSetDX(TFI_t fi, int dx)
+{
+ int j = -1;
+
+ if (fi != NULL && dx >= 0 && dx < fi->dc) {
+ j = fi->j;
+ fi->j = dx;
+ }
+ return j;
+}
+
+const char * tfiGetBN(TFI_t fi)
+{
+ const char * BN = NULL;
+
+ if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
+ if (fi->bnl != NULL)
+ BN = fi->bnl[fi->i];
+ }
+ return BN;
+}
+
+const char * tfiGetDN(TFI_t fi)
+{
+ const char * DN = NULL;
+
+ if (fi != NULL && fi->j >= 0 && fi->j < fi->dc) {
+ if (fi->dnl != NULL)
+ DN = fi->dnl[fi->j];
+ }
+ return DN;
+}
-int tfiNext(/*@null@*/ TFI_t fi)
- /*@modifies fi @*/
+const char * tfiGetFN(TFI_t fi)
+{
+ const char * FN = "";
+
+ /*@-branchstate@*/
+ if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
+ char * t;
+ if (fi->fn == NULL)
+ fi->fn = xmalloc(fi->fnlen);
+ FN = t = fi->fn;
+ *t = '\0';
+ t = stpcpy(t, fi->dnl[fi->dil[fi->i]]);
+ t = stpcpy(t, fi->bnl[fi->i]);
+ }
+ /*@=branchstate@*/
+ return FN;
+}
+
+int_32 tfiGetFFlags(TFI_t fi)
+{
+ int_32 FFlags = 0;
+
+ if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
+ if (fi->fflags != NULL)
+ FFlags = fi->fflags[fi->i];
+ }
+ return FFlags;
+}
+
+int tfiNext(TFI_t fi)
{
int i = -1;
if (fi != NULL && ++fi->i >= 0) {
- if (fi->i < fi->fc)
+ if (fi->i < fi->fc) {
i = fi->i;
- else
+ if (fi->dil != NULL)
+ fi->j = fi->dil[fi->i];
+ } else
fi->i = -1;
/*@-modfilesystem @*/
return i;
}
-TFI_t tfiInit(/*@returned@*/ /*@null@*/ TFI_t fi, int ix)
- /*@modifies fi @*/
+TFI_t tfiInit(TFI_t fi, int fx)
+{
+ if (fi != NULL) {
+ if (fx >= 0 && fx < fi->fc) {
+ fi->i = fx - 1;
+ fi->j = -1;
+ } else
+ fi = NULL;
+ }
+
+ /*@-refcounttrans@*/
+ return fi;
+ /*@=refcounttrans@*/
+}
+
+int tdiNext(TFI_t fi)
+{
+ int j = -1;
+
+ if (fi != NULL && ++fi->j >= 0) {
+ if (fi->j < fi->dc)
+ j = fi->j;
+ else
+ fi->j = -1;
+
+/*@-modfilesystem @*/
+if (_fi_debug < 0 && j != -1)
+fprintf(stderr, "*** fi %p\t%s[%d]\n", fi, (fi->Type ? fi->Type : "?Type?"), j);
+/*@=modfilesystem @*/
+
+ }
+
+ return j;
+}
+
+TFI_t tdiInit(TFI_t fi, int dx)
{
if (fi != NULL) {
- if (ix >= 0 && ix < fi->fc)
- fi->i = ix - 1;
+ if (dx >= 0 && dx < fi->fc)
+ fi->j = dx - 1;
else
fi = NULL;
}
fi->fsm = freeFSM(fi->fsm);
+ fi->fn = _free(fi->fn);
fi->apath = _free(fi->apath);
fi->fmapflags = _free(fi->fmapflags);
const char * Type;
uint_32 * uip;
int malloced = 0;
+ int dnlmax, bnlmax;
int len;
int xx;
int i;
fi->h = headerFree(fi->h, fi->Type);
}
- fi->dnlmax = -1;
+ dnlmax = -1;
for (i = 0; i < fi->dc; i++) {
- if ((len = strlen(fi->dnl[i])) > fi->dnlmax)
- fi->dnlmax = len;
+ if ((len = strlen(fi->dnl[i])) > dnlmax)
+ dnlmax = len;
}
- fi->bnlmax = -1;
+ bnlmax = -1;
for (i = 0; i < fi->fc; i++) {
- if ((len = strlen(fi->bnl[i])) > fi->bnlmax)
- fi->bnlmax = len;
+ if ((len = strlen(fi->bnl[i])) > bnlmax)
+ bnlmax = len;
}
+ fi->fnlen = dnlmax + bnlmax + 1;
+ fi->fn = NULL;
+
fi->dperms = 0755;
fi->fperms = 0644;
/** \ingroup rpmdep rpmtrans
* \file lib/rpmfi.h
- * Structure used for file info tag sets.
+ * Structure(s) used for file info tag sets.
*/
/**
* A package filename set.
*/
struct TFI_s {
- int i; /*!< File index. */
+ int i; /*!< Current file index. */
+ int j; /*!< Current directory index. */
/*@observer@*/
const char * Type; /*!< Tag name. */
const char ** odnl; /*!< Original dirname(s) (from header) */
/*@unused@*/
int_32 * odil; /*!< Original dirindex(s) (from header) */
- int bnlmax; /*!< Length (in bytes) of longest basename. */
- int dnlmax; /*!< Length (in bytes) of longest dirname. */
+
+/*@only@*/ /*@null@*/
+ char * fn; /*!< File name buffer. */
+ int fnlen; /*!< FIle name buffer length. */
+
int astriplen;
int striplen;
unsigned int archiveSize;
/*@*/;
/**
+ * Return file count from file info set.
+ * @param fi file info set
+ * @return current file count
+ */
+int tfiGetFC(/*@null@*/ TFI_t fi)
+ /*@*/;
+
+/**
+ * Return current file index from file info set.
+ * @param fi file info set
+ * @return current file index
+ */
+/*@unused@*/
+int tfiGetFX(/*@null@*/ TFI_t fi)
+ /*@*/;
+
+/**
+ * Set current file index in file info set.
+ * @param fi file info set
+ * @param fx new file index
+ * @return current file index
+ */
+/*@unused@*/
+int tfiSetFX(/*@null@*/ TFI_t fi, int fx)
+ /*@modifies fi @*/;
+
+/**
+ * Return directory count from file info set.
+ * @param fi file info set
+ * @return current directory count
+ */
+int tfiGetDC(/*@null@*/ TFI_t fi)
+ /*@*/;
+
+/**
+ * Return current directory index from file info set.
+ * @param fi file info set
+ * @return current directory index
+ */
+int tfiGetDX(/*@null@*/ TFI_t fi)
+ /*@*/;
+
+/**
+ * Set current directory index in file info set.
+ * @param fi file info set
+ * @param fx new directory index
+ * @return current directory index
+ */
+int tfiSetDX(/*@null@*/ TFI_t fi, int dx)
+ /*@modifies fi @*/;
+
+/**
+ * Return current base name from file info set.
+ * @param fi file info set
+ * @return current base name, NULL on invalid
+ */
+/*@null@*/
+const char * tfiGetBN(/*@null@*/ TFI_t fi)
+ /*@*/;
+
+/**
+ * Return current directory name from file info set.
+ * @param fi file info set
+ * @return current directory, NULL on invalid
+ */
+/*@null@*/
+const char * tfiGetDN(/*@null@*/ TFI_t fi)
+ /*@*/;
+
+/**
+ * Return current file name from file info set.
+ * @param fi file info set
+ * @return current file name
+ */
+/*@observer@*/
+const char * tfiGetFN(/*@null@*/ TFI_t fi)
+ /*@modifies fi @*/;
+
+/**
+ * Return current file flags from file info set.
+ * @param fi file info set
+ * @return current file flags, 0 on invalid
+ */
+int_32 tfiGetFFlags(/*@null@*/ TFI_t fi)
+ /*@*/;
+
+/**
+ * Return next file iterator index.
+ * @param fi file info set
+ * @return file iterator index, -1 on termination
+ */
+int tfiNext(/*@null@*/ TFI_t fi)
+ /*@modifies fi @*/;
+
+/**
+ * Initialize file iterator index.
+ * @param fi file info set
+ * @param fx file iterator index
+ * @return file info set, NULL if fx is out of range
+ */
+/*@null@*/
+TFI_t tfiInit(/*@null@*/ TFI_t fi, int fx)
+ /*@modifies fi @*/;
+
+/**
+ * Return next directory iterator index.
+ * @param fi file info set
+ * @return directory iterator index, -1 on termination
+ */
+/*@unused@*/
+int tdiNext(/*@null@*/ TFI_t fi)
+ /*@modifies fi @*/;
+
+/**
+ * Initialize directory iterator index.
+ * @param fi file info set
+ * @param dx directory iterator index
+ * @return file info set, NULL if dx is out of range
+ */
+/*@unused@*/ /*@null@*/
+TFI_t tdiInit(/*@null@*/ TFI_t fi, int dx)
+ /*@modifies fi @*/;
+
+/**
* Destroy a file info set.
* @param fi file set
* @param freefimem free fi memory too?
/*@modifies ts, fi, h @*/;
/**
- * Return next file info set iterator index.
- * @param fi file info set
- * @return file info set iterator index, -1 on termination
- */
-int tfiNext(/*@null@*/ TFI_t fi)
- /*@modifies fi @*/;
-
-/**
- * Initialize file info set iterator.
- * @param fi file info set
- * @param ix file info set index
- * @return file info set, NULL if ix is out of range
- */
-/*@null@*/
-TFI_t tfiInit(/*@null@*/ TFI_t fi, int ix)
- /*@modifies fi @*/;
-
-/**
* Return file type from mode_t.
* @param mode file mode bits (from header)
* @return file type
/**
*/
-static fileAction decideFileFate(const char * dirName,
- const char * baseName, short dbMode,
+static fileAction decideFileFate(const char * fn,
+ short dbMode,
const char * dbMd5, const char * dbLink, short newMode,
const char * newMd5, const char * newLink, int newFlags,
rpmtransFlags transFlags)
struct stat sb;
int i, rc;
int save = (newFlags & RPMFILE_NOREPLACE) ? FA_ALTNAME : FA_SAVE;
- char * filespec = alloca(strlen(dirName) + strlen(baseName) + 1);
- (void) stpcpy( stpcpy(filespec, dirName), baseName);
-
- if (lstat(filespec, &sb)) {
+ if (lstat(fn, &sb)) {
/*
* The file doesn't exist on the disk. Create it unless the new
* package has marked it as missingok, or allfiles is requested.
if (!(transFlags & RPMTRANS_FLAG_ALLFILES) &&
(newFlags & RPMFILE_MISSINGOK)) {
rpmMessage(RPMMESS_DEBUG, _("%s skipped due to missingok flag\n"),
- filespec);
+ fn);
return FA_SKIP;
} else {
return FA_CREATE;
}
if (dbWhat == REG) {
- rc = mdfile(filespec, buffer);
+ rc = mdfile(fn, buffer);
if (rc) {
/* assume the file has been removed, don't freak */
newAttr = newMd5;
} else /* dbWhat == LINK */ {
memset(buffer, 0, sizeof(buffer));
- i = readlink(filespec, buffer, sizeof(buffer) - 1);
+ i = readlink(fn, buffer, sizeof(buffer) - 1);
if (i == -1) {
/* assume the file has been removed, don't freak */
return FA_CREATE;
xx = hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &otherFlags, NULL);
xx = hge(h, RPMTAG_FILESIZES, NULL, (void **) &otherSizes, NULL);
- fi->replaced = xmalloc(sharedCount * sizeof(*fi->replaced));
+ fi->replaced = xcalloc(sharedCount, sizeof(*fi->replaced));
for (i = 0; i < sharedCount; i++, shared++) {
int otherFileNum, fileNum;
+ const char * fn;
+
otherFileNum = shared->otherFileNum;
fileNum = shared->pkgFileNum;
+ (void) tfiSetFX(fi, fileNum);
+ fn = tfiGetFN(fi);
+
/* XXX another tedious segfault, assume file state normal. */
if (otherStates && otherStates[otherFileNum] != RPMFILE_STATE_NORMAL)
continue;
const char * altNEVR = hGetNEVR(h, NULL);
rpmProblemSetAppend(ts->probs, RPMPROB_FILE_CONFLICT,
p->NEVR, p->key,
- fi->dnl[fi->dil[fileNum]], fi->bnl[fileNum],
+ tfiGetDN(fi), tfiGetBN(fi),
altNEVR,
0);
altNEVR = _free(altNEVR);
}
if ((otherFlags[otherFileNum] | fi->fflags[fileNum]) & RPMFILE_CONFIG) {
- fi->actions[fileNum] = decideFileFate(
- fi->dnl[fi->dil[fileNum]],
- fi->bnl[fileNum],
+ fi->actions[fileNum] = decideFileFate(fn,
otherModes[otherFileNum],
otherMd5s[otherFileNum],
otherLinks[otherFileNum],
{
struct diskspaceInfo * ds = NULL;
uint_32 fixupSize = 0;
- char * filespec = NULL;
- int fileSpecAlloced = 0;
+ const char * fn;
int i, j;
- for (i = 0; i < fi->fc; i++) {
+ fi = tfiInit(fi, 0);
+ if (fi != NULL)
+ while ((i = tfiNext(fi)) >= 0) {
int otherPkgNum, otherFileNum;
const TFI_t * recs;
int numRecs;
if (XFA_SKIPPING(fi->actions[i]))
continue;
- j = strlen(fi->dnl[fi->dil[i]]) + strlen(fi->bnl[i]) + 1;
- /*@-branchstate@*/
- if (j > fileSpecAlloced) {
- fileSpecAlloced = j * 2;
- filespec = xrealloc(filespec, fileSpecAlloced);
- }
- /*@=branchstate@*/
-
- (void) stpcpy( stpcpy( filespec, fi->dnl[fi->dil[i]]), fi->bnl[i]);
+ fn = tfiGetFN(fi);
if (ts->di) {
ds = ts->di;
if (fi->actions[i] != FA_UNKNOWN)
/*@switchbreak@*/ break;
if ((fi->fflags[i] & RPMFILE_CONFIG) &&
- !lstat(filespec, &sb)) {
+ !lstat(fn, &sb)) {
/* Here is a non-overlapped pre-existing config file. */
fi->actions[i] = (fi->fflags[i] & RPMFILE_NOREPLACE)
? FA_ALTNAME : FA_BACKUP;
const char * altNEVR = recs[otherPkgNum]->te->NEVR;
rpmProblemSetAppend(ts->probs, RPMPROB_NEW_FILE_CONFLICT,
p->NEVR, p->key,
- filespec, NULL,
+ fn, NULL,
altNEVR,
0);
}
/* Try to get the disk accounting correct even if a conflict. */
fixupSize = recs[otherPkgNum]->fsizes[otherFileNum];
- if ((fi->fflags[i] & RPMFILE_CONFIG) && !lstat(filespec, &sb)) {
+ if ((fi->fflags[i] & RPMFILE_CONFIG) && !lstat(fn, &sb)) {
/* Here is an overlapped pre-existing config file. */
fi->actions[i] = (fi->fflags[i] & RPMFILE_NOREPLACE)
? FA_ALTNAME : FA_SKIP;
/* Here is a pre-existing modified config file that needs saving. */
{ char mdsum[50];
- if (!mdfile(filespec, mdsum) && strcmp(fi->fmd5s[i], mdsum)) {
+ if (!mdfile(fn, mdsum) && strcmp(fi->fmd5s[i], mdsum)) {
fi->actions[i] = FA_BACKUP;
/*@switchbreak@*/ break;
}
ds->bneeded -= BLOCK_ROUND(fixupSize, ds->bsize);
}
}
- filespec = _free(filespec);
}
/**
if (languages) freeSplitString((char **)languages);
}
+/**
+ * Return transaction element's file info.
+ * @todo Take a TFI_t refcount here.
+ * @param tei transaction element iterator
+ * @return transaction element file info
+ */
+static /*@null@*/
+TFI_t teGetFi(const teIterator tei)
+ /*@modifies tei @*/
+{
+ TFI_t fi = NULL;
+
+ if (tei != NULL && tei->ocsave != -1) {
+ transactionElement te = tei->ts->order + tei->ocsave;
+ if ((fi = te->fi) != NULL)
+ fi->te = te;
+ }
+ /*@-compdef -refcounttrans -usereleased @*/
+ return fi;
+ /*@=compdef =refcounttrans =usereleased @*/
+}
+
#define NOTIFY(_ts, _al) if ((_ts)->notify) (void) (_ts)->notify _al
int rpmRunTransactions( rpmTransactionSet ts,
pi = teInitIterator(ts);
while ((p = teNextIterator(pi)) != NULL) {
- fi = teGetFi(pi);
if ((fi = teGetFi(pi)) == NULL)
continue; /* XXX can't happen */
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2001-11-13 13:56-0500\n"
+"POT-Creation-Date: 2001-11-13 19:04-0500\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"
msgid "package %s is not installed\n"
msgstr ""
-#: lib/rpmal.c:647
+#: lib/rpmal.c:673
msgid "(added files)"
msgstr ""
-#: lib/rpmal.c:744
+#: lib/rpmal.c:770
msgid "(added provide)"
msgstr ""
msgid "Signature: UNKNOWN (%d)\n"
msgstr ""
-#: lib/transaction.c:185
+#: lib/transaction.c:182
#, c-format
msgid "%s skipped due to missingok flag\n"
msgstr ""
#. @innercontinue@
-#: lib/transaction.c:850
+#: lib/transaction.c:842
#, c-format
msgid "excluding directory %s\n"
msgstr ""
-#: lib/transaction.c:918
+#: lib/transaction.c:932
msgid "getting list of mounted filesystems\n"
msgstr ""