diff --git a/build/files.c b/build/files.c index 4cd8e40..45a23a1 100644 --- a/build/files.c +++ b/build/files.c @@ -908,7 +908,7 @@ static int parseForSimple(/*@unused@*/Spec spec, Package pkg, char * buf, custom = 1; } else { const char *n, *v; - (void) headerNVR(pkg->header, &n, &v, NULL); + (void) headerNameVersion(pkg->header, &n, &v); ddir = rpmGetPath("%{_docdir}/", n, "-", v, NULL); } strcpy(buf, ddir); @@ -2547,7 +2547,7 @@ const char *saveInstScript(Spec spec, Package pkg, const char *scriptname) assert(buildroot); const char *N = NULL; - headerNVR(pkg->header, &N, NULL, NULL); + headerName(pkg->header, &N); assert(N); const char *path = @@ -2729,10 +2729,10 @@ checkProvides(Spec spec, Package pkg) if (p == pkg) continue; const char *n = NULL; - headerNVR(p->header, &n, NULL, NULL); + headerName(p->header, &n); for (i = 0; i < len; ++i) { if (!strcmp(n, names[i])) { - headerNVR(pkg->header, &n, NULL, NULL); + headerName(pkg->header, &n); rpmMessage(RPMMESS_WARNING, "%s provides another subpackage: %s\n", n, names[i]); break; @@ -3062,13 +3062,14 @@ int processBinaryFiles(Spec spec, int installSpecialDoc, int test) int rc = 0; for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) { - const char *n, *v, *r; - if (pkg->fileList == NULL) continue; - (void) headerNVR(pkg->header, &n, &v, &r); - rpmMessage(RPMMESS_NORMAL, _("Processing files: %s-%s-%s\n"), n, v, r); + { + const char *n, *v, *r; + (void) headerNVRD(pkg->header, &n, &v, &r, NULL); + rpmMessage(RPMMESS_NORMAL, _("Processing files: %s-%s-%s\n"), n, v, r); + } rc = processPackageFiles(spec, pkg, installSpecialDoc, test); if (rc) break; diff --git a/build/interdep.c b/build/interdep.c index 42c19a3..92c6183 100644 --- a/build/interdep.c +++ b/build/interdep.c @@ -18,7 +18,7 @@ const char *pkgName(Package pkg) if (fi) return fi->name; const char *name; - headerNVR(pkg->header, &name, NULL, NULL); + headerName(pkg->header, &name); return name; } diff --git a/build/pack.c b/build/pack.c index c4f906c..af528a9 100644 --- a/build/pack.c +++ b/build/pack.c @@ -29,7 +29,7 @@ static inline int genSourceRpmName(Spec spec) const char *name, *version, *release; char fileName[BUFSIZ]; - (void) headerNVR(spec->packages->header, &name, &version, &release); + (void) headerNVRD(spec->packages->header, &name, &version, &release, NULL); sprintf(fileName, "%s-%s-%s.%ssrc.rpm", name, version, release, spec->noSource ? "no" : ""); spec->sourceRpmName = xstrdup(fileName); @@ -488,7 +488,7 @@ int writeRPM(Header *hdrp, const char *fileName, int type, rpmio_flags = rpmExpand("%{?_source_payload}", NULL); break; case RPMLEAD_BINARY: - headerNVR(h, &N, NULL, NULL); + headerName(h, &N); dash = strrchr(N, '-'); if (dash && strcmp(dash, "-debuginfo") == 0) rpmio_flags = rpmExpand("%{?_debuginfo_payload}", NULL); @@ -837,7 +837,7 @@ int packageBinaries(Spec spec) binFormat = _free(binFormat); if (binRpm == NULL) { const char *name; - (void) headerNVR(pkg->header, &name, NULL, NULL); + (void) headerName(pkg->header, &name); rpmError(RPMERR_BADFILENAME, _("Could not generate output " "filename for package %s: %s\n"), name, errorString); return RPMERR_BADFILENAME; diff --git a/build/parsePreamble.c b/build/parsePreamble.c index e231230..27dc482 100644 --- a/build/parsePreamble.c +++ b/build/parsePreamble.c @@ -917,7 +917,7 @@ int parsePreamble(Spec spec, int initialPackage) /* Construct the package */ if (flag == PART_SUBNAME) { const char * mainName; - xx = headerNVR(spec->packages->header, &mainName, NULL, NULL); + xx = headerName(spec->packages->header, &mainName); sprintf(NVR, "%s-%s", mainName, name); } else strcpy(NVR, name); diff --git a/build/parsePrep.c b/build/parsePrep.c index ffd657e..f88e5db 100644 --- a/build/parsePrep.c +++ b/build/parsePrep.c @@ -364,7 +364,7 @@ static int doSetupMacro(Spec spec, char *line) spec->buildSubdir = xstrdup(dirName); } else { const char *name, *version; - (void) headerNVR(spec->packages->header, &name, &version, NULL); + (void) headerNameVersion(spec->packages->header, &name, &version); snprintf(buf, sizeof(buf), "%s-%s", name, version); spec->buildSubdir = xstrdup(buf); } diff --git a/build/parseSpec.c b/build/parseSpec.c index b15962b..691ab65 100644 --- a/build/parseSpec.c +++ b/build/parseSpec.c @@ -860,7 +860,7 @@ fprintf(stderr, "*** PS buildRootURL(%s) %p macro set to %s\n", spec->buildRootU 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); + (void) headerName(pkg->header, &name); rpmError(RPMERR_BADSPEC, _("Package has no %%description: %s\n"), name); spec = freeSpec(spec); diff --git a/build/spec.c b/build/spec.c index 1dad943..4fdb4fe 100644 --- a/build/spec.c +++ b/build/spec.c @@ -74,7 +74,7 @@ int lookupPackage(Spec spec, const char *name, int flag, /*@out@*/Package *pkg) /* Construct package name */ { char *n; if (flag == PART_SUBNAME) { - (void) headerNVR(spec->packages->header, &pname, NULL, NULL); + (void) headerName(spec->packages->header, &pname); fullName = n = alloca(strlen(pname) + 1 + strlen(name) + 1); while (*pname != '\0') *n++ = *pname++; *n++ = '-'; @@ -88,7 +88,7 @@ int lookupPackage(Spec spec, const char *name, int flag, /*@out@*/Package *pkg) /* Locate package with fullName */ for (p = spec->packages; p != NULL; p = p->next) { - (void) headerNVR(p->header, &pname, NULL, NULL); + (void) headerName(p->header, &pname); if (pname && (! strcmp(fullName, pname))) { break; } diff --git a/lib/depends.c b/lib/depends.c index 1c7c2a9..1b58d37 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -448,7 +448,7 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd, if (headerIsEntry(h, RPMTAG_SOURCEPACKAGE)) return 0; - (void) headerNVR(h, &name, NULL, NULL); + (void) headerName(h, &name); { rpmdbMatchIterator mi; Header h2; diff --git a/lib/formats.c b/lib/formats.c index bfb4921..058711b 100644 --- a/lib/formats.c +++ b/lib/formats.c @@ -631,7 +631,7 @@ static int i18nTag(Header h, int_32 tag, /*@out@*/ rpmTagType * type, const char * n; char * mk; size_t nb = sizeof("()"); - int xx = headerNVR(h, &n, NULL, NULL); + int xx = headerName(h, &n); if (tn) nb += strlen(tn); if (n) nb += strlen(n); mk = alloca(nb); diff --git a/lib/psm.c b/lib/psm.c index 189a931..44317c3 100644 --- a/lib/psm.c +++ b/lib/psm.c @@ -1048,7 +1048,7 @@ static int handleOneTrigger(PSM_t psm, Header sourceH, Header triggeredH, ) return 0; - xx = headerNVR(sourceH, &sourceName, NULL, NULL); + xx = headerName(sourceH, &sourceName); for (i = 0; i < numTriggers; i++) { rpmTagType tit, tst, tpt; @@ -1082,7 +1082,7 @@ static int handleOneTrigger(PSM_t psm, Header sourceH, Header triggeredH, ) continue; - xx = headerNVR(triggeredH, &triggerPackageName, NULL, NULL); + xx = headerName(triggeredH, &triggerPackageName); { int arg1; int index; diff --git a/lib/query.c b/lib/query.c index c4424ef..d07983b 100644 --- a/lib/query.c +++ b/lib/query.c @@ -446,7 +446,7 @@ printNewSpecfile(Spec spec) for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) { const char *pkgname; h = pkg->header; - (void) headerNVR(h, &pkgname, NULL, NULL); + (void) headerName(h, &pkgname); if (!strcmp(pkgname, fmt)) /*@innerbreak@*/ break; } diff --git a/lib/rpminstall.c b/lib/rpminstall.c index 1def25b..62d5dfa 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -467,7 +467,7 @@ restart: paths = headerFreeData(paths, pft); } else { const char * name; - xx = headerNVR(eiu->h, &name, NULL, NULL); + xx = headerName(eiu->h, &name); rpmMessage(RPMMESS_ERROR, _("package %s is not relocatable\n"), name); eiu->numFailed++; @@ -483,7 +483,7 @@ restart: Header oldH; int count; - xx = headerNVR(eiu->h, &name, NULL, NULL); + xx = headerName(eiu->h, &name); /*@-onlytrans@*/ mi = rpmdbInitIterator(eiu->db, RPMTAG_NAME, name, 0); /*@=onlytrans@*/ diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 1e4c9b3..d2f5116 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -119,6 +119,16 @@ int headerNVRD(Header h, /*@null@*/ /*@out@*/ const char ** dp) /*@modifies *np, *vp, *rp, *dp @*/; +static inline int headerNameVersion(Header h, const char **np, const char **vp) +{ + return headerNVRD(h, np, vp, NULL, NULL); +} + +static inline int headerName(Header h, const char **np) +{ + return headerNVRD(h, np, NULL, NULL, NULL); +} + /** \ingroup header * Return name, epoch, version, release, arch strings from header. * @param h header