From de35e20bf1b423e7c5279ca6ea5a4807df2c4673 Mon Sep 17 00:00:00 2001 From: jbj Date: Wed, 24 Jan 2001 15:58:35 +0000 Subject: Rip XFI_t from install. CVS patchset: 4495 CVS date: 2001/01/24 15:58:35 --- build/buildio.h | 5 +- build/files.c | 144 +++++++++++++------------- build/pack.c | 4 +- build/rpmspec.h | 2 - build/spec.c | 34 +------ lib/cpio.c | 58 ++++++----- lib/cpio.h | 28 ++---- lib/depends.h | 6 +- lib/install.c | 301 ++++++++++++++++--------------------------------------- lib/rpminstall.c | 28 +++--- po/rpm.pot | 171 ++++++++++++++++--------------- 11 files changed, 304 insertions(+), 477 deletions(-) diff --git a/build/buildio.h b/build/buildio.h index c3f23d847..9c44fdcd9 100644 --- a/build/buildio.h +++ b/build/buildio.h @@ -6,8 +6,6 @@ * XXX this information will move elsewhere eventually */ -#include "depends.h" /* XXX DYING */ -#include "install.h" /* XXX DYING */ #include "cpio.h" /** @@ -15,8 +13,7 @@ typedef struct cpioSourceArchive { unsigned int cpioArchiveSize; FD_t cpioFdIn; -/*@dependent@*/ const void * cpioList; - int cpioCount; +/*@dependent@*/ TFI_t cpioList; struct rpmlead * lead; /* XXX FIXME: exorcize lead/arch/os */ } CSA_t; diff --git a/build/files.c b/build/files.c index 8ff2943a1..7be4698e6 100644 --- a/build/files.c +++ b/build/files.c @@ -920,30 +920,33 @@ static void checkHardLinks(struct FileList *fl) * @todo Remove RPMTAG_OLDFILENAMES, add dirname/basename instead. * @param fl package file tree walk data */ -static void genCpioListAndHeader(struct FileList *fl, void **cpioList, - int *cpioCount, Header h, int isSrc) +static void genCpioListAndHeader(struct FileList *fl, TFI_t *cpioList, + Header h, int isSrc) { - int skipLen; + int _addDotSlash = !(isSrc || rpmExpandNumeric("%{_noPayloadPrefix}")); + uint_32 multiLibMask = 0; + int apathlen = 0; + int dpathlen = 0; + int skipLen = 0; FileListRec *flp; - int fc; - char *s; char buf[BUFSIZ]; - uint_32 multiLibMask = 0; + int i; /* Sort the big list */ qsort(fl->fileList, fl->fileListRecsUsed, sizeof(*(fl->fileList)), compareFileListRecs); /* Generate the header. */ - skipLen = 0; if (! isSrc) { skipLen = 1; if (fl->prefix) skipLen += strlen(fl->prefix); } - for (fc = 0, flp = fl->fileList; fc < fl->fileListRecsUsed; fc++, flp++) { - if (fc < (fl->fileListRecsUsed - 1) && + for (i = 0, flp = fl->fileList; i < fl->fileListRecsUsed; i++, flp++) { + char *s; + + if (i < (fl->fileListRecsUsed - 1) && !strcmp(flp->fileURL, flp[1].fileURL)) { rpmError(RPMERR_BADSPEC, _("File listed twice: %s\n"), @@ -951,6 +954,12 @@ static void genCpioListAndHeader(struct FileList *fl, void **cpioList, fl->processingFailed = 1; } + /* Omit '/' and/or URL prefix, leave room for "./" prefix */ + apathlen += (strlen(flp->fileURL) - skipLen + (_addDotSlash ? 3 : 1)); + + /* Leave room for both dirname and basename NUL's */ + dpathlen += (strlen(flp->diskURL) + 2); + if (flp->flags & RPMFILE_MULTILIB_MASK) multiLibMask |= (1 << ((flp->flags & RPMFILE_MULTILIB_MASK)) @@ -1068,6 +1077,9 @@ static void genCpioListAndHeader(struct FileList *fl, void **cpioList, headerAddEntry(h, RPMTAG_MULTILIBS, RPM_INT32_TYPE, &multiLibMask, 1); + if (_addDotSlash) + rpmlibNeedsFeature(h, "PayloadFilesHavePrefix", "4.0-1"); + /* Choose how filenames are represented. */ if (_noDirTokens) expandFilelist(h); @@ -1077,66 +1089,31 @@ static void genCpioListAndHeader(struct FileList *fl, void **cpioList, 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; + char * a, * d; fi->type = TR_ADDED; loadFi(h, fi); - fi->striplen = 1; + if (fi->dnl) { + free((void *)fi->dnl); fi->dnl = NULL; + } + fi->dnl = xmalloc(fi->fc * sizeof(*fi->dnl) + dpathlen); + d = (char *)(fi->dnl + fi->fc); + *d = '\0'; + + if (fi->bnl) { + free((void *)fi->bnl); fi->bnl = NULL; + } + fi->bnl = xmalloc(fi->fc * (sizeof(*fi->bnl) + sizeof(*fi->dil))); + fi->dil = (int *)(fi->bnl + fi->fc); + + fi->apath = xmalloc(fi->fc * sizeof(*fi->apath) + apathlen); + a = (char *)(fi->apath + fi->fc); + *a = '\0'; + fi->actions = xcalloc(sizeof(*fi->actions), fi->fc); fi->fmapflags = xcalloc(sizeof(*fi->fmapflags), fi->fc); - rpmBuildFileList(h, &fi->apath, NULL); + fi->striplen = 0; fi->fuser = NULL; fi->fuids = xcalloc(sizeof(*fi->fuids), fi->fc); fi->fgroup = NULL; @@ -1144,6 +1121,27 @@ static void genCpioListAndHeader(struct FileList *fl, void **cpioList, /* Make the cpio list */ for (i = 0, flp = fl->fileList; i < fi->fc; i++, flp++) { + char * b; + + /* Create disk directory and base name. */ + fi->dil[i] = i; + fi->dnl[fi->dil[i]] = d; + d = stpcpy(d, flp->diskURL); + + /* Make room for the dirName NUL, find start of baseName. */ + for (b = d; b > fi->dnl[fi->dil[i]] && *b != '/'; b--) + b[1] = b[0]; + b++; /* dirname's end in '/' */ + *b++ = '\0'; /* terminate dirname, b points to basename */ + fi->bnl[i] = b; + d += 2; /* skip both dirname and basename NUL's */ + + /* Create archive path, normally adding "./" */ + fi->apath[i] = a; + if (_addDotSlash) a = stpcpy(a, "./"); + a = stpcpy(a, (flp->fileURL + skipLen)); + a++; /* skip apath NUL */ + if (flp->flags & RPMFILE_GHOST) { fi->actions[i] = FA_SKIP; continue; @@ -1163,10 +1161,7 @@ static void genCpioListAndHeader(struct FileList *fl, void **cpioList, *cpioList = fi; else free(fi); - if (cpioCount) - *cpioCount = fc; } -#endif } /** @@ -1435,7 +1430,6 @@ static int processPackageFiles(Spec spec, Package pkg, nullAttrRec(&specialDocAttrRec); pkg->cpioList = NULL; - pkg->cpioCount = 0; if (pkg->fileFile) { const char *ffn; @@ -1607,8 +1601,7 @@ static int processPackageFiles(Spec spec, Package pkg, /* Verify that file attributes scope over hardlinks correctly. */ checkHardLinks(&fl); - genCpioListAndHeader(&fl, &(pkg->cpioList), &(pkg->cpioCount), - pkg->header, 0); + genCpioListAndHeader(&fl, (TFI_t *)&pkg->cpioList, pkg->header, 0); if (spec->timeCheck) timeCheck(spec->timeCheck, pkg->header); @@ -1748,7 +1741,6 @@ int processSourceFiles(Spec spec) } spec->sourceCpioList = NULL; - spec->sourceCpioCount = 0; fl.fileList = xmalloc((spec->numSources + 1) * sizeof(FileListRec)); fl.processingFailed = 0; @@ -1815,8 +1807,7 @@ int processSourceFiles(Spec spec) freeSplitString(files); if (! fl.processingFailed) { - genCpioListAndHeader(&fl, &(spec->sourceCpioList), - &(spec->sourceCpioCount), spec->sourceHeader, 1); + genCpioListAndHeader(&fl, (TFI_t *)&spec->sourceCpioList, spec->sourceHeader, 1); } freeStringBuf(sourceFiles); @@ -2014,8 +2005,7 @@ DepMsg_t depMsgs[] = { /** */ -static int generateDepends(Spec spec, Package pkg, void *cpioList, - /*@unused@*/ int cpioCount, int multiLib) +static int generateDepends(Spec spec, Package pkg, TFI_t cpioList, int multiLib) { TFI_t fi = cpioList; StringBuf writeBuf; @@ -2245,10 +2235,10 @@ int processBinaryFiles(Spec spec, int installSpecialDoc, int test) * XXX existence (rather than value) that will need to change as well. */ if (headerGetEntry(pkg->header, RPMTAG_MULTILIBS, NULL, NULL, NULL)) { - generateDepends(spec, pkg, pkg->cpioList, pkg->cpioCount, 1); - generateDepends(spec, pkg, pkg->cpioList, pkg->cpioCount, 2); + generateDepends(spec, pkg, pkg->cpioList, 1); + generateDepends(spec, pkg, pkg->cpioList, 2); } else - generateDepends(spec, pkg, pkg->cpioList, pkg->cpioCount, 0); + generateDepends(spec, pkg, pkg->cpioList, 0); printDeps(pkg->header); } diff --git a/build/pack.c b/build/pack.c index e90d26e95..09c5ae6f1 100644 --- a/build/pack.c +++ b/build/pack.c @@ -46,7 +46,7 @@ static int cpio_doio(FD_t fdo, Header h, CSA_t * csa, const char * fmodeMacro) fmode = xstrdup("w9.gzdio"); (void) Fflush(fdo); cfd = Fdopen(fdDup(Fileno(fdo)), fmode); - rc = cpioBuildArchive(cfd, csa->cpioList, csa->cpioCount, NULL, NULL, + rc = cpioBuildArchive(cfd, csa->cpioList, NULL, NULL, &csa->cpioArchiveSize, &failedFile); if (rc) { rpmError(RPMERR_CPIO, _("create archive failed on file %s: %s\n"), @@ -647,7 +647,6 @@ int packageBinaries(Spec spec) csa->cpioArchiveSize = 0; csa->cpioFdIn = fdNew("init (packageBinaries)"); csa->cpioList = pkg->cpioList; - csa->cpioCount = pkg->cpioCount; rc = writeRPM(&pkg->header, fn, RPMLEAD_BINARY, csa, spec->passPhrase, NULL); @@ -684,7 +683,6 @@ int packageSources(Spec spec) csa->cpioArchiveSize = 0; csa->cpioFdIn = fdNew("init (packageSources)"); csa->cpioList = spec->sourceCpioList; - csa->cpioCount = spec->sourceCpioCount; rc = writeRPM(&spec->sourceHeader, fn, RPMLEAD_SOURCE, csa, spec->passPhrase, &(spec->cookie)); diff --git a/build/rpmspec.h b/build/rpmspec.h index d98c54fbf..bec9026d8 100644 --- a/build/rpmspec.h +++ b/build/rpmspec.h @@ -125,7 +125,6 @@ struct SpecStruct { int noSource; /*@refcounted@*/ Header sourceHeader; - int sourceCpioCount; /*@owned@*/ void * sourceCpioList; /*@dependent@*/ struct MacroContext *macros; @@ -144,7 +143,6 @@ struct SpecStruct { struct PackageStruct { /*@refcounted@*/ Header header; - int cpioCount; /*@owned@*/ void * cpioList; /*@owned@*/ struct Source *icon; diff --git a/build/spec.c b/build/spec.c index 6109a076e..6c58d6db4 100644 --- a/build/spec.c +++ b/build/spec.c @@ -31,24 +31,6 @@ static inline void freeTriggerFiles(/*@only@*/ struct TriggerFileEntry *p) } } -#ifdef DYING -/** - */ -static inline void freeCpioList(/*@only@*/ struct cpioFileMapping *cpioList, int cpioCount) -{ - struct cpioFileMapping *p = cpioList; - - while (cpioCount--) { - rpmMessage(RPMMESS_DEBUG, _("archive = %s, fs = %s%s\n"), - p->archivePath, p->dirName, p->baseName); - FREE(p->archivePath); - FREE(p->dirName); /* XXX baseName is free'd here as well */ - p++; - } - FREE(cpioList); -} -#endif - /** */ static inline void freeSources(/*@only@*/ struct Source *s) @@ -127,7 +109,6 @@ Package newPackage(Spec spec) p->fileList = NULL; p->cpioList = NULL; - p->cpioCount = 0; p->preInFile = NULL; p->postInFile = NULL; @@ -164,14 +145,11 @@ 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; + if (p->cpioList) { + TFI_t fi = p->cpioList; freeFi(fi); free((void *)fi); } -#endif p->cpioList = NULL; freeStringBuf(p->specialDoc); @@ -435,7 +413,6 @@ Spec newSpec(void) spec->sourceHeader = NULL; - spec->sourceCpioCount = 0; spec->sourceCpioList = NULL; spec->gotBuildRootURL = 0; @@ -499,14 +476,11 @@ void freeSpec(/*@only@*/ Spec spec) spec->sourceHeader = NULL; } -#ifdef DYING - freeCpioList(spec->sourceCpioList, spec->sourceCpioCount); -#else - { TFI_t fi = spec->sourceCpioList; + if (spec->sourceCpioList) { + TFI_t fi = spec->sourceCpioList; freeFi(fi); free((void *)fi); } -#endif spec->sourceCpioList = NULL; headerFree(spec->buildRestrictions); diff --git a/lib/cpio.c b/lib/cpio.c index c010ae43e..cceadfb49 100644 --- a/lib/cpio.c +++ b/lib/cpio.c @@ -10,8 +10,6 @@ #include "system.h" #include -#include "depends.h" -#include "install.h" #include "cpio.h" #include "rpmerr.h" #include "debug.h" @@ -97,16 +95,22 @@ static void prtli(const char *msg, struct hardLink * li) } #endif +/** + */ static int mapFlags(const void * this, cpioMapFlags mask) { const struct cpioFileMapping * map = this; return (map->mapFlags & mask); } +/** + */ static /*@only@*/ const char * mapArchivePath(const void * this) { const struct cpioFileMapping * map = this; return xstrdup(map->archivePath); } +/** + */ static /*@only@*/ const char * mapFsPath(const void * this) { const struct cpioFileMapping * map = this; char * t = xmalloc( strlen(map->dirName) + strlen(map->baseName) + 1); @@ -114,32 +118,44 @@ static /*@only@*/ const char * mapFsPath(const void * this) { return t; } +/** + */ static mode_t mapFinalMode(const void * this) { const struct cpioFileMapping * map = this; return map->finalMode; } +/** + */ static uid_t mapFinalUid(const void * this) { const struct cpioFileMapping * map = this; return map->finalUid; } +/** + */ static gid_t mapFinalGid(const void * this) { const struct cpioFileMapping * map = this; return map->finalGid; } +/** + */ static const char * mapMd5sum(const void * this) { const struct cpioFileMapping * map = this; return map->md5sum; } +/** + */ struct mapi { TFI_t fi; int i; struct cpioFileMapping map; }; +/** + */ static const void * mapLink(const void * this) { const struct cpioFileMapping * omap = this; struct cpioFileMapping * nmap = xcalloc(sizeof(*nmap), 1); @@ -147,16 +163,22 @@ static const void * mapLink(const void * this) { return nmap; } +/** + */ static void mapFree(const void * this) { free((void *)this); } +/** + */ static void mapFreeIterator(/*@only@*/ const void * this) { if (this) free((void *)this); } -static void * mapInitIterator(const void * this, int numMappings) { +/** + */ +static void * mapInitIterator(const void * this) { struct mapi * mapi; if (this == NULL) @@ -167,6 +189,8 @@ static void * mapInitIterator(const void * this, int numMappings) { return mapi; } +/** + */ static const void * mapNextIterator(void * this) { struct mapi * mapi = this; TFI_t fi = mapi->fi; @@ -187,23 +211,11 @@ static const void * mapNextIterator(void * this) { 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; @@ -219,6 +231,8 @@ static int cpioStrCmp(const void * a, const void * b) { return strcmp(afn, bfn); } +/** + */ static const void * mapFind(void * this, const char * hdrPath) { struct mapi * mapi = this; const TFI_t fi = mapi->fi; @@ -858,12 +872,11 @@ static int eatBytes(FD_t cfd, int amount) } /** @todo Verify payload MD5 sum. */ -int cpioInstallArchive(FD_t cfd, const void * mappings, - int numMappings, cpioCallback cb, void * cbData, +int cpioInstallArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData, const char ** failedFile) { struct cpioHeader ch, *hdr = &ch; - void * mapi = mapInitIterator(mappings, numMappings); + void * mapi = mapInitIterator(fi); const void * map = NULL; struct cpioCallbackInfo cbInfo = { NULL, 0, 0, 0 }; struct hardLink * links = NULL; @@ -1267,11 +1280,10 @@ exit: return rc; } -int cpioBuildArchive(FD_t cfd, const void * mappings, - int numMappings, cpioCallback cb, void * cbData, +int cpioBuildArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData, unsigned int * archiveSize, const char ** failedFile) { - void * mapi = mapInitIterator(mappings, numMappings); + void * mapi = mapInitIterator(fi); const void * map; struct cpioCallbackInfo cbInfo = { NULL, 0, 0, 0 }; struct cpioCrcPhysicalHeader hdr; diff --git a/lib/cpio.h b/lib/cpio.h index 4f24415d9..6952148e9 100644 --- a/lib/cpio.h +++ b/lib/cpio.h @@ -17,6 +17,9 @@ #include +#include "depends.h" /* XXX DYING @todo Ratioanlize TFI_t. */ +#include "install.h" /* XXX DYING */ + /** \ingroup payload * @note CPIO_CHECK_ERRNO bit is set only if errno is valid. */ @@ -57,7 +60,7 @@ typedef enum cpioMapFlags_e { CPIO_MAP_MODE = (1 << 1), CPIO_MAP_UID = (1 << 2), CPIO_MAP_GID = (1 << 3), - CPIO_FOLLOW_SYMLINKS = (1 << 4), /* only for building */ + CPIO_FOLLOW_SYMLINKS = (1 << 4), /* @todo Implement. */ CPIO_MULTILIB = (1 << 31) /* internal, only for building */ } cpioMapFlags; @@ -93,15 +96,13 @@ typedef void (*cpioCallback) (struct cpioCallbackInfo * filespec, void * data); * user. * * @param cfd file handle - * @param mappings archive info for extraction - * @param numMappings number of archive elements + * @param fi transaction element file info * @param cb progress callback * @param cbData progress callback data * @retval failedFile file name (malloc'ed) that caused failure (if any) * @return 0 on success */ -int cpioInstallArchive(FD_t cfd, const void * mappings, - int numMappings, cpioCallback cb, void * cbData, +int cpioInstallArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData, /*@out@*/const char ** failedFile) /*@modifies fileSystem, cfd, *failedFile @*/; @@ -109,29 +110,16 @@ int cpioInstallArchive(FD_t cfd, const void * mappings, * The RPM internal equivalent of the command line "cpio -o". * * @param cfd file handle - * @param mappings archive info for building - * @param numMappings number of archive elements + * @param fi transaction element file info * @param cb progress callback * @param cbData progress callback data * @retval failedFile file name (malloc'ed) that caused failure (if any) * @return 0 on success */ -int cpioBuildArchive(FD_t cfd, const void * mappings, - int numMappings, cpioCallback cb, void * cbData, +int cpioBuildArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData, unsigned int * archiveSize, /*@out@*/const char ** failedFile) /*@modifies fileSystem, cfd, *archiveSize, *failedFile @*/; -#ifdef DYING -/** \ingroup payload - * Compare two cpio file map entries (qsort/bsearch). - * This is designed to be qsort/bsearch compatible. - * @param a 1st map - * @param b 2nd map - * @return result of comparison - */ -int cpioFileMapCmp(const void * a, const void * b) /*@*/; -#endif - /** \ingroup payload * Return formatted error message on payload handling failure. * @param error code diff --git a/lib/depends.h b/lib/depends.h index 2e81e00f8..b9f65993e 100644 --- a/lib/depends.h +++ b/lib/depends.h @@ -137,13 +137,13 @@ struct transactionFileInfo_s { 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) */ + 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) */ + int * odil; /*!< Original Directory indices (from header) */ const char ** fmd5s; /*!< file MD5 sums (from header) */ const char ** flinks; /*!< file links (from header) */ -/* XXX setuid/setgid bits are turned off if fsuer/fgroup doesn't map. */ +/* XXX setuid/setgid bits are turned off if fuser/fgroup doesn't map. */ uint_16 * fmodes; /*!< file modes (from header) */ char * fstates; /*!< file states (from header) */ const char ** fuser; /*!< file owner(s) */ diff --git a/lib/install.c b/lib/install.c index 8d5dc6225..a91648d6a 100644 --- a/lib/install.c +++ b/lib/install.c @@ -9,8 +9,6 @@ #include #include "cpio.h" -#include "depends.h" -#include "install.h" #include "misc.h" #include "debug.h" @@ -28,36 +26,6 @@ typedef struct callbackInfo_s { const void * pkgKey; } * cbInfo; -/** - * Header file info, gathered per-file, rather than per-tag. - */ -typedef struct fileInfo_s { -/*@dependent@*/ const char * dn; /* relative to root */ -/*@dependent@*/ const char * bn; -/*@observer@*/ const char * bnsuffix; -/*@observer@*/ const char * oext; -/*@dependent@*/ const char * md5sum; - uid_t uid; - gid_t gid; - uint_32 flags; - uint_32 size; - mode_t mode; - char state; - enum fileActions action; - int install; -} * XFI_t ; - -/** - * Keeps track of memory allocated while accessing header tags. - */ -typedef struct fileMemory_s { -/*@owned@*/ const char ** dnl; -/*@owned@*/ const char ** bnl; -/*@owned@*/ const char ** cpioNames; -/*@owned@*/ const char ** md5sums; -/*@owned@*/ XFI_t files; -} * fileMemory; - /* XXX add more tags */ /** * Macros to be defined from per-header tag values. @@ -106,30 +74,6 @@ static int rpmInstallLoadMacros(Header h) return 0; } -/** - * Create memory used to access header. - * @return pointer to memory - */ -static /*@only@*/ fileMemory newFileMemory(void) -{ - fileMemory fileMem = xcalloc(sizeof(*fileMem), 1); - return fileMem; -} - -/** - * Destroy memory used to access header. - * @param fileMem pointer to memory - */ -static void freeFileMemory( /*@only@*/ fileMemory fileMem) -{ - 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); -} - /* files should not be preallocated */ /** * Build file information array. @@ -140,47 +84,23 @@ static void freeFileMemory( /*@only@*/ fileMemory fileMem) * @param actions array of file dispositions * @return 0 always */ -static int assembleFileList(TFI_t fi, Header h, - /*@out@*/ fileMemory * memPtr, /*@out@*/ XFI_t * filesPtr) +static int assembleFileList(TFI_t fi, Header h) { - fileMemory mem = newFileMemory(); - XFI_t files; - XFI_t file; int i; - *memPtr = mem; - 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, &fi->apath, NULL); } else { rpmBuildFileList(h, &fi->apath, NULL); } - files = *filesPtr = mem->files = xcalloc(fi->fc, sizeof(*mem->files)); - - 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->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; - + for (i = 0; i < fi->fc; i++) { rpmMessage(RPMMESS_DEBUG, _(" file: %s%s action: %s\n"), - file->dn, file->bn, fileActionString(file->action)); + fi->dnl[fi->dil[i]], fi->bnl[i], + fileActionString((fi->actions ? fi->actions[i] : FA_UNKNOWN)) ); } return 0; @@ -190,11 +110,11 @@ 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 */ -static void setFileOwners(Header h, TFI_t fi, XFI_t files) +static void setFileOwners(Header h, TFI_t fi) { - XFI_t file; + uid_t uid; + gid_t gid; int i; if (fi->fuser == NULL) @@ -204,26 +124,24 @@ static void setFileOwners(Header h, TFI_t fi, XFI_t files) headerGetEntryMinMemory(h, RPMTAG_FILEGROUPNAME, NULL, (const void **) &fi->fgroup, NULL); - for (i = 0, file = files; i < fi->fc; i++, file++) { - if (unameToUid(fi->fuser[i], &file->uid)) { + for (i = 0; i < fi->fc; i++) { + if (unameToUid(fi->fuser[i], &uid)) { rpmMessage(RPMMESS_WARNING, _("user %s does not exist - using root\n"), fi->fuser[i]); - file->uid = 0; - file->mode &= ~S_ISUID; /* turn off the suid bit */ + uid = 0; /* XXX this diddles header memory. */ fi->fmodes[i] &= ~S_ISUID; /* turn off the suid bit */ } - if (gnameToGid(fi->fgroup[i], &file->gid)) { + if (gnameToGid(fi->fgroup[i], &gid)) { rpmMessage(RPMMESS_WARNING, _("group %s does not exist - using root\n"), fi->fgroup[i]); - file->gid = 0; - file->mode &= ~S_ISGID; /* turn off the sgid bit */ + gid = 0; /* 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; + fi->fuids[i] = uid; + fi->fgids[i] = gid; } } @@ -546,9 +464,8 @@ 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 fi transaction element file info (NULL means all files) * @param fd file handle of package (positioned at payload) - * @param files files to install (NULL means "all files") * @param notify callback function * @param notifyData callback private data * @param pkgKey package private data (e.g. file name) @@ -557,21 +474,18 @@ static void callback(struct cpioCallbackInfo * cpioInfo, void * data) * @param archiveSize @todo Document. * @return 0 on success */ -static int installArchive(const rpmTransactionSet ts, TFI_t fi, - FD_t fd, XFI_t files, +static int installArchive(const rpmTransactionSet ts, TFI_t fi, FD_t fd, rpmCallbackFunction notify, rpmCallbackData notifyData, const void * pkgKey, Header h, /*@out@*/ const char ** specFile, int archiveSize) { - const void * cpioMap = NULL; - int cpioMapCnt = 0; const char * failedFile = NULL; cbInfo cbi = alloca(sizeof(*cbi)); char * rpmio_flags; int saveerrno; int rc; - if (files == NULL) { + if (fi == NULL) { /* install all files */ } else if (fi->fc == 0) { /* no files to install */ @@ -587,40 +501,6 @@ 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) * fi->fc); - for (i = 0, mappedFiles = 0, file = files; i < fi->fc; i++, file++) { - if (!file->install) continue; - - map[mappedFiles].archivePath = file->cpioPath; - (void) urlPath(file->dn, &map[mappedFiles].dirName); - map[mappedFiles].baseName = file->bn; - - /* XXX Can't do src rpm MD5 sum verification (yet). */ - /* XXX binary rpms always have RPMTAG_SOURCERPM, source rpms do not */ - map[mappedFiles].md5sum = headerIsEntry(h, RPMTAG_SOURCERPM) - ? file->md5sum : NULL; - map[mappedFiles].finalMode = file->mode; - map[mappedFiles].finalUid = file->uid; - map[mappedFiles].finalGid = file->gid; - map[mappedFiles].mapFlags = CPIO_MAP_PATH | CPIO_MAP_MODE | - CPIO_MAP_UID | CPIO_MAP_GID; - mappedFiles++; - } - cpioMap = map; - cpioMapCnt = mappedFiles; -#else - cpioMap = fi; - cpioMapCnt = fi->fc; -#endif - } - if (notify) (void)notify(h, RPMCALLBACK_INST_PROGRESS, 0, archiveSize, pkgKey, notifyData); @@ -643,7 +523,7 @@ static int installArchive(const rpmTransactionSet ts, TFI_t fi, { FD_t cfd; (void) Fflush(fd); cfd = Fdopen(fdDup(Fileno(fd)), rpmio_flags); - rc = cpioInstallArchive(cfd, cpioMap, cpioMapCnt, + rc = cpioInstallArchive(cfd, fi, ((notify && archiveSize) || specFile) ? callback : NULL, cbi, &failedFile); saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */ @@ -652,8 +532,10 @@ static int installArchive(const rpmTransactionSet ts, TFI_t fi, headerFree(cbi->h); if (rc) { - /* this would probably be a good place to check if disk space - was used up - if so, we should return a different error */ + /* + * This would probably be a good place to check if disk space + * was used up - if so, we should return a different error. + */ errno = saveerrno; /* XXX FIXME: Fclose with libio destroys errno */ rpmError(RPMERR_CPIO, _("unpacking of archive failed%s%s: %s\n"), (failedFile != NULL ? _(" on file ") : ""), @@ -661,11 +543,9 @@ static int installArchive(const rpmTransactionSet ts, TFI_t fi, cpioStrerror(rc)); rc = 1; } else if (notify) { - if (archiveSize) - (void)notify(h, RPMCALLBACK_INST_PROGRESS, archiveSize, archiveSize, - pkgKey, notifyData); - else - (void)notify(h, RPMCALLBACK_INST_PROGRESS, 100, 100, + if (archiveSize == 0) + archiveSize = 100; + (void)notify(h, RPMCALLBACK_INST_PROGRESS, archiveSize, archiveSize, pkgKey, notifyData); rc = 0; } @@ -728,10 +608,8 @@ static int installSources(Header h, const char * rootDir, FD_t fd, const char * _sourcedir = rpmGenPath(rootDir, "%{_sourcedir}", ""); const char * _specdir = rpmGenPath(rootDir, "%{_specdir}", ""); uint_32 * archiveSizePtr = NULL; - fileMemory fileMem = NULL; - XFI_t files = NULL, file; - int i; int rc = 0; + int i; rpmMessage(RPMMESS_DEBUG, _("installing a source package\n")); @@ -760,17 +638,23 @@ static int installSources(Header h, const char * rootDir, FD_t fd, fi->striplen = 0; fi->mapflags = CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID; - assembleFileList(fi, h, &fileMem, &files); + fi->fuids = xcalloc(sizeof(*fi->fuids), fi->fc); + fi->fgids = xcalloc(sizeof(*fi->fgids), fi->fc); + for (i = 0; i < fi->fc; i++) { + fi->fuids[i] = fi->uid; + fi->fgids[i] = fi->gid; + } + + assembleFileList(fi, h); i = fi->fc; - file = files + i; if (headerIsEntry(h, RPMTAG_COOKIE)) - for (i = 0, file = files; i < fi->fc; i++, file++) - if (file->flags & RPMFILE_SPECFILE) break; + for (i = 0; i < fi->fc; i++) + if (fi->fflags[i] & RPMFILE_SPECFILE) break; if (i == fi->fc) { /* find the spec file by name */ - for (i = 0, file = files; i < fi->fc; i++, file++) { + for (i = 0; i < fi->fc; i++) { const char * t = fi->apath[i]; t += strlen(fi->apath[i]) - 5; if (!strcmp(t, ".spec")) break; @@ -778,10 +662,10 @@ static int installSources(Header h, const char * rootDir, FD_t fd, } if (i < fi->fc) { - char *t = alloca(strlen(_specdir) + strlen(fi->apath[i]) + 5); + char *t = xmalloc(strlen(_specdir) + strlen(fi->apath[i]) + 5); (void)stpcpy(stpcpy(t, _specdir), "/"); - file->dn = t; - file->bn = fi->apath[i]; + fi->dnl[fi->dil[i]] = t; + fi->bnl[i] = xstrdup(fi->apath[i]); specFileIndex = i; } else { rpmError(RPMERR_NOSPEC, _("source package contains no .spec file\n")); @@ -798,7 +682,7 @@ static int installSources(Header h, const char * rootDir, FD_t fd, { const char * currDir = currentDirectory(); Chdir(_sourcedir); - rc = installArchive(NULL, NULL, fd, fi->fc > 0 ? files : NULL, + rc = installArchive(NULL, NULL, fd, notify, notifyData, NULL, h, specFileIndex >= 0 ? NULL : &specFile, archiveSizePtr ? *archiveSizePtr : 0); @@ -850,8 +734,8 @@ static int installSources(Header h, const char * rootDir, FD_t fd, *specFilePtr = xstrdup(cSpecFile); } else { if (specFilePtr) { - const char * dn = files[specFileIndex].dn; - const char * bn = files[specFileIndex].bn; + const char * dn = fi->dnl[fi->dil[specFileIndex]]; + const char * bn = fi->bnl[specFileIndex]; char * t = xmalloc(strlen(dn) + strlen(bn) + 1); (void)stpcpy( stpcpy(t, dn), bn); *specFilePtr = t; @@ -864,7 +748,6 @@ exit: freeFi(fi); free(fi); } - if (fileMem) freeFileMemory(fileMem); if (_specdir) free((void *)_specdir); if (_sourcedir) free((void *)_sourcedir); return rc; @@ -909,16 +792,16 @@ int rpmVersionCompare(Header first, Header second) /*@obserever@*/ const char *const fileActionString(enum fileActions a) { switch (a) { - case FA_UNKNOWN: return "unknown"; - case FA_CREATE: return "create"; - case FA_BACKUP: return "backup"; - case FA_SAVE: return "save"; - case FA_SKIP: return "skip"; - case FA_ALTNAME: return "altname"; - case FA_REMOVE: return "remove"; - case FA_SKIPNSTATE: return "skipnstate"; - case FA_SKIPNETSHARED: return "skipnetshared"; - case FA_SKIPMULTILIB: return "skipmultilib"; + case FA_UNKNOWN: return "unknown"; + case FA_CREATE: return "create"; + case FA_BACKUP: return "backup"; + case FA_SAVE: return "save"; + case FA_SKIP: return "skip"; + case FA_ALTNAME: return "altname"; + case FA_REMOVE: return "remove"; + case FA_SKIPNSTATE: return "skipnstate"; + case FA_SKIPNETSHARED: return "skipnetshared"; + case FA_SKIPMULTILIB: return "skipmultilib"; } /*@notreached@*/ return "???"; @@ -962,11 +845,10 @@ int installBinaryPackage(const rpmTransactionSet ts, Header h, TFI_t fi) { rpmtransFlags transFlags = ts->transFlags; struct availablePackage * alp = fi->ap; - XFI_t files = NULL; + char * fstates = alloca(sizeof(*fstates) * fi->fc); Header oldH = NULL; int otherOffset = 0; int scriptArg; - fileMemory fileMem = NULL; int ec = 2; /* assume error return */ int rc; int i; @@ -996,6 +878,8 @@ int installBinaryPackage(const rpmTransactionSet ts, Header h, TFI_t fi) rpmdbFreeIterator(mi); } + memset(fstates, RPMFILE_STATE_NORMAL, fi->fc); + if (!(transFlags & RPMTRANS_FLAG_JUSTDB) && fi->fc > 0) { const char * p; @@ -1008,10 +892,8 @@ int installBinaryPackage(const rpmTransactionSet ts, Header h, TFI_t fi) 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)) + if (assembleFileList(fi, h)) goto exit; - } else { - files = NULL; } if (transFlags & RPMTRANS_FLAG_TEST) { @@ -1024,7 +906,6 @@ int installBinaryPackage(const rpmTransactionSet ts, Header h, TFI_t fi) rc = runInstScript(ts, h, RPMTAG_PREIN, RPMTAG_PREINPROG, scriptArg, transFlags & RPMTRANS_FLAG_NOSCRIPTS); - if (rc) { rpmError(RPMERR_SCRIPT, _("skipping %s-%s-%s install, %%pre scriptlet failed rc %d\n"), @@ -1043,34 +924,40 @@ int installBinaryPackage(const rpmTransactionSet ts, Header h, TFI_t fi) ts->chrootDone = 1; } - if (files) { - XFI_t file; + if (!(transFlags & RPMTRANS_FLAG_JUSTDB) && fi->fc > 0) { + if (fi->fuids == NULL) + fi->fuids = xcalloc(sizeof(*fi->fuids), fi->fc); + if (fi->fgids == NULL) + fi->fgids = xcalloc(sizeof(*fi->fgids), fi->fc); + + setFileOwners(h, fi); - setFileOwners(h, fi, files); + if (fi->actions) { + char * opath = alloca(fi->dnlmax + fi->bnlmax + 64); + char * npath = alloca(fi->dnlmax + fi->bnlmax + 64); - for (i = 0, file = files; i < fi->fc; i++, file++) { - char opath[BUFSIZ]; - char * npath; - char * ext; + for (i = 0; i < fi->fc; i++) { + char * ext, * t; - file->bnsuffix = file->oext = ext = NULL; + ext = NULL; - switch (file->action) { + switch (fi->actions[i]) { case FA_BACKUP: - file->oext = ext = ".rpmorig"; + ext = ".rpmorig"; break; case FA_ALTNAME: - file->bnsuffix = ".rpmnew"; - npath = alloca(strlen(file->bn) + strlen(file->bnsuffix) + 1); - (void)stpcpy(stpcpy(npath, file->bn), file->bnsuffix); + ext = ".rpmnew"; + t = xmalloc(strlen(fi->bnl[i]) + strlen(ext) + 1); + (void)stpcpy(stpcpy(t, fi->bnl[i]), ext); rpmMessage(RPMMESS_WARNING, _("%s%s created as %s\n"), - file->dn, file->bn, npath); - file->bn = npath; + fi->dnl[fi->dil[i]], fi->bnl[i], t); + fi->bnl[i] = t; /* XXX memory leak iff i = 0 */ + ext = NULL; break; case FA_SAVE: - file->oext = ext = ".rpmsave"; + ext = ".rpmsave"; break; case FA_CREATE: @@ -1078,33 +965,27 @@ int installBinaryPackage(const rpmTransactionSet ts, Header h, TFI_t fi) case FA_SKIP: case FA_SKIPMULTILIB: - file->install = 0; break; case FA_SKIPNSTATE: - file->state = RPMFILE_STATE_NOTINSTALLED; - file->install = 0; + fstates[i] = RPMFILE_STATE_NOTINSTALLED; break; case FA_SKIPNETSHARED: - file->state = RPMFILE_STATE_NETSHARED; - file->install = 0; + fstates[i] = RPMFILE_STATE_NETSHARED; break; case FA_UNKNOWN: case FA_REMOVE: - file->install = 0; break; } if (ext == NULL) continue; - (void)stpcpy(stpcpy(opath, file->dn), file->bn); + (void) stpcpy( stpcpy(opath, fi->dnl[fi->dil[i]]), fi->bnl[i]); if (access(opath, F_OK) != 0) continue; - npath = alloca(strlen(file->dn) + strlen(file->bn) - + strlen(ext) + 1); - (void)stpcpy(stpcpy(npath, opath), ext); + (void) stpcpy( stpcpy(npath, opath), ext); rpmMessage(RPMMESS_WARNING, _("%s saved as %s\n"), opath, npath); if (!rename(opath, npath)) @@ -1114,6 +995,7 @@ int installBinaryPackage(const rpmTransactionSet ts, Header h, TFI_t fi) opath, npath, strerror(errno)); goto exit; } + } { uint_32 archiveSize, * asp; @@ -1127,25 +1009,16 @@ 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, + rc = installArchive(ts, fi, alp->fd, ts->notify, ts->notifyData, alp->key, h, NULL, archiveSize); if (rc) goto exit; } - { 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, - fi->fc); - } + headerAddEntry(h, RPMTAG_FILESTATES, RPM_CHAR_TYPE, fstates, fi->fc); - if (fileMem) freeFileMemory(fileMem); - fileMem = NULL; } 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); } @@ -1217,8 +1090,6 @@ exit: chdir(ts->currDir); ts->chrootDone = 0; } - if (fileMem) - freeFileMemory(fileMem); if (oldH) headerFree(oldH); return ec; diff --git a/lib/rpminstall.c b/lib/rpminstall.c index 1cac761e0..26f84b91e 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -71,6 +71,8 @@ static void printHash(const unsigned long amount, const unsigned long total) } } +/** + */ static void * showProgress(const void * arg, const rpmCallbackType what, const unsigned long amount, const unsigned long total, @@ -186,7 +188,7 @@ int rpmInstall(const char * rootdir, const char ** fileArgv, int numFailed = 0; Header h; int isSource; - rpmTransactionSet rpmdep = NULL; + rpmTransactionSet ts = NULL; int numConflicts; int stopInstall = 0; int notifyFlags = interfaceFlags | (rpmIsVerbose() ? INSTALL_LABEL : 0 ); @@ -334,7 +336,7 @@ int rpmInstall(const char * rootdir, const char ** fileArgv, pkgURL[i] = NULL; break; } - rpmdep = rpmtransCreateSet(db, rootdir); + ts = rpmtransCreateSet(db, rootdir); dbIsOpen = 1; } @@ -383,7 +385,7 @@ int rpmInstall(const char * rootdir, const char ** fileArgv, /* Package is newer than those currently installed. */ } - rc = rpmtransAddPackage(rpmdep, h, NULL, fileName, + rc = rpmtransAddPackage(ts, h, NULL, fileName, (interfaceFlags & INSTALL_UPGRADE) != 0, relocations); @@ -422,7 +424,7 @@ int rpmInstall(const char * rootdir, const char ** fileArgv, if (numRPMS && !(interfaceFlags & INSTALL_NODEPS)) { struct rpmDependencyConflict * conflicts; - if (rpmdepCheck(rpmdep, &conflicts, &numConflicts)) { + if (rpmdepCheck(ts, &conflicts, &numConflicts)) { numFailed = numPkgs; stopInstall = 1; } @@ -437,7 +439,7 @@ int rpmInstall(const char * rootdir, const char ** fileArgv, } if (numRPMS && !(interfaceFlags & INSTALL_NOORDER)) { - if (rpmdepOrder(rpmdep)) { + if (rpmdepOrder(ts)) { numFailed = numPkgs; stopInstall = 1; } @@ -450,7 +452,7 @@ int rpmInstall(const char * rootdir, const char ** fileArgv, packagesTotal = numRPMS; #endif rpmMessage(RPMMESS_DEBUG, _("installing binary packages\n")); - rc = rpmRunTransactions(rpmdep, showProgress, (void *) ((long)notifyFlags), + rc = rpmRunTransactions(ts, showProgress, (void *) ((long)notifyFlags), NULL, &probs, transFlags, probFilter); if (rc < 0) { @@ -463,7 +465,7 @@ int rpmInstall(const char * rootdir, const char ** fileArgv, if (probs) rpmProblemSetFree(probs); } - if (numRPMS) rpmtransFree(rpmdep); + if (numRPMS) rpmtransFree(ts); if (numSRPMS && !stopInstall) { for (i = 0; i < numSRPMS; i++) { @@ -517,7 +519,7 @@ int rpmErase(const char * rootdir, const char ** argv, int count; const char ** arg; int numFailed = 0; - rpmTransactionSet rpmdep; + rpmTransactionSet ts; struct rpmDependencyConflict * conflicts; int numConflicts; int stopUninstall = 0; @@ -537,7 +539,7 @@ int rpmErase(const char * rootdir, const char ** argv, return -1; } - rpmdep = rpmtransCreateSet(db, rootdir); + ts = rpmtransCreateSet(db, rootdir); for (arg = argv; *arg; arg++) { rpmdbMatchIterator mi; @@ -556,7 +558,7 @@ int rpmErase(const char * rootdir, const char ** argv, while ((h = rpmdbNextIterator(mi)) != NULL) { unsigned int recOffset = rpmdbGetIteratorOffset(mi); if (recOffset) { - rpmtransRemovePackage(rpmdep, recOffset); + rpmtransRemovePackage(ts, recOffset); numPackages++; } } @@ -565,7 +567,7 @@ int rpmErase(const char * rootdir, const char ** argv, } if (!(interfaceFlags & UNINSTALL_NODEPS)) { - if (rpmdepCheck(rpmdep, &conflicts, &numConflicts)) { + if (rpmdepCheck(ts, &conflicts, &numConflicts)) { numFailed = numPackages; stopUninstall = 1; } @@ -581,11 +583,11 @@ int rpmErase(const char * rootdir, const char ** argv, } if (!stopUninstall) { - numFailed += rpmRunTransactions(rpmdep, NULL, NULL, NULL, &probs, + numFailed += rpmRunTransactions(ts, NULL, NULL, NULL, &probs, transFlags, 0); } - rpmtransFree(rpmdep); + rpmtransFree(ts); rpmdbClose(db); return numFailed; diff --git a/po/rpm.pot b/po/rpm.pot index d6d91fa2a..75255930b 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-23 17:58-0500\n" +"POT-Creation-Date: 2001-01-24 10:48-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1618,92 +1618,92 @@ msgstr "" msgid "Can't mix special %%doc with other forms: %s\n" msgstr "" -#: build/files.c:949 +#: build/files.c:952 #, c-format msgid "File listed twice: %s\n" msgstr "" -#: build/files.c:1033 +#: build/files.c:1042 #, c-format msgid "Symlink points to BuildRoot: %s -> %s\n" msgstr "" -#: build/files.c:1230 +#: build/files.c:1225 #, c-format msgid "File doesn't match prefix (%s): %s\n" msgstr "" -#: build/files.c:1240 +#: build/files.c:1235 #, c-format msgid "File not found: %s\n" msgstr "" -#: build/files.c:1283 build/files.c:1807 build/parsePrep.c:42 +#: build/files.c:1278 build/files.c:1799 build/parsePrep.c:42 #, c-format msgid "Bad owner/group: %s\n" msgstr "" -#: build/files.c:1295 +#: build/files.c:1290 #, c-format msgid "File %4d: %07o %s.%s\t %s\n" msgstr "" -#: build/files.c:1372 +#: build/files.c:1367 #, c-format msgid "File needs leading \"/\": %s\n" msgstr "" -#: build/files.c:1402 +#: build/files.c:1397 #, c-format msgid "File not found by glob: %s\n" msgstr "" -#: build/files.c:1457 +#: build/files.c:1451 msgid "Could not open %%files file %s: %s\n" msgstr "" -#: build/files.c:1466 build/pack.c:108 +#: build/files.c:1460 build/pack.c:108 #, c-format msgid "line: %s\n" msgstr "" -#: build/files.c:1795 +#: build/files.c:1787 #, c-format msgid "Bad file: %s: %s\n" msgstr "" #. XXX this error message is probably not seen. -#: build/files.c:1864 +#: build/files.c:1855 #, c-format msgid "Couldn't exec %s: %s\n" msgstr "" -#: build/files.c:1869 +#: build/files.c:1860 #, c-format msgid "Couldn't fork %s: %s\n" msgstr "" -#: build/files.c:1951 +#: build/files.c:1942 #, c-format msgid "%s failed\n" msgstr "" -#: build/files.c:1955 +#: build/files.c:1946 #, c-format msgid "failed to write all data to %s\n" msgstr "" -#: build/files.c:2083 +#: build/files.c:2073 #, c-format msgid "Finding %s: (using %s)...\n" msgstr "" -#: build/files.c:2111 build/files.c:2125 +#: build/files.c:2101 build/files.c:2115 #, c-format msgid "Failed to find %s:\n" msgstr "" -#: build/files.c:2238 +#: build/files.c:2228 #, c-format msgid "Processing files: %s-%s-%s\n" msgstr "" @@ -2170,75 +2170,70 @@ msgstr "" msgid "Package has no %%description: %s\n" msgstr "" -#: build/spec.c:42 -#, c-format -msgid "archive = %s, fs = %s%s\n" -msgstr "" - -#: build/spec.c:238 +#: build/spec.c:216 #, c-format msgid "line %d: Bad number: %s\n" msgstr "" -#: build/spec.c:244 +#: build/spec.c:222 #, c-format msgid "line %d: Bad no%s number: %d\n" msgstr "" -#: build/spec.c:302 +#: build/spec.c:280 #, c-format msgid "line %d: Bad %s number: %s\n" msgstr "" -#: lib/cpio.c:581 +#: lib/cpio.c:595 #, c-format msgid "can't rename %s to %s: %s\n" msgstr "" -#: lib/cpio.c:587 +#: lib/cpio.c:601 #, c-format msgid "can't unlink %s: %s\n" msgstr "" -#: lib/cpio.c:894 +#: lib/cpio.c:907 #, c-format msgid "getNextHeader: %s\n" msgstr "" -#: lib/cpio.c:1404 +#: lib/cpio.c:1416 #, c-format msgid "(error 0x%x)" msgstr "" -#: lib/cpio.c:1407 +#: lib/cpio.c:1419 msgid "Bad magic" msgstr "" -#: lib/cpio.c:1408 +#: lib/cpio.c:1420 msgid "Bad/unreadable header" msgstr "" -#: lib/cpio.c:1426 +#: lib/cpio.c:1438 msgid "Header size too big" msgstr "" -#: lib/cpio.c:1427 +#: lib/cpio.c:1439 msgid "Unknown file type" msgstr "" -#: lib/cpio.c:1428 +#: lib/cpio.c:1440 msgid "Missing hard link" msgstr "" -#: lib/cpio.c:1429 +#: lib/cpio.c:1441 msgid "MD5 sum mismatch" msgstr "" -#: lib/cpio.c:1430 +#: lib/cpio.c:1442 msgid "Internal error" msgstr "" -#: lib/cpio.c:1439 +#: lib/cpio.c:1451 msgid " failed - " msgstr "" @@ -2517,7 +2512,7 @@ msgstr "" msgid "dataLength() RPM_STRING_TYPE count must be 1.\n" msgstr "" -#: lib/header.c:207 lib/header.c:1015 lib/install.c:361 +#: lib/header.c:207 lib/header.c:1015 lib/install.c:279 #, c-format msgid "Data type %d not supported\n" msgstr "" @@ -2602,93 +2597,95 @@ msgstr "" msgid "(unknown type)" msgstr "" -#: lib/install.c:182 +#: lib/install.c:101 #, c-format msgid " file: %s%s action: %s\n" msgstr "" -#: lib/install.c:210 +#: lib/install.c:130 #, c-format msgid "user %s does not exist - using root\n" msgstr "" -#: lib/install.c:219 +#: lib/install.c:138 #, c-format msgid "group %s does not exist - using root\n" msgstr "" -#. this would probably be a good place to check if disk space -#. was used up - if so, we should return a different error +#. +#. * 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:658 +#: lib/install.c:540 #, c-format msgid "unpacking of archive failed%s%s: %s\n" msgstr "" -#: lib/install.c:659 +#: lib/install.c:541 msgid " on file " msgstr "" -#: lib/install.c:701 +#: lib/install.c:581 #, c-format msgid "cannot create %s %s\n" msgstr "" -#: lib/install.c:707 +#: lib/install.c:587 #, c-format msgid "cannot write to %s\n" msgstr "" -#: lib/install.c:736 +#: lib/install.c:614 msgid "installing a source package\n" msgstr "" -#: lib/install.c:787 lib/install.c:820 +#: lib/install.c:671 lib/install.c:704 msgid "source package contains no .spec file\n" msgstr "" -#: lib/install.c:840 +#: lib/install.c:724 #, c-format msgid "renaming %s to %s\n" msgstr "" -#: lib/install.c:842 lib/install.c:1113 lib/uninstall.c:43 +#: lib/install.c:726 lib/install.c:994 lib/uninstall.c:43 #, c-format msgid "rename of %s to %s failed: %s\n" msgstr "" -#: lib/install.c:940 +#: lib/install.c:823 msgid "source package expected, binary found\n" msgstr "" -#: lib/install.c:978 +#: lib/install.c:860 #, c-format msgid "package: %s-%s-%s has %d files test = %d\n" msgstr "" -#: lib/install.c:1018 +#: lib/install.c:900 msgid "stopping install as we're running --test\n" msgstr "" -#: lib/install.c:1023 +#: lib/install.c:905 msgid "running preinstall script (if any)\n" msgstr "" -#: lib/install.c:1030 +#: lib/install.c:911 msgid "skipping %s-%s-%s install, %%pre scriptlet failed rc %d\n" msgstr "" -#: lib/install.c:1067 +#: lib/install.c:953 #, c-format msgid "%s%s created as %s\n" msgstr "" -#: lib/install.c:1108 +#: lib/install.c:989 #, c-format msgid "%s saved as %s\n" msgstr "" -#: lib/install.c:1190 +#: lib/install.c:1063 msgid "running postinstall scripts (if any)\n" msgstr "" @@ -3024,7 +3021,7 @@ msgstr "" msgid "old format source packages cannot be queried\n" msgstr "" -#: lib/query.c:563 lib/rpminstall.c:312 +#: lib/query.c:563 lib/rpminstall.c:314 #, c-format msgid "%s does not appear to be a RPM package\n" msgstr "" @@ -3088,7 +3085,7 @@ msgstr "" msgid "record %d could not be read\n" msgstr "" -#: lib/query.c:746 lib/rpminstall.c:548 +#: lib/query.c:746 lib/rpminstall.c:550 #, c-format msgid "package %s is not installed\n" msgstr "" @@ -3324,117 +3321,117 @@ msgstr "" msgid "failed to remove directory %s: %s\n" msgstr "" -#: lib/rpminstall.c:142 +#: lib/rpminstall.c:144 msgid "Preparing..." msgstr "" -#: lib/rpminstall.c:145 +#: lib/rpminstall.c:147 msgid "Preparing packages for installation..." msgstr "" -#: lib/rpminstall.c:206 +#: lib/rpminstall.c:208 msgid "counting packages to install\n" msgstr "" -#: lib/rpminstall.c:210 +#: lib/rpminstall.c:212 #, c-format msgid "found %d packages\n" msgstr "" -#: lib/rpminstall.c:215 +#: lib/rpminstall.c:217 msgid "looking for packages to download\n" msgstr "" -#: lib/rpminstall.c:230 +#: lib/rpminstall.c:232 #, c-format msgid "skipping %s - rpmGlob failed(%d)\n" msgstr "" -#: lib/rpminstall.c:245 +#: lib/rpminstall.c:247 #, c-format msgid "Retrieving %s\n" msgstr "" #. XXX undefined %{name}/%{version}/%{release} here #. XXX %{_tmpdir} does not exist -#: lib/rpminstall.c:255 +#: lib/rpminstall.c:257 #, c-format msgid " ... as %s\n" msgstr "" -#: lib/rpminstall.c:259 +#: lib/rpminstall.c:261 #, c-format msgid "skipping %s - transfer failed - %s\n" msgstr "" -#: lib/rpminstall.c:286 +#: lib/rpminstall.c:288 #, c-format msgid "retrieved %d packages\n" msgstr "" -#: lib/rpminstall.c:298 lib/rpminstall.c:472 +#: lib/rpminstall.c:300 lib/rpminstall.c:474 #, c-format msgid "cannot open file %s: %s\n" msgstr "" -#: lib/rpminstall.c:316 lib/rpminstall.c:613 +#: lib/rpminstall.c:318 lib/rpminstall.c:615 #, c-format msgid "%s cannot be installed\n" msgstr "" -#: lib/rpminstall.c:331 +#: lib/rpminstall.c:333 #, c-format msgid "cannot open Packages database in %s\n" msgstr "" -#: lib/rpminstall.c:353 +#: lib/rpminstall.c:355 #, c-format msgid "package %s is not relocateable\n" msgstr "" -#: lib/rpminstall.c:398 +#: lib/rpminstall.c:400 #, c-format msgid "error reading from file %s\n" msgstr "" -#: lib/rpminstall.c:403 +#: lib/rpminstall.c:405 #, c-format msgid "file %s requires a newer version of RPM\n" msgstr "" -#: lib/rpminstall.c:420 +#: lib/rpminstall.c:422 #, c-format msgid "found %d source and %d binary packages\n" msgstr "" -#: lib/rpminstall.c:431 +#: lib/rpminstall.c:433 msgid "failed dependencies:\n" msgstr "" -#: lib/rpminstall.c:452 +#: lib/rpminstall.c:454 msgid "installing binary packages\n" msgstr "" -#: lib/rpminstall.c:535 +#: lib/rpminstall.c:537 #, c-format msgid "cannot open %s/packages.rpm\n" msgstr "" -#: lib/rpminstall.c:551 +#: lib/rpminstall.c:553 #, c-format msgid "\"%s\" specifies multiple packages\n" msgstr "" -#: lib/rpminstall.c:574 +#: lib/rpminstall.c:576 msgid "removing these packages would break dependencies:\n" msgstr "" -#: lib/rpminstall.c:602 +#: lib/rpminstall.c:604 #, c-format msgid "cannot open %s: %s\n" msgstr "" -#: lib/rpminstall.c:608 +#: lib/rpminstall.c:610 #, c-format msgid "Installing %s\n" msgstr "" -- cgit v1.2.3