From b2c81de5d619a76a7cee983b87d8b12be32b2fed Mon Sep 17 00:00:00 2001 From: jbj Date: Mon, 31 Aug 1998 21:06:41 +0000 Subject: [PATCH] copy changelog tags to sub-packages just before packaging. CVS patchset: 2269 CVS date: 1998/08/31 21:06:41 --- CHANGES | 1 + build/pack.c | 10 ++++++++++ build/parsePreamble.c | 23 ++++++++++------------- build/rpmbuild.h | 3 +++ 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/CHANGES b/CHANGES index 17a3bd50c..bdaf45628 100644 --- a/CHANGES +++ b/CHANGES @@ -18,6 +18,7 @@ - added :hex query format 2.5.2 -> 2.5.3: + - copy changelog tags to sub-packages just before packaging. - fix infinite recursion on non-ERANGE return from getcwd() during install (Matt Wilson). - rm .depend for multiple builds in same tree (Will Partain) diff --git a/build/pack.c b/build/pack.c index ce17fdc69..1f7206a4d 100644 --- a/build/pack.c +++ b/build/pack.c @@ -85,6 +85,13 @@ int packageSources(Spec spec) csa, spec->passPhrase, &(spec->cookie)); } +static int copyTags[] = { + RPMTAG_CHANGELOGTIME, + RPMTAG_CHANGELOGNAME, + RPMTAG_CHANGELOGTEXT, + 0 +}; + int packageBinaries(Spec spec) { CSA_t csabuf, *csa = &csabuf; @@ -108,6 +115,9 @@ int packageBinaries(Spec spec) headerAddEntry(pkg->header, RPMTAG_COOKIE, RPM_STRING_TYPE, spec->cookie, 1); } + + /* Copy changelog from src rpm */ + headerCopyTags(spec->packages->header, pkg->header, copyTags); headerAddEntry(pkg->header, RPMTAG_RPMVERSION, RPM_STRING_TYPE, VERSION, 1); diff --git a/build/parsePreamble.c b/build/parsePreamble.c index b2924ab4e..a3a7c9f09 100644 --- a/build/parsePreamble.c +++ b/build/parsePreamble.c @@ -4,7 +4,7 @@ #include "popt/popt.h" -static int copyTags[] = { +static int copyTagsDuringParse[] = { RPMTAG_VERSION, RPMTAG_RELEASE, RPMTAG_COPYRIGHT, @@ -12,10 +12,10 @@ static int copyTags[] = { RPMTAG_DISTRIBUTION, RPMTAG_VENDOR, RPMTAG_ICON, + RPMTAG_URL, RPMTAG_CHANGELOGTIME, RPMTAG_CHANGELOGNAME, RPMTAG_CHANGELOGTEXT, - RPMTAG_URL, 0 }; @@ -39,7 +39,6 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, char *macro, static void initPreambleList(void); static int findPreambleTag(Spec spec, int *tag, char **macro, char *lang); static int checkForRequired(Header h, char *name); -static void copyFromMain(Spec spec, Package pkg); static int checkForDuplicates(Header h, char *name); static void fillOutMainPackage(Header h); static char *tagName(int tag); @@ -208,18 +207,17 @@ static int checkForRequired(Header h, char *name) return res; } -static void copyFromMain(Spec spec, Package pkg) +void headerCopyTags(Header headerFrom, Header headerTo, int *tagstocopy) { - Header headerFrom, headerTo; - int *p = copyTags; - char *s; - int type, count; + int *p; - headerFrom = spec->packages->header; - headerTo = pkg->header; + if (headerFrom == headerTo) + return; - while (*p) { + for (p = tagstocopy; *p != 0; p++) { if (!headerIsEntry(headerTo, *p)) { + char *s; + int type, count; if (headerGetEntry(headerFrom, *p, &type, (void **) &s, &count)) { headerAddEntry(headerTo, *p, type, s, count); if (type == RPM_STRING_ARRAY_TYPE) { @@ -227,7 +225,6 @@ static void copyFromMain(Spec spec, Package pkg) } } } - p++; } } @@ -718,7 +715,7 @@ int parsePreamble(Spec spec, int initialPackage) } if (pkg != spec->packages) { - copyFromMain(spec, pkg); + headerCopyTags(spec->packages->header, pkg->header, copyTagsDuringParse); } if (checkForRequired(pkg->header, fullName)) { diff --git a/build/rpmbuild.h b/build/rpmbuild.h index b187c3356..c8bd622e2 100644 --- a/build/rpmbuild.h +++ b/build/rpmbuild.h @@ -67,6 +67,9 @@ extern "C" { #endif +/* XXX move to lib code */ +void headerCopyTags(Header headerFrom, Header headerTo, int *tagstocopy); + /* from build/names.h */ char *getUname(uid_t uid);