File rpm-shorten-changelog.diff of Package rpm.21495
--- ./build/pack.c.orig 2017-10-11 12:39:53.009897937 +0000
+++ ./build/pack.c 2017-12-04 16:02:29.299440578 +0000
@@ -641,6 +641,71 @@ static rpmRC checkPackages(char *pkgchec
return RPMRC_OK;
}
+static void trimChangelog(Header h)
+{
+ static int oneshot;
+ static int cuttime, minnum, maxnum;
+ rpm_count_t i, keep;
+ struct rpmtd_s timestd, namestd, textstd;
+ rpm_count_t count;
+
+ 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 (!headerGet(h, RPMTAG_CHANGELOGTIME, ×td, HEADERGET_MINMEM))
+ return;
+ count = rpmtdCount(×td);
+ if ((!cuttime || count <= minnum) && (!maxnum || count <= maxnum)) {
+ rpmtdFreeData(×td);
+ return;
+ }
+ keep = count;
+ if (maxnum && keep > maxnum)
+ keep = maxnum;
+ if (cuttime) {
+ for (i = 0; i < keep; i++) {
+ uint32_t *tp = rpmtdNextUint32(×td);
+ if (i >= minnum && tp && *tp < cuttime)
+ break;
+ }
+ keep = i;
+ }
+ if (keep >= count) {
+ rpmtdFreeData(×td);
+ return;
+ }
+ headerGet(h, RPMTAG_CHANGELOGNAME, &namestd, HEADERGET_MINMEM);
+ headerGet(h, RPMTAG_CHANGELOGTEXT, &textstd, HEADERGET_MINMEM);
+ timestd.count = namestd.count = textstd.count = keep;
+ headerMod(h, ×td);
+ headerMod(h, &namestd);
+ headerMod(h, &textstd);
+ rpmtdFreeData(&textstd);
+ rpmtdFreeData(&namestd);
+ rpmtdFreeData(×td);
+}
+
rpmRC packageBinaries(rpmSpec spec, const char *cookie, int cheating)
{
rpmRC rc;
@@ -648,6 +713,7 @@ rpmRC packageBinaries(rpmSpec spec, cons
Package pkg;
char *pkglist = NULL;
+ trimChangelog(spec->packages->header);
for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
char *fn;
--- ./build/parseChangelog.c.orig 2017-10-05 10:04:56.859602170 +0000
+++ ./build/parseChangelog.c 2017-12-04 14:47:41.249346774 +0000
@@ -255,6 +255,11 @@ static rpmRC addChangelog(Header h, ARGV
goto exit;
}
+ /* workaround old suse oddity */
+ if (*s == '-' && s[1] == ' ') {
+ s += 2;
+ }
+
/* name */
name = s;
while (*s != '\0') s++;