- fixed --noscript, --notriggers, --excludedocs, and a bunch
of other install/remove flags
- fixed noreplace handling
+ - complain about old packages being installed
2.5.x -> 2.90
- added --excludepath
release, altName, altVersion, altRelease);
break;
+ case RPMPROB_OLDPACKAGE:
+ sprintf(buf, _("package %s-%s-%s (which is newer then %s-%s-%s) is "
+ "already installed"), altName, altVersion, altRelease,
+ name, version, release);
+ break;
+
default:
sprintf(buf, _("unknown error %d encountered while manipulating "
"package %s-%s-%s"), prob.type, name, version, release);
flag = RPMPROB_FILTER_REPLACENEWFILES; break;
case RPMPROB_FILE_CONFLICT:
flag = RPMPROB_FILTER_REPLACEOLDFILES; break;
+ case RPMPROB_OLDPACKAGE:
+ flag = RPMPROB_FILTER_OLDPACKAGE; break;
default:
flag = 0;
}
RPMPROB_CONFLICT,
RPMPROB_NEW_FILE_CONFLICT,
RPMPROB_FILE_CONFLICT,
+ RPMPROB_OLDPACKAGE,
} rpmProblemType;
typedef struct rpmProblem_s {
#define RPMPROB_FILTER_FORCERELOCATE (1 << 3)
#define RPMPROB_FILTER_REPLACENEWFILES (1 << 4)
#define RPMPROB_FILTER_REPLACEOLDFILES (1 << 5)
-#define RPMPROB_FILTER_UPGRADETOOLD (1 << 6)
+#define RPMPROB_FILTER_OLDPACKAGE (1 << 6)
/** messages.c **/
int sharedCount);
void handleOverlappedFiles(struct fileInfo * fi, hashTable ht,
rpmProblemSet probs);
+static int ensureOlder(rpmdb db, Header new, int dbOffset, rpmProblemSet probs,
+ const void * key);
#define XSTRCMP(a, b) ((!(a) && !(b)) || ((a) && (b) && !strcmp((a), (b))))
int i, j;
struct availableList * al = &ts->addedPackages;
int rc, ourrc = 0;
- rpmProblem prob;
struct availablePackage * alp;
rpmProblemSet probs;
dbiIndexSet dbi, * matches;
psAppend(probs, RPMPROB_BADOS, alp->key, alp->h, NULL, NULL);
}
+ rc = rpmdbFindPackage(ts->db, alp->name, &dbi);
+ if (rc == 2) {
+ return -1;
+ } else if (!rc) {
+ for (i = 0; i < dbi.count; i++)
+ ensureOlder(ts->db, alp->h, dbi.recs[i].recOffset,
+ probs, alp->key);
+
+ dbiFreeIndexRecord(dbi);
+ }
+
rc = findMatches(ts->db, alp->name, alp->version, alp->release, &dbi);
if (rc == 2) {
return -1;
} else if (!rc) {
- prob.key = alp->key;
psAppend(probs, RPMPROB_PKG_INSTALLED, alp->key, alp->h, NULL,
NULL);
dbiFreeIndexRecord(dbi);
}
}
}
+
+static int ensureOlder(rpmdb db, Header new, int dbOffset, rpmProblemSet probs,
+ const void * key) {
+ Header old;
+ int result, rc = 0;
+
+ old = rpmdbGetRecord(db, dbOffset);
+ if (old == NULL) return 1;
+
+ result = rpmVersionCompare(old, new);
+ if (result <= 0)
+ rc = 0;
+ else if (result > 0) {
+ rc = 1;
+ psAppend(probs, RPMPROB_OLDPACKAGE, key, new, NULL, old);
+ }
+
+ headerFree(old);
+
+ return rc;
+}
probFilter |= RPMPROB_FILTER_REPLACEPKG |
RPMPROB_FILTER_REPLACEOLDFILES |
RPMPROB_FILTER_REPLACENEWFILES |
- RPMPROB_FILTER_UPGRADETOOLD;
+ RPMPROB_FILTER_OLDPACKAGE;
}
if (replaceFiles) probFilter |= RPMPROB_FILTER_REPLACEOLDFILES |
RPMPROB_FILTER_REPLACENEWFILES;
if (badReloc) probFilter |= RPMPROB_FILTER_FORCERELOCATE;
if (replacePackages) probFilter |= RPMPROB_FILTER_REPLACEPKG;
- if (oldPackage) probFilter |= RPMPROB_FILTER_UPGRADETOOLD;
+ if (oldPackage) probFilter |= RPMPROB_FILTER_OLDPACKAGE;
if (ignoreArch) probFilter |= RPMPROB_FILTER_IGNOREARCH;
if (ignoreOs) probFilter |= RPMPROB_FILTER_IGNOREOS;