]>
Commit | Line | Data |
---|---|---|
685ff051 ER |
1 | # vim:ts=8:sw=4 |
2 | --- rpm-4.4.6/build/parseChangelog.c~ 2006-04-30 17:34:40.334393487 +0300 | |
3 | +++ rpm-4.4.6/build/parseChangelog.c 2006-05-02 19:46:06.357193264 +0300 | |
4 | @@ -8,6 +8,9 @@ | |
5 | #include "rpmbuild.h" | |
6 | #include "debug.h" | |
7 | ||
8 | +#define CVS_RCSID "$""Log: " | |
9 | +#define CVS_REVISION "Revision " | |
10 | + | |
11 | void addChangelogEntry(Header h, time_t time, const char *name, const char *text) | |
12 | { | |
13 | int_32 mytime = time; /* XXX convert to header representation */ | |
122ebef2 ER |
14 | @@ -123,6 +123,7 @@ |
15 | int nentries = 0; | |
16 | static time_t last = 0; | |
17 | static int oneshot = 0; | |
18 | + int numchangelog = rpmExpandNumeric("%{?_buildchangelogtruncate}"); | |
19 | ||
20 | /* Determine changelog truncation criteria. */ | |
21 | if (!oneshot++) { | |
685ff051 ER |
22 | @@ -222,6 +223,42 @@ |
23 | /* backup to end of description */ | |
24 | while ((s > text) && xisspace(*s)) | |
25 | *s-- = '\0'; | |
26 | + | |
27 | + if (numchangelog && (s = strstr(text, CVS_RCSID))) { | |
28 | + /* find end of line */ | |
29 | + while(*s && *s != '\n') s++; | |
30 | + if (!*s) { | |
31 | + goto out; | |
32 | + } | |
33 | + s++; | |
34 | + if (!*s) { | |
35 | + goto out; | |
36 | + } | |
37 | + | |
38 | + /* we reached place where first Revisions should be */ | |
39 | + i = 0; | |
40 | + while (1) { | |
41 | + if (strncmp(s, CVS_REVISION, sizeof(CVS_REVISION) - 1) == 0) { | |
42 | + if (i++ == numchangelog) { | |
43 | + break; | |
44 | + } | |
45 | + } | |
46 | + while(*s && *s != '\n') s++; | |
47 | + if (!*s) { | |
48 | + break; | |
49 | + } | |
50 | + s++; | |
51 | + } | |
52 | + | |
53 | + if (*s) { | |
54 | + s--; | |
55 | + /* backup to the beginning of line */ | |
56 | + while ((s > text) && (*s == '\n' || xisspace(*s))) { | |
57 | + *s-- = '\0'; | |
58 | + } | |
59 | + } | |
60 | + } | |
61 | +out: | |
62 | ||
63 | /* Add entry if not truncated. */ | |
64 | nentries++; |