summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-04-21 06:02:09 +0000
committerjbj <devnull@localhost>2001-04-21 06:02:09 +0000
commit389d253e6236173e05b488d8f77ebe3b785f84a8 (patch)
tree5aab727659620d074d8419e77f29088da48488c6
parent84329c6779c60c57f75ae66b92f6fb9f37c3b4f6 (diff)
downloadrpm-389d253e6236173e05b488d8f77ebe3b785f84a8.tar.gz
rpm-389d253e6236173e05b488d8f77ebe3b785f84a8.tar.bz2
rpm-389d253e6236173e05b488d8f77ebe3b785f84a8.zip
Sync with rpm-4_0 branch.
CVS patchset: 4700 CVS date: 2001/04/21 06:02:09
-rw-r--r--.exclude40
-rw-r--r--CHANGES13
-rw-r--r--lib/.cvsignore1
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/depends.c108
-rw-r--r--lib/depends.h3
-rw-r--r--lib/misc.c2
-rw-r--r--lib/package.c10
-rw-r--r--lib/rpminstall.c8
-rw-r--r--lib/rpmlib.h14
-rw-r--r--lib/rpmlibprov.c2
-rw-r--r--lib/transaction.c16
-rw-r--r--po/rpm.pot78
-rw-r--r--python/rpmmodule.c3
-rwxr-xr-xrpm.c2
-rw-r--r--rpmio/Makefile.am6
-rw-r--r--rpmio/rpmlog.c4
-rw-r--r--rpmio/tficl.c80
-rw-r--r--tools/rpmsort.c209
19 files changed, 395 insertions, 206 deletions
diff --git a/.exclude b/.exclude
new file mode 100644
index 000000000..4c27a5ce8
--- /dev/null
+++ b/.exclude
@@ -0,0 +1,40 @@
+CVS
+.deps
+.depend
+.depend-done
+.libs
+apidocs
+autodeps
+intl
+scripts
+po
+[a-zA-Z]
+*-BUGGY
+*.a
+*.la
+*.in
+*.lo
+*.o
+*.so
+*.orig
+*.rej
+*.gz
+*.po
+.exclude
+CHANGES
+Doxyfile
+Makefile
+mklog
+config.cache
+config.guess
+config.h
+config.log
+config.status
+config.sub
+configure
+doxygen
+libtool
+ltconfig
+ltmain.sh
+stamp-h
+tags
diff --git a/CHANGES b/CHANGES
index 24e29dcf4..74902fecc 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,10 +1,4 @@
4.0.3 -> 4.1
- - cpio mappings carry dirname/basename, not absolute path.
- - fix: check waitpid return code.
- - remove support for v1 src rpm's.
- - re-position callbacks with ts/fi in cpio payload layer.
- - state machines for packages (psm.c) and payloads (fsm.c)
- - add --repackage option to put erased bits back into a package.
4.0.2 -> 4.0.3
- update per-interpreter dependency scripts, add sql/tcl (#20295).
@@ -27,6 +21,13 @@
- fix: s390 (and ppc?) could return CPIOERR_BAD_HEADER (#28645).
- fix: Fwrite's are optimized out by aggressive compiler(irix) (#34711).
- portability: vsnprintf/snprintf wrappers for those without (#34657).
+ - cpio mappings carry dirname/basename, not absolute path.
+ - fix: check waitpid return code.
+ - remove support for v1 src rpm's.
+ - re-position callbacks with ts/fi in cpio payload layer.
+ - state machines for packages (psm.c) and payloads (fsm.c)
+ - add --repackage option to put erased bits back into a package.
+ - fix: (ppc) copy va_list in loop (#36845).
4.0 -> 4.0.[12]
- add doxygen and lclint annotations most everywhere.
diff --git a/lib/.cvsignore b/lib/.cvsignore
index eb211a62f..d5d93dbae 100644
--- a/lib/.cvsignore
+++ b/lib/.cvsignore
@@ -2,6 +2,7 @@
.depend
Makefile
Makefile.in
+getdate.c
tagtable.c
.libs
*.la
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 5f443d65d..c3fa7fbf7 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -66,7 +66,7 @@ getdate.c: getdate.y
fi ;\
fi
-BUILT_SOURCES = tagtable.c
+BUILT_SOURCES = tagtable.c getdate.c
.PHONY: lclint
.PHONY: lclint
diff --git a/lib/depends.c b/lib/depends.c
index bd1ad00e7..3371338c6 100644
--- a/lib/depends.c
+++ b/lib/depends.c
@@ -263,6 +263,7 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList
pkgNum = al->size++;
p = al->list + pkgNum;
p->h = headerLink(h); /* XXX reference held by transaction set */
+ p->depth = p->npreds = 0;
memset(&p->tsi, 0, sizeof(p->tsi));
p->multiLib = 0; /* MULTILIB */
@@ -579,8 +580,8 @@ int rpmRangesOverlap(const char *AName, const char *AEVR, int AFlags,
sense = rpmvercmp(aR, bR);
}
}
- free(aEVR);
- free(bEVR);
+ aEVR = _free(aEVR);
+ bEVR = _free(bEVR);
/* Detect overlap of {A,B} range. */
result = 0;
@@ -597,9 +598,9 @@ int rpmRangesOverlap(const char *AName, const char *AEVR, int AFlags,
exit:
rpmMessage(RPMMESS_DEBUG, _(" %s A %s\tB %s\n"),
- (result ? "YES" : "NO "), aDepend, bDepend);
- if (aDepend) free((void *)aDepend);
- if (bDepend) free((void *)bDepend);
+ (result ? _("YES") : _("NO ")), aDepend, bDepend);
+ aDepend = _free(aDepend);
+ bDepend = _free(bDepend);
return result;
}
@@ -879,25 +880,17 @@ void rpmtransRemovePackage(rpmTransactionSet ts, int dboffset)
void rpmtransFree(rpmTransactionSet ts)
{
- struct availableList * addedPackages = &ts->addedPackages;
- struct availableList * availablePackages = &ts->availablePackages;
-
- alFree(addedPackages);
- alFree(availablePackages);
- if (ts->di)
- free((void *)ts->di);
- if (ts->removedPackages)
- free(ts->removedPackages);
- if (ts->order)
- free(ts->order);
+ alFree(&ts->addedPackages);
+ alFree(&ts->availablePackages);
+ ts->di = _free(ts->di);
+ ts->removedPackages = _free(ts->removedPackages);
+ ts->order = _free(ts->order);
if (ts->scriptFd)
ts->scriptFd = fdFree(ts->scriptFd, "rpmtransSetScriptFd (rpmtransFree");
- if (ts->rootDir)
- free((void *)ts->rootDir);
- if (ts->currDir)
- free((void *)ts->currDir);
+ ts->rootDir = _free(ts->rootDir);
+ ts->currDir = _free(ts->currDir);
- free(ts);
+ ts = _free(ts);
}
void rpmdepFreeConflicts(struct rpmDependencyConflict * conflicts,
@@ -907,14 +900,14 @@ void rpmdepFreeConflicts(struct rpmDependencyConflict * conflicts,
for (i = 0; i < numConflicts; i++) {
headerFree(conflicts[i].byHeader);
- free((void *)conflicts[i].byName);
- free((void *)conflicts[i].byVersion);
- free((void *)conflicts[i].byRelease);
- free((void *)conflicts[i].needsName);
- free((void *)conflicts[i].needsVersion);
+ conflicts[i].byName = _free(conflicts[i].byName);
+ conflicts[i].byVersion = _free(conflicts[i].byVersion);
+ conflicts[i].byRelease = _free(conflicts[i].byRelease);
+ conflicts[i].needsName = _free(conflicts[i].needsName);
+ conflicts[i].needsVersion = _free(conflicts[i].needsVersion);
}
- free(conflicts);
+ conflicts = _free(conflicts);
}
/**
@@ -948,7 +941,7 @@ alFileSatisfiesDepend(struct availableList * al,
dirNeedle.dirNameLen = strlen(dirName);
dirMatch = bsearch(&dirNeedle, al->dirs, al->numDirs,
sizeof(dirNeedle), dirInfoCompare);
- free((void *)dirName);
+ dirName = _free(dirName);
if (!dirMatch) return NULL;
baseName = strrchr(fileName, '/') + 1;
@@ -1075,8 +1068,8 @@ static int unsatisfiedDepend(rpmTransactionSet ts,
xx = dbiGet(dbi, dbcursor, (void **)&keyDepend, &keylen, &datap, &datalen, 0);
if (xx == 0 && datap && datalen == 4) {
memcpy(&rc, datap, datalen);
- rpmMessage(RPMMESS_DEBUG, _("%s: %-45s %-3s (cached)\n"),
- keyType, keyDepend, (rc ? "NO" : "YES"));
+ rpmMessage(RPMMESS_DEBUG, _("%s: %-45s %-s (cached)\n"),
+ keyType, keyDepend, (rc ? _("NO ") : _("YES")));
xx = dbiCclose(dbi, NULL, 0);
return rc;
}
@@ -1197,7 +1190,7 @@ exit:
_cacheDependsRC = 0;
#if 0 /* XXX NOISY */
else
- rpmMessage(RPMMESS_DEBUG, _("%s: (%s, %s) added to Depends cache.\n"), keyType, keyDepend, (rc ? "NO" : "YES"));
+ rpmMessage(RPMMESS_DEBUG, _("%s: (%s, %s) added to Depends cache.\n"), keyType, keyDepend, (rc ? _("NO ") : _("YES")));
#endif
xx = dbiCclose(dbi, dbcursor, 0);
}
@@ -1228,7 +1221,8 @@ static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp,
headerNVR(h, &name, &version, &release);
- if (!hge(h, RPMTAG_REQUIRENAME, &rnt, (void **) &requires, &requiresCount)) {
+ if (!hge(h, RPMTAG_REQUIRENAME, &rnt, (void **) &requires, &requiresCount))
+ {
requiresCount = 0;
} else {
hge(h, RPMTAG_REQUIREFLAGS, &type, (void **) &requireFlags,
@@ -1238,7 +1232,7 @@ static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp,
}
for (i = 0; i < requiresCount && !ourrc; i++) {
- const char *keyDepend;
+ const char * keyDepend;
/* Filter out requires that came along for the ride. */
if (keyName && strcmp(keyName, requires[i]))
@@ -1287,7 +1281,7 @@ static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp,
ourrc = 1;
break;
}
- free((void *)keyDepend);
+ keyDepend = _free(keyDepend);
}
if (requiresCount) {
@@ -1306,7 +1300,7 @@ static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp,
}
for (i = 0; i < conflictsCount && !ourrc; i++) {
- const char *keyDepend;
+ const char * keyDepend;
/* Filter out conflicts that came along for the ride. */
if (keyName && strcmp(keyName, conflicts[i]))
@@ -1352,7 +1346,7 @@ static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp,
ourrc = 1;
break;
}
- free((void *)keyDepend);
+ keyDepend = _free(keyDepend);
}
if (conflictsCount) {
@@ -1436,7 +1430,6 @@ static struct badDeps_s {
{ "compat-glibc", "db2" },
{ "compat-glibc", "db1" },
{ "pam", "initscripts" },
- { "kernel", "initscripts" },
{ "initscripts", "sysklogd" },
/* 6.2 */
{ "egcs-c++", "libstdc++" },
@@ -1546,7 +1539,7 @@ zapRelation(struct availablePackage * q, struct availablePackage * p,
tsi_prev->tsi_next = tsi->tsi_next;
tsi->tsi_next = NULL;
tsi->tsi_suc = NULL;
- free(tsi);
+ tsi = _free(tsi);
if (nzaps)
(*nzaps)++;
if (zap)
@@ -1598,6 +1591,9 @@ static inline int addRelation( const rpmTransactionSet ts,
/* T3. Record next "q <- p" relation (i.e. "p" requires "q"). */
p->tsi.tsi_count++; /* bump p predecessor count */
+ if (p->depth <= q->depth) /* Save max. depth in dependency tree */
+ p->depth = q->depth + 1;
+
tsi = xmalloc(sizeof(*tsi));
tsi->tsi_suc = p;
tsi->tsi_reqx = j;
@@ -1655,6 +1651,7 @@ static void addQ(/*@kept@*/ struct availablePackage * p,
int rpmdepOrder(rpmTransactionSet ts)
{
int npkgs = ts->addedPackages.size;
+ int chainsaw = ts->transFlags & RPMTRANS_FLAG_CHAINSAW;
struct availablePackage * p;
struct availablePackage * q;
struct availablePackage * r;
@@ -1725,6 +1722,11 @@ int rpmdepOrder(rpmTransactionSet ts)
}
}
+ /* Save predecessor count. */
+ for (i = 0, p = ts->addedPackages.list; i < npkgs; i++, p++) {
+ p->npreds = p->tsi.tsi_count;
+ }
+
/* T4. Scan for zeroes. */
rpmMessage(RPMMESS_DEBUG, _("========== tsorting packages\n"));
@@ -1734,7 +1736,8 @@ rescan:
for (i = 0, p = ts->addedPackages.list; i < npkgs; i++, p++) {
/* Prefer packages in presentation order. */
- p->tsi.tsi_qcnt = (npkgs - i);
+ if (!chainsaw)
+ p->tsi.tsi_qcnt = (npkgs - i);
if (p->tsi.tsi_count != 0)
continue;
@@ -1746,8 +1749,9 @@ rescan:
/* T5. Output front of queue (T7. Remove from queue.) */
for (; q != NULL; q = q->tsi.tsi_suc) {
- rpmMessage(RPMMESS_DEBUG, "%5d (%d,%d) %s-%s-%s\n", orderingCount,
- qlen, q->tsi.tsi_qcnt,
+ rpmMessage(RPMMESS_DEBUG, "%4d%4d%4d%4d %*s %s-%s-%s\n",
+ orderingCount, q->npreds, q->tsi.tsi_qcnt, q->depth,
+ 2*q->depth, "",
q->name, q->version, q->release);
ordering[orderingCount++] = q - ts->addedPackages.list;
qlen--;
@@ -1766,7 +1770,7 @@ rescan:
addQ(p, &q->tsi.tsi_suc, &r);
qlen++;
}
- free(tsi);
+ tsi = _free(tsi);
}
if (!_printed && loopcheck == qlen && q->tsi.tsi_suc != NULL) {
_printed++;
@@ -1831,10 +1835,7 @@ rescan:
sprintf(buf, "%s-%s-%s", p->name, p->version, p->release);
rpmMessage(RPMMESS_WARNING, " %-40s %s\n", buf, dp);
- if (dp) {
- free((void *)dp);
- dp = NULL;
- }
+ dp = _free((void *)dp);
}
/* Walk (and erase) linear part of predecessor chain as well. */
@@ -1902,10 +1903,10 @@ rescan:
}
assert(newOrderCount == ts->orderCount);
- free(ts->order);
+ ts->order = _free(ts->order);
ts->order = newOrder;
ts->orderAlloced = ts->orderCount;
- free(orderList);
+ orderList = _free(orderList);
return 0;
}
@@ -2032,7 +2033,7 @@ int rpmdepCheck(rpmTransactionSet ts,
break;
}
- free(fileName);
+ fileName = _free(fileName);
baseNames = hfd(baseNames, bnt);
dirNames = hfd(dirNames, dnt);
if (rc)
@@ -2045,19 +2046,16 @@ int rpmdepCheck(rpmTransactionSet ts,
mi = NULL;
}
- if (!ps.num) {
- free(ps.problems);
- } else {
+ if (ps.num) {
*conflicts = ps.problems;
+ ps.problems = NULL;
*numConflicts = ps.num;
}
- ps.problems = NULL;
rc = 0;
exit:
if (mi)
rpmdbFreeIterator(mi);
- if (ps.problems)
- free(ps.problems);
+ ps.problems = _free(ps.problems);
return rc;
}
diff --git a/lib/depends.h b/lib/depends.h
index e5f5e79a6..41dddac48 100644
--- a/lib/depends.h
+++ b/lib/depends.h
@@ -43,6 +43,8 @@ struct availablePackage {
int providesCount; /*!< No. of Provide:'s in header. */
int requiresCount; /*!< No. of Require:'s in header. */
int filesCount; /*!< No. of files in header. */
+ int npreds; /*!< No. of predecessors. */
+ int depth; /*!< Max. depth in dependency tree. */
struct tsortInfo tsi; /*!< Dependency tsort data. */
uint_32 multiLib; /* MULTILIB */
/*@kept@*/ const void * key; /*!< Private data associated with a package (e.g. file name of package). */
@@ -165,7 +167,6 @@ struct problemsSet {
extern "C" {
#endif
-/* XXX lib/scriptlet.c */
/** \ingroup rpmdep
* Compare package name-version-release from header with dependency, looking
* for overlap.
diff --git a/lib/misc.c b/lib/misc.c
index 174d0d936..c8aac96e6 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -796,6 +796,8 @@ void providePackageNVR(Header h)
/* Generate provides for this package name-version-release. */
headerNVR(h, &name, &version, &release);
+ if (!(name && version && release))
+ return;
pEVR = p = alloca(21 + strlen(version) + 1 + strlen(release) + 1);
*p = '\0';
if (headerGetEntry(h, RPMTAG_EPOCH, NULL, (void **) &epoch, NULL)) {
diff --git a/lib/package.c b/lib/package.c
index bd789800b..e71c5efa6 100644
--- a/lib/package.c
+++ b/lib/package.c
@@ -143,10 +143,12 @@ static rpmRC readPackageHeaders(FD_t fd, /*@out@*/ struct rpmlead * leadPtr,
if (headerIsEntry(*hdr, RPMTAG_FILEGROUPNAME))
headerRemoveEntry(*hdr, RPMTAG_FILEGIDS);
- /* We switched the way we do relocateable packages. We fix some of
- it up here, though the install code still has to be a bit
- careful. This fixup makes queries give the new values though,
- which is quite handy. */
+ /*
+ * We switched the way we do relocateable packages. We fix some of
+ * it up here, though the install code still has to be a bit
+ * careful. This fixup makes queries give the new values though,
+ * which is quite handy.
+ */
if (headerGetEntry(*hdr, RPMTAG_DEFAULTPREFIX, NULL,
(void **) &defaultPrefix, NULL)) {
defaultPrefix =
diff --git a/lib/rpminstall.c b/lib/rpminstall.c
index 351b3d9e6..db7e52960 100644
--- a/lib/rpminstall.c
+++ b/lib/rpminstall.c
@@ -228,10 +228,9 @@ int rpmInstall(const char * rootdir, const char ** fileArgv,
rc = rpmGlob(*fnp, &ac, &av);
if (rc || ac == 0) continue;
- if (argc == 0)
- argv = xmalloc((argc+2) * sizeof(*argv));
- else
- argv = xrealloc(argv, (argc+2) * sizeof(*argv));
+ argv = (argc == 0)
+ ? xmalloc((argc+2) * sizeof(*argv))
+ : xrealloc(argv, (argc+2) * sizeof(*argv));
memcpy(argv+argc, av, ac * sizeof(*av));
argc += ac;
argv[argc] = NULL;
@@ -547,6 +546,7 @@ exit:
}
pkgState = _free(pkgState);
pkgURL = _free(pkgURL);
+ argv = _free(argv);
if (dbIsOpen) rpmdbClose(db);
return numFailed;
}
diff --git a/lib/rpmlib.h b/lib/rpmlib.h
index 53c160ff9..3046b95af 100644
--- a/lib/rpmlib.h
+++ b/lib/rpmlib.h
@@ -78,7 +78,7 @@ void headerMergeLegacySigs(Header h, const Header sig)
/** \ingroup header
* Regenerate signature header.
* @param h header
- * @return regenerated signature header
+ * @return regenerated signature header
*/
Header headerRegenSigHeader(const Header h) /*@*/;
@@ -1097,6 +1097,8 @@ typedef enum rpmtransFlags_e {
RPMTRANS_FLAG_NOTRIGGERPOSTUN = (1 << 23),
RPMTRANS_FLAG_NOPAYLOAD = (1 << 24),
RPMTRANS_FLAG_APPLYONLY = (1 << 25),
+
+ RPMTRANS_FLAG_CHAINSAW = (1 << 26),
} rpmtransFlags;
#define _noTransScripts \
@@ -1499,7 +1501,7 @@ typedef enum rpmInstallInterfaceFlags_e {
INSTALL_NOORDER = (1 << 3), /*!< from --noorder */
INSTALL_LABEL = (1 << 4), /*!< from --verbose (notify) */
INSTALL_UPGRADE = (1 << 5), /*!< from --upgrade */
- INSTALL_FRESHEN = (1 << 6), /*!< from --freshen */
+ INSTALL_FRESHEN = (1 << 6) /*!< from --freshen */
} rpmInstallInterfaceFlags;
/** \ingroup rpmcli
@@ -1535,7 +1537,7 @@ int rpmInstallSource(const char * prefix, const char * arg,
typedef enum rpmEraseInterfaceFlags_e {
UNINSTALL_NONE = 0,
UNINSTALL_NODEPS = (1 << 0), /*!< from --nodeps */
- UNINSTALL_ALLMATCHES= (1 << 1), /*!< from --allmatches */
+ UNINSTALL_ALLMATCHES= (1 << 1) /*!< from --allmatches */
} rpmEraseInterfaceFlags;
/** \ingroup rpmcli
@@ -1598,7 +1600,7 @@ typedef enum rpmVerifySignatureReturn_e {
RPMSIG_UNKNOWN = 1, /*!< Signature is unknown. */
RPMSIG_BAD = 2, /*!< Signature does not verify. */
RPMSIG_NOKEY = 3, /*!< Key is unavailable. */
- RPMSIG_NOTTRUSTED = 4, /*!< Signature is OK, but key is not trusted. */
+ RPMSIG_NOTTRUSTED = 4 /*!< Signature is OK, but key is not trusted. */
} rpmVerifySignatureReturn;
/** \ingroup signature
@@ -1627,7 +1629,7 @@ typedef enum rpmCheckSigFlags_e {
CHECKSIG_NONE = 0, /*!< Don't check any signatures. */
CHECKSIG_PGP = (1 << 0), /*!< if not --nopgp */
CHECKSIG_MD5 = (1 << 1), /*!< if not --nomd5 */
- CHECKSIG_GPG = (1 << 2), /*!< if not --nogpg */
+ CHECKSIG_GPG = (1 << 2) /*!< if not --nogpg */
} rpmCheckSigFlags;
/** \ingroup rpmcli
@@ -1643,7 +1645,7 @@ int rpmCheckSig(rpmCheckSigFlags flags, const char ** argv);
*/
typedef enum rpmResignFlags_e {
RESIGN_NEW_SIGNATURE = 0, /*!< from --resign */
- RESIGN_ADD_SIGNATURE, /*!< from --addsign */
+ RESIGN_ADD_SIGNATURE /*!< from --addsign */
} rpmResignFlags;
/** \ingroup rpmcli
diff --git a/lib/rpmlibprov.c b/lib/rpmlibprov.c
index 932930a50..1613b138e 100644
--- a/lib/rpmlibprov.c
+++ b/lib/rpmlibprov.c
@@ -31,7 +31,7 @@ static struct rpmlibProvides {
{ "rpmlib(HeaderLoadSortsTags)", "4.0.1-1",
( RPMSENSE_EQUAL),
N_("header tags are always sorted after being loaded.") },
- { NULL, NULL, NULL, 0 }
+ { NULL, NULL, 0, NULL }
};
void rpmShowRpmlibProvides(FILE * fp)
diff --git a/lib/transaction.c b/lib/transaction.c
index 06a3b8af1..c74e5fb38 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -173,7 +173,7 @@ static void psAppend(rpmProblemSet probs, rpmProblemType type,
}
if (altH) {
- const char *n, *v, *r;
+ const char * n, * v, * r;
headerNVR(altH, &n, &v, &r);
p->altNEVR =
t = xmalloc(strlen(n) + strlen(v) + strlen(r) + sizeof("--"));
@@ -578,7 +578,7 @@ static Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
if (strcmp(baseNames[i], te)) /* basename changed too? */
baseNames[i] = alloca_strdup(te);
*te = '\0'; /* terminate new directory name */
- }
+ }
/* Does this directory already exist in the directory list? */
for (j = 0; j < dirCount; j++) {
@@ -671,7 +671,7 @@ static Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
baseNames, fileCount);
fi->bnl = hfd(fi->bnl, RPM_STRING_ARRAY_TYPE);
hge(h, RPMTAG_BASENAMES, NULL, (void **) &fi->bnl, &fi->fc);
-
+
headerModifyEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
dirNames, dirCount);
fi->dnl = hfd(fi->dnl, RPM_STRING_ARRAY_TYPE);
@@ -684,7 +684,7 @@ static Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
baseNames = hfd(baseNames, RPM_STRING_ARRAY_TYPE);
dirNames = hfd(dirNames, RPM_STRING_ARRAY_TYPE);
- if (fn) free(fn);
+ fn = _free(fn);
return h;
}
@@ -1227,7 +1227,6 @@ static void skipFiles(const rpmTransactionSet ts, TFI_t fi)
tmpPath = _free(tmpPath);
}
-
s = rpmExpand("%{_install_langs}", NULL);
if (!(s && *s != '%'))
s = _free(s);
@@ -1321,6 +1320,7 @@ static void skipFiles(const rpmTransactionSet ts, TFI_t fi)
if (noDocs && (fi->fflags[i] & RPMFILE_DOC)) {
drc[ix]--; dff[ix] = 1;
fi->actions[i] = FA_SKIPNSTATE;
+ continue;
}
}
@@ -1640,7 +1640,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
preTransCount = 0;
fi->type = ts->order[oc].type;
- switch (ts->order[oc].type) {
+ switch (fi->type) {
case TR_ADDED:
i = ts->order[oc].u.addedIndex;
alp = ts->addedPackages.list + i;
@@ -1846,7 +1846,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
NULL, ts->notifyData));
if (ts->chrootDone) {
- /*@-unrecog@*/ chroot("."); /*@-unrecog@*/
+ /*@-unrecog@*/ chroot("."); /*@-unrecog@*/
ts->chrootDone = 0;
chdir(ts->currDir);
}
@@ -1915,7 +1915,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
gotfd = 0;
psm->fi = fi;
switch (fi->type)
- {
+ {
case TR_ADDED:
alp = tsGetAlp(tsi);
assert(alp == fi->ap);
diff --git a/po/rpm.pot b/po/rpm.pot
index d3f49558e..515203e89 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-04-04 13:52-0400\n"
+"POT-Creation-Date: 2001-04-18 16:40-0400\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"
@@ -2375,104 +2375,104 @@ msgid "%s has too large or too small integer value, skipped\n"
msgstr ""
#. XXX legacy epoch-less requires/conflicts compatibility
-#: lib/depends.c:570
+#: lib/depends.c:571
#, c-format
msgid ""
"the \"B\" dependency needs an epoch (assuming same as \"A\")\n"
"\tA %s\tB %s\n"
msgstr ""
-#: lib/depends.c:599
+#: lib/depends.c:600
#, c-format
msgid " %s A %s\tB %s\n"
msgstr ""
-#: lib/depends.c:967
+#: lib/depends.c:960
#, c-format
msgid "%s: %-45s YES (added files)\n"
msgstr ""
-#: lib/depends.c:1026
+#: lib/depends.c:1019
#, c-format
msgid "%s: %-45s YES (added provide)\n"
msgstr ""
-#: lib/depends.c:1078
+#: lib/depends.c:1071
#, c-format
msgid "%s: %-45s %-3s (cached)\n"
msgstr ""
-#: lib/depends.c:1097
+#: lib/depends.c:1090
#, c-format
msgid "%s: %-45s YES (rpmrc provides)\n"
msgstr ""
-#: lib/depends.c:1114
+#: lib/depends.c:1107
#, c-format
msgid "%s: %-45s YES (rpmlib provides)\n"
msgstr ""
-#: lib/depends.c:1136
+#: lib/depends.c:1129
#, c-format
msgid "%s: %-45s YES (db files)\n"
msgstr ""
-#: lib/depends.c:1149
+#: lib/depends.c:1142
#, c-format
msgid "%s: %-45s YES (db provides)\n"
msgstr ""
-#: lib/depends.c:1163
+#: lib/depends.c:1156
#, c-format
msgid "%s: %-45s YES (db package)\n"
msgstr ""
-#: lib/depends.c:1179
+#: lib/depends.c:1172
#, c-format
msgid "%s: %-45s NO\n"
msgstr ""
-#: lib/depends.c:1200
+#: lib/depends.c:1193
#, c-format
msgid "%s: (%s, %s) added to Depends cache.\n"
msgstr ""
#. requirements are not satisfied.
-#: lib/depends.c:1261
+#: lib/depends.c:1254
#, c-format
msgid "package %s-%s-%s require not satisfied: %s\n"
msgstr ""
#. conflicts exist.
-#: lib/depends.c:1328
+#: lib/depends.c:1321
#, c-format
msgid "package %s conflicts: %s\n"
msgstr ""
-#: lib/depends.c:1543
+#: lib/depends.c:1536
#, c-format
msgid "removing %s-%s-%s \"%s\" from tsort relations.\n"
msgstr ""
#. Record all relations.
-#: lib/depends.c:1682
+#: lib/depends.c:1679
msgid "========== recording tsort relations\n"
msgstr ""
#. T4. Scan for zeroes.
-#: lib/depends.c:1729
+#: lib/depends.c:1731
msgid "========== tsorting packages\n"
msgstr ""
-#: lib/depends.c:1774
+#: lib/depends.c:1778
msgid "========== successors only (presentation order)\n"
msgstr ""
-#: lib/depends.c:1823
+#: lib/depends.c:1827
msgid "LOOP:\n"
msgstr ""
-#: lib/depends.c:1854
+#: lib/depends.c:1855
msgid "========== continuing tsort ...\n"
msgstr ""
@@ -2877,57 +2877,57 @@ msgstr ""
msgid " conflicts with %s-%s-%s\n"
msgstr ""
-#: lib/problems.c:99
+#: lib/problems.c:118
#, c-format
msgid "package %s is for a different architecture"
msgstr ""
-#: lib/problems.c:103
+#: lib/problems.c:122
#, c-format
msgid "package %s is for a different operating system"
msgstr ""
-#: lib/problems.c:107
+#: lib/problems.c:126
#, c-format
msgid "package %s is already installed"
msgstr ""
-#: lib/problems.c:111
+#: lib/problems.c:130
#, c-format
msgid "path %s in package %s is not relocateable"
msgstr ""
-#: lib/problems.c:116
+#: lib/problems.c:135
#, c-format
msgid "file %s conflicts between attempted installs of %s and %s"
msgstr ""
-#: lib/problems.c:121
+#: lib/problems.c:140
#, c-format
msgid "file %s from install of %s conflicts with file from package %s"
msgstr ""
-#: lib/problems.c:126
+#: lib/problems.c:145
#, c-format
msgid "package %s (which is newer than %s) is already installed"
msgstr ""
-#: lib/problems.c:131
+#: lib/problems.c:150
#, c-format
msgid "installing package %s needs %ld%cb on the %s filesystem"
msgstr ""
-#: lib/problems.c:141
+#: lib/problems.c:160
#, c-format
msgid "installing package %s needs %ld inodes on the %s filesystem"
msgstr ""
-#: lib/problems.c:146
+#: lib/problems.c:165
#, c-format
msgid "package %s pre-transaction syscall(s): %s failed: %s"
msgstr ""
-#: lib/problems.c:153
+#: lib/problems.c:172
#, c-format
msgid "unknown error %d encountered while manipulating package %s"
msgstr ""
@@ -3110,7 +3110,7 @@ msgstr ""
msgid "record %d could not be read\n"
msgstr ""
-#: lib/query.c:744 lib/rpminstall.c:591
+#: lib/query.c:744 lib/rpminstall.c:592
#, c-format
msgid "package %s is not installed\n"
msgstr ""
@@ -3391,7 +3391,7 @@ msgstr ""
msgid "file %s requires a newer version of RPM\n"
msgstr ""
-#: lib/rpminstall.c:439 lib/rpminstall.c:659
+#: lib/rpminstall.c:439 lib/rpminstall.c:660
#, c-format
msgid "%s cannot be installed\n"
msgstr ""
@@ -3414,26 +3414,26 @@ msgstr ""
msgid "cannot open file %s: %s\n"
msgstr ""
-#: lib/rpminstall.c:578
+#: lib/rpminstall.c:579
#, c-format
msgid "cannot open %s/packages.rpm\n"
msgstr ""
-#: lib/rpminstall.c:594
+#: lib/rpminstall.c:595
#, c-format
msgid "\"%s\" specifies multiple packages\n"
msgstr ""
-#: lib/rpminstall.c:617
+#: lib/rpminstall.c:618
msgid "removing these packages would break dependencies:\n"
msgstr ""
-#: lib/rpminstall.c:646
+#: lib/rpminstall.c:647
#, c-format
msgid "cannot open %s: %s\n"
msgstr ""
-#: lib/rpminstall.c:652
+#: lib/rpminstall.c:653
#, c-format
msgid "Installing %s\n"
msgstr ""
diff --git a/python/rpmmodule.c b/python/rpmmodule.c
index 1dd736024..68e92412f 100644
--- a/python/rpmmodule.c
+++ b/python/rpmmodule.c
@@ -67,7 +67,7 @@ static PyObject * pyrpmError;
* import os, rpm
*
* fd = os.open("/tmp/foo-1.0-1.i386.rpm", os.O_RDONLY)
- * (isSource, header) = rpm.headerFromPackage(fd)
+ * (header, isSource) = rpm.headerFromPackage(fd)
* fd.close()
* \endcode
* The Python interface to the header data is quite elegant. It
@@ -2291,6 +2291,7 @@ static PyMethodDef rpmModuleMethods[] = {
{ "initdb", (PyCFunction) rpmInitDB, METH_VARARGS, NULL },
{ "opendb", (PyCFunction) rpmOpenDB, METH_VARARGS, NULL },
{ "rebuilddb", (PyCFunction) rebuildDB, METH_VARARGS, NULL },
+ { "mergeHeaderListFromFD", (PyCFunction) rpmMergeHeadersFromFD, METH_VARARGS, NULL },
{ "readHeaderListFromFD", (PyCFunction) rpmHeaderFromFD, METH_VARARGS, NULL },
{ "readHeaderListFromFile", (PyCFunction) rpmHeaderFromFile, METH_VARARGS, NULL },
{ "errorSetCallback", (PyCFunction) errorSetCallback, METH_VARARGS, NULL },
diff --git a/rpm.c b/rpm.c
index a6515261b..5bda69e39 100755
--- a/rpm.c
+++ b/rpm.c
@@ -531,8 +531,6 @@ static void printHelp(void) {
_("build the packages for the build targets platform1...platformN."));
printHelpLine( " --nobuild ",
_("do not execute any stages"));
- printHelpLine(_(" --timecheck <secs> "),
- _("set the time check to <secs> seconds (0 disables)"));
puts("");
printHelpLine(_(" --rebuild <src_pkg> "),
_("install source package, build binary package and remove spec file, sources, patches, and icons."));
diff --git a/rpmio/Makefile.am b/rpmio/Makefile.am
index 08786f9fe..8ef4482a7 100644
--- a/rpmio/Makefile.am
+++ b/rpmio/Makefile.am
@@ -39,3 +39,9 @@ tkey: librpmio.la tkey.o
tdigest.o: tdigest.c
tdigest: librpmio.la tdigest.o
$(LINK) -o $@ tdigest.o librpmio.la $(top_builddir)/popt/libpopt.la
+
+tficl.o: tficl.c
+ $(COMPILE) -I/usr/include/ficl -o $@ -c tficl.c
+
+tficl: tficl.o
+ $(LINK) -o $@ tficl.o -lficl
diff --git a/rpmio/rpmlog.c b/rpmio/rpmlog.c
index 8e060d81c..526aae3a6 100644
--- a/rpmio/rpmlog.c
+++ b/rpmio/rpmlog.c
@@ -124,8 +124,10 @@ static void vrpmlog (unsigned code, const char *fmt, va_list ap)
/* Allocate a sufficently large buffer for output. */
while (1) {
+ va_list apc;
+ __va_copy(apc, ap);
/*@-unrecog@*/
- nb = vsnprintf(msgbuf, msgnb, fmt, ap);
+ nb = vsnprintf(msgbuf, msgnb, fmt, apc);
/*@=unrecog@*/
if (nb > -1 && nb < msgnb)
break;
diff --git a/rpmio/tficl.c b/rpmio/tficl.c
index 6cc87ed4a..a41c03b57 100644
--- a/rpmio/tficl.c
+++ b/rpmio/tficl.c
@@ -7,9 +7,6 @@
#include <stdio.h>
#include <string.h>
#include <time.h>
-#ifdef WIN32
-#include <direct.h>
-#endif
#include <sys/types.h>
#include <sys/stat.h>
#ifdef linux
@@ -27,11 +24,7 @@ static void ficlGetCWD(FICL_VM *pVM)
{
char *cp;
-#ifdef WIN32
- cp = _getcwd(NULL, 80);
-#else
cp = getcwd(NULL, 80);
-#endif
vmTextOut(pVM, cp, 1);
free(cp);
return;
@@ -50,11 +43,7 @@ static void ficlChDir(FICL_VM *pVM)
vmGetString(pVM, pFS, '\n');
if (pFS->count > 0)
{
-#ifdef WIN32
- int err = _chdir(pFS->text);
-#else
int err = chdir(pFS->text);
-#endif
if (err)
{
vmTextOut(pVM, "Error: path not found", 1);
@@ -115,12 +104,7 @@ static void ficlLoad(FICL_VM *pVM)
FILE *fp;
int result;
CELL id;
-#ifdef WIN32
- struct _stat buf;
-#else
struct stat buf;
-#endif
-
vmGetString(pVM, pFilename, '\n');
@@ -133,11 +117,7 @@ static void ficlLoad(FICL_VM *pVM)
/*
** get the file's size and make sure it exists
*/
-#ifdef WIN32
- result = _stat( pFilename->text, &buf );
-#else
result = stat( pFilename->text, &buf );
-#endif
if (result != 0)
{
@@ -274,7 +254,7 @@ static void execxt(FICL_VM *pVM)
}
-void buildTestInterface(void)
+static void buildTestInterface(void)
{
ficlBuild("break", ficlBreak, FW_DEFAULT);
ficlBuild("clock", ficlClock, FW_DEFAULT);
@@ -291,42 +271,52 @@ void buildTestInterface(void)
}
-#if !defined (_WINDOWS)
-#define nINBUF 256
+static int quiet = 0;
+
int main(int argc, char **argv)
{
- char in[nINBUF];
+ char in[BUFSIZ], * s;
FICL_VM *pVM;
+ extern char * optarg;
+ extern int optind, opterr, optopt;
+ int errflg = 0;
+ int ret;
+ int c;
+
+ while ((c = getopt(argc, argv, "q")) != EOF)
+ switch (c) {
+ case 'q':
+ quiet++;
+ break;
+ case '?':
+ default:
+ errflg++;
+ break;
+ }
ficlInitSystem(10000);
buildTestInterface();
pVM = ficlNewVM();
- ficlExec(pVM, ".ver .( " __DATE__ " ) cr quit");
+ if (!quiet)
+ ficlExec(pVM, ".ver .( " __DATE__ " ) cr quit");
- /*
- ** load file from cmd line...
- */
- if (argc > 1)
- {
- sprintf(in, ".( loading %s ) cr load %s\n cr", argv[1], argv[1]);
+ for ( ; optind < argc; optind++) {
+ sprintf(in, ".( loading %s ) cr load %s\n cr", argv[optind], argv[optind]);
ficlExec(pVM, in);
}
- for (;;)
- {
- int ret;
- fgets(in, nINBUF, stdin);
- ret = ficlExec(pVM, in);
- if (ret == VM_USEREXIT)
- {
- ficlTermSystem();
- break;
- }
- }
+ s = in;
+ if (!quiet)
+ *s++ = '\n';
+ *s++ = '\0';
+ ret = 0;
+ do {
+ if (in[0])
+ ret = ficlExec(pVM, in);
+ } while (ret != VM_USEREXIT && (s = fgets(in, sizeof(in)-1, stdin)) != NULL);
+
+ ficlTermSystem();
return 0;
}
-
-#endif
-
diff --git a/tools/rpmsort.c b/tools/rpmsort.c
index 441ec6d92..d392fc605 100644
--- a/tools/rpmsort.c
+++ b/tools/rpmsort.c
@@ -1,66 +1,203 @@
#include "system.h"
-#include "rpmbuild.h"
-#include "buildio.h"
+#include <rpmlib.h>
+#include <rpmmacro.h>
+#include <rpmurl.h>
#include "depends.h"
-#include "header.h"
+
+#include "manifest.h"
+#include "misc.h"
#include "debug.h"
extern int _depends_debug;
+static int noAvailable = 0;
+static const char * avdbpath =
+ "/usr/lib/rpmdb/%{_arch}-%{_vendor}-%{_os}/redhat";
+static int noChainsaw = 0;
static int noDeps = 0;
+/**
+ * Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
+ * @param this memory to free
+ * @retval NULL always
+ */
+static /*@null@*/ void * _free(/*@only@*/ /*@null@*/ const void * this) {
+ if (this) free((void *)this);
+ return NULL;
+}
+
static int
do_tsort(const char *fileArgv[])
{
const char * rootdir = "/";
- const char ** fileURL;
- int numPkgs;
- int numFailed = 0;
rpmdb rpmdb = NULL;
rpmTransactionSet ts = NULL;
+ const char ** pkgURL = NULL;
+ char * pkgState = NULL;
+ const char ** fnp;
+ const char * fileURL = NULL;
+ int numPkgs = 0;
+ int numFailed = 0;
+ int prevx;
+ int pkgx;
+ const char ** argv = NULL;
+ int argc = 0;
+ const char ** av = NULL;
+ int ac = 0;
Header h;
- int rc;
+ int rc = 0;
+ int i;
if (fileArgv == NULL)
return 0;
- if (rpmdbOpen(rootdir, &rpmdb, O_RDONLY, 0644)) {
+ rc = rpmdbOpen(rootdir, &rpmdb, O_RDONLY, 0644);
+ if (rc) {
rpmMessage(RPMMESS_ERROR, _("cannot open Packages database\n"));
rc = -1;
goto exit;
}
ts = rpmtransCreateSet(rpmdb, rootdir);
+ if (!noChainsaw)
+ ts->transFlags = RPMTRANS_FLAG_CHAINSAW;
+
+ /* Load all the available packages. */
+ if (!(noDeps || noAvailable)) {
+ rpmdbMatchIterator mi = NULL;
+ struct rpmdb_s * avdb = NULL;
+
+ addMacro(NULL, "_dbpath", NULL, avdbpath, RMIL_CMDLINE);
+ rc = rpmdbOpen(rootdir, &avdb, O_RDONLY, 0644);
+ delMacro(NULL, "_dbpath");
+ if (rc) {
+ rpmMessage(RPMMESS_ERROR, _("cannot open Available database\n"));
+ goto endavail;
+ }
+ mi = rpmdbInitIterator(avdb, RPMDBI_PACKAGES, NULL, 0);
+ while ((h = rpmdbNextIterator(mi)) != NULL) {
+ rpmtransAvailablePackage(ts, h, NULL);
+ }
+
+endavail:
+ if (mi) rpmdbFreeIterator(mi);
+ if (avdb) rpmdbClose(avdb);
+ }
+
+ /* Build fully globbed list of arguments in argv[argc]. */
+ for (fnp = fileArgv; *fnp; fnp++) {
+ av = _free(av);
+ ac = 0;
+ rc = rpmGlob(*fnp, &ac, &av);
+ if (rc || ac == 0) continue;
+
+ argv = (argc == 0)
+ ? xmalloc((argc+2) * sizeof(*argv))
+ : xrealloc(argv, (argc+2) * sizeof(*argv));
+ memcpy(argv+argc, av, ac * sizeof(*av));
+ argc += ac;
+ argv[argc] = NULL;
+ }
+ av = _free(av);
+
+ numPkgs = 0;
+ prevx = 0;
+ pkgx = 0;
+
+restart:
+ /* Allocate sufficient storage for next set of args. */
+ if (pkgx >= numPkgs) {
+ numPkgs = pkgx + argc;
+ pkgURL = (pkgURL == NULL)
+ ? xmalloc( (numPkgs + 1) * sizeof(*pkgURL))
+ : xrealloc(pkgURL, (numPkgs + 1) * sizeof(*pkgURL));
+ memset(pkgURL + pkgx, 0, ((argc + 1) * sizeof(*pkgURL)));
+ pkgState = (pkgState == NULL)
+ ? xmalloc( (numPkgs + 1) * sizeof(*pkgState))
+ : xrealloc(pkgState, (numPkgs + 1) * sizeof(*pkgState));
+ memset(pkgState + pkgx, 0, ((argc + 1) * sizeof(*pkgState)));
+ }
- for (fileURL = fileArgv, numPkgs = 0; *fileURL; fileURL++, numPkgs++)
- ;
+ /* Copy next set of args. */
+ for (i = 0; i < argc; i++) {
+ fileURL = _free(fileURL);
+ fileURL = argv[i];
+ argv[i] = NULL;
+ pkgURL[pkgx] = fileURL;
+ fileURL = NULL;
+ pkgx++;
+ }
+ fileURL = _free(fileURL);
- for (fileURL = fileArgv; *fileURL; fileURL++) {
+ /* Continue processing file arguments, building transaction set. */
+ for (fnp = pkgURL+prevx; *fnp; fnp++, prevx++) {
const char * fileName;
- rpmRC rpmrc;
+ int isSource;
FD_t fd;
- (void) urlPath(*fileURL, &fileName);
- fd = Fopen(*fileURL, "r.ufdio");
+ (void) urlPath(*fnp, &fileName);
+
+ /* Try to read the header from a package file. */
+ fd = Fopen(*fnp, "r.ufdio");
if (fd == NULL || Ferror(fd)) {
- rpmMessage(RPMMESS_ERROR, _("cannot open file %s: %s\n"), *fileURL,
- Fstrerror(fd));
+ rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), *fnp,
+ Fstrerror(fd));
if (fd) Fclose(fd);
- numFailed++;
- continue;
- }
+ numFailed++; *fnp = NULL;
+ continue;
+ }
- rpmrc = rpmReadPackageHeader(fd, &h, NULL, NULL, NULL);
+ rc = rpmReadPackageHeader(fd, &h, &isSource, NULL, NULL);
+ Fclose(fd);
- rc = rpmtransAddPackage(ts, h, NULL, fileName, 0, NULL);
+ if (rc == 2) {
+ numFailed++; *fnp = NULL;
+ continue;
+ }
+
+ if (rc == 0) {
+ rc = rpmtransAddPackage(ts, h, NULL, fileName, 0, NULL);
+ headerFree(h); /* XXX reference held by transaction set */
+ continue;
+ }
+
+ if (rc != 1) {
+ rpmMessage(RPMMESS_ERROR, _("%s cannot be installed\n"), *fnp);
+ numFailed++; *fnp = NULL;
+ break;
+ }
- headerFree(h); /* XXX reference held by transaction set */
+ /* Try to read a package manifest. */
+ fd = Fopen(*fnp, "r.fpio");
+ if (fd == NULL || Ferror(fd)) {
+ rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), *fnp,
+ Fstrerror(fd));
+ if (fd) Fclose(fd);
+ numFailed++; *fnp = NULL;
+ break;
+ }
+
+ /* Read list of packages from manifest. */
+ rc = rpmReadPackageManifest(fd, &argc, &argv);
+ if (rc)
+ rpmError(RPMERR_MANIFEST, _("%s: read manifest failed: %s\n"),
+ fileURL, Fstrerror(fd));
Fclose(fd);
+ /* If successful, restart the query loop. */
+ if (rc == 0) {
+ prevx++;
+ goto restart;
+ }
+
+ numFailed++; *fnp = NULL;
+ break;
}
+ if (numFailed) goto exit;
+
if (!noDeps) {
struct rpmDependencyConflict * conflicts = NULL;
int numConflicts = 0;
@@ -87,6 +224,7 @@ do_tsort(const char *fileArgv[])
const char * str;
int i;
+ alp = NULL;
str = "???";
switch (ts->order[oc].type) {
case TR_ADDED:
@@ -107,9 +245,14 @@ do_tsort(const char *fileArgv[])
}
if (h) {
- const char *n, *v, *r;
- headerNVR(h, &n, &v, &r);
- fprintf(stdout, "%s %s-%s-%s\n", str, n, v, r);
+ if (alp && alp->key) {
+ const char * fn = alp->key;
+ fprintf(stdout, "%s %s\n", str, fn);
+ } else {
+ const char *n, *v, *r;
+ headerNVR(h, &n, &v, &r);
+ fprintf(stdout, "%s %s-%s-%s\n", str, n, v, r);
+ }
headerFree(h);
}
@@ -119,18 +262,20 @@ do_tsort(const char *fileArgv[])
rc = 0;
exit:
- if (ts) {
- rpmtransFree(ts);
- ts = NULL;
- }
- if (rpmdb) {
- rpmdbClose(rpmdb);
- rpmdb = NULL;
+ if (ts) rpmtransFree(ts);
+ for (i = 0; i < numPkgs; i++) {
+ pkgURL[i] = _free(pkgURL[i]);
}
+ pkgState = _free(pkgState);
+ pkgURL = _free(pkgURL);
+ argv = _free(argv);
+ if (rpmdb) rpmdbClose(rpmdb);
return rc;
}
static struct poptOption optionsTable[] = {
+ { "noavailable", '\0', 0, &noAvailable, 0, NULL, NULL},
+ { "nochainsaw", '\0', 0, &noChainsaw, 0, NULL, NULL},
{ "nodeps", '\0', 0, &noDeps, 0, NULL, NULL},
{ "verbose", 'v', 0, 0, 'v', NULL, NULL},
{ NULL, 0, 0, 0, 0, NULL, NULL}