From 9b92c41eac934f5e95e44c8c9e35a7eb1898a44d Mon Sep 17 00:00:00 2001 From: ewt Date: Sun, 1 Jun 1997 22:59:24 +0000 Subject: [PATCH] Added rpmfilename tag to to rpmrc and made use of it during package builds CVS patchset: 1675 CVS date: 1997/06/01 22:59:24 --- CHANGES | 2 ++ build/pack.c | 17 ++++++++++++++--- lib-rpmrc.in | 1 + lib/rpmlib.h | 4 +++- lib/rpmrc.c | 1 + misc/miscfn.h | 2 +- 6 files changed, 22 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index b07277c..f335a46 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,8 @@ - completely rewrote queryformat code - added fsnames, fssizes virtual query tags - added rpmdbFindByHeader() and rpmdbFindByTag() public functions + - added rpmfilename tag to rpmrc to define the filename format to + use for binary packages (note the rpmdir is prepended to it) 2.4 -> 2.4.1: - take advantage of lchown() if it's available diff --git a/build/pack.c b/build/pack.c index 607764b..25791c1 100644 --- a/build/pack.c +++ b/build/pack.c @@ -383,6 +383,7 @@ int packageBinaries(Spec s, char *passPhrase, int doPackage) char *nametmp; char filename[1024]; char sourcerpm[1024]; + char * binrpm; char *icon; int iconFD; struct stat statbuf; @@ -398,6 +399,7 @@ int packageBinaries(Spec s, char *passPhrase, int doPackage) char *packager; char *packageVersion, *packageRelease; char *prefix, *prefixSave; + char * binformat, * errorString; int prefixLen; int size; StringBuf cpioFileList; @@ -419,7 +421,7 @@ int packageBinaries(Spec s, char *passPhrase, int doPackage) version = strdup(version); release = strdup(release); - sprintf(sourcerpm, "%s-%s-%s.%ssrc.rpm", s->name, version, release, + sprintf(sourcerpm, "%s-%s-%s.%sprc.rpm", s->name, version, release, (s->numNoPatch + s->numNoSource) ? "no" : ""); vendor = NULL; @@ -599,8 +601,17 @@ int packageBinaries(Spec s, char *passPhrase, int doPackage) /* Make the output RPM filename */ if (doPackage == PACK_PACKAGE) { - sprintf(filename, "%s/%s/%s.%s.rpm", rpmGetVar(RPMVAR_RPMDIR), - rpmGetArchName(), name, rpmGetArchName()); + binformat = rpmGetVar(RPMVAR_RPMFILENAME); + binrpm = headerSprintf(outHeader, binformat, rpmTagTable, + rpmHeaderFormats, &errorString); + + if (!binrpm) { + rpmError(RPMERR_BADFILENAME, "could not generate output " + "filename for package %s: %s\n", name, binrpm); + } + + sprintf(filename, "%s/%s", rpmGetVar(RPMVAR_RPMDIR), binrpm); + free(binrpm); if (generateRPM(name, filename, RPMLEAD_BINARY, outHeader, NULL, getStringBuf(cpioFileList), passPhrase, prefix)) { diff --git a/lib-rpmrc.in b/lib-rpmrc.in index 7cbe520..f954ebd 100644 --- a/lib-rpmrc.in +++ b/lib-rpmrc.in @@ -8,6 +8,7 @@ cpiobin: @CPIOBIN@ gzipbin: @GZIPBIN@ defaultdocdir: @prefix@/doc fixperms: @FIXPERMS@ +rpmfilename: %{ARCH}/%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}.rpm ############################################################# diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 9eb94e4..ccb952a 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -190,7 +190,8 @@ extern const struct headerSprintfExtension rpmHeaderFormats[]; #define RPMVAR_DEFAULTDOCDIR 34 #define RPMVAR_FIXPERMS 35 #define RPMVAR_GZIPBIN 36 -#define RPMVAR_LASTVAR 37 /* IMPORTANT to keep right! */ +#define RPMVAR_RPMFILENAME 37 +#define RPMVAR_LASTVAR 38 /* IMPORTANT to keep right! */ char *rpmGetVar(int var); int rpmGetBooleanVar(int var); @@ -384,6 +385,7 @@ rpmErrorCallBackType rpmErrorSetCallback(rpmErrorCallBackType); #define RPMERR_GZIP -117 #define RPMERR_BADSPEC -118 #define RPMERR_LDD -119 /* couldn't understand ldd output */ +#define RPMERR_BADFILENAME -120 #define RPMERR_BADSIGTYPE -200 /* Unknown signature type */ #define RPMERR_SIGGEN -201 /* Error generating signature */ diff --git a/lib/rpmrc.c b/lib/rpmrc.c index 85e7684..fb998b1 100644 --- a/lib/rpmrc.c +++ b/lib/rpmrc.c @@ -93,6 +93,7 @@ struct rpmoption optionTable[] = { { "require_vendor", RPMVAR_REQUIREVENDOR, 0, 0 }, { "root", RPMVAR_ROOT, 0, 0 }, { "rpmdir", RPMVAR_RPMDIR, 0, 0 }, + { "rpmfilename", RPMVAR_RPMFILENAME, 0, 1 }, { "signature", RPMVAR_SIGTYPE, 0, 0 }, { "sourcedir", RPMVAR_SOURCEDIR, 0, 0 }, { "specdir", RPMVAR_SPECDIR, 0, 0 }, diff --git a/misc/miscfn.h b/misc/miscfn.h index d94a334..5e5e51b 100644 --- a/misc/miscfn.h +++ b/misc/miscfn.h @@ -67,7 +67,7 @@ extern void *myrealloc(void *, size_t); #define GETMNTENT_ONE 1 #define GETMNTENT_TWO 0 #define our_mntent struct mntent -#defeine our_mntdir mnt_dir +#define our_mntdir mnt_dir #elif HAVE_SYS_MNTTAB_H #include #include -- 2.7.4