Start deconstructing TFI_t in favor of a per-transactionElement rpmFNSet.
authorjbj <devnull@localhost>
Fri, 9 Nov 2001 19:22:29 +0000 (19:22 +0000)
committerjbj <devnull@localhost>
Fri, 9 Nov 2001 19:22:29 +0000 (19:22 +0000)
CVS patchset: 5164
CVS date: 2001/11/09 19:22:29

lib/rpmal.c
lib/rpmds.c
lib/rpmds.h
po/rpm.pot

index 4dc7e0a..99b047b 100644 (file)
@@ -199,7 +199,7 @@ int alGetFilesCount(const availableList al, alKey pkgKey)
     int_32 filesCount = 0;
     if (alp != NULL)
        if (alp->fns != NULL)
-           filesCount = alp->fns->Count;
+           filesCount = alp->fns->fc;
     return filesCount;
 }
 #endif
@@ -369,7 +369,7 @@ fprintf(stderr, "*** del %p[%d] %s-%s-%s\n", al->list, pkgNum, alp->name, alp->v
 
     /* Delete directory/file info entries from added package list. */
     if ((fns = alp->fns) != NULL)
-    if (fns->BN != NULL && fns->Count > 0) {
+    if (fns->bnl != NULL && fns->fc > 0) {
        int origNumDirs = al->numDirs;
        int dirNum;
        dirInfo dieNeedle =
@@ -381,12 +381,12 @@ fprintf(stderr, "*** del %p[%d] %s-%s-%s\n", al->list, pkgNum, alp->name, alp->v
        /* XXX FIXME: We ought to relocate the directory list here */
 
        if (al->dirs != NULL)
-       if (fns->DN != NULL)
-       for (dirNum = fns->DCount - 1; dirNum >= 0; dirNum--) {
+       if (fns->dnl != NULL)
+       for (dirNum = fns->dc - 1; dirNum >= 0; dirNum--) {
            fileIndexEntry fie;
 
            /*@-assignexpose@*/
-           dieNeedle->dirName = (char *) fns->DN[dirNum];
+           dieNeedle->dirName = (char *) fns->dnl[dirNum];
            /*@=assignexpose@*/
            dieNeedle->dirNameLen = strlen(dieNeedle->dirName);
            die = bsearch(dieNeedle, al->dirs, al->numDirs,
@@ -510,7 +510,7 @@ fprintf(stderr, "*** add %p[%d] %s-%s-%s\n", al->list, pkgNum, alp->name, alp->v
 
     alp->fns = fns = fnsNew(h, RPMTAG_BASENAMES, scareMem);
 
-    if (fns && fns->Count > 0) {
+    if (fns && fns->fc > 0) {
        int * dirMapping;
        dirInfo dieNeedle =
                memset(alloca(sizeof(*dieNeedle)), 0, sizeof(*dieNeedle));
@@ -520,20 +520,20 @@ fprintf(stderr, "*** add %p[%d] %s-%s-%s\n", al->list, pkgNum, alp->name, alp->v
 
        /* XXX FIXME: We ought to relocate the directory list here */
 
-       dirMapping = alloca(sizeof(*dirMapping) * fns->DCount);
+       dirMapping = alloca(sizeof(*dirMapping) * fns->dc);
 
        /* allocated enough space for all the directories we could possible
           need to add */
        al->dirs = xrealloc(al->dirs,
-                       (al->numDirs + fns->DCount) * sizeof(*al->dirs));
+                       (al->numDirs + fns->dc) * sizeof(*al->dirs));
        origNumDirs = al->numDirs;
 
-       if (fns->DN != NULL)
-       for (dirNum = 0; dirNum < fns->DCount; dirNum++) {
+       if (fns->dnl != NULL)
+       for (dirNum = 0; dirNum < fns->dc; dirNum++) {
            /*@-assignexpose@*/
-           dieNeedle->dirName = (char *) fns->DN[dirNum];
+           dieNeedle->dirName = (char *) fns->dnl[dirNum];
            /*@=assignexpose@*/
-           dieNeedle->dirNameLen = strlen(fns->DN[dirNum]);
+           dieNeedle->dirNameLen = strlen(fns->dnl[dirNum]);
            die = bsearch(dieNeedle, al->dirs, origNumDirs,
                               sizeof(*dieNeedle), dieCompare);
            if (die) {
@@ -541,7 +541,7 @@ fprintf(stderr, "*** add %p[%d] %s-%s-%s\n", al->list, pkgNum, alp->name, alp->v
            } else {
                dirMapping[dirNum] = al->numDirs;
                die = al->dirs + al->numDirs;
-               die->dirName = xstrdup(fns->DN[dirNum]);
+               die->dirName = xstrdup(fns->dnl[dirNum]);
                die->dirNameLen = strlen(die->dirName);
                die->files = NULL;
                die->numFiles = 0;
@@ -550,34 +550,34 @@ fprintf(stderr, "*** add %p[%d] %s-%s-%s\n", al->list, pkgNum, alp->name, alp->v
        }
 
        last = 0;
-       for (first = 0; first < fns->Count; first = last + 1) {
+       for (first = 0; first < fns->fc; first = last + 1) {
            fileIndexEntry fie;
 
-           if (fns->DI == NULL)        /* XXX can't happen */
+           if (fns->dil == NULL)       /* XXX can't happen */
                continue;
 
-           for (last = first; (last + 1) < fns->Count; last++) {
-               if (fns->DI[first] != fns->DI[last + 1])
+           for (last = first; (last + 1) < fns->fc; last++) {
+               if (fns->dil[first] != fns->dil[last + 1])
                    /*@innerbreak@*/ break;
            }
 
-           die = al->dirs + dirMapping[fns->DI[first]];
+           die = al->dirs + dirMapping[fns->dil[first]];
            die->files = xrealloc(die->files,
                    (die->numFiles + last - first + 1) *
                        sizeof(*die->files));
 
            fie = die->files + die->numFiles;
            for (fns->i = first; fns->i <= last; fns->i++) {
-               if (fns->BN == NULL)    /* XXX can't happen */
+               if (fns->bnl == NULL)   /* XXX can't happen */
                    /*@innercontinue@*/ continue;
-               if (fns->Flags == NULL) /* XXX can't happen */
+               if (fns->fflags == NULL)        /* XXX can't happen */
                    /*@innercontinue@*/ continue;
                /*@-assignexpose@*/
-               fie->baseName = fns->BN[fns->i];
-               fie->baseNameLen = strlen(fns->BN[fns->i]);
+               fie->baseName = fns->bnl[fns->i];
+               fie->baseNameLen = strlen(fns->bnl[fns->i]);
                /*@=assignexpose@*/
                fie->pkgNum = pkgNum;
-               fie->fileFlags = fns->Flags[fns->i];
+               fie->fileFlags = fns->fflags[fns->i];
                die->numFiles++;
                fie++;
            }
index 667e088..e57826a 100644 (file)
@@ -44,20 +44,32 @@ rpmFNSet fnsFree(rpmFNSet fns)
 
 /*@-modfilesystem@*/
 if (_fns_debug)
-fprintf(stderr, "*** fns %p -- %s[%d]\n", fns, fns->Type, fns->Count);
+fprintf(stderr, "*** fns %p -- %s[%d]\n", fns, fns->Type, fns->fc);
 /*@=modfilesystem@*/
 
     /*@-branchstate@*/
-    if (fns->Count > 0) {
-       fns->DN = hfd(fns->DN, fns->DNt);
-       fns->BN = hfd(fns->BN, fns->BNt);
+    if (fns->fc > 0) {
+       fns->bnl = hfd(fns->bnl, -1);
+       fns->dnl = hfd(fns->dnl, -1);
+
+       fns->flinks = hfd(fns->flinks, -1);
+       fns->flangs = hfd(fns->flangs, -1);
+       fns->fmd5s = hfd(fns->fmd5s, -1);
+
+       fns->fstates = _free(fns->fstates);
+
        /*@-evalorder@*/
-       fns->DI =
-               (fns->h != NULL ? hfd(fns->DI, fns->DIt) : _free(fns->DI));
-       fns->Flags =
-               (fns->h != NULL ? hfd(fns->Flags, fns->Ft) : _free(fns->Flags));
+       if (fns->h != NULL) {
+           fns->h = headerFree(fns->h, "fnsFree");
+       } else {
+           fns->fmtimes = _free(fns->fmtimes);
+           fns->fmodes = _free(fns->fmodes);
+           fns->fflags = _free(fns->fflags);
+           fns->fsizes = _free(fns->fsizes);
+           fns->frdevs = _free(fns->frdevs);
+           fns->dil = _free(fns->dil);
+       }
        /*@=evalorder@*/
-       fns->h = headerFree(fns->h, "fnsFree");
     }
     /*@=branchstate@*/
 
@@ -66,6 +78,11 @@ fprintf(stderr, "*** fns %p -- %s[%d]\n", fns, fns->Type, fns->Count);
     return NULL;
 }
 
+#define        _fdupe(_fns, _data)     \
+    if ((_fns)->_data != NULL) \
+       (_fns)->_data = memcpy(xmalloc((_fns)->fc * sizeof(*(_fns)->_data)), \
+                       (_fns)->_data, (_fns)->fc * sizeof(*(_fns)->_data))
+
 rpmFNSet fnsNew(Header h, rpmTag tagN, int scareMem)
 {
     HGE_t hge =
@@ -75,52 +92,64 @@ rpmFNSet fnsNew(Header h, rpmTag tagN, int scareMem)
     const char ** N;
     rpmTagType Nt;
     int_32 Count;
-    rpmTag tagBN, tagDI, tagF, tagDN;
 
     if (tagN == RPMTAG_BASENAMES) {
        Type = "Files";
-       tagBN = tagN;
-       tagDI = RPMTAG_DIRINDEXES;
-       tagF = RPMTAG_FILEFLAGS;
-       tagDN = RPMTAG_DIRNAMES;
     } else
        goto exit;
 
     /*@-branchstate@*/
-    if (hge(h, tagBN, &Nt, (void **) &N, &Count)
+    if (hge(h, tagN, &Nt, (void **) &N, &Count)
      && N != NULL && Count > 0)
     {
        int xx;
 
        fns = xcalloc(1, sizeof(*fns));
-       fns->h = (scareMem ? headerLink(h, "fnsNew") : NULL);
+       fns->h = headerLink(h, "fnsNew");
        fns->i = -1;
        fns->Type = Type;
        fns->tagN = tagN;
-       fns->BN = N;
-       fns->BNt = Nt;
-       fns->Count = Count;
-
-       xx = hge(h, tagDN, &fns->DNt, (void **) &fns->DN, &fns->DCount);
-       xx = hge(h, tagDI, &fns->DIt, (void **) &fns->DI, NULL);
-       if (!scareMem && fns->DI != NULL)
-           fns->DI = memcpy(xmalloc(fns->Count * sizeof(*fns->DI)),
-                                fns->DI, fns->Count * sizeof(*fns->DI));
-       xx = hge(h, tagF, &fns->Ft, (void **) &fns->Flags, NULL);
-       if (!scareMem && fns->Flags != NULL)
-           fns->Flags = memcpy(xmalloc(fns->Count * sizeof(*fns->Flags)),
-                                fns->Flags, fns->Count * sizeof(*fns->Flags));
+       fns->bnl = N;
+       fns->fc = Count;
+
+       xx = hge(h, RPMTAG_DIRNAMES, NULL, (void **) &fns->dnl, &fns->dc);
+
+       xx = hge(h, RPMTAG_FILELINKTOS, NULL, (void **) &fns->flinks, NULL);
+       xx = hge(h, RPMTAG_FILELANGS, NULL, (void **) &fns->flangs, NULL);
+       xx = hge(h, RPMTAG_FILEMD5S, NULL, (void **) &fns->fmd5s, NULL);
+
+       xx = hge(h, RPMTAG_FILEMTIMES, NULL, (void **) &fns->fmtimes, NULL);
+       xx = hge(h, RPMTAG_FILEMODES, NULL, (void **) &fns->fmodes, NULL);
+       xx = hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fns->fflags, NULL);
+       xx = hge(h, RPMTAG_FILESIZES, NULL, (void **) &fns->fsizes, NULL);
+       xx = hge(h, RPMTAG_FILERDEVS, NULL, (void **) &fns->frdevs, NULL);
+       xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fns->dil, NULL);
+
+       xx = hge(h, RPMTAG_FILESTATES, NULL, (void **) &fns->fstates, NULL);
+       _fdupe(fns, fstates);
+       if (xx == 0 || fns->fstates == NULL)
+           fns->fstates = xcalloc(fns->fc, sizeof(*fns->fstates));
+
+       if (!scareMem) {
+           _fdupe(fns, fmtimes);
+           _fdupe(fns, fmodes);
+           _fdupe(fns, fflags);
+           _fdupe(fns, fsizes);
+           _fdupe(fns, frdevs);
+           _fdupe(fns, dil);
+           fns->h = headerFree(fns->h, "fnsNew");
+       }
 
 /*@-modfilesystem@*/
 if (_fns_debug)
-fprintf(stderr, "*** fns %p ++ %s[%d]\n", fns, fns->Type, fns->Count);
+fprintf(stderr, "*** fns %p ++ %s[%d]\n", fns, fns->Type, fns->fc);
 /*@=modfilesystem@*/
 
     }
     /*@-branchstate@*/
 
 exit:
-    /*@-nullret@*/ /* FIX: fns->{DI,Flags} may be NULL. */
+    /*@-nullret@*/ /* FIX: fns->{dil,fflags} may be NULL. */
 /*@i@*/ return fns;
     /*@=nullret@*/
 }
index bf6999d..8aec0c2 100644 (file)
@@ -24,16 +24,35 @@ struct rpmFNSet_s {
     Header h;                  /*!< Header for file name set (or NULL) */
 
 /*@only@*/
-    const char ** BN;          /*!< File base name(s). */
+    const char ** bnl;         /*!< Base name(s) (from header) */
 /*@only@*/
-    const int_32 * DI;         /*!< File directory index. */
+    const char ** dnl;         /*!< Directory name(s) (from header) */
+
+/*@only@*/
+    const char ** fmd5s;       /*!< File MD5 sum(s) (from header) */
+/*@only@*/
+    const char ** flinks;      /*!< File link(s) (from header) */
+/*@only@*/
+    const char ** flangs;      /*!< File lang(s) */
+
+/*@only@*/
+    const uint_32 * dil;       /*!< Directory indice(s) (from header) */
 /*@only@*/
-    const uint_32 * Flags;     /*!< File flags. */
+    const uint_32 * fflags;    /*!< File flag(s) (from header) */
 /*@only@*/
-    const char ** DN;          /*!< Directory name(s). */
-    int_32 DCount;             /*!< No. of directories. */
-    rpmTagType BNt, DIt, Ft, DNt;      /*!< Tag data types. */
-    int_32 Count;              /*!< No. of files. */
+    const uint_32 * fsizes;    /*!< File size(s) (from header) */
+/*@only@*/
+    const uint_32 * fmtimes;   /*!< File modification time(s) (from header) */
+/*@only@*/
+    const uint_16 * fmodes;    /*!< File mode(s) (from header) */
+/*@only@*/
+    const uint_16 * frdevs;    /*!< File rdev(s) (from header) */
+
+/*@only@*/
+    char * fstates;            /*!< File state(s) (from header) */
+
+    int_32 dc;                 /*!< No. of directories. */
+    int_32 fc;                 /*!< No. of files. */
 };
 
 /**
index b91e0db..ca40bf2 100644 (file)
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2001-11-09 12:21-0500\n"
+"POT-Creation-Date: 2001-11-09 14:05-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"
@@ -1459,11 +1459,11 @@ msgstr ""
 msgid "%9s: (%s, %s) added to Depends cache.\n"
 msgstr ""
 
-#: lib/depends.c:758 lib/rpmds.c:375 lib/rpmds.c:530
+#: lib/depends.c:758 lib/rpmds.c:404 lib/rpmds.c:559
 msgid "NO "
 msgstr ""
 
-#: lib/depends.c:758 lib/rpmds.c:375 lib/rpmds.c:530
+#: lib/depends.c:758 lib/rpmds.c:404 lib/rpmds.c:559
 msgid "YES"
 msgstr ""
 
@@ -2483,20 +2483,20 @@ msgid "OK"
 msgstr ""
 
 #. XXX legacy epoch-less requires/conflicts compatibility
-#: lib/rpmds.c:500
+#: lib/rpmds.c:529
 #, c-format
 msgid ""
 "the \"B\" dependency needs an epoch (assuming same as \"A\")\n"
 "\tA %s\tB %s\n"
 msgstr ""
 
-#: lib/rpmds.c:529
+#: lib/rpmds.c:558
 #, c-format
 msgid "  %s    A %s\tB %s\n"
 msgstr ""
 
 #. @=branchstate@
-#: lib/rpmds.c:554
+#: lib/rpmds.c:583
 #, c-format
 msgid "package %s has unsatisfied %s: %s\n"
 msgstr ""