diff options
author | jbj <devnull@localhost> | 2001-10-27 20:09:20 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2001-10-27 20:09:20 +0000 |
commit | 7402ce15464cc59617177a2af2799c36c8ef60fd (patch) | |
tree | 6c3185d6dd7d9e8e95b518a896799438176f5199 /build.c | |
parent | 4a1a5e81483a2f81b22c3a0d2cb054d93055998e (diff) | |
download | librpm-tizen-7402ce15464cc59617177a2af2799c36c8ef60fd.tar.gz librpm-tizen-7402ce15464cc59617177a2af2799c36c8ef60fd.tar.bz2 librpm-tizen-7402ce15464cc59617177a2af2799c36c8ef60fd.zip |
- legacy signatures always checked where possible on package read.
- wire transactions through rpmcli build modes.
- lazy rpmdb open/close through transaction methods (mostly anyways).
- no-brainer refcounts for rpmdb object.
- check added header against transaction set, replace if newer.
CVS patchset: 5135
CVS date: 2001/10/27 20:09:20
Diffstat (limited to 'build.c')
-rw-r--r-- | build.c | 42 |
1 files changed, 16 insertions, 26 deletions
@@ -16,30 +16,18 @@ /** */ -static int checkSpec(Header h) - /*@globals rpmGlobalMacroContext, fileSystem @*/ - /*@modifies h, rpmGlobalMacroContext, fileSystem @*/ +static int checkSpec(rpmTransactionSet ts, Header h) + /*@globals fileSystem @*/ + /*@modifies ts, h, fileSystem @*/ { - const char * rootdir = NULL; - rpmdb db = NULL; - int mode = O_RDONLY; - rpmTransactionSet ts; rpmDependencyConflict conflicts; int numConflicts; int rc; - if (!headerIsEntry(h, RPMTAG_REQUIREFLAGS)) + if (!headerIsEntry(h, RPMTAG_REQUIRENAME) + && !headerIsEntry(h, RPMTAG_CONFLICTNAME)) return 0; - if (rpmdbOpen(rootdir, &db, mode, 0644)) { - const char * dn; - dn = rpmGetPath( (rootdir ? rootdir : ""), "%{_dbpath}", NULL); - rpmError(RPMERR_OPEN, _("cannot open rpm database in %s\n"), dn); - dn = _free(dn); - exit(EXIT_FAILURE); - } - ts = rpmtransCreateSet(db, rootdir); - rc = rpmtransAddPackage(ts, h, NULL, NULL, 0, NULL); rc = rpmdepCheck(ts, &conflicts, &numConflicts); @@ -52,10 +40,6 @@ static int checkSpec(Header h) } /*@=branchstate@*/ - ts = rpmtransFree(ts); - if (db != NULL) - (void) rpmdbClose(db); - return rc; } @@ -105,10 +89,10 @@ static int isSpecFile(const char * specfile) /** */ -static int buildForTarget(const char * arg, BTA_t ba) +static int buildForTarget(rpmTransactionSet ts, const char * arg, BTA_t ba) /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ - /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/ + /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/ { const char * passPhrase = ba->passPhrase; const char * cookie = ba->cookie; @@ -276,7 +260,7 @@ static int buildForTarget(const char * arg, BTA_t ba) initSourceHeader(spec); /* Check build prerequisites */ - if (!ba->noDeps && checkSpec(spec->sourceHeader)) { + if (!ba->noDeps && checkSpec(ts, spec->sourceHeader)) { rc = 1; goto exit; } @@ -298,14 +282,17 @@ exit: int build(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(arg, ba); + rc = buildForTarget(ts, arg, ba); goto exit; } @@ -331,7 +318,7 @@ int build(const char * arg, BTA_t ba, const char * rcfile) /* Read in configuration for target. */ rpmFreeMacros(NULL); (void) rpmReadConfigFiles(rcfile, target); - rc = buildForTarget(arg, ba); + rc = buildForTarget(ts, arg, ba); if (rc) break; } @@ -340,5 +327,8 @@ exit: /* Restore original configuration. */ rpmFreeMacros(NULL); (void) rpmReadConfigFiles(rcfile, NULL); + + ts = rpmtransFree(ts); + return rc; } |