From ff9733b6fd8cb7dc8afccf38833d26d0363aeef7 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 18 Nov 2008 11:22:26 +0200 Subject: Generate and insert SOURCERPM tag earlier - needed to make checking for source/binary package in rpmfiNew() reliable at build time --- build/files.c | 14 ++++++++++++++ build/pack.c | 19 ------------------- 2 files changed, 14 insertions(+), 19 deletions(-) (limited to 'build') diff --git a/build/files.c b/build/files.c index 51d6392de..9b4446a50 100644 --- a/build/files.c +++ b/build/files.c @@ -1982,6 +1982,17 @@ static const rpmTag sourceTags[] = { 0 }; +static void genSourceRpmName(rpmSpec spec) +{ + if (spec->sourceRpmName == NULL) { + const char *name, *version, *release; + + (void) headerNVR(spec->packages->header, &name, &version, &release); + rasprintf(&spec->sourceRpmName, "%s-%s-%s.%ssrc.rpm", name, version, release, + spec->noSource ? "no" : ""); + } +} + void initSourceHeader(rpmSpec spec) { HeaderIterator hi; @@ -2034,6 +2045,7 @@ int processSourceFiles(rpmSpec spec) if (spec->sourceHeader == NULL) initSourceHeader(spec); + genSourceRpmName(spec); /* Construct the file list and source entries */ appendLineStringBuf(sourceFiles, spec->specFile); if (spec->sourceHeader != NULL) @@ -2213,9 +2225,11 @@ int processBinaryFiles(rpmSpec spec, int installSpecialDoc, int test) int rc = RPMRC_OK; check_fileList = newStringBuf(); + genSourceRpmName(spec); for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) { const char *n, *v, *r; + headerPutString(pkg->header, RPMTAG_SOURCERPM, spec->sourceRpmName); if (pkg->fileList == NULL) continue; diff --git a/build/pack.c b/build/pack.c index 2a6f81797..e0860c2b2 100644 --- a/build/pack.c +++ b/build/pack.c @@ -21,21 +21,6 @@ #include "debug.h" -/** - */ -static inline int genSourceRpmName(rpmSpec spec) -{ - if (spec->sourceRpmName == NULL) { - const char *name, *version, *release; - - (void) headerNVR(spec->packages->header, &name, &version, &release); - rasprintf(&spec->sourceRpmName, "%s-%s-%s.%ssrc.rpm", name, version, release, - spec->noSource ? "no" : ""); - } - - return 0; -} - /** * @todo Create transaction set *much* earlier. */ @@ -734,9 +719,6 @@ rpmRC packageBinaries(rpmSpec spec) optflags = _free(optflags); } - (void) genSourceRpmName(spec); - headerPutString(pkg->header, RPMTAG_SOURCERPM, spec->sourceRpmName); - if (spec->sourcePkgId != NULL) { headerPutBin(pkg->header, RPMTAG_SOURCEPKGID, spec->sourcePkgId,16); } @@ -824,7 +806,6 @@ rpmRC packageSources(rpmSpec spec) headerPutString(spec->sourceHeader, RPMTAG_RPMVERSION, VERSION); headerPutString(spec->sourceHeader, RPMTAG_BUILDHOST, buildHost()); headerPutUint32(spec->sourceHeader, RPMTAG_BUILDTIME, getBuildTime(), 1); - (void) genSourceRpmName(spec); spec->cookie = _free(spec->cookie); -- cgit v1.2.3