a76d6c30a2
Copy from Base:System/rpm based on submit request 18841 from user mlschroe OBS-URL: https://build.opensuse.org/request/show/18841 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpm?expand=0&rev=84
94 lines
2.7 KiB
Diff
94 lines
2.7 KiB
Diff
Index: build/parseChangelog.c
|
|
===================================================================
|
|
--- build/parseChangelog.c.orig
|
|
+++ build/parseChangelog.c
|
|
@@ -167,6 +167,11 @@ static rpmRC addChangelog(Header h, Stri
|
|
return RPMRC_FAIL;
|
|
}
|
|
|
|
+ /* workaround old suse oddity */
|
|
+ if (*s == '-' && s[1] == ' ') {
|
|
+ s += 2;
|
|
+ }
|
|
+
|
|
/* name */
|
|
name = s;
|
|
while (*s != '\0') s++;
|
|
Index: build/pack.c
|
|
===================================================================
|
|
--- build/pack.c.orig
|
|
+++ build/pack.c
|
|
@@ -707,6 +707,64 @@ 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)
|
|
{
|
|
struct cpioSourceArchive_s csabuf;
|
|
@@ -716,6 +774,7 @@ rpmRC packageBinaries(rpmSpec spec)
|
|
Package pkg;
|
|
char *pkglist = NULL;
|
|
|
|
+ trimChangelog(spec->packages->header);
|
|
for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
|
|
char *fn;
|
|
|