summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/cpio.c6
-rw-r--r--lib/depends.h34
-rw-r--r--lib/install.c226
-rw-r--r--lib/transaction.c202
-rw-r--r--po/rpm.pot79
5 files changed, 271 insertions, 276 deletions
diff --git a/lib/cpio.c b/lib/cpio.c
index 6c5332c04..ae0bf9c00 100644
--- a/lib/cpio.c
+++ b/lib/cpio.c
@@ -160,9 +160,9 @@ static void mapFree(const void * this) {
return;
}
-static void mapFreeIterator(/*@only@*/ void * this) {
+static void mapFreeIterator(/*@only@*/ const void * this) {
if (this)
- free(this);
+ free((void *)this);
}
static void * mapInitIterator(const void * this, int numMappings) {
@@ -1230,7 +1230,7 @@ int cpioBuildArchive(FD_t cfd, const void * mappings,
int numMappings, cpioCallback cb, void * cbData,
unsigned int * archiveSize, const char ** failedFile)
{
- void * mapi = mapInitIterator(mappings, numMappings);
+ const void * mapi = mapInitIterator(mappings, numMappings);
const void * map;
struct cpioCallbackInfo cbInfo = { NULL, 0, 0, 0 };
struct cpioCrcPhysicalHeader hdr;
diff --git a/lib/depends.h b/lib/depends.h
index 649208074..b2d4b004a 100644
--- a/lib/depends.h
+++ b/lib/depends.h
@@ -120,20 +120,37 @@ struct transactionElement {
/**
*/
+typedef int (*HGE_t) (Header h, int_32 tag, /*@out@*/ int_32 * type,
+ /*@out@*/ const void ** p, /*@out@*/int_32 * c)
+ /*@modifies *type, *p, *c @*/;
+
+/**
+ */
struct transactionFileInfo_s {
/* for all packages */
enum rpmTransactionType type;
enum fileActions * actions; /*!< file disposition */
/*@dependent@*/ struct fingerPrint_s * fps; /*!< file fingerprints */
- Header h; /*!< package header */
- uint_32 * fflags; /*!< File flags (from header) */
- uint_32 * fsizes; /*!< File sizes (from header) */
+ HGE_t hge;
+ Header h; /*!< Package header */
+ const char * n; /*!< Package name */
+ const char * v; /*!< Package version */
+ const char * r; /*!< Package release */
+ const uint_32 * fflags; /*!< File flags (from header) */
+ const uint_32 * fsizes; /*!< File sizes (from header) */
const char ** bnl; /*!< Base names (from header) */
const char ** dnl; /*!< Directory names (from header) */
const int * dil; /*!< Directory indices (from header) */
+ const char ** obnl; /*!< Original Base names (from header) */
+ const char ** odnl; /*!< Original Directory names (from header) */
+ const int * odil; /*!< Original Directory indices (from header) */
const char ** fmd5s; /*!< file MD5 sums (from header) */
- uint_16 * fmodes; /*!< file modes (from header) */
+ const char ** flinks; /*!< file links (from header) */
+ const uint_16 * fmodes; /*!< file modes (from header) */
char * fstates; /*!< file states (from header) */
+ const char ** fuser; /*!< file owner(s) */
+ const char ** fgroup; /*!< file group(s) */
+ const char ** flangs; /*!< file lang(s) */
int fc; /*!< No. of files. */
int dc; /*!< No. of directories. */
int bnlmax; /*!< Length (in bytes) of longest base name. */
@@ -141,7 +158,6 @@ struct transactionFileInfo_s {
int magic;
#define TFIMAGIC 0x09697923
/* these are for TR_ADDED packages */
- const char ** flinks; /*!< file links (from header) */
struct availablePackage * ap;
struct sharedFileInfo * replaced;
uint_32 * replacedSizes;
@@ -190,6 +206,14 @@ struct problemsSet {
extern "C" {
#endif
+/**
+ */
+void loadFi(Header h, struct transactionFileInfo_s * fi);
+
+/**
+ */
+void freeFi(struct transactionFileInfo_s * fi);
+
/* XXX lib/scriptlet.c */
/**
* Compare package name-version-release from header with dependency, looking
diff --git a/lib/install.c b/lib/install.c
index 9a0202f68..fa11fc299 100644
--- a/lib/install.c
+++ b/lib/install.c
@@ -113,12 +113,7 @@ static int rpmInstallLoadMacros(Header h)
*/
static /*@only@*/ fileMemory newFileMemory(void)
{
- fileMemory fileMem = xmalloc(sizeof(*fileMem));
- fileMem->files = NULL;
- fileMem->dnl = NULL;
- fileMem->bnl = NULL;
- fileMem->cpioNames = NULL;
- fileMem->md5sums = NULL;
+ fileMemory fileMem = xcalloc(sizeof(*fileMem), 1);
return fileMem;
}
@@ -128,11 +123,11 @@ static /*@only@*/ fileMemory newFileMemory(void)
*/
static void freeFileMemory( /*@only@*/ fileMemory fileMem)
{
- if (fileMem->files) free(fileMem->files);
if (fileMem->dnl) free(fileMem->dnl);
if (fileMem->bnl) free(fileMem->bnl);
if (fileMem->cpioNames) free(fileMem->cpioNames);
if (fileMem->md5sums) free(fileMem->md5sums);
+ if (fileMem->files) free(fileMem->files);
free(fileMem);
}
@@ -154,12 +149,6 @@ static int assembleFileList(TFI_t fi, Header h,
/*@out@*/ XFI_t * filesPtr,
int stripPrefixLength)
{
- enum fileActions * actions;
- const char ** dnl, ** bnl, ** fmd5s;
- const int_32 * dil;
- uint_32 * fflags;
- uint_32 * fsizes;
- uint_16 * fmodes;
fileMemory mem = newFileMemory();
XFI_t files;
XFI_t file;
@@ -180,43 +169,18 @@ static int assembleFileList(TFI_t fi, Header h,
files = *filesPtr = mem->files = xcalloc(fileCount, sizeof(*mem->files));
- if (fi) {
- dnl = fi->dnl;
- dil = fi->dil;
- bnl = fi->bnl;
- fmd5s = fi->fmd5s;
- fflags = fi->fflags;
- fmodes = fi->fmodes;
- fsizes = fi->fsizes;
- actions = fi->actions;
- } else {
- headerGetEntryMinMemory(h, RPMTAG_DIRNAMES, NULL, (void **) &dnl, NULL);
- mem->dnl = dnl;
- headerGetEntry(h, RPMTAG_DIRINDEXES, NULL, (void **) &dil, NULL);
- headerGetEntryMinMemory(h, RPMTAG_BASENAMES,NULL, (void **) &bnl, NULL);
- mem->bnl = bnl;
- if (!headerGetEntryMinMemory(h, RPMTAG_FILEMD5S, NULL,
- (void **) &fmd5s, NULL))
- fmd5s = NULL;
- mem->md5sums = fmd5s;
- headerGetEntry(h, RPMTAG_FILEFLAGS, NULL, (void **) &fflags, NULL);
- headerGetEntry(h, RPMTAG_FILEMODES, NULL, (void **) &fmodes, NULL);
- headerGetEntry(h, RPMTAG_FILESIZES, NULL, (void **) &fsizes, NULL);
- actions = NULL;
- }
-
for (i = 0, file = files; i < fileCount; i++, file++) {
file->state = RPMFILE_STATE_NORMAL;
- file->action = (actions ? actions[i] : FA_UNKNOWN);
+ file->action = (fi->actions ? fi->actions[i] : FA_UNKNOWN);
file->install = 1;
- file->dn = dnl[dil[i]];
- file->bn = bnl[i];
+ file->dn = fi->dnl[fi->dil[i]];
+ file->bn = fi->bnl[i];
file->cpioPath = mem->cpioNames[i] + stripPrefixLength;
- file->md5sum = (fmd5s ? fmd5s[i] : NULL);
- file->mode = fmodes[i];
- file->size = fsizes[i];
- file->flags = fflags[i];
+ file->md5sum = (fi->fmd5s ? fi->fmd5s[i] : NULL);
+ file->mode = fi->fmodes[i];
+ file->size = fi->fsizes[i];
+ file->flags = fi->fflags[i];
rpmMessage(RPMMESS_DEBUG, _(" file: %s%s action: %s\n"),
file->dn, file->bn, fileActionString(file->action));
@@ -647,10 +611,6 @@ static int installArchive(const rpmTransactionSet ts, TFI_t fi,
CPIO_MAP_UID | CPIO_MAP_GID;
mappedFiles++;
}
-
-#ifdef DYING
- qsort(map, mappedFiles, sizeof(*map), cpioFileMapCmp);
-#endif
}
if (notify)
@@ -706,6 +666,39 @@ static int installArchive(const rpmTransactionSet ts, TFI_t fi,
return rc;
}
+static int chkdir (const char * dpath, const char * dname)
+{
+ struct stat st;
+ int rc;
+
+ if ((rc = Stat(dpath, &st)) < 0) {
+ int ut = urlPath(dpath, NULL);
+ switch (ut) {
+ case URL_IS_PATH:
+ case URL_IS_UNKNOWN:
+ if (errno != ENOENT)
+ break;
+ /*@fallthrough@*/
+ case URL_IS_FTP:
+ case URL_IS_HTTP:
+ /* XXX this will only create last component of directory path */
+ rc = Mkdir(dpath, 0755);
+ break;
+ case URL_IS_DASH:
+ break;
+ }
+ if (rc < 0) {
+ rpmError(RPMERR_CREATE, _("cannot create %s %s\n"),
+ dname, dpath);
+ return 2;
+ }
+ }
+ if ((rc = Access(dpath, W_OK))) {
+ rpmError(RPMERR_CREATE, _("cannot write to %s\n"), dpath);
+ return 2;
+ }
+ return 0;
+}
/**
* @param h header
* @param rootDir path to top of install tree
@@ -719,118 +712,66 @@ static int installSources(Header h, const char * rootDir, FD_t fd,
const char ** specFilePtr,
rpmCallbackFunction notify, rpmCallbackData notifyData)
{
+ TFI_t fi = xcalloc(sizeof(*fi), 1);
const char * specFile = NULL;
int specFileIndex = -1;
- const char * _sourcedir = NULL;
- const char * _specdir = NULL;
+ const char * _sourcedir = rpmGenPath(rootDir, "%{_sourcedir}", "");
+ const char * _specdir = rpmGenPath(rootDir, "%{_specdir}", "");
int fileCount = 0;
uint_32 * archiveSizePtr = NULL;
fileMemory fileMem = NULL;
XFI_t files = NULL, file;
int i;
- const char * currDir = NULL;
uid_t currUid = getuid();
gid_t currGid = getgid();
- struct stat st;
int rc = 0;
rpmMessage(RPMMESS_DEBUG, _("installing a source package\n"));
- _sourcedir = rpmGenPath(rootDir, "%{_sourcedir}", "");
- if ((rc = Stat(_sourcedir, &st)) < 0) {
- int ut = urlPath(_sourcedir, NULL);
- switch (ut) {
- case URL_IS_PATH:
- case URL_IS_UNKNOWN:
- if (errno != ENOENT)
- break;
- /*@fallthrough@*/
- case URL_IS_FTP:
- case URL_IS_HTTP:
- /* XXX this will only create last component of directory path */
- rc = Mkdir(_sourcedir, 0755);
- break;
- case URL_IS_DASH:
- break;
- }
- if (rc < 0) {
- rpmError(RPMERR_CREATE, _("cannot create sourcedir %s\n"),
- _sourcedir);
- rc = 2;
- goto exit;
- }
- }
- if ((rc = Access(_sourcedir, W_OK))) {
- rpmError(RPMERR_CREATE, _("cannot write to %s\n"), _sourcedir);
+ rc = chkdir(_sourcedir, "sourcedir");
+ if (rc) {
rc = 2;
goto exit;
}
- rpmMessage(RPMMESS_DEBUG, _("sources in: %s\n"), _sourcedir);
- _specdir = rpmGenPath(rootDir, "%{_specdir}", "");
- if ((rc = Stat(_specdir, &st)) < 0) {
- int ut = urlPath(_specdir, NULL);
- switch (ut) {
- case URL_IS_PATH:
- case URL_IS_UNKNOWN:
- if (errno != ENOENT)
- break;
- /*@fallthrough@*/
- case URL_IS_FTP:
- case URL_IS_HTTP:
- /* XXX this will only create last component of directory path */
- rc = Mkdir(_specdir, 0755);
- break;
- case URL_IS_DASH:
- break;
- }
- if (rc < 0) {
- rpmError(RPMERR_CREATE, _("cannot create specdir %s\n"), _specdir);
- rc = 2;
- goto exit;
- }
- }
- if ((rc = Access(_specdir, W_OK))) {
- rpmError(RPMERR_CREATE, _("cannot write to %s\n"), _specdir);
+ rc = chkdir(_specdir, "specdir");
+ if (rc) {
rc = 2;
goto exit;
}
- rpmMessage(RPMMESS_DEBUG, _("spec file in: %s\n"), _specdir);
- if (h != NULL && headerIsEntry(h, RPMTAG_BASENAMES)) {
- /* we can't remap v1 packages */
- assembleFileList(NULL, h, &fileMem, &fileCount, &files, 0);
+ loadFi(h, fi);
- for (i = 0, file = files; i < fileCount; i++, file++) {
- file->uid = currUid;
- file->gid = currGid;
- }
+ assembleFileList(fi, h, &fileMem, &fileCount, &files, 0);
- if (headerIsEntry(h, RPMTAG_COOKIE))
- for (i = 0, file = files; i < fileCount; i++, file++)
+ for (i = 0, file = files; i < fileCount; i++, file++) {
+ file->uid = currUid;
+ file->gid = currGid;
+ }
+
+ if (headerIsEntry(h, RPMTAG_COOKIE))
+ for (i = 0, file = files; i < fileCount; i++, file++)
if (file->flags & RPMFILE_SPECFILE) break;
- if (i == fileCount) {
- /* find the spec file by name */
- for (i = 0, file = files; i < fileCount; i++, file++) {
+ if (i == fileCount) {
+ /* find the spec file by name */
+ for (i = 0, file = files; i < fileCount; i++, file++) {
const char * t = file->cpioPath;
t += strlen(file->cpioPath) - 5;
if (!strcmp(t, ".spec")) break;
- }
}
+ }
- if (i < fileCount) {
- char *t = alloca(strlen(_specdir) + strlen(file->cpioPath) + 5);
- (void)stpcpy(stpcpy(t, _specdir), "/");
- file->dn = t;
- file->bn = file->cpioPath;
- specFileIndex = i;
- } else {
- rpmError(RPMERR_NOSPEC,
- _("source package contains no .spec file\n"));
- rc = 2;
- goto exit;
- }
+ if (i < fileCount) {
+ char *t = alloca(strlen(_specdir) + strlen(file->cpioPath) + 5);
+ (void)stpcpy(stpcpy(t, _specdir), "/");
+ file->dn = t;
+ file->bn = file->cpioPath;
+ specFileIndex = i;
+ } else {
+ rpmError(RPMERR_NOSPEC, _("source package contains no .spec file\n"));
+ rc = 2;
+ goto exit;
}
if (notify)
@@ -840,16 +781,20 @@ static int installSources(Header h, const char * rootDir, FD_t fd,
(void **) &archiveSizePtr, NULL))
archiveSizePtr = NULL;
- currDir = currentDirectory();
- Chdir(_sourcedir);
- if (installArchive(NULL, NULL, fd, fileCount > 0 ? files : NULL,
+ { const char * currDir = currentDirectory();
+ Chdir(_sourcedir);
+ rc = installArchive(NULL, NULL, fd, fileCount > 0 ? files : NULL,
fileCount, notify, notifyData, NULL, h,
specFileIndex >= 0 ? NULL : &specFile,
- archiveSizePtr ? *archiveSizePtr : 0)) {
- rc = 2;
- goto exit;
+ archiveSizePtr ? *archiveSizePtr : 0);
+
+ Chdir(currDir);
+ free((void *)currDir);
+ if (rc) {
+ rc = 2;
+ goto exit;
+ }
}
- Chdir(currDir);
if (specFileIndex == -1) {
char * cSpecFile;
@@ -900,8 +845,11 @@ static int installSources(Header h, const char * rootDir, FD_t fd,
rc = 0;
exit:
+ if (fi) {
+ freeFi(fi);
+ free(fi);
+ }
if (fileMem) freeFileMemory(fileMem);
- if (currDir) free((void *)currDir);
if (_specdir) free((void *)_specdir);
if (_sourcedir) free((void *)_sourcedir);
return rc;
diff --git a/lib/transaction.c b/lib/transaction.c
index 4c247de7b..687d0443e 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -64,13 +64,23 @@ struct diskspaceInfo {
#define XFA_SKIPPING(_a) \
((_a) == FA_SKIP || (_a) == FA_SKIPNSTATE || (_a) == FA_SKIPNETSHARED || (_a) == FA_SKIPMULTILIB)
-static void loadFi(TFI_t fi)
+void loadFi(Header h, TFI_t fi)
{
+ HGE_t hge;
int len, i;
- if (!headerGetEntry(fi->h, RPMTAG_BASENAMES, NULL,
- (void **) &fi->bnl, &fi->fc))
- {
+ /* XXX avoid gcc noise on pointer (4th arg) cast(s) */
+ hge = (fi->type == TR_ADDED)
+ ? (HGE_t) headerGetEntryMinMemory : (HGE_t) headerGetEntry;
+ fi->hge = hge;
+
+ if (h && fi->h == NULL) fi->h = headerLink(h);
+
+ hge(fi->h, RPMTAG_NAME, NULL, (void **) &fi->n, NULL);
+ hge(fi->h, RPMTAG_VERSION, NULL, (void **) &fi->v, NULL);
+ hge(fi->h, RPMTAG_RELEASE, NULL, (void **) &fi->r, NULL);
+
+ if (!hge(fi->h, RPMTAG_BASENAMES, NULL, (void **) &fi->bnl, &fi->fc)) {
fi->dc = 0;
fi->fc = 0;
fi->dnl = NULL;
@@ -83,12 +93,51 @@ static void loadFi(TFI_t fi)
return;
}
- headerGetEntry(fi->h, RPMTAG_DIRINDEXES, NULL, (void **)&fi->dil, NULL);
- headerGetEntry(fi->h, RPMTAG_DIRNAMES, NULL, (void **)&fi->dnl, &fi->dc);
- headerGetEntry(fi->h, RPMTAG_FILEMODES, NULL, (void **)&fi->fmodes, NULL);
- headerGetEntry(fi->h, RPMTAG_FILEFLAGS, NULL, (void **)&fi->fflags, NULL);
- headerGetEntry(fi->h, RPMTAG_FILESIZES, NULL, (void **)&fi->fsizes, NULL);
- headerGetEntry(fi->h, RPMTAG_FILESTATES, NULL, (void **)&fi->fstates, NULL);
+ hge(fi->h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL);
+ hge(fi->h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc);
+ hge(fi->h, RPMTAG_FILEMODES, NULL, (void **) &fi->fmodes, NULL);
+ hge(fi->h, RPMTAG_FILEFLAGS, NULL, (void **) &fi->fflags, NULL);
+ hge(fi->h, RPMTAG_FILESIZES, NULL, (void **) &fi->fsizes, NULL);
+ hge(fi->h, RPMTAG_FILESTATES, NULL, (void **) &fi->fstates, NULL);
+
+ /* actions is initialized earlier for added packages */
+ if (fi->actions == NULL)
+ fi->actions = xcalloc(fi->fc, sizeof(*fi->actions));
+
+ switch (fi->type) {
+ case TR_ADDED:
+ hge(fi->h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL);
+ hge(fi->h, RPMTAG_FILELINKTOS, NULL, (void **) &fi->flinks, NULL);
+ hge(fi->h, RPMTAG_FILELANGS, NULL, (void **) &fi->flangs, NULL);
+
+ /* 0 makes for noops */
+ fi->replacedSizes = xcalloc(fi->fc, sizeof(*fi->replacedSizes));
+
+ break;
+ case TR_REMOVED:
+ fi->n = xstrdup(fi->n);
+ fi->v = xstrdup(fi->v);
+ fi->r = xstrdup(fi->r);
+ hge(fi->h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL);
+ hge(fi->h, RPMTAG_FILELINKTOS, NULL, (void **) &fi->flinks, NULL);
+ 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));
+ headerFree(fi->h);
+ fi->h = NULL;
+ break;
+ }
fi->dnlmax = -1;
for (i = 0; i < fi->dc; i++) {
@@ -105,7 +154,7 @@ static void loadFi(TFI_t fi)
return;
}
-static void freeFi(TFI_t fi)
+void freeFi(TFI_t fi)
{
if (fi->h) {
headerFree(fi->h); fi->h = NULL;
@@ -121,35 +170,61 @@ static void freeFi(TFI_t fi)
}
if (fi->bnl) {
free(fi->bnl); fi->bnl = NULL;
+ }
+ if (fi->dnl) {
free(fi->dnl); fi->dnl = NULL;
}
+ if (fi->obnl) {
+ free(fi->obnl); fi->obnl = NULL;
+ }
+ if (fi->odnl) {
+ free(fi->odnl); fi->odnl = NULL;
+ }
if (fi->flinks) {
free(fi->flinks); fi->flinks = NULL;
}
if (fi->fmd5s) {
free(fi->fmd5s); fi->fmd5s = NULL;
}
+ if (fi->fuser) {
+ free(fi->fuser); fi->fuser = NULL;
+ }
+ if (fi->fgroup) {
+ free(fi->fgroup); fi->fgroup = NULL;
+ }
+ if (fi->flangs) {
+ free(fi->flangs); fi->flangs = NULL;
+ }
switch (fi->type) {
+ case TR_ADDED:
+ break;
case TR_REMOVED:
+ if (fi->n) {
+ free((void *)fi->n); fi->n = NULL;
+ }
+ if (fi->v) {
+ free((void *)fi->v); fi->v = NULL;
+ }
+ if (fi->r) {
+ free((void *)fi->r); fi->r = NULL;
+ }
if (fi->fsizes) {
- free(fi->fsizes); fi->fsizes = NULL;
+ free((void *)fi->fsizes); fi->fsizes = NULL;
}
if (fi->fflags) {
- free(fi->fflags); fi->fflags = NULL;
+ free((void *)fi->fflags); fi->fflags = NULL;
}
if (fi->fmodes) {
- free(fi->fmodes); fi->fmodes = NULL;
+ free((void *)fi->fmodes); fi->fmodes = NULL;
}
if (fi->fstates) {
- free(fi->fstates); fi->fstates = NULL;
+ free((void *)fi->fstates); fi->fstates = NULL;
}
if (fi->dil) {
free((void *)fi->dil); fi->dil = NULL;
}
break;
- case TR_ADDED:
- break;
}
}
@@ -523,13 +598,16 @@ static Header relocateFileList(const rpmTransactionSet ts,
headerFreeData(validRelocations, validType);
}
- headerGetEntry(h, RPMTAG_BASENAMES, NULL, (void **) &baseNames,
- &fileCount);
- headerGetEntry(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
- headerGetEntry(h, RPMTAG_DIRNAMES, NULL, (void **) &dirNames,
- &dirCount);
- headerGetEntry(h, RPMTAG_FILEFLAGS, NULL, (void **) &fFlags, NULL);
- headerGetEntry(h, RPMTAG_FILEMODES, NULL, (void **) &fModes, NULL);
+ headerGetEntryMinMemory(h, RPMTAG_BASENAMES, NULL,
+ (const void **) &baseNames, &fileCount);
+ headerGetEntryMinMemory(h, RPMTAG_DIRINDEXES, NULL,
+ (const void **) &dirIndexes, NULL);
+ headerGetEntryMinMemory(h, RPMTAG_DIRNAMES, NULL,
+ (const void **) &dirNames, &dirCount);
+ headerGetEntryMinMemory(h, RPMTAG_FILEFLAGS, NULL,
+ (const void **) &fFlags, NULL);
+ headerGetEntryMinMemory(h, RPMTAG_FILEMODES, NULL,
+ (const void **) &fModes, NULL);
skipDirList = alloca(dirCount * sizeof(*skipDirList));
memset(skipDirList, 0, dirCount * sizeof(*skipDirList));
@@ -1253,13 +1331,13 @@ static int ensureOlder(struct availablePackage * alp, Header old,
return rc;
}
-static void skipFiles(TFI_t fi, int noDocs)
+static void skipFiles(const rpmTransactionSet ts, TFI_t fi)
{
- int i;
+ int noDocs = (ts->transFlags & RPMTRANS_FLAG_NODOCS);
char ** netsharedPaths = NULL;
- const char ** fileLangs;
const char ** languages;
const char * s;
+ int i;
if (!noDocs)
noDocs = rpmExpandNumeric("%{_excludedocs}");
@@ -1270,9 +1348,6 @@ static void skipFiles(TFI_t fi, int noDocs)
free((void *)tmpPath);
}
- if (!headerGetEntry(fi->h, RPMTAG_FILELANGS, NULL, (void **) &fileLangs,
- NULL))
- fileLangs = NULL;
s = rpmExpand("%{_install_langs}", NULL);
if (!(s && *s != '%')) {
@@ -1319,12 +1394,12 @@ static void skipFiles(TFI_t fi, int noDocs)
/*
* Skip i18n language specific files.
*/
- if (fileLangs && languages && *fileLangs[i]) {
+ if (fi->flangs && languages && *fi->flangs[i]) {
const char **lang, *l, *le;
for (lang = languages; *lang; lang++) {
if (!strcmp(*lang, "all"))
break;
- for (l = fileLangs[i]; *l; l = le) {
+ for (l = fi->flangs[i]; *l; l = le) {
for (le = l; *le && *le != '|'; le++)
;
if ((le-l) > 0 && !strncmp(*lang, l, (le-l)))
@@ -1347,7 +1422,9 @@ static void skipFiles(TFI_t fi, int noDocs)
}
if (netsharedPaths) freeSplitString(netsharedPaths);
- if (fileLangs) free(fileLangs);
+ if (fi->flangs) {
+ free(fi->flangs); fi->flangs = NULL;
+ }
if (languages) freeSplitString((char **)languages);
}
@@ -1530,12 +1607,13 @@ int rpmRunTransactions( rpmTransactionSet ts,
preTrans = NULL;
preTransCount = 0;
+ fi->type = ts->order[oc].type;
switch (ts->order[oc].type) {
case TR_ADDED:
- fi->type = TR_ADDED;
i = ts->order[oc].u.addedIndex;
alp = ts->addedPackages.list + i;
fi->ap = alp;
+ fi->record = 0;
if (!headerGetEntryMinMemory(alp->h, RPMTAG_BASENAMES, NULL,
NULL, &fi->fc)) {
fi->h = headerLink(alp->h);
@@ -1546,10 +1624,12 @@ int rpmRunTransactions( rpmTransactionSet ts,
/* Allocate file actions (and initialize to FA_UNKNOWN) */
fi->actions = xcalloc(fi->fc, sizeof(*fi->actions));
hdrs[i] = relocateFileList(ts, alp, alp->h, fi->actions);
- fi->h = headerLink(hdrs[i]);
+ loadFi(hdrs[i], fi);
+
+ /* Skip netshared paths, not our i18n files, and excluded docs */
+ skipFiles(ts, fi);
break;
case TR_REMOVED:
- fi->type = TR_REMOVED;
fi->ap = alp = NULL;
fi->record = ts->order[oc].u.removed.dboffset;
{ rpmdbMatchIterator mi;
@@ -1564,55 +1644,13 @@ int rpmRunTransactions( rpmTransactionSet ts,
/* ACK! */
continue;
}
+ /* XXX header arg unused. */
+ loadFi(fi->h, fi);
break;
}
- loadFi(fi);
- if (fi->fc == 0)
- continue;
-
- /* actions is initialized earlier for added packages */
- if (fi->actions == NULL)
- fi->actions = xcalloc(fi->fc, sizeof(*fi->actions));
-
- switch (ts->order[oc].type) {
- case TR_ADDED:
- headerGetEntryMinMemory(fi->h, RPMTAG_FILEMD5S, NULL,
- (const void **) &fi->fmd5s, NULL);
- headerGetEntryMinMemory(fi->h, RPMTAG_FILELINKTOS, NULL,
- (const void **) &fi->flinks, NULL);
-
- /* 0 makes for noops */
- fi->replacedSizes = xcalloc(fi->fc, sizeof(*fi->replacedSizes));
-
- /* Skip netshared paths, not our i18n files, and excluded docs */
- skipFiles(fi, ts->transFlags & RPMTRANS_FLAG_NODOCS);
- break;
- case TR_REMOVED:
- headerGetEntry(fi->h, RPMTAG_FILEMD5S, NULL,
- (void **) &fi->fmd5s, NULL);
- headerGetEntry(fi->h, RPMTAG_FILELINKTOS, NULL,
- (void **) &fi->flinks, NULL);
- 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));
- headerFree(fi->h);
- fi->h = NULL;
- break;
- }
-
- fi->fps = xmalloc(sizeof(*fi->fps) * fi->fc);
+ if (fi->fc)
+ fi->fps = xmalloc(sizeof(*fi->fps) * fi->fc);
}
/* Open all database indices before installing. */
diff --git a/po/rpm.pot b/po/rpm.pot
index 41c832844..de05ad19a 100644
--- a/po/rpm.pot
+++ b/po/rpm.pot
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2001-01-22 14:07-0500\n"
+"POT-Creation-Date: 2001-01-23 11:02-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"
@@ -2517,7 +2517,7 @@ msgstr ""
msgid "dataLength() RPM_STRING_TYPE count must be 1.\n"
msgstr ""
-#: lib/header.c:207 lib/header.c:1015 lib/install.c:396
+#: lib/header.c:207 lib/header.c:1015 lib/install.c:360
#, c-format
msgid "Data type %d not supported\n"
msgstr ""
@@ -2602,17 +2602,17 @@ msgstr ""
msgid "(unknown type)"
msgstr ""
-#: lib/install.c:221
+#: lib/install.c:185
#, c-format
msgid " file: %s%s action: %s\n"
msgstr ""
-#: lib/install.c:247
+#: lib/install.c:211
#, c-format
msgid "user %s does not exist - using root\n"
msgstr ""
-#: lib/install.c:254
+#: lib/install.c:218
#, c-format
msgid "group %s does not exist - using root\n"
msgstr ""
@@ -2620,90 +2620,75 @@ msgstr ""
#. this would probably be a good place to check if disk space
#. was used up - if so, we should return a different error
#. XXX FIXME: Fclose with libio destroys errno
-#: lib/install.c:688
+#: lib/install.c:648
#, c-format
msgid "unpacking of archive failed%s%s: %s\n"
msgstr ""
-#: lib/install.c:689
+#: lib/install.c:649
msgid " on file "
msgstr ""
-#: lib/install.c:737
-msgid "installing a source package\n"
-msgstr ""
-
-#: lib/install.c:757
+#: lib/install.c:691
#, c-format
-msgid "cannot create sourcedir %s\n"
+msgid "cannot create %s %s\n"
msgstr ""
-#: lib/install.c:764 lib/install.c:794
+#: lib/install.c:697
#, c-format
msgid "cannot write to %s\n"
msgstr ""
-#: lib/install.c:768
-#, c-format
-msgid "sources in: %s\n"
-msgstr ""
-
-#: lib/install.c:788
-#, c-format
-msgid "cannot create specdir %s\n"
-msgstr ""
-
-#: lib/install.c:798
-#, c-format
-msgid "spec file in: %s\n"
+#: lib/install.c:729
+msgid "installing a source package\n"
msgstr ""
-#: lib/install.c:830 lib/install.c:860
+#: lib/install.c:772 lib/install.c:805
msgid "source package contains no .spec file\n"
msgstr ""
-#: lib/install.c:880
+#: lib/install.c:825
#, c-format
msgid "renaming %s to %s\n"
msgstr ""
-#: lib/install.c:882 lib/install.c:1152 lib/uninstall.c:43
+#: lib/install.c:827 lib/install.c:1100 lib/uninstall.c:43
#, c-format
msgid "rename of %s to %s failed: %s\n"
msgstr ""
-#: lib/install.c:977
+#: lib/install.c:925
msgid "source package expected, binary found\n"
msgstr ""
-#: lib/install.c:1016
+#: lib/install.c:964
#, c-format
msgid "package: %s-%s-%s files test = %d\n"
msgstr ""
-#: lib/install.c:1057
+#: lib/install.c:1005
msgid "stopping install as we're running --test\n"
msgstr ""
-#: lib/install.c:1062
+#: lib/install.c:1010
msgid "running preinstall script (if any)\n"
msgstr ""
-#: lib/install.c:1069
+#: lib/install.c:1017
msgid "skipping %s-%s-%s install, %%pre scriptlet failed rc %d\n"
msgstr ""
-#: lib/install.c:1106
+#: lib/install.c:1054
#, c-format
msgid "%s%s created as %s\n"
msgstr ""
-#: lib/install.c:1147
+#: lib/install.c:1095
#, c-format
msgid "%s saved as %s\n"
msgstr ""
-#: lib/install.c:1232
+#: lib/install.c:1180
msgid "running postinstall scripts (if any)\n"
msgstr ""
@@ -3687,46 +3672,46 @@ msgstr ""
msgid "You must set \"%%_pgp_name\" in your macro file\n"
msgstr ""
-#: lib/transaction.c:483
+#: lib/transaction.c:558
msgid "========== relocations\n"
msgstr ""
-#: lib/transaction.c:486
+#: lib/transaction.c:561
#, c-format
msgid "%5d exclude %s\n"
msgstr ""
-#: lib/transaction.c:489
+#: lib/transaction.c:564
#, c-format
msgid "%5d relocate %s -> %s\n"
msgstr ""
-#: lib/transaction.c:560
+#: lib/transaction.c:638
#, c-format
msgid "excluding multilib path %s%s\n"
msgstr ""
-#: lib/transaction.c:609
+#: lib/transaction.c:687
#, c-format
msgid "excluding %s %s\n"
msgstr ""
-#: lib/transaction.c:616
+#: lib/transaction.c:694
#, c-format
msgid "relocating %s to %s\n"
msgstr ""
-#: lib/transaction.c:688
+#: lib/transaction.c:766
#, c-format
msgid "relocating directory %s to %s\n"
msgstr ""
-#: lib/transaction.c:693
+#: lib/transaction.c:771
#, c-format
msgid "excluding directory %s\n"
msgstr ""
-#: lib/transaction.c:817
+#: lib/transaction.c:895
#, c-format
msgid "%s skipped due to missingok flag\n"
msgstr ""