Gather all problem handling routines in one place.
authorjbj <devnull@localhost>
Mon, 29 Oct 2001 16:35:01 +0000 (16:35 +0000)
committerjbj <devnull@localhost>
Mon, 29 Oct 2001 16:35:01 +0000 (16:35 +0000)
CVS patchset: 5138
CVS date: 2001/10/29 16:35:01

lib/depends.h
lib/problems.c
lib/psm.c
lib/psm.h
lib/rpmlib.h
lib/transaction.c
po/rpm.pot

index 5bfd17d..a9ee126 100644 (file)
@@ -9,7 +9,6 @@
 #include <header.h>
 #include <rpmhash.h>
 
-typedef /*@abstract@*/ struct availablePackage_s *     availablePackage;
 typedef /*@abstract@*/ struct availableIndexEntry_s *  availableIndexEntry;
 typedef /*@abstract@*/ struct availableIndex_s *       availableIndex;
 typedef /*@abstract@*/ struct fileIndexEntry_s *       fileIndexEntry;
index f64b6a3..ef5088a 100644 (file)
 #include "misc.h"
 #include "debug.h"
 
+/*@access Header@*/
 /*@access rpmProblemSet@*/
 /*@access rpmProblem@*/
 /*@access rpmDependencyConflict@*/
+/*@access availablePackage@*/
+
+rpmProblemSet rpmProblemSetCreate(void)
+{
+    rpmProblemSet probs;
+
+    probs = xcalloc(1, sizeof(*probs));        /* XXX memory leak */
+    probs->numProblems = probs->numProblemsAlloced = 0;
+    probs->probs = NULL;
+
+    return probs;
+}
+
+void rpmProblemSetFree(rpmProblemSet tsprobs)
+{
+    int i;
+
+    for (i = 0; i < tsprobs->numProblems; i++) {
+       rpmProblem p = tsprobs->probs + i;
+       p->h = headerFree(p->h);
+       p->pkgNEVR = _free(p->pkgNEVR);
+       p->altNEVR = _free(p->altNEVR);
+       p->str1 = _free(p->str1);
+    }
+    tsprobs = _free(tsprobs);
+}
+
+void rpmProblemSetAppend(rpmProblemSet tsprobs, rpmProblemType type,
+               const availablePackage alp,
+               const char * dn, const char * bn,
+               Header altH, unsigned long ulong1)
+{
+    rpmProblem p;
+    char *t;
+
+    if (tsprobs->numProblems == tsprobs->numProblemsAlloced) {
+       if (tsprobs->numProblemsAlloced)
+           tsprobs->numProblemsAlloced *= 2;
+       else
+           tsprobs->numProblemsAlloced = 2;
+       tsprobs->probs = xrealloc(tsprobs->probs,
+                       tsprobs->numProblemsAlloced * sizeof(*tsprobs->probs));
+    }
+
+    p = tsprobs->probs + tsprobs->numProblems;
+    tsprobs->numProblems++;
+    memset(p, 0, sizeof(*p));
+    p->type = type;
+    /*@-assignexpose@*/
+    p->key = alp->key;
+    /*@=assignexpose@*/
+    p->ulong1 = ulong1;
+    p->ignoreProblem = 0;
+    p->str1 = NULL;
+    p->h = NULL;
+    p->pkgNEVR = NULL;
+    p->altNEVR = NULL;
+
+    if (dn != NULL || bn != NULL) {
+       t = xcalloc(1,  (dn != NULL ? strlen(dn) : 0) +
+                       (bn != NULL ? strlen(bn) : 0) + 1);
+       p->str1 = t;
+       if (dn != NULL) t = stpcpy(t, dn);
+       if (bn != NULL) t = stpcpy(t, bn);
+    }
+
+    if (alp != NULL) {
+       p->h = headerLink(alp->h);
+       t = xcalloc(1,  strlen(alp->name) +
+                       strlen(alp->version) +
+                       strlen(alp->release) + sizeof("--"));
+       p->pkgNEVR = t;
+       t = stpcpy(t, alp->name);
+       t = stpcpy(t, "-");
+       t = stpcpy(t, alp->version);
+       t = stpcpy(t, "-");
+       t = stpcpy(t, alp->release);
+    }
+
+    if (altH != NULL) {
+       const char * n, * v, * r;
+       (void) headerNVR(altH, &n, &v, &r);
+       t = xcalloc(1, strlen(n) + strlen(v) + strlen(r) + sizeof("--"));
+       p->altNEVR = t;
+       t = stpcpy(t, n);
+       t = stpcpy(t, "-");
+       t = stpcpy(t, v);
+       t = stpcpy(t, "-");
+       t = stpcpy(t, r);
+    }
+}
+
+#define XSTRCMP(a, b) ((!(a) && !(b)) || ((a) && (b) && !strcmp((a), (b))))
+
+int rpmProblemSetTrim(rpmProblemSet tsprobs, rpmProblemSet filter)
+{
+    rpmProblem t;
+    rpmProblem f;
+    int gotProblems = 0;
+
+    if (tsprobs == NULL || tsprobs->numProblems == 0)
+       return 0;
+
+    if (filter == NULL)
+       return (tsprobs->numProblems == 0 ? 0 : 1);
+
+    t = tsprobs->probs;
+    f = filter->probs;
+
+    /*@-branchstate@*/
+    while ((f - filter->probs) < filter->numProblems) {
+       if (!f->ignoreProblem) {
+           f++;
+           continue;
+       }
+       while ((t - tsprobs->probs) < tsprobs->numProblems) {
+           /*@-nullpass@*/     /* LCL: looks good to me */
+           if (f->h == t->h && f->type == t->type && t->key == f->key &&
+                    XSTRCMP(f->str1, t->str1))
+               /*@innerbreak@*/ break;
+           /*@=nullpass@*/
+           t++;
+           gotProblems = 1;
+       }
+
+       /* XXX This can't happen, but let's be sane in case it does. */
+       if ((t - tsprobs->probs) == tsprobs->numProblems)
+           break;
+
+       t->ignoreProblem = f->ignoreProblem;
+       t++, f++;
+    }
+    /*@=branchstate@*/
+
+    if ((t - tsprobs->probs) < tsprobs->numProblems)
+       gotProblems = 1;
+
+    return gotProblems;
+}
 
 /* XXX FIXME: merge into problems */
 /* XXX used in verify.c rpmlibprov.c */
