summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-09-01 14:00:54 +0300
committerPanu Matilainen <pmatilai@redhat.com>2010-09-01 14:00:54 +0300
commit4acb8866ef8b232b736b84a68b2701070439a6f4 (patch)
treed71688c0e5f96258d89c8690a0eae1bbda37137a
parent628de71cdebf8ed8cb1574b39de6fe0150dd65fb (diff)
downloadlibrpm-tizen-4acb8866ef8b232b736b84a68b2701070439a6f4.tar.gz
librpm-tizen-4acb8866ef8b232b736b84a68b2701070439a6f4.tar.bz2
librpm-tizen-4acb8866ef8b232b736b84a68b2701070439a6f4.zip
Eliminate cookie from spec structure
- Cookies are not a property of spec but a given build, handle this internally to buildSpec() except for --rebuild which passes the srpm identifier cookie through buildArgs
-rw-r--r--build/build.c6
-rw-r--r--build/pack.c13
-rw-r--r--build/parseSpec.c4
-rw-r--r--build/rpmbuild.h2
-rw-r--r--build/rpmbuild_internal.h6
-rw-r--r--build/rpmspec.h1
-rw-r--r--build/spec.c6
-rw-r--r--rpmbuild.c3
8 files changed, 17 insertions, 24 deletions
diff --git a/build/build.c b/build/build.c
index 1b829aeec..e4e11b4d2 100644
--- a/build/build.c
+++ b/build/build.c
@@ -217,6 +217,7 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what)
{
rpmRC rc = RPMRC_OK;
int test = buildArgs->noBuild;
+ char *cookie = buildArgs->cookie ? xstrdup(buildArgs->cookie) : NULL;
if (!spec->recursing && spec->BACount) {
int x;
@@ -261,11 +262,11 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what)
goto exit;
if (((what & RPMBUILD_PACKAGESOURCE) && !test) &&
- (rc = packageSources(spec)))
+ (rc = packageSources(spec, &cookie)))
return rc;
if (((what & RPMBUILD_PACKAGEBINARY) && !test) &&
- (rc = packageBinaries(spec)))
+ (rc = packageBinaries(spec, cookie)))
goto exit;
if ((what & RPMBUILD_CLEAN) &&
@@ -284,6 +285,7 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what)
(void) unlink(spec->specFile);
exit:
+ free(cookie);
if (rc != RPMRC_OK && rpmlogGetNrecs() > 0) {
rpmlog(RPMLOG_NOTICE, _("\n\nRPM build errors:\n"));
rpmlogPrint(NULL);
diff --git a/build/pack.c b/build/pack.c
index 8518080ce..8e0c8685c 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -668,7 +668,7 @@ static rpmRC checkPackages(char *pkgcheck)
return RPMRC_OK;
}
-rpmRC packageBinaries(rpmSpec spec)
+rpmRC packageBinaries(rpmSpec spec, const char *cookie)
{
struct cpioSourceArchive_s csabuf;
CSA_t csa = &csabuf;
@@ -683,8 +683,8 @@ rpmRC packageBinaries(rpmSpec spec)
if ((rc = processScriptFiles(spec, pkg)))
return rc;
- if (spec->cookie) {
- headerPutString(pkg->header, RPMTAG_COOKIE, spec->cookie);
+ if (cookie) {
+ headerPutString(pkg->header, RPMTAG_COOKIE, cookie);
}
/* Copy changelog from src rpm */
@@ -779,7 +779,7 @@ rpmRC packageBinaries(rpmSpec spec)
return RPMRC_OK;
}
-rpmRC packageSources(rpmSpec spec)
+rpmRC packageSources(rpmSpec spec, char **cookie)
{
struct cpioSourceArchive_s csabuf;
CSA_t csa = &csabuf;
@@ -790,8 +790,6 @@ rpmRC packageSources(rpmSpec spec)
headerPutString(spec->sourceHeader, RPMTAG_BUILDHOST, buildHost());
headerPutUint32(spec->sourceHeader, RPMTAG_BUILDTIME, getBuildTime(), 1);
- spec->cookie = _free(spec->cookie);
-
/* XXX this should be %_srpmdir */
{ char *fn = rpmGetPath("%{_srcrpmdir}/", spec->sourceRpmName,NULL);
char *pkgcheck = rpmExpand("%{?_build_pkgcheck_srpm} ", fn, NULL);
@@ -802,8 +800,7 @@ rpmRC packageSources(rpmSpec spec)
csa->cpioList = rpmfiLink(spec->sourceCpioList);
spec->sourcePkgId = NULL;
- rc = writeRPM(&spec->sourceHeader, &spec->sourcePkgId, fn,
- csa, &(spec->cookie));
+ rc = writeRPM(&spec->sourceHeader, &spec->sourcePkgId, fn, csa, cookie);
/* Do check SRPM package if enabled */
if (rc == RPMRC_OK && pkgcheck[0] != ' ') {
diff --git a/build/parseSpec.c b/build/parseSpec.c
index 38ba5e206..9e2b0ef45 100644
--- a/build/parseSpec.c
+++ b/build/parseSpec.c
@@ -546,8 +546,6 @@ int parseSpec(rpmts ts, const char *specFile, const char *rootDir,
if (rootDir)
spec->rootDir = xstrdup(rootDir);
- if (cookie)
- spec->cookie = xstrdup(cookie);
spec->timeCheck = rpmExpandNumeric("%{_timecheck}");
@@ -635,7 +633,7 @@ int parseSpec(rpmts ts, const char *specFile, const char *rootDir,
addMacro(NULL, "_target_cpu", NULL, spec->BANames[x], RMIL_RPMRC);
spec->BASpecs[index] = NULL;
if (parseSpec(ts, specFile, spec->rootDir, buildRoot, 1,
- NULL, cookie, anyarch, force)
+ NULL, NULL, anyarch, force)
|| (spec->BASpecs[index] = rpmtsSetSpec(ts, NULL)) == NULL)
{
spec->BACount = index;
diff --git a/build/rpmbuild.h b/build/rpmbuild.h
index 6d340d66b..8f0b9d221 100644
--- a/build/rpmbuild.h
+++ b/build/rpmbuild.h
@@ -77,7 +77,7 @@ extern int _noDirTokens;
* @param buildRoot
* @param recursing parse is recursive?
* @param passPhrase (unused)
- * @param cookie
+ * @param cookie (unused)
* @param anyarch
* @param force
* @return
diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h
index d3fa72472..0b17496be 100644
--- a/build/rpmbuild_internal.h
+++ b/build/rpmbuild_internal.h
@@ -284,17 +284,19 @@ int processSourceFiles(rpmSpec spec);
/** \ingroup rpmbuild
* Generate binary package(s).
* @param spec spec file control structure
+ * @param cookie build identifier "cookie" or NULL
* @return RPMRC_OK on success
*/
RPM_GNUC_INTERNAL
-rpmRC packageBinaries(rpmSpec spec);
+rpmRC packageBinaries(rpmSpec spec, const char *cookie);
/** \ingroup rpmbuild
* Generate source package.
* @param spec spec file control structure
+ * @retval cookie build identifier "cookie" or NULL
* @return RPMRC_OK on success
*/
RPM_GNUC_INTERNAL
-rpmRC packageSources(rpmSpec spec);
+rpmRC packageSources(rpmSpec spec, char **cookie);
#endif /* _RPMBUILD_INTERNAL_H */
diff --git a/build/rpmspec.h b/build/rpmspec.h
index 8b677a277..b739149bb 100644
--- a/build/rpmspec.h
+++ b/build/rpmspec.h
@@ -69,7 +69,6 @@ struct rpmSpec_s {
int anyarch;
int timeCheck;
- char * cookie;
struct Source * sources;
int numSources;
diff --git a/build/spec.c b/build/spec.c
index 92136fc7e..de224aa0d 100644
--- a/build/spec.c
+++ b/build/spec.c
@@ -225,7 +225,6 @@ rpmSpec newSpec(void)
spec->buildSubdir = NULL;
spec->timeCheck = 0;
- spec->cookie = NULL;
spec->buildRestrictions = headerNew();
spec->BANames = NULL;
@@ -301,8 +300,6 @@ rpmSpec freeSpec(rpmSpec spec)
}
spec->BANames = _free(spec->BANames);
- spec->cookie = _free(spec->cookie);
-
#ifdef WITH_LUA
rpmlua lua = NULL; /* global state */
rpmluaDelVar(lua, "patches");
@@ -323,7 +320,6 @@ int rpmspecQuery(rpmts ts, QVA_t qva, const char * arg)
Package pkg;
char * buildRoot = NULL;
int recursing = 0;
- char *cookie = NULL;
int anyarch = 1;
int force = 1;
int res = 1;
@@ -334,7 +330,7 @@ int rpmspecQuery(rpmts ts, QVA_t qva, const char * arg)
/* FIX: make spec abstract */
if (parseSpec(ts, arg, "/", buildRoot, recursing, NULL,
- cookie, anyarch, force)
+ NULL, anyarch, force)
|| (spec = rpmtsSetSpec(ts, NULL)) == NULL)
{
rpmlog(RPMLOG_ERR,
diff --git a/rpmbuild.c b/rpmbuild.c
index cd9db7c65..ee130bd93 100644
--- a/rpmbuild.c
+++ b/rpmbuild.c
@@ -196,7 +196,6 @@ exit:
static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
{
- const char * cookie = ba->cookie;
int buildAmount = ba->buildAmount;
char * buildRootURL = NULL;
char * specFile = NULL;
@@ -276,7 +275,7 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
#define _anyarch(_f) \
(((_f)&(RPMBUILD_PREP|RPMBUILD_BUILD|RPMBUILD_INSTALL|RPMBUILD_PACKAGEBINARY)) == 0)
if (parseSpec(ts, specFile, ba->rootdir, buildRootURL, 0, NULL,
- cookie, _anyarch(buildAmount), ba->force))
+ NULL, _anyarch(buildAmount), ba->force))
{
goto exit;
}