diff options
author | Anas Nashif <anas.nashif@intel.com> | 2012-10-11 15:23:31 -0700 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2013-02-02 16:44:15 -0800 |
commit | 962bc4dff6520651539fcc08a542cbf80c2b4c2d (patch) | |
tree | a25240ad59430cda4821132358460a53fc268ceb /build | |
parent | ce3317effe1753835d508e78a1a27e8af9c690ae (diff) | |
download | rpm-962bc4dff6520651539fcc08a542cbf80c2b4c2d.tar.gz rpm-962bc4dff6520651539fcc08a542cbf80c2b4c2d.tar.bz2 rpm-962bc4dff6520651539fcc08a542cbf80c2b4c2d.zip |
short changelog
Diffstat (limited to 'build')
-rw-r--r-- | build/pack.c | 58 | ||||
-rw-r--r-- | build/parseChangelog.c | 5 |
2 files changed, 63 insertions, 0 deletions
diff --git a/build/pack.c b/build/pack.c index 9679d87c2..6480cecaa 100644 --- a/build/pack.c +++ b/build/pack.c @@ -553,6 +553,63 @@ static rpmRC checkPackages(char *pkgcheck) return RPMRC_OK; } +static void trimChangelog(Header h) +{ + static int oneshot; + static int cuttime, minnum, maxnum; + int * times; + char ** names = 0, ** texts = 0; + int i, keep, count = 0; + + if (!oneshot) { + char *binarychangelogtrim = rpmExpand("%{?_binarychangelogtrim}", NULL); + oneshot = 1; + if (binarychangelogtrim && *binarychangelogtrim) { + maxnum = atoi(binarychangelogtrim); + binarychangelogtrim = strchr(binarychangelogtrim, ','); + if (binarychangelogtrim) + binarychangelogtrim++; + } + if (binarychangelogtrim && *binarychangelogtrim) { + cuttime = atoi(binarychangelogtrim); + binarychangelogtrim = strchr(binarychangelogtrim, ','); + if (binarychangelogtrim) + binarychangelogtrim++; + } + if (binarychangelogtrim && *binarychangelogtrim) { + minnum = atoi(binarychangelogtrim); + binarychangelogtrim = strchr(binarychangelogtrim, ','); + } + } + if (!cuttime && !minnum && !maxnum) { + return; + } + if (!headerGetEntry(h, RPMTAG_CHANGELOGTIME, NULL, (void **) ×, &count)) + return; + if ((!cuttime || count <= minnum) && (!maxnum || count <= maxnum)) { + return; + } + keep = count; + if (maxnum && keep > maxnum) + keep = maxnum; + if (cuttime) { + for (i = 0; i < keep; i++) { + if (i >= minnum && times[i] < cuttime) + break; + } + keep = i; + } + if (keep >= count) + return; + headerGetEntry(h, RPMTAG_CHANGELOGNAME, NULL, (void **) &names, &count); + headerGetEntry(h, RPMTAG_CHANGELOGTEXT, NULL, (void **) &texts, &count); + headerModifyEntry(h, RPMTAG_CHANGELOGTIME, RPM_INT32_TYPE, times, keep); + headerModifyEntry(h, RPMTAG_CHANGELOGNAME, RPM_STRING_ARRAY_TYPE, names, keep); + headerModifyEntry(h, RPMTAG_CHANGELOGTEXT, RPM_STRING_ARRAY_TYPE, texts, keep); + free(names); + free(texts); +} + rpmRC packageBinaries(rpmSpec spec, const char *cookie, int cheating) { struct cpioSourceArchive_s csabuf; @@ -562,6 +619,7 @@ rpmRC packageBinaries(rpmSpec spec, const char *cookie, int cheating) Package pkg; char *pkglist = NULL; + trimChangelog(spec->packages->header); for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) { char *fn; diff --git a/build/parseChangelog.c b/build/parseChangelog.c index 56ba69daa..b06c9236b 100644 --- a/build/parseChangelog.c +++ b/build/parseChangelog.c @@ -183,6 +183,11 @@ static rpmRC addChangelog(Header h, ARGV_const_t sb) goto exit; } + /* workaround old suse oddity */ + if (*s == '-' && s[1] == ' ') { + s += 2; + } + /* name */ name = s; while (*s != '\0') s++; |