Michael Schröder
7481dd3084
OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=552
98 lines
2.9 KiB
Diff
98 lines
2.9 KiB
Diff
--- ./build/pack.c.orig 2020-09-30 12:49:33.397074156 +0000
|
|
+++ ./build/pack.c 2020-09-30 12:51:34.628805840 +0000
|
|
@@ -728,6 +728,71 @@ static rpmRC packageBinary(rpmSpec spec,
|
|
return rc;
|
|
}
|
|
|
|
+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);
|
|
+}
|
|
+
|
|
static int compareBinaries(const void *p1, const void *p2) {
|
|
Package pkg1 = *(Package *)p1;
|
|
Package pkg2 = *(Package *)p2;
|
|
@@ -751,6 +816,8 @@ rpmRC packageBinaries(rpmSpec spec, cons
|
|
Package *tasks;
|
|
int npkgs = 0;
|
|
|
|
+ trimChangelog(spec->packages->header);
|
|
+
|
|
for (pkg = spec->packages; pkg != NULL; pkg = pkg->next)
|
|
npkgs++;
|
|
tasks = xcalloc(npkgs, sizeof(Package));
|
|
--- ./build/parseChangelog.c.orig 2020-08-31 09:14:07.991087349 +0000
|
|
+++ ./build/parseChangelog.c 2020-09-30 12:49:33.401074147 +0000
|
|
@@ -267,6 +267,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++;
|