Rip out cpioFileMap.

CVS patchset: 4493
CVS date: 2001/01/23 23:03:28
This commit is contained in:
jbj 2001-01-23 23:03:28 +00:00
parent 7eb91a5152
commit 8b7b911a17
12 changed files with 540 additions and 405 deletions

View File

@ -6,14 +6,18 @@
* XXX this information will move elsewhere eventually
*/
#include "depends.h" /* XXX DYING */
#include "install.h" /* XXX DYING */
#include "cpio.h"
/**
*/
typedef struct cpioSourceArchive {
unsigned int cpioArchiveSize;
FD_t cpioFdIn;
/*@dependent@*/ struct cpioFileMapping *cpioList;
/*@dependent@*/ const void * cpioList;
int cpioCount;
struct rpmlead *lead; /* XXX FIXME: exorcize lead/arch/os */
struct rpmlead * lead; /* XXX FIXME: exorcize lead/arch/os */
} CSA_t;
#ifdef __cplusplus

View File

@ -26,6 +26,8 @@
#define MAXDOCDIR 1024
extern int _noDirTokens;
/**
*/
typedef struct {
@ -915,16 +917,15 @@ static void checkHardLinks(struct FileList *fl)
/**
* @todo Should directories have %doc/%config attributes? (#14531)
* @todo Remove RPMTAG_OLDFILENAMES, add dirname/basename instead.
* @param fl package file tree walk data
*/
static void genCpioListAndHeader(struct FileList *fl,
struct cpioFileMapping **cpioList,
static void genCpioListAndHeader(struct FileList *fl, void **cpioList,
int *cpioCount, Header h, int isSrc)
{
int skipLen;
int count;
FileListRec *flp;
struct cpioFileMapping *clp;
int fc;
char *s;
char buf[BUFSIZ];
uint_32 multiLibMask = 0;
@ -933,7 +934,7 @@ static void genCpioListAndHeader(struct FileList *fl,
qsort(fl->fileList, fl->fileListRecsUsed,
sizeof(*(fl->fileList)), compareFileListRecs);
/* Generate the cpio list and the header */
/* Generate the header. */
skipLen = 0;
if (! isSrc) {
skipLen = 1;
@ -941,11 +942,10 @@ static void genCpioListAndHeader(struct FileList *fl,
skipLen += strlen(fl->prefix);
}
*cpioCount = 0;
clp = *cpioList = xmalloc(sizeof(**cpioList) * fl->fileListRecsUsed);
for (flp = fl->fileList, count = fl->fileListRecsUsed; count > 0; flp++, count--) {
if ((count > 1) && !strcmp(flp->fileURL, flp[1].fileURL)) {
for (fc = 0, flp = fl->fileList; fc < fl->fileListRecsUsed; fc++, flp++) {
if (fc < (fl->fileListRecsUsed - 1) &&
!strcmp(flp->fileURL, flp[1].fileURL))
{
rpmError(RPMERR_BADSPEC, _("File listed twice: %s\n"),
flp->fileURL);
fl->processingFailed = 1;
@ -956,43 +956,6 @@ static void genCpioListAndHeader(struct FileList *fl,
(1 << ((flp->flags & RPMFILE_MULTILIB_MASK))
>> RPMFILE_MULTILIB_SHIFT);
/* Make the cpio list */
if (! (flp->flags & RPMFILE_GHOST)) {
char * t;
clp->dirName = t = xmalloc(strlen(flp->diskURL) + 2);
t = stpcpy(t, flp->diskURL);
/* Make room for the dirName NUL, find start of baseName. */
for (; t > clp->dirName && *t != '/'; t--)
t[1] = t[0];
t++;
*t++ = '\0';
clp->baseName = t;
/* XXX legacy requires './' payload prefix to be omitted from rpm packages. */
clp->archivePath = t = xmalloc(strlen(flp->fileURL) - skipLen + 3);
if (!isSrc && !rpmExpandNumeric("%{_noPayloadPrefix}")) {
t = stpcpy(t, "./");
rpmlibNeedsFeature(h, "PayloadFilesHavePrefix", "4.0-1");
}
t = stpcpy(t, (flp->fileURL + skipLen));
clp->finalMode = flp->fl_mode;
clp->finalUid = flp->fl_uid;
clp->finalGid = flp->fl_gid;
clp->mapFlags = CPIO_MAP_PATH | CPIO_MAP_MODE |
CPIO_MAP_UID | CPIO_MAP_GID;
if (isSrc)
clp->mapFlags |= CPIO_FOLLOW_SYMLINKS;
if (flp->flags & RPMFILE_MULTILIB_MASK)
clp->mapFlags |= CPIO_MULTILIB;
clp++;
(*cpioCount)++;
}
/* Make the header, the OLDFILENAMES will get converted to a
compressed file list write before we write the actual package to
disk. */
@ -1092,9 +1055,11 @@ static void genCpioListAndHeader(struct FileList *fl,
headerAddOrAppendEntry(h, RPMTAG_FILEFLAGS, RPM_INT32_TYPE,
&(flp->flags), 1);
}
headerAddEntry(h, RPMTAG_SIZE, RPM_INT32_TYPE,
&(fl->totalFileSize), 1);
/* XXX This should be added always so that packages look alike.
* XXX However, there is logic in files.c/depends.c that checks for
* XXX existence (rather than value) that will need to change as well.
@ -1102,6 +1067,106 @@ static void genCpioListAndHeader(struct FileList *fl,
if (multiLibMask)
headerAddEntry(h, RPMTAG_MULTILIBS, RPM_INT32_TYPE,
&multiLibMask, 1);
/* Choose how filenames are represented. */
if (_noDirTokens)
expandFilelist(h);
else {
compressFilelist(h);
/* Binary packages with dirNames cannot be installed by legacy rpm. */
rpmlibNeedsFeature(h, "CompressedFileNames", "3.0.4-1");
}
#ifdef DYING
{ struct cpioFileMapping * clp = xmalloc(sizeof(*clp) * fl->fileListRecsUsed);
int clpcnt = 0;
/* Make the cpio list */
for (fc = 0, flp = fl->fileList; fc < fl->fileListRecsUsed; fc++, flp++) {
char * t;
if (flp->flags & RPMFILE_GHOST)
continue;
clp->dirName = t = xmalloc(strlen(flp->diskURL) + 2);
t = stpcpy(t, flp->diskURL);
/* Make room for the dirName NUL, find start of baseName. */
for (; t > clp->dirName && *t != '/'; t--)
t[1] = t[0];
t++;
*t++ = '\0';
clp->baseName = t;
/* XXX legacy requires './' payload prefix to be omitted from rpm packages. */
clp->archivePath = t = xmalloc(strlen(flp->fileURL) - skipLen + 3);
if (!isSrc && !rpmExpandNumeric("%{_noPayloadPrefix}")) {
t = stpcpy(t, "./");
rpmlibNeedsFeature(h, "PayloadFilesHavePrefix", "4.0-1");
}
t = stpcpy(t, (flp->fileURL + skipLen));
clp->finalMode = flp->fl_mode;
clp->finalUid = flp->fl_uid;
clp->finalGid = flp->fl_gid;
clp->mapFlags = CPIO_MAP_PATH | CPIO_MAP_MODE |
CPIO_MAP_UID | CPIO_MAP_GID;
if (isSrc)
clp->mapFlags |= CPIO_FOLLOW_SYMLINKS;
if (flp->flags & RPMFILE_MULTILIB_MASK)
clp->mapFlags |= CPIO_MULTILIB;
clp++;
clpcnt++;
}
if (cpioList)
*cpioList = clp;
else
free(clp);
if (cpioCount)
*cpioCount = clpcnt;
}
#else
{ TFI_t fi = xmalloc(sizeof(*fi) * fl->fileListRecsUsed);
int i;
fi->type = TR_ADDED;
loadFi(h, fi);
fi->striplen = 1;
fi->actions = xcalloc(sizeof(*fi->actions), fi->fc);
fi->fmapflags = xcalloc(sizeof(*fi->fmapflags), fi->fc);
rpmBuildFileList(h, &fi->apath, NULL);
fi->fuser = NULL;
fi->fuids = xcalloc(sizeof(*fi->fuids), fi->fc);
fi->fgroup = NULL;
fi->fgids = xcalloc(sizeof(*fi->fgids), fi->fc);
/* Make the cpio list */
for (i = 0, flp = fl->fileList; i < fi->fc; i++, flp++) {
if (flp->flags & RPMFILE_GHOST) {
fi->actions[i] = FA_SKIP;
continue;
}
fi->actions[i] = FA_CREATE;
fi->fuids[i] = flp->fl_uid;
fi->fgids[i] = flp->fl_gid;
fi->fmapflags[i] =
CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID;
if (isSrc)
fi->fmapflags[i] |= CPIO_FOLLOW_SYMLINKS;
if (flp->flags & RPMFILE_MULTILIB_MASK)
fi->fmapflags[i] |= CPIO_MULTILIB;
}
if (cpioList)
*cpioList = fi;
else
free(fi);
if (cpioCount)
*cpioCount = fc;
}
#endif
}
/**
@ -1949,10 +2014,10 @@ DepMsg_t depMsgs[] = {
/**
*/
static int generateDepends(Spec spec, Package pkg,
struct cpioFileMapping *cpioList, int cpioCount,
int multiLib)
static int generateDepends(Spec spec, Package pkg, void *cpioList,
/*@unused@*/ int cpioCount, int multiLib)
{
TFI_t fi = cpioList;
StringBuf writeBuf;
int writeBytes;
StringBuf readBuf;
@ -1960,30 +2025,31 @@ static int generateDepends(Spec spec, Package pkg,
char *myargv[4];
int failnonzero = 0;
int rc = 0;
int i;
if (cpioCount <= 0)
if (fi->fc <= 0)
return 0;
if (! (pkg->autoReq || pkg->autoProv))
return 0;
writeBuf = newStringBuf();
for (writeBytes = 0; cpioCount--; cpioList++) {
for (i = 0, writeBytes = 0; i < fi->fc; i++) {
if (multiLib == 2) {
if (!(cpioList->mapFlags & CPIO_MULTILIB))
if (fi->fmapflags && multiLib == 2) {
if (!(fi->fmapflags[i] & CPIO_MULTILIB))
continue;
cpioList->mapFlags &= ~CPIO_MULTILIB;
fi->fmapflags[i] &= ~CPIO_MULTILIB;
}
appendStringBuf(writeBuf, cpioList->dirName);
writeBytes += strlen(cpioList->dirName);
appendLineStringBuf(writeBuf, cpioList->baseName);
writeBytes += strlen(cpioList->baseName) + 1;
appendStringBuf(writeBuf, fi->dnl[fi->dil[i]]);
writeBytes += strlen(fi->dnl[fi->dil[i]]);
appendLineStringBuf(writeBuf, fi->bnl[i]);
writeBytes += strlen(fi->bnl[i]) + 1;
}
for (dm = depMsgs; dm->msg != NULL; dm++) {
int i, tag, tagflags;
int tag, tagflags;
tag = (dm->ftag > 0) ? dm->ftag : dm->ntag;
tagflags = 0;

View File

@ -35,12 +35,12 @@ static inline int genSourceRpmName(Spec spec)
/**
*/
static int cpio_doio(FD_t fdo, CSA_t * csa, const char * fmodeMacro)
static int cpio_doio(FD_t fdo, Header h, CSA_t * csa, const char * fmodeMacro)
{
const char *fmode = rpmExpand(fmodeMacro, NULL);
const char *failedFile = NULL;
FD_t cfd;
int rc;
const char *failedFile = NULL;
const char *fmode = rpmExpand(fmodeMacro, NULL);
if (!(fmode && fmode[0] == 'w'))
fmode = xstrdup("w9.gzdio");
@ -308,6 +308,7 @@ int writeRPM(Header *hdrp, const char *fileName, int type,
&csa->cpioArchiveSize, 1);
}
#ifdef DYING
/* Choose how filenames are represented. */
if (_noDirTokens)
expandFilelist(h);
@ -317,6 +318,7 @@ int writeRPM(Header *hdrp, const char *fileName, int type,
if (type == RPMLEAD_BINARY)
rpmlibNeedsFeature(h, "CompressedFileNames", "3.0.4-1");
}
#endif
/* Binary packages now have explicit Provides: name = version-release. */
if (type == RPMLEAD_BINARY)
@ -375,7 +377,7 @@ int writeRPM(Header *hdrp, const char *fileName, int type,
rc = RPMERR_NOSPACE;
} else { /* Write the archive and get the size */
if (csa->cpioList != NULL) {
rc = cpio_doio(fd, csa, rpmio_flags);
rc = cpio_doio(fd, h, csa, rpmio_flags);
} else if (Fileno(csa->cpioFdIn) >= 0) {
rc = cpio_copy(fd, csa);
} else {

View File

@ -126,7 +126,7 @@ struct SpecStruct {
/*@refcounted@*/ Header sourceHeader;
int sourceCpioCount;
/*@owned@*/ struct cpioFileMapping *sourceCpioList;
/*@owned@*/ void * sourceCpioList;
/*@dependent@*/ struct MacroContext *macros;
@ -145,7 +145,7 @@ struct PackageStruct {
/*@refcounted@*/ Header header;
int cpioCount;
/*@owned@*/ struct cpioFileMapping *cpioList;
/*@owned@*/ void * cpioList;
/*@owned@*/ struct Source *icon;

View File

@ -31,6 +31,7 @@ static inline void freeTriggerFiles(/*@only@*/ struct TriggerFileEntry *p)
}
}
#ifdef DYING
/**
*/
static inline void freeCpioList(/*@only@*/ struct cpioFileMapping *cpioList, int cpioCount)
@ -46,6 +47,7 @@ static inline void freeCpioList(/*@only@*/ struct cpioFileMapping *cpioList, int
}
FREE(cpioList);
}
#endif
/**
*/
@ -162,7 +164,15 @@ void freePackage(/*@only@*/ Package p)
headerFree(p->header);
freeStringBuf(p->fileList);
FREE(p->fileFile);
#ifdef DYING
freeCpioList(p->cpioList, p->cpioCount);
#else
{ TFI_t fi = p->cpioList;
freeFi(fi);
free((void *)fi);
}
#endif
p->cpioList = NULL;
freeStringBuf(p->specialDoc);
@ -489,7 +499,14 @@ void freeSpec(/*@only@*/ Spec spec)
spec->sourceHeader = NULL;
}
#ifdef DYING
freeCpioList(spec->sourceCpioList, spec->sourceCpioCount);
#else
{ TFI_t fi = spec->sourceCpioList;
freeFi(fi);
free((void *)fi);
}
#endif
spec->sourceCpioList = NULL;
headerFree(spec->buildRestrictions);

View File

@ -22,6 +22,20 @@
#define CPIO_CRC_MAGIC "070702"
#define TRAILER "TRAILER!!!"
/** \ingroup payload
* Defines a single file to be included in a cpio payload.
*/
struct cpioFileMapping {
/*@dependent@*/ const char * archivePath; /*!< Path to store in cpio archive. */
/*@dependent@*/ const char * dirName; /*!< Payload file directory. */
/*@dependent@*/ const char * baseName; /*!< Payload file base name. */
/*@dependent@*/ const char * md5sum; /*!< File MD5 sum (NULL disables). */
mode_t finalMode; /*!< Mode of payload file (from header). */
uid_t finalUid; /*!< Uid of payload file (from header). */
gid_t finalGid; /*!< Gid of payload file (from header). */
cpioMapFlags mapFlags;
};
/** \ingroup payload
* Keeps track of set of all hard linked files in archive.
*/
@ -121,43 +135,20 @@ static const char * mapMd5sum(const void * this) {
}
struct mapi {
union {
const struct cpioFileMapping * mappings;
TFI_t fi;
} u;
int numMappings;
TFI_t fi;
int i;
struct cpioFileMapping map;
};
static int cpioFileMapCmp(const void * a, const void * b) {
const char * afn = ((const struct cpioFileMapping *)a)->archivePath;
const char * bfn = ((const struct cpioFileMapping *)b)->archivePath;
/* Match payloads with ./ prefixes as well. */
if (afn[0] == '.' && afn[1] == '/') afn += 2;
if (bfn[0] == '.' && bfn[1] == '/') bfn += 2;
return strcmp(afn, bfn);
}
static const void * mapFind(const void * this, const char * hdrPath) {
const struct mapi * mapi = this;
const struct cpioFileMapping * map;
struct cpioFileMapping needle;
needle.archivePath = hdrPath;
map = bsearch(&needle, mapi->u.mappings, mapi->numMappings,
sizeof(needle), cpioFileMapCmp);
return map;
}
static const void * mapLink(const void * this) {
const struct cpioFileMapping * map = this;
return map;
const struct cpioFileMapping * omap = this;
struct cpioFileMapping * nmap = xcalloc(sizeof(*nmap), 1);
*nmap = *omap; /* structure assignment */
return nmap;
}
static void mapFree(const void * this) {
return;
free((void *)this);
}
static void mapFreeIterator(/*@only@*/ const void * this) {
@ -171,27 +162,77 @@ static void * mapInitIterator(const void * this, int numMappings) {
if (this == NULL)
return NULL;
mapi = xcalloc(sizeof(*mapi), 1);
mapi->u.mappings = this;
mapi->numMappings = numMappings;
mapi->fi = (void *)this;
mapi->i = 0;
qsort((void *)mapi->u.mappings, numMappings, sizeof(*mapi->u.mappings),
cpioFileMapCmp);
return mapi;
}
static const void * mapNextIterator(void * this) {
struct mapi * mapi = this;
const struct cpioFileMapping * map;
TFI_t fi = mapi->fi;
struct cpioFileMapping * map = &mapi->map;
int i = mapi->i;
if (!(mapi->i < mapi->numMappings))
return NULL;
map = mapi->u.mappings + mapi->i;
do {
if (!((i = mapi->i++) < fi->fc))
return NULL;
} while (fi->actions && XFA_SKIPPING(fi->actions[i]));
/* src rpms have simple base name in payload. */
map->archivePath = (fi->apath ? fi->apath[i] + fi->striplen : fi->bnl[i]);
map->dirName = fi->dnl[fi->dil[i]];
map->baseName = fi->bnl[i];
map->md5sum = (fi->fmd5s ? fi->fmd5s[i] : NULL);
map->finalMode = fi->fmodes[i];
map->finalUid = (fi->fuids ? fi->fuids[i] : fi->uid); /* XXX chmod u-s */
map->finalGid = (fi->fgids ? fi->fgids[i] : fi->gid); /* XXX chmod g-s */
map->mapFlags = (fi->fmapflags ? fi->fmapflags[i] : fi->mapflags);
mapi->i++;
return map;
}
#ifdef DYING
static int cpioFileMapCmp(const void * a, const void * b) {
const char * afn = ((const struct cpioFileMapping *)a)->archivePath;
const char * bfn = ((const struct cpioFileMapping *)b)->archivePath;
/* Match payloads with ./ prefixes as well. */
if (afn[0] == '.' && afn[1] == '/') afn += 2;
if (bfn[0] == '.' && bfn[1] == '/') bfn += 2;
return strcmp(afn, bfn);
}
#endif
static int cpioStrCmp(const void * a, const void * b) {
const char * afn = *(const char **)a;
const char * bfn = *(const char **)b;
/* Match rpm-4.0 payloads with ./ prefixes. */
if (afn[0] == '.' && afn[1] == '/') afn += 2;
if (bfn[0] == '.' && bfn[1] == '/') bfn += 2;
/* If either path is absolute, make it relative. */
if (afn[0] == '/') afn += 1;
if (bfn[0] == '/') bfn += 1;
return strcmp(afn, bfn);
}
static const void * mapFind(void * this, const char * hdrPath) {
struct mapi * mapi = this;
const TFI_t fi = mapi->fi;
const char ** p;
p = bsearch(&hdrPath, fi->apath, fi->fc, sizeof(hdrPath), cpioStrCmp);
if (p == NULL) {
fprintf(stderr, "*** not mapped %s\n", hdrPath);
return NULL;
}
mapi->i = p - fi->apath;
return mapNextIterator(this);
}
/**
* Read data from payload.
* @param cfd payload file handle
@ -822,7 +863,7 @@ int cpioInstallArchive(FD_t cfd, const void * mappings,
const char ** failedFile)
{
struct cpioHeader ch, *hdr = &ch;
const void * mapi = mapInitIterator(mappings, numMappings);
void * mapi = mapInitIterator(mappings, numMappings);
const void * map = NULL;
struct cpioCallbackInfo cbInfo = { NULL, 0, 0, 0 };
struct hardLink * links = NULL;
@ -1230,7 +1271,7 @@ int cpioBuildArchive(FD_t cfd, const void * mappings,
int numMappings, cpioCallback cb, void * cbData,
unsigned int * archiveSize, const char ** failedFile)
{
const void * mapi = mapInitIterator(mappings, numMappings);
void * mapi = mapInitIterator(mappings, numMappings);
const void * map;
struct cpioCallbackInfo cbInfo = { NULL, 0, 0, 0 };
struct cpioCrcPhysicalHeader hdr;

View File

@ -61,20 +61,6 @@ typedef enum cpioMapFlags_e {
CPIO_MULTILIB = (1 << 31) /* internal, only for building */
} cpioMapFlags;
/** \ingroup payload
* Defines a single file to be included in a cpio payload.
*/
struct cpioFileMapping {
/*@dependent@*/ const char * archivePath; /*!< Path to store in cpio archive. */
/*@dependent@*/ const char * dirName; /*!< Payload file directory. */
/*@dependent@*/ const char * baseName; /*!< Payload file base name. */
/*@dependent@*/ const char * md5sum; /*!< File MD5 sum (NULL disables). */
mode_t finalMode; /*!< Mode of payload file (from header). */
uid_t finalUid; /*!< Uid of payload file (from header). */
gid_t finalGid; /*!< Gid of payload file (from header). */
cpioMapFlags mapFlags;
};
/** \ingroup payload
* The first argument passed in a cpio progress callback.
*

View File

@ -121,7 +121,7 @@ struct transactionElement {
/**
*/
typedef int (*HGE_t) (Header h, int_32 tag, /*@out@*/ int_32 * type,
/*@out@*/ const void ** p, /*@out@*/int_32 * c)
/*@out@*/ void ** p, /*@out@*/int_32 * c)
/*@modifies *type, *p, *c @*/;
/**
@ -133,9 +133,6 @@ struct transactionFileInfo_s {
/*@dependent@*/ struct fingerPrint_s * fps; /*!< file fingerprints */
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) */
@ -146,7 +143,8 @@ struct transactionFileInfo_s {
const int * odil; /*!< Original Directory indices (from header) */
const char ** fmd5s; /*!< file MD5 sums (from header) */
const char ** flinks; /*!< file links (from header) */
const uint_16 * fmodes; /*!< file modes (from header) */
/* XXX setuid/setgid bits are turned off if fsuer/fgroup doesn't map. */
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) */
@ -155,6 +153,14 @@ struct transactionFileInfo_s {
int dc; /*!< No. of directories. */
int bnlmax; /*!< Length (in bytes) of longest base name. */
int dnlmax; /*!< Length (in bytes) of longest dir name. */
int mapflags;
int striplen;
const char ** apath;
uid_t uid;
gid_t gid;
uid_t * fuids;
gid_t * fgids;
int * fmapflags;
int magic;
#define TFIMAGIC 0x09697923
/* these are for TR_ADDED packages */
@ -206,6 +212,9 @@ struct problemsSet {
extern "C" {
#endif
#define XFA_SKIPPING(_a) \
((_a) == FA_SKIP || (_a) == FA_SKIPNSTATE || (_a) == FA_SKIPNETSHARED || (_a) == FA_SKIPMULTILIB)
/**
*/
void loadFi(Header h, struct transactionFileInfo_s * fi);

View File

@ -32,7 +32,6 @@ typedef struct callbackInfo_s {
* Header file info, gathered per-file, rather than per-tag.
*/
typedef struct fileInfo_s {
/*@dependent@*/ const char * cpioPath;
/*@dependent@*/ const char * dn; /* relative to root */
/*@dependent@*/ const char * bn;
/*@observer@*/ const char * bnsuffix;
@ -137,51 +136,49 @@ static void freeFileMemory( /*@only@*/ fileMemory fileMem)
* @param fi transaction file info (NULL for source package)
* @param h header
* @retval memPtr address of allocated memory from header access
* @retval fileCountPtr address of install file count
* @retval files address of install file information
* @param stripPrefixLength no. bytes of file prefix to skip
* @param actions array of file dispositions
* @return 0 always
*/
static int assembleFileList(TFI_t fi, Header h,
/*@out@*/ fileMemory * memPtr,
/*@out@*/ int * fileCountPtr,
/*@out@*/ XFI_t * filesPtr,
int stripPrefixLength)
/*@out@*/ fileMemory * memPtr, /*@out@*/ XFI_t * filesPtr)
{
fileMemory mem = newFileMemory();
XFI_t files;
XFI_t file;
int fileCount;
int i;
*memPtr = mem;
if (!headerIsEntry(h, RPMTAG_BASENAMES)) return 0;
if (fi->fc == 0)
return 0;
fi->fuids = xcalloc(sizeof(*fi->fuids), fi->fc);
fi->fgids = xcalloc(sizeof(*fi->fgids), fi->fc);
if (headerIsEntry(h, RPMTAG_ORIGBASENAMES)) {
buildOrigFileList(h, &mem->cpioNames, fileCountPtr);
buildOrigFileList(h, &fi->apath, NULL);
} else {
rpmBuildFileList(h, &mem->cpioNames, fileCountPtr);
rpmBuildFileList(h, &fi->apath, NULL);
}
fileCount = *fileCountPtr;
files = *filesPtr = mem->files = xcalloc(fi->fc, sizeof(*mem->files));
files = *filesPtr = mem->files = xcalloc(fileCount, sizeof(*mem->files));
for (i = 0, file = files; i < fileCount; i++, file++) {
for (i = 0, file = files; i < fi->fc; i++, file++) {
file->state = RPMFILE_STATE_NORMAL;
file->action = (fi->actions ? fi->actions[i] : FA_UNKNOWN);
file->install = 1;
file->dn = fi->dnl[fi->dil[i]];
file->bn = fi->bnl[i];
file->cpioPath = mem->cpioNames[i] + stripPrefixLength;
file->md5sum = (fi->fmd5s ? fi->fmd5s[i] : NULL);
file->mode = fi->fmodes[i];
file->size = fi->fsizes[i];
file->flags = fi->fflags[i];
fi->fuids[i] = file->uid = fi->uid;
fi->fgids[i] = file->gid = fi->gid;
rpmMessage(RPMMESS_DEBUG, _(" file: %s%s action: %s\n"),
file->dn, file->bn, fileActionString(file->action));
}
@ -192,37 +189,42 @@ static int assembleFileList(TFI_t fi, Header h,
/**
* Localize user/group id's.
* @param h header
* @param fi transaction element file info
* @param files install file information
* @param fileCount install file count
*/
static void setFileOwners(Header h, XFI_t files, int fileCount)
static void setFileOwners(Header h, TFI_t fi, XFI_t files)
{
const char ** fileOwners;
const char ** fileGroups;
XFI_t file;
int i;
headerGetEntry(h, RPMTAG_FILEUSERNAME, NULL, (void **) &fileOwners, NULL);
headerGetEntry(h, RPMTAG_FILEGROUPNAME, NULL, (void **) &fileGroups, NULL);
if (fi->fuser == NULL)
headerGetEntryMinMemory(h, RPMTAG_FILEUSERNAME, NULL,
(const void **) &fi->fuser, NULL);
if (fi->fgroup == NULL)
headerGetEntryMinMemory(h, RPMTAG_FILEGROUPNAME, NULL,
(const void **) &fi->fgroup, NULL);
for (i = 0, file = files; i < fileCount; i++, file++) {
if (unameToUid(fileOwners[i], &file->uid)) {
for (i = 0, file = files; i < fi->fc; i++, file++) {
if (unameToUid(fi->fuser[i], &file->uid)) {
rpmMessage(RPMMESS_WARNING,
_("user %s does not exist - using root\n"), fileOwners[i]);
_("user %s does not exist - using root\n"), fi->fuser[i]);
file->uid = 0;
file->mode &= ~S_ISUID; /* turn off the suid bit */
/* XXX this diddles header memory. */
fi->fmodes[i] &= ~S_ISUID; /* turn off the suid bit */
}
if (gnameToGid(fileGroups[i], &file->gid)) {
if (gnameToGid(fi->fgroup[i], &file->gid)) {
rpmMessage(RPMMESS_WARNING,
_("group %s does not exist - using root\n"), fileGroups[i]);
_("group %s does not exist - using root\n"), fi->fgroup[i]);
file->gid = 0;
file->mode &= ~S_ISGID; /* turn off the sgid bit */
/* XXX this diddles header memory. */
fi->fmodes[i] &= ~S_ISGID; /* turn off the sgid bit */
}
fi->fuids[i] = file->uid;
fi->fgids[i] = file->gid;
}
free(fileOwners);
free(fileGroups);
}
#ifdef DYING
@ -277,7 +279,7 @@ static void trimChangelog(Header h)
static int mergeFiles(Header h, Header newH, TFI_t fi)
{
enum fileActions * actions = fi->actions;
int i, j, k, fileCount;
int i, j, k, fc;
int_32 type, count, dirNamesCount, dirCount;
void * data, * newdata;
int_32 * dirIndexes, * newDirIndexes;
@ -310,9 +312,9 @@ static int mergeFiles(Header h, Header newH, TFI_t fi)
headerGetEntry(h, RPMTAG_SIZE, NULL, (void **) &fileSizes, NULL);
fileSize = *fileSizes;
headerGetEntry(newH, RPMTAG_FILESIZES, NULL, (void **) &fileSizes, &count);
for (i = 0, fileCount = 0; i < count; i++)
for (i = 0, fc = 0; i < count; i++)
if (actions[i] != FA_SKIPMULTILIB) {
fileCount++;
fc++;
fileSize += fileSizes[i];
}
headerModifyEntry(h, RPMTAG_SIZE, RPM_INT32_TYPE, &fileSize, 1);
@ -323,36 +325,35 @@ static int mergeFiles(Header h, Header newH, TFI_t fi)
switch (type) {
case RPM_CHAR_TYPE:
case RPM_INT8_TYPE:
newdata = xmalloc(fileCount * sizeof(int_8));
newdata = xmalloc(fc * sizeof(int_8));
for (j = 0, k = 0; j < count; j++)
if (actions[j] != FA_SKIPMULTILIB)
((int_8 *) newdata)[k++] = ((int_8 *) data)[j];
headerAddOrAppendEntry(h, mergeTags[i], type, newdata,
fileCount);
headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
free (newdata);
break;
case RPM_INT16_TYPE:
newdata = xmalloc(fileCount * sizeof(int_16));
newdata = xmalloc(fc * sizeof(int_16));
for (j = 0, k = 0; j < count; j++)
if (actions[j] != FA_SKIPMULTILIB)
((int_16 *) newdata)[k++] = ((int_16 *) data)[j];
headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fileCount);
headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
free (newdata);
break;
case RPM_INT32_TYPE:
newdata = xmalloc(fileCount * sizeof(int_32));
newdata = xmalloc(fc * sizeof(int_32));
for (j = 0, k = 0; j < count; j++)
if (actions[j] != FA_SKIPMULTILIB)
((int_32 *) newdata)[k++] = ((int_32 *) data)[j];
headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fileCount);
headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
free (newdata);
break;
case RPM_STRING_ARRAY_TYPE:
newdata = xmalloc(fileCount * sizeof(char *));
newdata = xmalloc(fc * sizeof(char *));
for (j = 0, k = 0; j < count; j++)
if (actions[j] != FA_SKIPMULTILIB)
((char **) newdata)[k++] = ((char **) data)[j];
headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fileCount);
headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
free (newdata);
free (data);
break;
@ -371,11 +372,11 @@ static int mergeFiles(Header h, Header newH, TFI_t fi)
headerGetEntryMinMemory(h, RPMTAG_DIRNAMES, NULL, (const void **) &data,
&dirNamesCount);
dirNames = xcalloc(dirNamesCount + fileCount, sizeof(char *));
dirNames = xcalloc(dirNamesCount + fc, sizeof(char *));
for (i = 0; i < dirNamesCount; i++)
dirNames[i] = ((char **) data)[i];
dirCount = dirNamesCount;
newdata = xmalloc(fileCount * sizeof(int_32));
newdata = xmalloc(fc * sizeof(int_32));
for (i = 0, k = 0; i < count; i++) {
if (actions[i] == FA_SKIPMULTILIB)
continue;
@ -386,8 +387,7 @@ static int mergeFiles(Header h, Header newH, TFI_t fi)
dirNames[dirCount++] = newDirNames[newDirIndexes[i]];
((int_32 *) newdata)[k++] = j;
}
headerAddOrAppendEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE, newdata,
fileCount);
headerAddOrAppendEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE, newdata, fc);
if (dirCount > dirNamesCount)
headerAddOrAppendEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
dirNames + dirNamesCount,
@ -545,9 +545,10 @@ static void callback(struct cpioCallbackInfo * cpioInfo, void * data)
*
* @todo Add endian tag so that srpm MD5 sums can ber verified when installed.
*
* @param ts transaction set
* @param fi transaction element file info
* @param fd file handle of package (positioned at payload)
* @param files files to install (NULL means "all files")
* @param fileCount no. files to install
* @param notify callback function
* @param notifyData callback private data
* @param pkgKey package private data (e.g. file name)
@ -557,24 +558,22 @@ static void callback(struct cpioCallbackInfo * cpioInfo, void * data)
* @return 0 on success
*/
static int installArchive(const rpmTransactionSet ts, TFI_t fi,
FD_t fd, XFI_t files, int fileCount,
FD_t fd, XFI_t files,
rpmCallbackFunction notify, rpmCallbackData notifyData,
const void * pkgKey, Header h,
/*@out@*/ const char ** specFile, int archiveSize)
{
struct cpioFileMapping * map = NULL;
int mappedFiles = 0;
const void * cpioMap = NULL;
int cpioMapCnt = 0;
const char * failedFile = NULL;
cbInfo cbi = alloca(sizeof(*cbi));
char * rpmio_flags;
FD_t cfd;
int saveerrno;
int rc;
if (!files) {
if (files == NULL) {
/* install all files */
fileCount = 0;
} else if (!fileCount) {
} else if (fi->fc == 0) {
/* no files to install */
return 0;
}
@ -589,11 +588,14 @@ static int installArchive(const rpmTransactionSet ts, TFI_t fi,
if (specFile) *specFile = NULL;
if (files) {
#ifdef DYING
struct cpioFileMapping * map = NULL;
int mappedFiles;
XFI_t file;
int i;
map = alloca(sizeof(*map) * fileCount);
for (i = 0, mappedFiles = 0, file = files; i < fileCount; i++, file++) {
map = alloca(sizeof(*map) * fi->fc);
for (i = 0, mappedFiles = 0, file = files; i < fi->fc; i++, file++) {
if (!file->install) continue;
map[mappedFiles].archivePath = file->cpioPath;
@ -611,6 +613,12 @@ static int installArchive(const rpmTransactionSet ts, TFI_t fi,
CPIO_MAP_UID | CPIO_MAP_GID;
mappedFiles++;
}
cpioMap = map;
cpioMapCnt = mappedFiles;
#else
cpioMap = fi;
cpioMapCnt = fi->fc;
#endif
}
if (notify)
@ -632,13 +640,15 @@ static int installArchive(const rpmTransactionSet ts, TFI_t fi,
t = stpcpy(t, ".bzdio");
}
(void) Fflush(fd);
cfd = Fdopen(fdDup(Fileno(fd)), rpmio_flags);
rc = cpioInstallArchive(cfd, map, mappedFiles,
{ FD_t cfd;
(void) Fflush(fd);
cfd = Fdopen(fdDup(Fileno(fd)), rpmio_flags);
rc = cpioInstallArchive(cfd, cpioMap, cpioMapCnt,
((notify && archiveSize) || specFile) ? callback : NULL,
cbi, &failedFile);
saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
Fclose(cfd);
saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
Fclose(cfd);
}
headerFree(cbi->h);
if (rc) {
@ -717,13 +727,10 @@ static int installSources(Header h, const char * rootDir, FD_t fd,
int specFileIndex = -1;
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;
uid_t currUid = getuid();
gid_t currGid = getgid();
int rc = 0;
rpmMessage(RPMMESS_DEBUG, _("installing a source package\n"));
@ -740,33 +747,41 @@ static int installSources(Header h, const char * rootDir, FD_t fd,
goto exit;
}
fi->type = TR_ADDED;
loadFi(h, fi);
assembleFileList(fi, h, &fileMem, &fileCount, &files, 0);
for (i = 0, file = files; i < fileCount; i++, file++) {
file->uid = currUid;
file->gid = currGid;
if (fi->fmd5s) { /* DYING */
free((void **)fi->fmd5s); fi->fmd5s = NULL;
}
if (fi->fmapflags) { /* DYING */
free((void **)fi->fmapflags); fi->fmapflags = NULL;
}
fi->uid = getuid();
fi->gid = getgid();
fi->striplen = 0;
fi->mapflags = CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID;
assembleFileList(fi, h, &fileMem, &files);
i = fi->fc;
file = files + i;
if (headerIsEntry(h, RPMTAG_COOKIE))
for (i = 0, file = files; i < fileCount; i++, file++)
for (i = 0, file = files; i < fi->fc; i++, file++)
if (file->flags & RPMFILE_SPECFILE) break;
if (i == fileCount) {
if (i == fi->fc) {
/* 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;
for (i = 0, file = files; i < fi->fc; i++, file++) {
const char * t = fi->apath[i];
t += strlen(fi->apath[i]) - 5;
if (!strcmp(t, ".spec")) break;
}
}
if (i < fileCount) {
char *t = alloca(strlen(_specdir) + strlen(file->cpioPath) + 5);
if (i < fi->fc) {
char *t = alloca(strlen(_specdir) + strlen(fi->apath[i]) + 5);
(void)stpcpy(stpcpy(t, _specdir), "/");
file->dn = t;
file->bn = file->cpioPath;
file->bn = fi->apath[i];
specFileIndex = i;
} else {
rpmError(RPMERR_NOSPEC, _("source package contains no .spec file\n"));
@ -783,8 +798,8 @@ static int installSources(Header h, const char * rootDir, FD_t fd,
{ const char * currDir = currentDirectory();
Chdir(_sourcedir);
rc = installArchive(NULL, NULL, fd, fileCount > 0 ? files : NULL,
fileCount, notify, notifyData, NULL, h,
rc = installArchive(NULL, NULL, fd, fi->fc > 0 ? files : NULL,
notify, notifyData, NULL, h,
specFileIndex >= 0 ? NULL : &specFile,
archiveSizePtr ? *archiveSizePtr : 0);
@ -947,7 +962,6 @@ int installBinaryPackage(const rpmTransactionSet ts, Header h, TFI_t fi)
{
rpmtransFlags transFlags = ts->transFlags;
struct availablePackage * alp = fi->ap;
int fileCount = 0;
XFI_t files = NULL;
Header oldH = NULL;
int otherOffset = 0;
@ -961,9 +975,9 @@ int installBinaryPackage(const rpmTransactionSet ts, Header h, TFI_t fi)
if (transFlags & (RPMTRANS_FLAG_JUSTDB | RPMTRANS_FLAG_MULTILIB))
transFlags |= RPMTRANS_FLAG_NOSCRIPTS;
rpmMessage(RPMMESS_DEBUG, _("package: %s-%s-%s files test = %d\n"),
rpmMessage(RPMMESS_DEBUG, _("package: %s-%s-%s has %d files test = %d\n"),
alp->name, alp->version, alp->release,
transFlags & RPMTRANS_FLAG_TEST);
fi->fc, (transFlags & RPMTRANS_FLAG_TEST));
if ((scriptArg = rpmdbCountPackages(ts->rpmdb, alp->name)) < 0)
goto exit;
@ -982,11 +996,8 @@ int installBinaryPackage(const rpmTransactionSet ts, Header h, TFI_t fi)
rpmdbFreeIterator(mi);
}
if (!(transFlags & RPMTRANS_FLAG_JUSTDB) &&
headerIsEntry(h, RPMTAG_BASENAMES))
{
if (!(transFlags & RPMTRANS_FLAG_JUSTDB) && fi->fc > 0) {
const char * p;
int stripSize;
/*
* Old format relocateable packages need the entire default
@ -994,8 +1005,10 @@ int installBinaryPackage(const rpmTransactionSet ts, Header h, TFI_t fi)
* need the leading / stripped.
*/
rc = headerGetEntry(h, RPMTAG_DEFAULTPREFIX, NULL, (void **) &p, NULL);
stripSize = (rc ? strlen(p) + 1 : 1);
if (assembleFileList(fi, h, &fileMem, &fileCount, &files, stripSize))
fi->striplen = (rc ? strlen(p) + 1 : 1);
fi->mapflags =
CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID;
if (assembleFileList(fi, h, &fileMem, &files))
goto exit;
} else {
files = NULL;
@ -1033,9 +1046,9 @@ int installBinaryPackage(const rpmTransactionSet ts, Header h, TFI_t fi)
if (files) {
XFI_t file;
setFileOwners(h, files, fileCount);
setFileOwners(h, fi, files);
for (i = 0, file = files; i < fileCount; i++, file++) {
for (i = 0, file = files; i < fi->fc; i++, file++) {
char opath[BUFSIZ];
char * npath;
char * ext;
@ -1114,29 +1127,26 @@ int installBinaryPackage(const rpmTransactionSet ts, Header h, TFI_t fi)
}
/* the file pointer for fd is pointing at the cpio archive */
rc = installArchive(ts, fi, alp->fd, files, fileCount,
rc = installArchive(ts, fi, alp->fd, files,
ts->notify, ts->notifyData, alp->key,
h, NULL, archiveSize);
if (rc)
goto exit;
}
{ char *fstates = alloca(sizeof(*fstates) * fileCount);
for (i = 0, file = files; i < fileCount; i++, file++)
{ char *fstates = alloca(sizeof(*fstates) * fi->fc);
for (i = 0, file = files; i < fi->fc; i++, file++)
fstates[i] = file->state;
headerAddEntry(h, RPMTAG_FILESTATES, RPM_CHAR_TYPE, fstates,
fileCount);
fi->fc);
}
if (fileMem) freeFileMemory(fileMem);
fileMem = NULL;
} else if (transFlags & RPMTRANS_FLAG_JUSTDB) {
if (headerGetEntry(h, RPMTAG_BASENAMES, NULL, NULL, &fileCount)) {
char * fstates = alloca(sizeof(*fstates) * fileCount);
memset(fstates, RPMFILE_STATE_NORMAL, fileCount);
headerAddEntry(h, RPMTAG_FILESTATES, RPM_CHAR_TYPE, fstates,
fileCount);
}
} else if (fi->fc > 0 && transFlags & RPMTRANS_FLAG_JUSTDB) {
char * fstates = alloca(sizeof(*fstates) * fi->fc);
memset(fstates, RPMFILE_STATE_NORMAL, fi->fc);
headerAddEntry(h, RPMTAG_FILESTATES, RPM_CHAR_TYPE, fstates, fi->fc);
}
{ int_32 installTime = time(NULL);

View File

@ -478,8 +478,8 @@ static void doBuildFileList(Header h, /*@out@*/ const char *** fileListPtr,
int i;
if (!headerGetEntry(h, baseNameTag, NULL, (void **) &baseNames, &count)) {
*fileListPtr = NULL;
*fileCountPtr = 0;
if (fileListPtr) *fileListPtr = NULL;
if (fileCountPtr) *fileCountPtr = 0;
return; /* no file list */
}
@ -500,8 +500,11 @@ static void doBuildFileList(Header h, /*@out@*/ const char *** fileListPtr,
free((void *)baseNames);
free((void *)dirNames);
*fileListPtr = fileNames;
*fileCountPtr = count;
if (fileListPtr)
*fileListPtr = fileNames;
else
free((void *)fileNames);
if (fileCountPtr) *fileCountPtr = count;
}
void expandFilelist(Header h)

View File

@ -61,9 +61,6 @@ struct diskspaceInfo {
#define XSTRCMP(a, b) ((!(a) && !(b)) || ((a) && (b) && !strcmp((a), (b))))
#define XFA_SKIPPING(_a) \
((_a) == FA_SKIP || (_a) == FA_SKIPNSTATE || (_a) == FA_SKIPNETSHARED || (_a) == FA_SKIPMULTILIB)
void loadFi(Header h, TFI_t fi)
{
HGE_t hge;
@ -76,11 +73,8 @@ void loadFi(Header h, TFI_t fi)
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)) {
fprintf(stderr, "*** BASENAMES not found\n");
fi->dc = 0;
fi->fc = 0;
fi->dnl = NULL;
@ -90,6 +84,9 @@ void loadFi(Header h, TFI_t fi)
fi->fflags = NULL;
fi->fsizes = NULL;
fi->fstates = NULL;
fi->fmd5s = NULL;
fi->flinks = NULL;
fi->flangs = NULL;
return;
}
@ -115,9 +112,6 @@ void loadFi(Header h, TFI_t fi)
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)),
@ -156,76 +150,79 @@ void loadFi(Header h, TFI_t fi)
void freeFi(TFI_t fi)
{
if (fi->h) {
headerFree(fi->h); fi->h = NULL;
}
if (fi->actions) {
free(fi->actions); fi->actions = NULL;
}
if (fi->replacedSizes) {
free(fi->replacedSizes); fi->replacedSizes = NULL;
}
if (fi->replaced) {
free(fi->replaced); fi->replaced = NULL;
}
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;
}
if (fi->h) {
headerFree(fi->h); fi->h = NULL;
}
if (fi->actions) {
free(fi->actions); fi->actions = NULL;
}
if (fi->replacedSizes) {
free(fi->replacedSizes); fi->replacedSizes = NULL;
}
if (fi->replaced) {
free(fi->replaced); fi->replaced = NULL;
}
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;
}
if (fi->apath) {
free(fi->apath); fi->apath = NULL;
}
if (fi->fuids) {
free(fi->fuids); fi->fuids = NULL;
}
if (fi->fgids) {
free(fi->fgids); fi->fgids = NULL;
}
if (fi->fmapflags) {
free(fi->fmapflags); fi->fmapflags = 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((void *)fi->fsizes); fi->fsizes = NULL;
}
if (fi->fflags) {
free((void *)fi->fflags); fi->fflags = NULL;
}
if (fi->fmodes) {
free((void *)fi->fmodes); fi->fmodes = NULL;
}
if (fi->fstates) {
free((void *)fi->fstates); fi->fstates = NULL;
}
if (fi->dil) {
free((void *)fi->dil); fi->dil = NULL;
}
switch (fi->type) {
case TR_ADDED:
break;
case TR_REMOVED:
if (fi->fsizes) {
free((void *)fi->fsizes); fi->fsizes = NULL;
}
if (fi->fflags) {
free((void *)fi->fflags); fi->fflags = NULL;
}
if (fi->fmodes) {
free((void *)fi->fmodes); fi->fmodes = NULL;
}
if (fi->fstates) {
free((void *)fi->fstates); fi->fstates = NULL;
}
if (fi->dil) {
free((void *)fi->dil); fi->dil = NULL;
}
break;
}
}
static void freeFl(rpmTransactionSet ts, TFI_t flList)

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2001-01-23 11:02-0500\n"
"POT-Creation-Date: 2001-01-23 17:58-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"
@ -1472,7 +1472,7 @@ msgstr ""
msgid "no tar files given for build"
msgstr ""
#: build/build.c:114 build/pack.c:370
#: build/build.c:114 build/pack.c:372
msgid "Unable to open temp file.\n"
msgstr ""
@ -1547,74 +1547,74 @@ msgstr ""
msgid "syntax error in expression\n"
msgstr ""
#: build/files.c:227
#: build/files.c:229
#, c-format
msgid "TIMECHECK failure: %s\n"
msgstr ""
#: build/files.c:278 build/files.c:363 build/files.c:538
#: build/files.c:280 build/files.c:365 build/files.c:540
#, c-format
msgid "Missing '(' in %s %s\n"
msgstr ""
#: build/files.c:289 build/files.c:483 build/files.c:549
#: build/files.c:291 build/files.c:485 build/files.c:551
#, c-format
msgid "Missing ')' in %s(%s\n"
msgstr ""
#: build/files.c:327 build/files.c:508
#: build/files.c:329 build/files.c:510
#, c-format
msgid "Invalid %s token: %s\n"
msgstr ""
#: build/files.c:379
#: build/files.c:381
#, c-format
msgid "Non-white space follows %s(): %s\n"
msgstr ""
#: build/files.c:417
#: build/files.c:419
#, c-format
msgid "Bad syntax: %s(%s)\n"
msgstr ""
#: build/files.c:427
#: build/files.c:429
#, c-format
msgid "Bad mode spec: %s(%s)\n"
msgstr ""
#: build/files.c:439
#: build/files.c:441
#, c-format
msgid "Bad dirmode spec: %s(%s)\n"
msgstr ""
#: build/files.c:576
#: build/files.c:578
msgid "Unusual locale length: \"%.*s\" in %%lang(%s)\n"
msgstr ""
#: build/files.c:586
#: build/files.c:588
msgid "Duplicate locale %.*s in %%lang(%s)\n"
msgstr ""
#: build/files.c:723
#: build/files.c:725
msgid "Hit limit for %%docdir\n"
msgstr ""
#: build/files.c:729
#: build/files.c:731
msgid "Only one arg for %%docdir\n"
msgstr ""
#. We already got a file -- error
#: build/files.c:757
#: build/files.c:759
#, c-format
msgid "Two files on one line: %s\n"
msgstr ""
#: build/files.c:771
#: build/files.c:773
#, c-format
msgid "File must begin with \"/\": %s\n"
msgstr ""
#: build/files.c:783
#: build/files.c:785
msgid "Can't mix special %%doc with other forms: %s\n"
msgstr ""
@ -1623,87 +1623,87 @@ msgstr ""
msgid "File listed twice: %s\n"
msgstr ""
#: build/files.c:1070
#: build/files.c:1033
#, c-format
msgid "Symlink points to BuildRoot: %s -> %s\n"
msgstr ""
#: build/files.c:1165
#: build/files.c:1230
#, c-format
msgid "File doesn't match prefix (%s): %s\n"
msgstr ""
#: build/files.c:1175
#: build/files.c:1240
#, c-format
msgid "File not found: %s\n"
msgstr ""
#: build/files.c:1218 build/files.c:1742 build/parsePrep.c:42
#: build/files.c:1283 build/files.c:1807 build/parsePrep.c:42
#, c-format
msgid "Bad owner/group: %s\n"
msgstr ""
#: build/files.c:1230
#: build/files.c:1295
#, c-format
msgid "File %4d: %07o %s.%s\t %s\n"
msgstr ""
#: build/files.c:1307
#: build/files.c:1372
#, c-format
msgid "File needs leading \"/\": %s\n"
msgstr ""
#: build/files.c:1337
#: build/files.c:1402
#, c-format
msgid "File not found by glob: %s\n"
msgstr ""
#: build/files.c:1392
#: build/files.c:1457
msgid "Could not open %%files file %s: %s\n"
msgstr ""
#: build/files.c:1401 build/pack.c:108
#: build/files.c:1466 build/pack.c:108
#, c-format
msgid "line: %s\n"
msgstr ""
#: build/files.c:1730
#: build/files.c:1795
#, c-format
msgid "Bad file: %s: %s\n"
msgstr ""
#. XXX this error message is probably not seen.
#: build/files.c:1799
#: build/files.c:1864
#, c-format
msgid "Couldn't exec %s: %s\n"
msgstr ""
#: build/files.c:1804
#: build/files.c:1869
#, c-format
msgid "Couldn't fork %s: %s\n"
msgstr ""
#: build/files.c:1886
#: build/files.c:1951
#, c-format
msgid "%s failed\n"
msgstr ""
#: build/files.c:1890
#: build/files.c:1955
#, c-format
msgid "failed to write all data to %s\n"
msgstr ""
#: build/files.c:2017
#: build/files.c:2083
#, c-format
msgid "Finding %s: (using %s)...\n"
msgstr ""
#: build/files.c:2045 build/files.c:2059
#: build/files.c:2111 build/files.c:2125
#, c-format
msgid "Failed to find %s:\n"
msgstr ""
#: build/files.c:2172
#: build/files.c:2238
#, c-format
msgid "Processing files: %s-%s-%s\n"
msgstr ""
@ -1794,61 +1794,61 @@ msgstr ""
msgid "readRPM: reading header from %s\n"
msgstr ""
#: build/pack.c:382
#: build/pack.c:384
msgid "Bad CSA data\n"
msgstr ""
#: build/pack.c:423
#: build/pack.c:425
#, c-format
msgid "Generating signature: %d\n"
msgstr ""
#: build/pack.c:433
#: build/pack.c:435
#, c-format
msgid "Could not open %s: %s\n"
msgstr ""
#: build/pack.c:470
#: build/pack.c:472
#, c-format
msgid "Unable to write package: %s\n"
msgstr ""
#: build/pack.c:485
#: build/pack.c:487
#, c-format
msgid "Unable to open sigtarget %s: %s\n"
msgstr ""
#: build/pack.c:495
#: build/pack.c:497
#, c-format
msgid "Unable to read header from %s: %s\n"
msgstr ""
#: build/pack.c:509
#: build/pack.c:511
#, c-format
msgid "Unable to write header to %s: %s\n"
msgstr ""
#: build/pack.c:519
#: build/pack.c:521
#, c-format
msgid "Unable to read payload from %s: %s\n"
msgstr ""
#: build/pack.c:525
#: build/pack.c:527
#, c-format
msgid "Unable to write payload to %s: %s\n"
msgstr ""
#: build/pack.c:552
#: build/pack.c:554
#, c-format
msgid "Wrote: %s\n"
msgstr ""
#: build/pack.c:617
#: build/pack.c:619
#, c-format
msgid "Could not generate output filename for package %s: %s\n"
msgstr ""
#: build/pack.c:634
#: build/pack.c:636
#, c-format
msgid "cannot create %s: %s\n"
msgstr ""
@ -2170,75 +2170,75 @@ msgstr ""
msgid "Package has no %%description: %s\n"
msgstr ""
#: build/spec.c:41
#: build/spec.c:42
#, c-format
msgid "archive = %s, fs = %s%s\n"
msgstr ""
#: build/spec.c:228
#: build/spec.c:238
#, c-format
msgid "line %d: Bad number: %s\n"
msgstr ""
#: build/spec.c:234
#: build/spec.c:244
#, c-format
msgid "line %d: Bad no%s number: %d\n"
msgstr ""
#: build/spec.c:292
#: build/spec.c:302
#, c-format
msgid "line %d: Bad %s number: %s\n"
msgstr ""
#: lib/cpio.c:540
#: lib/cpio.c:581
#, c-format
msgid "can't rename %s to %s: %s\n"
msgstr ""
#: lib/cpio.c:546
#: lib/cpio.c:587
#, c-format
msgid "can't unlink %s: %s\n"
msgstr ""
#: lib/cpio.c:853
#: lib/cpio.c:894
#, c-format
msgid "getNextHeader: %s\n"
msgstr ""
#: lib/cpio.c:1363
#: lib/cpio.c:1404
#, c-format
msgid "(error 0x%x)"
msgstr ""
#: lib/cpio.c:1366
#: lib/cpio.c:1407
msgid "Bad magic"
msgstr ""
#: lib/cpio.c:1367
#: lib/cpio.c:1408
msgid "Bad/unreadable header"
msgstr ""
#: lib/cpio.c:1385
#: lib/cpio.c:1426
msgid "Header size too big"
msgstr ""
#: lib/cpio.c:1386
#: lib/cpio.c:1427
msgid "Unknown file type"
msgstr ""
#: lib/cpio.c:1387
#: lib/cpio.c:1428
msgid "Missing hard link"
msgstr ""
#: lib/cpio.c:1388
#: lib/cpio.c:1429
msgid "MD5 sum mismatch"
msgstr ""
#: lib/cpio.c:1389
#: lib/cpio.c:1430
msgid "Internal error"
msgstr ""
#: lib/cpio.c:1398
#: lib/cpio.c:1439
msgid " failed - "
msgstr ""
@ -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:360
#: lib/header.c:207 lib/header.c:1015 lib/install.c:361
#, c-format
msgid "Data type %d not supported\n"
msgstr ""
@ -2602,17 +2602,17 @@ msgstr ""
msgid "(unknown type)"
msgstr ""
#: lib/install.c:185
#: lib/install.c:182
#, c-format
msgid " file: %s%s action: %s\n"
msgstr ""
#: lib/install.c:211
#: lib/install.c:210
#, c-format
msgid "user %s does not exist - using root\n"
msgstr ""
#: lib/install.c:218
#: lib/install.c:219
#, c-format
msgid "group %s does not exist - using root\n"
msgstr ""
@ -2620,75 +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:648
#: lib/install.c:658
#, c-format
msgid "unpacking of archive failed%s%s: %s\n"
msgstr ""
#: lib/install.c:649
#: lib/install.c:659
msgid " on file "
msgstr ""
#: lib/install.c:691
#: lib/install.c:701
#, c-format
msgid "cannot create %s %s\n"
msgstr ""
#: lib/install.c:697
#: lib/install.c:707
#, c-format
msgid "cannot write to %s\n"
msgstr ""
#: lib/install.c:729
#: lib/install.c:736
msgid "installing a source package\n"
msgstr ""
#: lib/install.c:772 lib/install.c:805
#: lib/install.c:787 lib/install.c:820
msgid "source package contains no .spec file\n"
msgstr ""
#: lib/install.c:825
#: lib/install.c:840
#, c-format
msgid "renaming %s to %s\n"
msgstr ""
#: lib/install.c:827 lib/install.c:1100 lib/uninstall.c:43
#: lib/install.c:842 lib/install.c:1113 lib/uninstall.c:43
#, c-format
msgid "rename of %s to %s failed: %s\n"
msgstr ""
#: lib/install.c:925
#: lib/install.c:940
msgid "source package expected, binary found\n"
msgstr ""
#: lib/install.c:964
#: lib/install.c:978
#, c-format
msgid "package: %s-%s-%s files test = %d\n"
msgid "package: %s-%s-%s has %d files test = %d\n"
msgstr ""
#: lib/install.c:1005
#: lib/install.c:1018
msgid "stopping install as we're running --test\n"
msgstr ""
#: lib/install.c:1010
#: lib/install.c:1023
msgid "running preinstall script (if any)\n"
msgstr ""
#: lib/install.c:1017
#: lib/install.c:1030
msgid "skipping %s-%s-%s install, %%pre scriptlet failed rc %d\n"
msgstr ""
#: lib/install.c:1054
#: lib/install.c:1067
#, c-format
msgid "%s%s created as %s\n"
msgstr ""
#: lib/install.c:1095
#: lib/install.c:1108
#, c-format
msgid "%s saved as %s\n"
msgstr ""
#: lib/install.c:1180
#: lib/install.c:1190
msgid "running postinstall scripts (if any)\n"
msgstr ""
@ -3672,46 +3672,46 @@ msgstr ""
msgid "You must set \"%%_pgp_name\" in your macro file\n"
msgstr ""
#: lib/transaction.c:558
#: lib/transaction.c:555
msgid "========== relocations\n"
msgstr ""
#: lib/transaction.c:561
#: lib/transaction.c:558
#, c-format
msgid "%5d exclude %s\n"
msgstr ""
#: lib/transaction.c:564
#: lib/transaction.c:561
#, c-format
msgid "%5d relocate %s -> %s\n"
msgstr ""
#: lib/transaction.c:638
#: lib/transaction.c:635
#, c-format
msgid "excluding multilib path %s%s\n"
msgstr ""
#: lib/transaction.c:687
#: lib/transaction.c:684
#, c-format
msgid "excluding %s %s\n"
msgstr ""
#: lib/transaction.c:694
#: lib/transaction.c:691
#, c-format
msgid "relocating %s to %s\n"
msgstr ""
#: lib/transaction.c:766
#: lib/transaction.c:763
#, c-format
msgid "relocating directory %s to %s\n"
msgstr ""
#: lib/transaction.c:771
#: lib/transaction.c:768
#, c-format
msgid "excluding directory %s\n"
msgstr ""
#: lib/transaction.c:895
#: lib/transaction.c:892
#, c-format
msgid "%s skipped due to missingok flag\n"
msgstr ""