- Grand Renaming of rpm data types.
[platform/upstream/rpm.git] / build.c
diff --git a/build.c b/build.c
index dd03ac6..5e2e1d8 100644 (file)
--- a/build.c
+++ b/build.c
@@ -7,38 +7,44 @@
 #include <rpmcli.h>
 #include <rpmbuild.h>
 
+#include "rpmps.h"
+#include "rpmte.h"
+#include "rpmts.h"
+
 #include "build.h"
 #include "debug.h"
 
-/*@access rpmTransactionSet @*/        /* XXX compared with NULL @*/
+/*@access rpmts @*/    /* XXX compared with NULL @*/
 /*@access rpmdb @*/            /* XXX compared with NULL @*/
 /*@access FD_t @*/             /* XXX compared with NULL @*/
 
 /**
  */
-static int checkSpec(rpmTransactionSet ts, Header h)
-       /*@globals fileSystem @*/
-       /*@modifies ts, h, fileSystem @*/
+static int checkSpec(rpmts ts, Header h)
+       /*@globals fileSystem, internalState @*/
+       /*@modifies ts, h, fileSystem, internalState @*/
 {
-    rpmDependencyConflict conflicts;
-    int numConflicts;
+    rpmps ps;
     int rc;
 
     if (!headerIsEntry(h, RPMTAG_REQUIRENAME)
      && !headerIsEntry(h, RPMTAG_CONFLICTNAME))
        return 0;
 
-    rc = rpmtransAddPackage(ts, h, NULL, NULL, 0, NULL);
+    rc = rpmtsAddPackage(ts, h, NULL, 0, NULL);
 
-    rc = rpmdepCheck(ts, &conflicts, &numConflicts);
-    /*@-branchstate@*/
-    if (rc == 0 && conflicts) {
-       rpmMessage(RPMMESS_ERROR, _("failed build dependencies:\n"));
-       printDepProblems(stderr, conflicts, numConflicts);
-       conflicts = rpmdepFreeConflicts(conflicts, numConflicts);
+    rc = rpmtsCheck(ts);
+
+    ps = rpmtsGetProblems(ts);
+    if (rc == 0 && ps) {
+       rpmMessage(RPMMESS_ERROR, _("Failed build dependencies:\n"));
+       printDepProblems(stderr, ps);
        rc = 1;
     }
-    /*@=branchstate@*/
+    ps = rpmpsFree(ps);
+
+    /* XXX nuke the added package. */
+    rpmtsClean(ts);
 
     return rc;
 }
@@ -89,10 +95,11 @@ static int isSpecFile(const char * specfile)
 
 /**
  */
-static int buildForTarget(rpmTransactionSet ts, const char * arg, BTA_t ba)
+static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
        /*@globals rpmGlobalMacroContext,
                fileSystem, internalState @*/
-       /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/
+       /*@modifies ts, rpmGlobalMacroContext,
+               fileSystem, internalState @*/
 {
     const char * passPhrase = ba->passPhrase;
     const char * cookie = ba->cookie;
@@ -114,6 +121,7 @@ static int buildForTarget(rpmTransactionSet ts, const char * arg, BTA_t ba)
        buildRootURL = rpmGenPath(NULL, ba->buildRootOverride, NULL);
     /*@=branchstate@*/
 
+    /*@-compmempass@*/ /* FIX: static zcmds heartburn */
     if (ba->buildMode == 't') {
        FILE *fp;
        const char * specDir;
@@ -213,6 +221,7 @@ static int buildForTarget(rpmTransactionSet ts, const char * arg, BTA_t ba)
     } else {
        specURL = arg;
     }
+    /*@=compmempass@*/
 
     specut = urlPath(specURL, &specFile);
     if (*specFile != '/') {
@@ -280,17 +289,14 @@ exit:
     return rc;
 }
 
-int build(const char * arg, BTA_t ba, const char * rcfile)
+int build(rpmts ts, const char * arg, BTA_t ba, const char * rcfile)
 {
-    rpmTransactionSet ts;
     char *t, *te;
     int rc = 0;
     char * targets = ba->targets;
 #define        buildCleanMask  (RPMBUILD_RMSOURCE|RPMBUILD_RMSPEC)
     int cleanFlags = ba->buildAmount & buildCleanMask;
 
-    ts = rpmtransCreateSet(NULL, NULL);
-
     if (targets == NULL) {
        rc =  buildForTarget(ts, arg, ba);
        goto exit;
@@ -328,7 +334,5 @@ exit:
     rpmFreeMacros(NULL);
     (void) rpmReadConfigFiles(rcfile, NULL);
 
-    ts = rpmtransFree(ts);
-
     return rc;
 }