@@ -196,18 +336,18 @@ void rpmProblemPrint(FILE *fp, rpmProblem prob)
     msg = _free(msg);
 }
 
-void rpmProblemSetPrint(FILE *fp, rpmProblemSet probs)
+void rpmProblemSetPrint(FILE *fp, rpmProblemSet tsprobs)
 {
     int i;
 
-    if (probs == NULL)
+    if (tsprobs == NULL)
        return;
 
     if (fp == NULL)
        fp = stderr;
 
-    for (i = 0; i < probs->numProblems; i++) {
-       rpmProblem myprob = probs->probs + i;
+    for (i = 0; i < tsprobs->numProblems; i++) {
+       rpmProblem myprob = tsprobs->probs + i;
        if (!myprob->ignoreProblem)
            rpmProblemPrint(fp, myprob);
     }
index fe76fc0..cd18d47 100644 (file)
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -28,8 +28,6 @@ int _fi_debug = 0;
 
 /*@access rpmTransactionSet @*/
 /*@access TFI_t @*/
-/*@access rpmProblemSet@*/
-/*@access rpmProblem@*/
 /*@access PSM_t @*/
 
 /*@access availablePackage@*/
@@ -75,7 +73,8 @@ int rpmVersionCompare(Header first, Header second)
     return rpmvercmp(one, two);
 }
 
-rpmProblemSet psCreate(void)
+#ifdef DYING
+rpmProblemSet rpmProblemSetCreate(void)
 {
     rpmProblemSet probs;
 
@@ -86,7 +85,7 @@ rpmProblemSet psCreate(void)
     return probs;
 }
 
-void psAppend(rpmProblemSet probs, rpmProblemType type,
+void rpmProblemSetAppend(rpmProblemSet probs, rpmProblemType type,
                const availablePackage alp,
                const char * dn, const char * bn,
                Header altH, unsigned long ulong1)
@@ -149,6 +148,8 @@ void psAppend(rpmProblemSet probs, rpmProblemType type,
        t = stpcpy(t, r);
     }
 }
+#endif /* DYING */
+
 /**
  */
 static /*@observer@*/ const char *const ftstring (fileTypes ft)
@@ -282,7 +283,7 @@ Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
                    /*@innerbreak@*/ break;
            /* XXX actions check prevents problem from being appended twice. */
            if (j == numValid && !allowBadRelocate && actions)
-               psAppend(ts->probs, RPMPROB_BADRELOCATE, alp,
+               rpmProblemSetAppend(ts->probs, RPMPROB_BADRELOCATE, alp,
                         relocations[i].oldPath, NULL, NULL, 0);
            del =
                strlen(relocations[i].newPath) - strlen(relocations[i].oldPath);
@@ -619,7 +620,7 @@ fprintf(stderr, "--> fi %p ++ %d %s at %s:%u\n", fi, fi->nrefs, msg, fn, ln);
     /*@-refcounttrans@*/ return fi; /*@=refcounttrans@*/
 }
 
-void loadFi(const rpmTransactionSet ts, TFI_t fi, Header h, int scareMem)
+void loadFi(const rpmTransactionSet ts, TFI_t fi, Header h, int keep_header)
 {
     HGE_t hge;
     HFD_t hfd;
@@ -632,7 +633,7 @@ void loadFi(const rpmTransactionSet ts, TFI_t fi, Header h, int scareMem)
        fi->fsm = newFSM();
 
     /* XXX avoid gcc noise on pointer (4th arg) cast(s) */
-    hge = (scareMem && fi->type == TR_ADDED)
+    hge = (keep_header && fi->type == TR_ADDED)
        ? (HGE_t) headerGetEntryMinMemory : (HGE_t) headerGetEntry;
     fi->hge = hge;
     fi->hae = (HAE_t) headerAddEntry;
@@ -683,7 +684,7 @@ void loadFi(const rpmTransactionSet ts, TFI_t fi, Header h, int scareMem)
     if (fi->actions == NULL)
        fi->actions = xcalloc(fi->fc, sizeof(*fi->actions));
 
-    fi->scareMem = scareMem;
+    fi->keep_header = keep_header;
     switch (fi->type) {
     case TR_ADDED:
        fi->mapflags =
@@ -704,7 +705,7 @@ void loadFi(const rpmTransactionSet ts, TFI_t fi, Header h, int scareMem)
            foo = headerFree(foo);
        }
 
-    if (!scareMem) {
+    if (!fi->keep_header) {
        fi->fmtimes = memcpy(xmalloc(fi->fc * sizeof(*fi->fmtimes)),
                                fi->fmtimes, fi->fc * sizeof(*fi->fmtimes));
        fi->frdevs = memcpy(xmalloc(fi->fc * sizeof(*fi->frdevs)),
@@ -776,7 +777,7 @@ void freeFi(TFI_t fi)
 
     switch (fi->type) {
     case TR_ADDED:
-       if (!fi->scareMem) {
+       if (!fi->keep_header) {
            fi->fmtimes = hfd(fi->fmtimes, -1);
            fi->frdevs = hfd(fi->frdevs, -1);
            fi->fsizes = hfd(fi->fsizes, -1);
index 2f8034a..1af348d 100644 (file)
--- a/lib/psm.h
+++ b/lib/psm.h
@@ -80,7 +80,7 @@ struct transactionFileInfo_s {
 #define        TFIMAGIC        0x09697923
 /*@owned@*/ FSM_t fsm;         /*!< File state machine data. */
 
-    int scareMem;              /*!< Keep header? */
+    int keep_header;           /*!< Keep header? */
 /*@refs@*/ int nrefs;          /*!< Reference count. */
 
   /* these are for TR_ADDED packages */
@@ -173,20 +173,22 @@ struct psm_s {
 extern "C" {
 #endif
 
+#ifdef DYING
 /**
  * Create problem set.
  */
-rpmProblemSet psCreate(void)
+/*@only@*/ rpmProblemSet rpmProblemSetCreate(void)
        /*@*/;
 
 /**
  * Append problem to set.
  */
-void psAppend(rpmProblemSet probs, rpmProblemType type,
+void rpmProblemSetAppend(rpmProblemSet tsprobs, rpmProblemType type,
                const availablePackage alp,
                const char * dn, const char * bn,
                Header altH, unsigned long ulong1)
-       /*@modifies probs, alp @*/;
+       /*@modifies tsprobs, alp @*/;
+#endif /* DYING */
 
 /**
  * Return file type from mode_t.
@@ -216,10 +218,10 @@ Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
  * @param ts           transaction set
  * @param fi           transaction element file info
  * @param h            header
- * @param scareMem     use header memory?
+ * @param keep_header  use header memory?
  */
 void loadFi(/*@null@*/ const rpmTransactionSet ts, TFI_t fi,
-               Header h, int scareMem)
+               Header h, int keep_header)
        /*@modifies ts, fi, h @*/;
 
 /**
index 59d8d34..910d7d2 100644 (file)
@@ -902,6 +902,26 @@ int rpmdbRebuild(/*@null@*/ const char * prefix)
 /*@{*/
 
 /**
+ * A package in a transaction set.
+ */
+typedef /*@abstract@*/ struct availablePackage_s * availablePackage;
+
+/**
+ * Raw data for an element of a problem set.
+ */
+typedef /*@abstract@*/ struct rpmProblem_s * rpmProblem;
+
+/**
+ * Transaction problems found by rpmRunTransactions().
+ */
+typedef /*@abstract@*/ struct rpmProblemSet_s * rpmProblemSet;
+
+/**
+ * Dependency problems found by rpmdepCheck().
+ */
+typedef /*@abstract@*/ struct rpmDependencyConflict_s * rpmDependencyConflict;
+
+/**
  * Enumerate transaction set problem types.
  */
 typedef enum rpmProblemType_e {
@@ -914,14 +934,14 @@ typedef enum rpmProblemType_e {
     RPMPROB_NEW_FILE_CONFLICT, /*!< file ... conflicts between attemped installs of ... */
     RPMPROB_FILE_CONFLICT,/*!< file ... from install of ... conflicts with file from package ... */
     RPMPROB_OLDPACKAGE,        /*!< package ... (which is newer than ...) is already installed */
-    RPMPROB_DISKSPACE, /*!< installing package ... needs ... on the ...  filesystem */
-    RPMPROB_DISKNODES, /*!< installing package ... needs ... on the ...  filesystem */
+    RPMPROB_DISKSPACE, /*!< installing package ... needs ... on the ... filesystem */
+    RPMPROB_DISKNODES, /*!< installing package ... needs ... on the ... filesystem */
     RPMPROB_BADPRETRANS        /*!< (unimplemented) */
  } rpmProblemType;
 
 /**
  */
-typedef /*@abstract@*/ struct rpmProblem_s {
+struct rpmProblem_s {
 /*@only@*/ /*@null@*/ const char * pkgNEVR;
 /*@only@*/ /*@null@*/ const char * altNEVR;
 /*@kept@*/ /*@null@*/ const void * key;
@@ -930,15 +950,15 @@ typedef /*@abstract@*/ struct rpmProblem_s {
     int ignoreProblem;
 /*@only@*/ /*@null@*/ const char * str1;
     unsigned long ulong1;
-} * rpmProblem;
+};
 
 /**
  */
-typedef /*@abstract@*/ struct rpmProblemSet_s {
+struct rpmProblemSet_s {
     int numProblems;           /*!< Current probs array size. */
     int numProblemsAlloced;    /*!< Allocated probs array size. */
     rpmProblem probs;          /*!< Array of specific problems. */
-} * rpmProblemSet;
+};
 
 /**
  */
@@ -947,9 +967,8 @@ void printDepFlags(FILE *fp, const char *version, int flags)
        /*@modifies *fp, fileSystem @*/;
 
 /**
- * Dependency problems found by rpmdepCheck().
  */
-typedef /*@abstract@*/ struct rpmDependencyConflict_s {
+struct rpmDependencyConflict_s {
     const char * byName;       /*!< package name */
     const char * byVersion;    /*!< package version */
     const char * byRelease;    /*!< package release */
@@ -966,7 +985,7 @@ typedef /*@abstract@*/ struct rpmDependencyConflict_s {
        RPMDEP_SENSE_REQUIRES,          /*!< requirement not satisfied. */
        RPMDEP_SENSE_CONFLICTS          /*!< conflict was found. */
     } sense;
-} * rpmDependencyConflict;
+};
 
 /**
  * Print results of rpmdepCheck() dependency check.
@@ -991,6 +1010,19 @@ void printDepProblems(FILE * fp, const rpmDependencyConflict conflicts,
 /*@=redecl@*/
 
 /**
+ * Create problem set.
+ */
+/*@only@*/ rpmProblemSet rpmProblemSetCreate(void)
+       /*@*/;
+
+/**
+ * Destroy problem set.
+ * @param tsprobs      problem set
+ */
+void rpmProblemSetFree( /*@only@*/ rpmProblemSet tsprobs)
+       /*@modifies tsprobs @*/;
+
+/**
  * Output formatted string representation of problem to file handle.
  * @deprecated API: prob used to be passed by value, now passed by reference.
  * @param fp           file handle
@@ -1005,16 +1037,35 @@ void rpmProblemPrint(FILE *fp, rpmProblem prob)
  * @param fp           file handle
  * @param probs                problem set
  */
-void rpmProblemSetPrint(FILE *fp, rpmProblemSet probs)
+void rpmProblemSetPrint(FILE *fp, rpmProblemSet tsprobs)
        /*@globals fileSystem @*/
-       /*@modifies probs, *fp, fileSystem @*/;
+       /*@modifies tsprobs, *fp, fileSystem @*/;
 
 /**
- * Destroy problem set.
- * @param probs                problem set
+ * Append problem to set.
+ */
+void rpmProblemSetAppend(rpmProblemSet tsprobs, rpmProblemType type,
+               const availablePackage alp,
+               const char * dn, const char * bn,
+               Header altH, unsigned long ulong1)
+       /*@modifies tsprobs, alp @*/;
+
+/**
+ * Filter a problem set.
+ * As the problem sets are generated in an order solely dependent
+ * on the ordering of the packages in the transaction, and that
+ * ordering can't be changed, the problem sets must be parallel to
+ * one another. Additionally, the filter set must be a subset of the
+ * target set, given the operations available on transaction set.
+ * This is good, as it lets us perform this trim in linear time, rather
+ * then logarithmic or quadratic.
+ *
+ * @param tsprobs      transaction problem set
+ * @param filter       problem filter (or NULL)
+ * @return             0 no problems, 1 if problems remain
  */
-void rpmProblemSetFree( /*@only@*/ rpmProblemSet probs)
-       /*@modifies probs @*/;
+int rpmProblemSetTrim(/*@null@*/ rpmProblemSet tsprobs, /*@null@*/ rpmProblemSet filter)
+       /*@modifies tsprobs @*/;
 
 /*@}*/
 /* ==================================================================== */
@@ -1449,7 +1500,7 @@ int rpmdepOrder(rpmTransactionSet ts)
        /*@modifies conflicts @*/;
 
 /** \ingroup rpmtrans
- * Bit(s) to control rpmRunTransaction() operation.
+ * Bit(s) to control rpmRunTransactions() operation.
  */
 typedef enum rpmtransFlags_e {
     RPMTRANS_FLAG_NONE         = 0,
index cd14789..b8313fc 100644 (file)
@@ -48,13 +48,12 @@ extern int statvfs (const char * file, /*@out@*/ struct statvfs * buf)
 
 /*@access FD_t@*/              /* XXX compared with NULL */
 /*@access Header@*/            /* XXX compared with NULL */
+/*@access rpmProblemSet@*/     /* XXX need rpmProblemSetOK() */
 /*@access dbiIndexSet@*/
 /*@access rpmdb@*/
 /*@access rpmTransactionSet@*/
 /*@access TFI_t@*/
 /*@access PSM_t@*/
-/*@access rpmProblemSet@*/
-/*@access rpmProblem@*/
 
 /*@access availablePackage@*/
 
@@ -78,7 +77,9 @@ struct diskspaceInfo {
    probably right :-( */
 #define BLOCK_ROUND(size, block) (((size) + (block) - 1) / (block))
 
+#ifdef DYING
 #define XSTRCMP(a, b) ((!(a) && !(b)) || ((a) && (b) && !strcmp((a), (b))))
+#endif
 
 /**
  */
@@ -198,18 +199,19 @@ static int osOkay(Header h)
     return 1;
 }
 
-void rpmProblemSetFree(rpmProblemSet probs)
+#ifdef DYING
+void rpmProblemSetFree(rpmProblemSet tsprobs)
 {
     int i;
 
-    for (i = 0; i < probs->numProblems; i++) {
-       rpmProblem p = probs->probs + i;
+    for (i = 0; i < tsprobs->numProblems; i++) {
+       rpmProblem p = tsprobs->probs + i;
        p->h = headerFree(p->h);
        p->pkgNEVR = _free(p->pkgNEVR);
        p->altNEVR = _free(p->altNEVR);
        p->str1 = _free(p->str1);
     }
-    free(probs);
+    free(tsprobs);
 }
 
 /**
@@ -222,15 +224,15 @@ void rpmProblemSetFree(rpmProblemSet probs)
  * This is good, as it lets us perform this trim in linear time, rather
  * then logarithmic or quadratic.
  *
+ * @param tsprobs      transaction problem set
  * @param filter       filter
- * @param target       problem set
  * @return             0 no problems, 1 if problems remain
  */
-static int psTrim(rpmProblemSet filter, rpmProblemSet target)
-       /*@modifies target @*/
+static int rpmProblemSetTrim(rpmProblemSet tsprobs, rpmProblemSet filter)
+       /*@modifies tsprobs @*/
 {
+    rpmProblem t = tsprobs->probs;
     rpmProblem f = filter->probs;
-    rpmProblem t = target->probs;
     int gotProblems = 0;
 
     /*@-branchstate@*/
@@ -239,7 +241,7 @@ static int psTrim(rpmProblemSet filter, rpmProblemSet target)
            f++;
            continue;
        }
-       while ((t - target->probs) < target->numProblems) {
+       while ((t - tsprobs->probs) < tsprobs->numProblems) {
            /*@-nullpass@*/     /* LCL: looks good to me */
            if (f->h == t->h && f->type == t->type && t->key == f->key &&
                     XSTRCMP(f->str1, t->str1))
@@ -249,7 +251,7 @@ static int psTrim(rpmProblemSet filter, rpmProblemSet target)
            gotProblems = 1;
        }
 
-       if ((t - target->probs) == target->numProblems) {
+       if ((t - tsprobs->probs) == tsprobs->numProblems) {
            /* this can't happen ;-) let's be sane if it doesn though */
            break;
        }
@@ -259,11 +261,12 @@ static int psTrim(rpmProblemSet filter, rpmProblemSet target)
     }
     /*@=branchstate@*/
 
-    if ((t - target->probs) < target->numProblems)
+    if ((t - tsprobs->probs) < tsprobs->numProblems)
        gotProblems = 1;
 
     return gotProblems;
 }
+#endif /* DYING */
 
 /**
  */
@@ -408,7 +411,6 @@ static int handleInstInstalledFiles(const rpmTransactionSet ts, TFI_t fi,
 {
     HGE_t hge = fi->hge;
     HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
-    rpmProblemSet probs = ts->probs;
     rpmtransFlags transFlags = ts->transFlags;
     rpmTagType oltype, omtype;
     Header h;
@@ -459,7 +461,7 @@ static int handleInstInstalledFiles(const rpmTransactionSet ts, TFI_t fi,
                        fi->fmd5s[fileNum],
                        fi->flinks[fileNum])) {
            if (reportConflicts)
-               psAppend(probs, RPMPROB_FILE_CONFLICT, fi->ap,
+               rpmProblemSetAppend(ts->probs, RPMPROB_FILE_CONFLICT, fi->ap,
                        fi->dnl[fi->dil[fileNum]], fi->bnl[fileNum], h, 0);
            if (!(otherFlags[otherFileNum] | fi->fflags[fileNum])
                        & RPMFILE_CONFIG) {
@@ -547,10 +549,6 @@ static void handleOverlappedFiles(const rpmTransactionSet ts, TFI_t fi)
        /*@globals fileSystem @*/
        /*@modifies ts, fi, fileSystem @*/
 {
-    struct diskspaceInfo * dsl = ts->di;
-    rpmProblemSet probs = (ts->ignoreSet & RPMPROB_FILTER_REPLACENEWFILES)
-       ? NULL : ts->probs;
-    hashTable ht = ts->ht;
     struct diskspaceInfo * ds = NULL;
     uint_32 fixupSize = 0;
     char * filespec = NULL;
@@ -575,8 +573,8 @@ static void handleOverlappedFiles(const rpmTransactionSet ts, TFI_t fi)
 
        (void) stpcpy( stpcpy( filespec, fi->dnl[fi->dil[i]]), fi->bnl[i]);
 
-       if (dsl) {
-           ds = dsl;
+       if (ts->di) {
+           ds = ts->di;
            while (ds->bsize && ds->dev != fi->fps[i].entry->dev) ds++;
            if (!ds->bsize) ds = NULL;
            fixupSize = 0;
@@ -588,7 +586,8 @@ static void handleOverlappedFiles(const rpmTransactionSet ts, TFI_t fi)
         * will be installed and removed so the records for an overlapped
         * files will be sorted in exactly the same order.
         */
-       (void) htGetEntry(ht, &fi->fps[i], (const void ***) &recs, &numRecs, NULL);
+       (void) htGetEntry(ts->ht, &fi->fps[i],
+                       (const void ***) &recs, &numRecs, NULL);
 
        /*
         * If this package is being added, look only at other packages
@@ -660,13 +659,14 @@ static void handleOverlappedFiles(const rpmTransactionSet ts, TFI_t fi)
            }
 
            /* Mark added overlapped non-identical files as a conflict. */
-           if (probs && filecmp(recs[otherPkgNum]->fmodes[otherFileNum],
+           if ((ts->ignoreSet & RPMPROB_FILTER_REPLACENEWFILES)
+            && filecmp(recs[otherPkgNum]->fmodes[otherFileNum],
                        recs[otherPkgNum]->fmd5s[otherFileNum],
                        recs[otherPkgNum]->flinks[otherFileNum],
                        fi->fmodes[i],
                        fi->fmd5s[i],
                        fi->flinks[i])) {
-               psAppend(probs, RPMPROB_NEW_FILE_CONFLICT, fi->ap,
+               rpmProblemSetAppend(ts->probs, RPMPROB_NEW_FILE_CONFLICT, fi->ap,
                                filespec, NULL, recs[otherPkgNum]->ap->h, 0);
            }
 
@@ -750,9 +750,8 @@ static void handleOverlappedFiles(const rpmTransactionSet ts, TFI_t fi)
 
 /**
  */
-static int ensureOlder(availablePackage alp, Header old,
-               rpmProblemSet probs)
-       /*@modifies alp, probs @*/
+static int ensureOlder(rpmTransactionSet ts, availablePackage alp, Header old)
+       /*@modifies ts, alp @*/
 {
     int result, rc = 0;
 
@@ -763,7 +762,8 @@ static int ensureOlder(availablePackage alp, Header old,
        rc = 0;
     else if (result > 0) {
        rc = 1;
-       psAppend(probs, RPMPROB_OLDPACKAGE, alp, NULL, NULL, old, 0);
+       rpmProblemSetAppend(ts->probs, RPMPROB_OLDPACKAGE, alp,
+                       NULL, NULL, old, 0);
     }
 
     return rc;
@@ -1071,7 +1071,7 @@ int rpmRunTransactions(   rpmTransactionSet ts,
     PSM_t psm = &psmbuf;
     void * tsi;
     int xx;
-int scareMem = 0;
+int keep_header = 1;   /* XXX rpmProblemSetAppend prevents dumping headers. */
 
     /* FIXME: what if the same package is included in ts twice? */
 
@@ -1088,7 +1088,7 @@ int scareMem = 0;
     ts->notify = notify;
     ts->notifyData = notifyData;
     /*@-assignexpose@*/
-    ts->probs = *newProbs = psCreate();
+    ts->probs = *newProbs = rpmProblemSetCreate();
     /*@=assignexpose@*/
     ts->ignoreSet = ignoreSet;
     ts->currDir = _free(ts->currDir);
@@ -1172,17 +1172,19 @@ int scareMem = 0;
        alp++)
     {
        if (!archOkay(alp->h) && !(ts->ignoreSet & RPMPROB_FILTER_IGNOREARCH))
-           psAppend(ts->probs, RPMPROB_BADARCH, alp, NULL, NULL, NULL, 0);
+           rpmProblemSetAppend(ts->probs, RPMPROB_BADARCH, alp,
+                       NULL, NULL, NULL, 0);
 
        if (!osOkay(alp->h) && !(ts->ignoreSet & RPMPROB_FILTER_IGNOREOS))
-           psAppend(ts->probs, RPMPROB_BADOS, alp, NULL, NULL, NULL, 0);
+           rpmProblemSetAppend(ts->probs, RPMPROB_BADOS, alp,
+                       NULL, NULL, NULL, 0);
 
        if (!(ts->ignoreSet & RPMPROB_FILTER_OLDPACKAGE)) {
            rpmdbMatchIterator mi;
            Header oldH;
            mi = rpmtsInitIterator(ts, RPMTAG_NAME, alp->name, 0);
            while ((oldH = rpmdbNextIterator(mi)) != NULL)
-               xx = ensureOlder(alp, oldH, ts->probs);
+               xx = ensureOlder(ts, alp, oldH);
            mi = rpmdbFreeIterator(mi);
        }
 
@@ -1196,7 +1198,7 @@ int scareMem = 0;
                        RPMMIRE_DEFAULT, alp->release);
 
            while (rpmdbNextIterator(mi) != NULL) {
-               psAppend(ts->probs, RPMPROB_PKG_INSTALLED, alp,
+               rpmProblemSetAppend(ts->probs, RPMPROB_PKG_INSTALLED, alp,
                        NULL, NULL, NULL, 0);
                /*@innerbreak@*/ break;
            }
@@ -1247,7 +1249,7 @@ int scareMem = 0;
            /* XXX watchout: fi->type must be set for tsGetAlp() to "work" */
            fi->ap = tsGetAlp(tsi);
            fi->record = 0;
-           loadFi(ts, fi, fi->ap->h, scareMem);
+           loadFi(ts, fi, fi->ap->h, keep_header);
 /* XXX free fi->ap->h here if/when possible */
            if (fi->fc == 0)
                continue;
@@ -1436,12 +1438,12 @@ int scareMem = 0;
                    /*@innercontinue@*/ continue;
 
                if (adj_fs_blocks(dip->bneeded) > dip->bavail)
-                   psAppend(ts->probs, RPMPROB_DISKSPACE, fi->ap,
+                   rpmProblemSetAppend(ts->probs, RPMPROB_DISKSPACE, fi->ap,
                                ts->filesystems[i], NULL, NULL,
                   (adj_fs_blocks(dip->bneeded) - dip->bavail) * dip->bsize);
 
                if (adj_fs_blocks(dip->ineeded) > dip->iavail)
-                   psAppend(ts->probs, RPMPROB_DISKNODES, fi->ap,
+                   rpmProblemSetAppend(ts->probs, RPMPROB_DISKNODES, fi->ap,
                                ts->filesystems[i], NULL, NULL,
                    (adj_fs_blocks(dip->ineeded) - dip->iavail));
            }
@@ -1488,8 +1490,10 @@ int scareMem = 0;
     /* ===============================================
      * If unfiltered problems exist, free memory and return.
      */
-    if ((ts->transFlags & RPMTRANS_FLAG_BUILD_PROBS) ||
-           (ts->probs->numProblems && (!okProbs || psTrim(okProbs, ts->probs))))
+    if ((ts->transFlags & RPMTRANS_FLAG_BUILD_PROBS)
+     || (ts->probs->numProblems &&
+               (okProbs != NULL || rpmProblemSetTrim(ts->probs, okProbs)))
+       )
     {
        *newProbs = ts->probs;
 
index 6aac128..eb51fa3 100644 (file)
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2001-10-28 17:05-0500\n"
+"POT-Creation-Date: 2001-10-29 11:11-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"
@@ -816,7 +816,7 @@ msgstr ""
 msgid "Could not open %s: %s\n"
 msgstr ""
 
-#: build/pack.c:603 lib/psm.c:2180
+#: build/pack.c:603 lib/psm.c:2181
 #, c-format
 msgid "Unable to write package: %s\n"
 msgstr ""
@@ -846,7 +846,7 @@ msgstr ""
 msgid "Unable to write payload to %s: %s\n"
 msgstr ""
 
-#: build/pack.c:683 lib/psm.c:2446
+#: build/pack.c:683 lib/psm.c:2447
 #, c-format
 msgid "Wrote: %s\n"
 msgstr ""
@@ -1640,7 +1640,7 @@ msgid "dataLength() RPM_STRING_TYPE count must be 1.\n"
 msgstr ""
 
 #. @-modfilesys@
-#: lib/header.c:351 lib/header_internal.c:161 lib/psm.c:997
+#: lib/header.c:351 lib/header_internal.c:161 lib/psm.c:998
 #, c-format
 msgid "Data type %d not supported\n"
 msgstr ""
@@ -2147,173 +2147,173 @@ msgstr ""
 msgid "generate signature"
 msgstr ""
 
-#: lib/problems.c:83
+#: lib/problems.c:223
 #, c-format
 msgid " is needed by %s-%s-%s\n"
 msgstr ""
 
-#: lib/problems.c:86
+#: lib/problems.c:226
 #, c-format
 msgid " conflicts with %s-%s-%s\n"
 msgstr ""
 
-#: lib/problems.c:126
+#: lib/problems.c:266
 #, c-format
 msgid "package %s is for a different architecture"
 msgstr ""
 
-#: lib/problems.c:131
+#: lib/problems.c:271
 #, c-format
 msgid "package %s is for a different operating system"
 msgstr ""
 
-#: lib/problems.c:136
+#: lib/problems.c:276
 #, c-format
 msgid "package %s is already installed"
 msgstr ""
 
-#: lib/problems.c:141
+#: lib/problems.c:281
 #, c-format
 msgid "path %s in package %s is not relocateable"
 msgstr ""
 
-#: lib/problems.c:146
+#: lib/problems.c:286
 #, c-format
 msgid "file %s conflicts between attempted installs of %s and %s"
 msgstr ""
 
-#: lib/problems.c:151
+#: lib/problems.c:291
 #, c-format
 msgid "file %s from install of %s conflicts with file from package %s"
 msgstr ""
 
-#: lib/problems.c:156
+#: lib/problems.c:296
 #, c-format
 msgid "package %s (which is newer than %s) is already installed"
 msgstr ""
 
-#: lib/problems.c:161
+#: lib/problems.c:301
 #, c-format
 msgid "installing package %s needs %ld%cb on the %s filesystem"
 msgstr ""
 
-#: lib/problems.c:171
+#: lib/problems.c:311
 #, c-format
 msgid "installing package %s needs %ld inodes on the %s filesystem"
 msgstr ""
 
-#: lib/problems.c:176
+#: lib/problems.c:316
 #, c-format
 msgid "package %s pre-transaction syscall(s): %s failed: %s"
 msgstr ""
 
-#: lib/problems.c:183
+#: lib/problems.c:323
 #, c-format
 msgid "unknown error %d encountered while manipulating package %s"
 msgstr ""
 
-#: lib/psm.c:320
+#: lib/psm.c:321
 msgid "========== relocations\n"
 msgstr ""
 
-#: lib/psm.c:324
+#: lib/psm.c:325
 #, c-format
 msgid "%5d exclude  %s\n"
 msgstr ""
 
-#: lib/psm.c:327
+#: lib/psm.c:328
 #, c-format
 msgid "%5d relocate %s -> %s\n"
 msgstr ""
 
-#: lib/psm.c:397
+#: lib/psm.c:398
 #, c-format
 msgid "excluding multilib path %s%s\n"
 msgstr ""
 
-#: lib/psm.c:463
+#: lib/psm.c:464
 #, c-format
 msgid "excluding %s %s\n"
 msgstr ""
 
-#: lib/psm.c:473
+#: lib/psm.c:474
 #, c-format
 msgid "relocating %s to %s\n"
 msgstr ""
 
-#: lib/psm.c:552
+#: lib/psm.c:553
 #, c-format
 msgid "relocating directory %s to %s\n"
 msgstr ""
 
-#: lib/psm.c:1194
+#: lib/psm.c:1195
 #, c-format
 msgid "cannot create %%%s %s\n"
 msgstr ""
 
-#: lib/psm.c:1200
+#: lib/psm.c:1201
 #, c-format
 msgid "cannot write to %%%s %s\n"
 msgstr ""
 
-#: lib/psm.c:1240
+#: lib/psm.c:1241
 msgid "source package expected, binary found\n"
 msgstr ""
 
-#: lib/psm.c:1353
+#: lib/psm.c:1354
 msgid "source package contains no .spec file\n"
 msgstr ""
 
-#: lib/psm.c:1463
+#: lib/psm.c:1464
 #, c-format
 msgid "%s: running %s scriptlet\n"
 msgstr ""
 
-#: lib/psm.c:1631
+#: lib/psm.c:1632
 #, c-format
 msgid "execution of %s scriptlet from %s-%s-%s failed, waitpid returned %s\n"
 msgstr ""
 
-#: lib/psm.c:1638
+#: lib/psm.c:1639
 #, c-format
 msgid "execution of %s scriptlet from %s-%s-%s failed, exit status %d\n"
 msgstr ""
 
-#: lib/psm.c:1985
+#: lib/psm.c:1986
 #, c-format
 msgid "%s: %s-%s-%s has %d files, test = %d\n"
 msgstr ""
 
-#: lib/psm.c:2102
+#: lib/psm.c:2103
 #, c-format
 msgid "%s: %s scriptlet failed (%d), skipping %s-%s-%s\n"
 msgstr ""
 
-#: lib/psm.c:2217
+#: lib/psm.c:2218
 #, c-format
 msgid "user %s does not exist - using root\n"
 msgstr ""
 
-#: lib/psm.c:2226
+#: lib/psm.c:2227
 #, c-format
 msgid "group %s does not exist - using root\n"
 msgstr ""
 
-#: lib/psm.c:2267
+#: lib/psm.c:2268
 #, c-format
 msgid "unpacking of archive failed%s%s: %s\n"
 msgstr ""
 
-#: lib/psm.c:2268
+#: lib/psm.c:2269
 msgid " on file "
 msgstr ""
 
-#: lib/psm.c:2454
+#: lib/psm.c:2455
 #, c-format
 msgid "%s failed on file %s: %s\n"
 msgstr ""
 
-#: lib/psm.c:2457
+#: lib/psm.c:2458
 #, c-format
 msgid "%s failed: %s\n"
 msgstr ""
@@ -2827,7 +2827,7 @@ msgstr ""
 msgid "Signature: UNKNOWN (%d)\n"
 msgstr ""
 
-#: lib/transaction.c:311
+#: lib/transaction.c:314
 #, c-format
 msgid "%s skipped due to missingok flag\n"
 msgstr ""