summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRakesh Pandit <rakesh@fedoraproject.org>2009-02-12 17:57:35 +0530
committerPanu Matilainen <pmatilai@redhat.com>2009-02-16 09:27:59 +0200
commit73d7e90f5e074f8cf03dafa8a4493ca7cbd66848 (patch)
tree812c152fa8e2701fe3a5daedd3d8efb6bba56d60 /lib
parent1fbdab96551c55e55fd6d9ebcf7b6a824e594816 (diff)
downloadlibrpm-tizen-73d7e90f5e074f8cf03dafa8a4493ca7cbd66848.tar.gz
librpm-tizen-73d7e90f5e074f8cf03dafa8a4493ca7cbd66848.tar.bz2
librpm-tizen-73d7e90f5e074f8cf03dafa8a4493ca7cbd66848.zip
-Moved maifest checking from rpmInstall to rpmCheckManifest.
Diffstat (limited to 'lib')
-rw-r--r--lib/rpminstall.c70
1 files changed, 36 insertions, 34 deletions
diff --git a/lib/rpminstall.c b/lib/rpminstall.c
index 231cc1700..1ebba6768 100644
--- a/lib/rpminstall.c
+++ b/lib/rpminstall.c
@@ -290,6 +290,37 @@ static int rpmcliTransaction(rpmts ts, struct rpmInstallArguments_s * ia,
return rc;
}
+static int tryReadManifest(struct rpmEIU * eiu)
+{
+ int rc, xx;
+
+ /* Try to read a package manifest. */
+ eiu->fd = Fopen(*eiu->fnp, "r.fpio");
+ if (eiu->fd == NULL || Ferror(eiu->fd)) {
+ rpmlog(RPMLOG_ERR, _("open of %s failed: %s\n"), *eiu->fnp,
+ Fstrerror(eiu->fd));
+ if (eiu->fd != NULL) {
+ xx = Fclose(eiu->fd);
+ eiu->fd = NULL;
+ }
+ eiu->numFailed++; *eiu->fnp = NULL;
+ return RPMRC_FAIL;
+ }
+
+ /* Read list of packages from manifest. */
+ rc = rpmReadPackageManifest(eiu->fd, &eiu->argc, &eiu->argv);
+ if (rc != RPMRC_OK)
+ rpmlog(RPMLOG_ERR, _("%s: not an rpm package (or package manifest): %s\n"),
+ *eiu->fnp, Fstrerror(eiu->fd));
+ xx = Fclose(eiu->fd);
+ eiu->fd = NULL;
+
+ if (rc != RPMRC_OK)
+ eiu->numFailed++; *eiu->fnp = NULL;
+
+ return rc;
+}
+
/** @todo Generalize --freshen policies. */
int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv)
@@ -443,7 +474,11 @@ restart:
continue;
break;
case RPMRC_NOTFOUND:
- goto maybe_manifest;
+ rc = tryReadManifest(eiu);
+ if (rc == RPMRC_OK) {
+ eiu->prevx++;
+ goto restart;
+ }
break;
case RPMRC_NOTTRUSTED:
case RPMRC_NOKEY:
@@ -542,39 +577,6 @@ restart:
}
eiu->numRPMS++;
- continue;
-
-maybe_manifest:
- /* Try to read a package manifest. */
- eiu->fd = Fopen(*eiu->fnp, "r.fpio");
- if (eiu->fd == NULL || Ferror(eiu->fd)) {
- rpmlog(RPMLOG_ERR, _("open of %s failed: %s\n"), *eiu->fnp,
- Fstrerror(eiu->fd));
- if (eiu->fd != NULL) {
- xx = Fclose(eiu->fd);
- eiu->fd = NULL;
- }
- eiu->numFailed++; *eiu->fnp = NULL;
- break;
- }
-
- /* Read list of packages from manifest. */
-/* FIX: *eiu->argv can be NULL */
- rc = rpmReadPackageManifest(eiu->fd, &eiu->argc, &eiu->argv);
- if (rc != RPMRC_OK)
- rpmlog(RPMLOG_ERR, _("%s: not an rpm package (or package manifest): %s\n"),
- *eiu->fnp, Fstrerror(eiu->fd));
- xx = Fclose(eiu->fd);
- eiu->fd = NULL;
-
- /* If successful, restart the query loop. */
- if (rc == RPMRC_OK) {
- eiu->prevx++;
- goto restart;
- }
-
- eiu->numFailed++; *eiu->fnp = NULL;
- break;
}
rpmlog(RPMLOG_DEBUG, "found %d source and %d binary packages\n",