summaryrefslogtreecommitdiff
path: root/rpmbuild.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-09-02 14:13:28 +0300
committerPanu Matilainen <pmatilai@redhat.com>2010-09-02 14:13:28 +0300
commit56bb5c89ef61c17e78fdb28e100aee52d49b98d5 (patch)
tree2605ed8ff1429214db4a4c1c109aae2174815a8c /rpmbuild.c
parent9ee219093a4af23d491b6f2125baf78f16834bed (diff)
downloadlibrpm-tizen-56bb5c89ef61c17e78fdb28e100aee52d49b98d5.tar.gz
librpm-tizen-56bb5c89ef61c17e78fdb28e100aee52d49b98d5.tar.bz2
librpm-tizen-56bb5c89ef61c17e78fdb28e100aee52d49b98d5.zip
Move build dependency checking from cli tool to librpmbuild
- Add new public rpmSpecCheckDeps() function which can be used for checking build dependencies of a spec against a transaction set. - Change checkSpec() in rpmbuild cli to use the new interface - rpmbuild.c is now free of direct spec structure accesses
Diffstat (limited to 'rpmbuild.c')
-rw-r--r--rpmbuild.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/rpmbuild.c b/rpmbuild.c
index 6d3ad9065..fe604bac9 100644
--- a/rpmbuild.c
+++ b/rpmbuild.c
@@ -242,30 +242,17 @@ static struct poptOption optionsTable[] = {
POPT_TABLEEND
};
-static int checkSpec(rpmts ts, Header h)
+static int checkSpec(rpmts ts, rpmSpec spec)
{
- rpmps ps;
int rc;
+ rpmps ps = rpmSpecCheckDeps(ts, spec);
- if (!headerIsEntry(h, RPMTAG_REQUIRENAME)
- && !headerIsEntry(h, RPMTAG_CONFLICTNAME))
- return 0;
-
- rc = rpmtsAddInstallElement(ts, h, NULL, 0, NULL);
-
- rc = rpmtsCheck(ts);
-
- ps = rpmtsProblems(ts);
- if (rc == 0 && rpmpsNumProblems(ps) > 0) {
+ if (ps) {
rpmlog(RPMLOG_ERR, _("Failed build dependencies:\n"));
rpmpsPrint(NULL, ps);
- rc = 1;
}
+ rc = (ps != NULL);
ps = rpmpsFree(ps);
-
- /* XXX nuke the added package. */
- rpmtsClean(ts);
-
return rc;
}
@@ -481,7 +468,7 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
}
/* Check build prerequisites if necessary, unless disabled */
- if (!justRm && !noDeps && checkSpec(ts, spec->sourceHeader)) {
+ if (!justRm && !noDeps && checkSpec(ts, spec)) {
goto exit;
}