1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
Index: rpm-4.9.0/build/pack.c
===================================================================
--- rpm-4.9.0.orig/build/pack.c
+++ rpm-4.9.0/build/pack.c
@@ -671,6 +671,63 @@ static rpmRC checkPackages(char *pkgchec
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;
@@ -680,6 +737,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;
Index: rpm-4.9.0/build/parseChangelog.c
===================================================================
--- rpm-4.9.0.orig/build/parseChangelog.c
+++ rpm-4.9.0/build/parseChangelog.c
@@ -168,6 +168,11 @@ static rpmRC addChangelog(Header h, ARGV
return RPMRC_FAIL;
}
+ /* workaround old suse oddity */
+ if (*s == '-' && s[1] == ' ') {
+ s += 2;
+ }
+
/* name */
name = s;
while (*s != '\0') s++;
|