]>
Commit | Line | Data |
---|---|---|
af197e8e | 1 | diff -urN rpm-4.0.2/build/parseChangelog.c rpm-4.0.2.patched/build/parseChangelog.c |
0a6e9fd1 | 2 | --- rpm-4.0.2/build/parseChangelog.c Tue Jan 16 00:10:04 2001 |
af197e8e | 3 | +++ rpm-4.0.2.patched/build/parseChangelog.c Sat Sep 1 15:11:55 2001 |
0a6e9fd1 | 4 | @@ -213,7 +213,7 @@ |
5 | ||
6 | while (! (nextPart = isPart(spec->line))) { | |
7 | appendStringBuf(sb, spec->line); | |
8 | - if ((rc = readLine(spec, STRIP_COMMENTS)) > 0) { | |
9 | + if ((rc = readLine(spec, STRIP_COMMENTS | STRIP_NOEXPAND)) > 0) { | |
10 | nextPart = PART_NONE; | |
11 | break; | |
12 | } | |
af197e8e | 13 | diff -urN rpm-4.0.2/build/parseSpec.c rpm-4.0.2.patched/build/parseSpec.c |
0a6e9fd1 | 14 | --- rpm-4.0.2/build/parseSpec.c Tue Jan 16 14:08:55 2001 |
af197e8e | 15 | +++ rpm-4.0.2.patched/build/parseSpec.c Sat Sep 1 15:36:00 2001 |
0a6e9fd1 | 16 | @@ -131,12 +131,16 @@ |
17 | ofi->readPtr = from; | |
18 | ||
19 | /* Don't expand macros (eg. %define) in false branch of %if clause */ | |
20 | - if (spec->readStack->reading && | |
21 | - expandMacros(spec, spec->macros, spec->lbuf, sizeof(spec->lbuf))) { | |
22 | - rpmError(RPMERR_BADSPEC, _("line %d: %s\n"), | |
23 | - spec->lineNum, spec->lbuf); | |
24 | - return RPMERR_BADSPEC; | |
25 | - } | |
af197e8e | 26 | + /* Also don't expand macros in %changelog where we set STRIP_NOEXPAND flag */ |
27 | + /* (first line is ommited, so if there is e.g. %date macro, it will be expanded */ | |
0a6e9fd1 | 28 | + if (!(strip & STRIP_NOEXPAND)) { |
29 | + if (spec->readStack->reading && | |
30 | + expandMacros(spec, spec->macros, spec->lbuf, sizeof(spec->lbuf))) { | |
31 | + rpmError(RPMERR_BADSPEC, _("line %d: %s\n"), | |
32 | + spec->lineNum, spec->lbuf); | |
33 | + return RPMERR_BADSPEC; | |
34 | + } | |
35 | + } | |
36 | spec->nextline = spec->lbuf; | |
37 | } | |
38 | ||
af197e8e | 39 | @@ -241,86 +245,88 @@ |
40 | SKIPSPACE(s); | |
41 | ||
42 | match = -1; | |
43 | - if (! strncmp("%ifarch", s, sizeof("%ifarch")-1)) { | |
44 | - const char *arch = rpmExpand("%{_target_cpu}", NULL); | |
45 | - s += 7; | |
46 | - match = matchTok(arch, s); | |
47 | - free((void *)arch); | |
48 | - } else if (! strncmp("%ifnarch", s, sizeof("%ifnarch")-1)) { | |
49 | - const char *arch = rpmExpand("%{_target_cpu}", NULL); | |
50 | - s += 8; | |
51 | - match = !matchTok(arch, s); | |
52 | - free((void *)arch); | |
53 | - } else if (! strncmp("%ifos", s, sizeof("%ifos")-1)) { | |
54 | - const char *os = rpmExpand("%{_target_os}", NULL); | |
55 | - s += 5; | |
56 | - match = matchTok(os, s); | |
57 | - free((void *)os); | |
58 | - } else if (! strncmp("%ifnos", s, sizeof("%ifnos")-1)) { | |
59 | - const char *os = rpmExpand("%{_target_os}", NULL); | |
60 | - s += 6; | |
61 | - match = !matchTok(os, s); | |
62 | - free((void *)os); | |
63 | - } else if (! strncmp("%if", s, sizeof("%if")-1)) { | |
64 | - s += 3; | |
65 | - match = parseExpressionBoolean(spec, s); | |
66 | - if (match < 0) { | |
67 | - rpmError(RPMERR_UNMATCHEDIF, | |
68 | - _("%s:%d: parseExpressionBoolean returns %d\n"), | |
69 | - ofi->fileName, ofi->lineNum, match); | |
70 | - return RPMERR_BADSPEC; | |
71 | - } | |
72 | - } else if (! strncmp("%else", s, sizeof("%else")-1)) { | |
73 | - s += 5; | |
74 | - if (! spec->readStack->next) { | |
75 | - /* Got an else with no %if ! */ | |
76 | - rpmError(RPMERR_UNMATCHEDIF, | |
77 | - _("%s:%d: Got a %%else with no %%if\n"), | |
78 | - ofi->fileName, ofi->lineNum); | |
79 | - return RPMERR_UNMATCHEDIF; | |
80 | - } | |
81 | - spec->readStack->reading = | |
82 | - spec->readStack->next->reading && ! spec->readStack->reading; | |
83 | - spec->line[0] = '\0'; | |
84 | - } else if (! strncmp("%endif", s, sizeof("%endif")-1)) { | |
85 | - s += 6; | |
86 | - if (! spec->readStack->next) { | |
87 | - /* Got an end with no %if ! */ | |
88 | - rpmError(RPMERR_UNMATCHEDIF, | |
89 | - _("%s:%d: Got a %%endif with no %%if\n"), | |
90 | - ofi->fileName, ofi->lineNum); | |
91 | - return RPMERR_UNMATCHEDIF; | |
92 | - } | |
93 | - rl = spec->readStack; | |
94 | - spec->readStack = spec->readStack->next; | |
95 | - free(rl); | |
96 | - spec->line[0] = '\0'; | |
97 | - } else if (! strncmp("%include", s, sizeof("%include")-1)) { | |
98 | - char *fileName, *endFileName, *p; | |
99 | - | |
100 | - s += 8; | |
101 | - fileName = s; | |
102 | - if (! isspace(*fileName)) { | |
103 | - rpmError(RPMERR_BADSPEC, _("malformed %%include statement\n")); | |
104 | - return RPMERR_BADSPEC; | |
105 | - } | |
106 | - SKIPSPACE(fileName); | |
107 | - endFileName = fileName; | |
108 | - SKIPNONSPACE(endFileName); | |
109 | - p = endFileName; | |
110 | - SKIPSPACE(p); | |
111 | - if (*p != '\0') { | |
112 | - rpmError(RPMERR_BADSPEC, _("malformed %%include statement\n")); | |
113 | - return RPMERR_BADSPEC; | |
114 | - } | |
115 | - *endFileName = '\0'; | |
116 | + if (! (strip & STRIP_NOEXPAND)) { | |
117 | + if (! strncmp("%ifarch", s, sizeof("%ifarch")-1)) { | |
118 | + const char *arch = rpmExpand("%{_target_cpu}", NULL); | |
119 | + s += 7; | |
120 | + match = matchTok(arch, s); | |
121 | + free((void *)arch); | |
122 | + } else if (! strncmp("%ifnarch", s, sizeof("%ifnarch")-1)) { | |
123 | + const char *arch = rpmExpand("%{_target_cpu}", NULL); | |
124 | + s += 8; | |
125 | + match = !matchTok(arch, s); | |
126 | + free((void *)arch); | |
127 | + } else if (! strncmp("%ifos", s, sizeof("%ifos")-1)) { | |
128 | + const char *os = rpmExpand("%{_target_os}", NULL); | |
129 | + s += 5; | |
130 | + match = matchTok(os, s); | |
131 | + free((void *)os); | |
132 | + } else if (! strncmp("%ifnos", s, sizeof("%ifnos")-1)) { | |
133 | + const char *os = rpmExpand("%{_target_os}", NULL); | |
134 | + s += 6; | |
135 | + match = !matchTok(os, s); | |
136 | + free((void *)os); | |
137 | + } else if (! strncmp("%if", s, sizeof("%if")-1)) { | |
138 | + s += 3; | |
139 | + match = parseExpressionBoolean(spec, s); | |
140 | + if (match < 0) { | |
141 | + rpmError(RPMERR_UNMATCHEDIF, | |
142 | + _("%s:%d: parseExpressionBoolean returns %d\n"), | |
143 | + ofi->fileName, ofi->lineNum, match); | |
144 | + return RPMERR_BADSPEC; | |
145 | + } | |
146 | + } else if (! strncmp("%else", s, sizeof("%else")-1)) { | |
147 | + s += 5; | |
148 | + if (! spec->readStack->next) { | |
149 | + /* Got an else with no %if ! */ | |
150 | + rpmError(RPMERR_UNMATCHEDIF, | |
151 | + _("%s:%d: Got a %%else with no %%if\n"), | |
152 | + ofi->fileName, ofi->lineNum); | |
153 | + return RPMERR_UNMATCHEDIF; | |
154 | + } | |
155 | + spec->readStack->reading = | |
156 | + spec->readStack->next->reading && ! spec->readStack->reading; | |
157 | + spec->line[0] = '\0'; | |
158 | + } else if (! strncmp("%endif", s, sizeof("%endif")-1)) { | |
159 | + s += 6; | |
160 | + if (! spec->readStack->next) { | |
161 | + /* Got an end with no %if ! */ | |
162 | + rpmError(RPMERR_UNMATCHEDIF, | |
163 | + _("%s:%d: Got a %%endif with no %%if\n"), | |
164 | + ofi->fileName, ofi->lineNum); | |
165 | + return RPMERR_UNMATCHEDIF; | |
166 | + } | |
167 | + rl = spec->readStack; | |
168 | + spec->readStack = spec->readStack->next; | |
169 | + free(rl); | |
170 | + spec->line[0] = '\0'; | |
171 | + } else if (! strncmp("%include", s, sizeof("%include")-1)) { | |
172 | + char *fileName, *endFileName, *p; | |
173 | + | |
174 | + s += 8; | |
175 | + fileName = s; | |
176 | + if (! isspace(*fileName)) { | |
177 | + rpmError(RPMERR_BADSPEC, _("malformed %%include statement\n")); | |
178 | + return RPMERR_BADSPEC; | |
179 | + } | |
180 | + SKIPSPACE(fileName); | |
181 | + endFileName = fileName; | |
182 | + SKIPNONSPACE(endFileName); | |
183 | + p = endFileName; | |
184 | + SKIPSPACE(p); | |
185 | + if (*p != '\0') { | |
186 | + rpmError(RPMERR_BADSPEC, _("malformed %%include statement\n")); | |
187 | + return RPMERR_BADSPEC; | |
188 | + } | |
189 | + *endFileName = '\0'; | |
190 | ||
191 | - forceIncludeFile(spec, fileName); | |
192 | + forceIncludeFile(spec, fileName); | |
193 | ||
194 | - ofi = spec->fileStack; | |
195 | - goto retry; | |
196 | + ofi = spec->fileStack; | |
197 | + goto retry; | |
198 | + } | |
199 | } | |
200 | - | |
201 | + | |
202 | if (match != -1) { | |
203 | rl = xmalloc(sizeof(struct ReadLevelEntry)); | |
204 | rl->reading = spec->readStack->reading && match; | |
205 | diff -urN rpm-4.0.2/build/rpmbuild.h rpm-4.0.2.patched/build/rpmbuild.h | |
0a6e9fd1 | 206 | --- rpm-4.0.2/build/rpmbuild.h Thu Jan 11 15:15:15 2001 |
af197e8e | 207 | +++ rpm-4.0.2.patched/build/rpmbuild.h Sat Sep 1 15:11:55 2001 |
0a6e9fd1 | 208 | @@ -69,6 +69,7 @@ |
209 | #define STRIP_NOTHING 0 | |
210 | #define STRIP_TRAILINGSPACE (1 << 0) | |
211 | #define STRIP_COMMENTS (1 << 1) | |
212 | +#define STRIP_NOEXPAND (1 << 2) | |
213 | ||
214 | #ifdef __cplusplus | |
215 | extern "C" { |