Michael Schröder
dc6592c036
OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=507
96 lines
2.7 KiB
Diff
96 lines
2.7 KiB
Diff
--- ./build/pack.c.orig 2019-06-26 14:17:31.395985720 +0000
|
|
+++ ./build/pack.c 2019-10-02 11:31:05.908639084 +0000
|
|
@@ -743,11 +743,78 @@ 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);
|
|
+}
|
|
+
|
|
rpmRC packageBinaries(rpmSpec spec, const char *cookie, int cheating)
|
|
{
|
|
rpmRC rc = RPMRC_OK;
|
|
Package pkg;
|
|
|
|
+ trimChangelog(spec->packages->header);
|
|
+
|
|
/* Run binary creation in parallel */
|
|
#pragma omp parallel
|
|
#pragma omp single
|
|
--- ./build/parseChangelog.c.orig 2019-06-26 14:17:31.395985720 +0000
|
|
+++ ./build/parseChangelog.c 2019-10-02 11:29:26.684840735 +0000
|
|
@@ -253,6 +253,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++;
|