diff options
-rw-r--r-- | build/files.c | 18 | ||||
-rw-r--r-- | build/pack.c | 15 | ||||
-rw-r--r-- | build/parsePreamble.c | 7 | ||||
-rw-r--r-- | build/parsePrep.c | 6 | ||||
-rw-r--r-- | build/parseSpec.c | 5 | ||||
-rw-r--r-- | build/spec.c | 4 |
6 files changed, 26 insertions, 29 deletions
diff --git a/build/files.c b/build/files.c index d8ca3d38b..e8a953c17 100644 --- a/build/files.c +++ b/build/files.c @@ -2002,11 +2002,10 @@ static const rpmTag sourceTags[] = { 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" : ""); + char *nvr = headerGetAsString(spec->packages->header, RPMTAG_NVR); + rasprintf(&spec->sourceRpmName, "%s.%ssrc.rpm", nvr, + spec->noSource ? "no" : ""); + free(nvr); } } @@ -2243,19 +2242,22 @@ int processBinaryFiles(rpmSpec spec, int installSpecialDoc, int test) genSourceRpmName(spec); for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) { - const char *n, *v, *r, *a; + char *nvr; + const char *a; headerPutString(pkg->header, RPMTAG_SOURCERPM, spec->sourceRpmName); if (pkg->fileList == NULL) continue; - (void) headerNEVRA(pkg->header, &n, NULL, &v, &r, &a); - rpmlog(RPMLOG_NOTICE, _("Processing files: %s-%s-%s.%s\n"), n, v, r, a); + nvr = headerGetAsString(spec->packages->header, RPMTAG_NVRA); + rpmlog(RPMLOG_NOTICE, _("Processing files: %s\n"), nvr); + free(nvr); if ((rc = processPackageFiles(spec, pkg, installSpecialDoc, test)) != RPMRC_OK || (rc = rpmfcGenerateDepends(spec, pkg)) != RPMRC_OK) goto exit; + a = headerGetString(spec->packages->header, RPMTAG_ARCH); if (rstreq(a, "noarch") && headerGetColor(pkg->header) != 0) { int terminate = rpmExpandNumeric("%{?_binaries_in_noarch_packages_terminate_build}"); rpmlog(terminate ? RPMLOG_ERR : RPMLOG_WARNING, diff --git a/build/pack.c b/build/pack.c index 8f51a135d..332aee410 100644 --- a/build/pack.c +++ b/build/pack.c @@ -656,13 +656,14 @@ static const rpmTag copyTags[] = { */ static void addPackageProvides(Header h) { - const char *name = NULL, *arch = NULL; + const char *arch, *name; char *evr, *isaprov; rpmsenseFlags pflags = RPMSENSE_EQUAL; - struct rpmtd_s archtd; /* <name> = <evr> provide */ - evr = headerGetEVR(h, &name); + name = headerGetString(h, RPMTAG_NAME); + arch = headerGetString(h, RPMTAG_ARCH); + evr = headerGetAsString(h, RPMTAG_EVR); headerPutString(h, RPMTAG_PROVIDENAME, name); headerPutString(h, RPMTAG_PROVIDEVERSION, evr); headerPutUint32(h, RPMTAG_PROVIDEFLAGS, &pflags, 1); @@ -673,15 +674,12 @@ static void addPackageProvides(Header h) * cause reading in the noarch macros :-/ */ isaprov = rpmExpand(name, "%{?_isa}", NULL); - headerGet(h, RPMTAG_ARCH, &archtd, HEADERGET_MINMEM); - arch = rpmtdGetString(&archtd); if (!rstreq(arch, "noarch") && !rstreq(name, isaprov)) { headerPutString(h, RPMTAG_PROVIDENAME, isaprov); headerPutString(h, RPMTAG_PROVIDEVERSION, evr); headerPutUint32(h, RPMTAG_PROVIDEFLAGS, &pflags, 1); } free(isaprov); - free(evr); } @@ -749,10 +747,9 @@ rpmRC packageBinaries(rpmSpec spec) binRpm = headerFormat(pkg->header, binFormat, &errorString); binFormat = _free(binFormat); if (binRpm == NULL) { - const char *name; - (void) headerNVR(pkg->header, &name, NULL, NULL); rpmlog(RPMLOG_ERR, _("Could not generate output " - "filename for package %s: %s\n"), name, errorString); + "filename for package %s: %s\n"), + headerGetString(pkg->header, RPMTAG_NAME), errorString); return RPMRC_FAIL; } fn = rpmGetPath("%{_rpmdir}/", binRpm, NULL); diff --git a/build/parsePreamble.c b/build/parsePreamble.c index a43e85dab..a1b28b4f9 100644 --- a/build/parsePreamble.c +++ b/build/parsePreamble.c @@ -816,7 +816,7 @@ int parsePreamble(rpmSpec spec, int initialPackage) { int nextPart = PART_ERROR; int res = PART_ERROR; /* assume failure */ - int rc, xx; + int rc; char *name, *linep; int flag = 0; Package pkg; @@ -841,9 +841,8 @@ int parsePreamble(rpmSpec spec, int initialPackage) /* Construct the package */ if (flag == PART_SUBNAME) { - const char * mainName; - xx = headerNVR(spec->packages->header, &mainName, NULL, NULL); - rasprintf(&NVR, "%s-%s", mainName, name); + rasprintf(&NVR, "%s-%s", + headerGetString(spec->packages->header, RPMTAG_NAME), name); } else NVR = xstrdup(name); free(name); diff --git a/build/parsePrep.c b/build/parsePrep.c index 172ef6bb1..5a0769de8 100644 --- a/build/parsePrep.c +++ b/build/parsePrep.c @@ -317,9 +317,9 @@ static int doSetupMacro(rpmSpec spec, const char *line) if (dirName) { spec->buildSubdir = xstrdup(dirName); } else { - const char *name, *version; - (void) headerNVR(spec->packages->header, &name, &version, NULL); - rasprintf(&spec->buildSubdir, "%s-%s", name, version); + rasprintf(&spec->buildSubdir, "%s-%s", + headerGetString(spec->packages->header, RPMTAG_NAME), + headerGetString(spec->packages->header, RPMTAG_VERSION)); } addMacro(spec->macros, "buildsubdir", NULL, spec->buildSubdir, RMIL_SPEC); diff --git a/build/parseSpec.c b/build/parseSpec.c index 24b0cbf78..3c5349d1e 100644 --- a/build/parseSpec.c +++ b/build/parseSpec.c @@ -570,9 +570,8 @@ int parseSpec(rpmts ts, const char *specFile, const char *rootDir, for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) { if (!headerIsEntry(pkg->header, RPMTAG_DESCRIPTION)) { - const char * name; - (void) headerNVR(pkg->header, &name, NULL, NULL); - rpmlog(RPMLOG_ERR, _("Package has no %%description: %s\n"), name); + rpmlog(RPMLOG_ERR, _("Package has no %%description: %s\n"), + headerGetString(pkg->header, RPMTAG_NAME)); goto errxit; } diff --git a/build/spec.c b/build/spec.c index d1013c81f..5ae5f01f4 100644 --- a/build/spec.c +++ b/build/spec.c @@ -75,7 +75,7 @@ rpmRC lookupPackage(rpmSpec spec, const char *name, int flag,Package *pkg) /* Construct package name */ if (flag == PART_SUBNAME) { - (void) headerNVR(spec->packages->header, &pname, NULL, NULL); + pname = headerGetString(spec->packages->header, RPMTAG_NAME); rasprintf(&fullName, "%s-%s", pname, name); } else { fullName = xstrdup(name); @@ -83,7 +83,7 @@ rpmRC lookupPackage(rpmSpec spec, const char *name, int flag,Package *pkg) /* Locate package with fullName */ for (p = spec->packages; p != NULL; p = p->next) { - (void) headerNVR(p->header, &pname, NULL, NULL); + pname = headerGetString(spec->packages->header, RPMTAG_NAME); if (pname && (rstreq(fullName, pname))) { break; } |