1 diff -urN rpm-4.0.2/build/parseChangelog.c rpm-4.0.2.patched/build/parseChangelog.c
2 --- rpm-4.0.2/build/parseChangelog.c Tue Jan 16 00:10:04 2001
3 +++ rpm-4.0.2.patched/build/parseChangelog.c Sat Sep 1 15:11:55 2001
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) {
13 diff -urN rpm-4.0.2/build/parseSpec.c rpm-4.0.2.patched/build/parseSpec.c
14 --- rpm-4.0.2/build/parseSpec.c Tue Jan 16 14:08:55 2001
15 +++ rpm-4.0.2.patched/build/parseSpec.c Sat Sep 1 15:36:00 2001
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;
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 */
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;
36 spec->nextline = spec->lbuf;
43 - if (! strncmp("%ifarch", s, sizeof("%ifarch")-1)) {
44 - const char *arch = rpmExpand("%{_target_cpu}", NULL);
46 - match = matchTok(arch, s);
48 - } else if (! strncmp("%ifnarch", s, sizeof("%ifnarch")-1)) {
49 - const char *arch = rpmExpand("%{_target_cpu}", NULL);
51 - match = !matchTok(arch, s);
53 - } else if (! strncmp("%ifos", s, sizeof("%ifos")-1)) {
54 - const char *os = rpmExpand("%{_target_os}", NULL);
56 - match = matchTok(os, s);
58 - } else if (! strncmp("%ifnos", s, sizeof("%ifnos")-1)) {
59 - const char *os = rpmExpand("%{_target_os}", NULL);
61 - match = !matchTok(os, s);
63 - } else if (! strncmp("%if", s, sizeof("%if")-1)) {
65 - match = parseExpressionBoolean(spec, s);
67 - rpmError(RPMERR_UNMATCHEDIF,
68 - _("%s:%d: parseExpressionBoolean returns %d\n"),
69 - ofi->fileName, ofi->lineNum, match);
70 - return RPMERR_BADSPEC;
72 - } else if (! strncmp("%else", s, sizeof("%else")-1)) {
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;
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)) {
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;
93 - rl = spec->readStack;
94 - spec->readStack = spec->readStack->next;
96 - spec->line[0] = '\0';
97 - } else if (! strncmp("%include", s, sizeof("%include")-1)) {
98 - char *fileName, *endFileName, *p;
102 - if (! isspace(*fileName)) {
103 - rpmError(RPMERR_BADSPEC, _("malformed %%include statement\n"));
104 - return RPMERR_BADSPEC;
106 - SKIPSPACE(fileName);
107 - endFileName = fileName;
108 - SKIPNONSPACE(endFileName);
112 - rpmError(RPMERR_BADSPEC, _("malformed %%include statement\n"));
113 - return RPMERR_BADSPEC;
115 - *endFileName = '\0';
116 + if (! (strip & STRIP_NOEXPAND)) {
117 + if (! strncmp("%ifarch", s, sizeof("%ifarch")-1)) {
118 + const char *arch = rpmExpand("%{_target_cpu}", NULL);
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);
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);
130 + match = matchTok(os, s);
132 + } else if (! strncmp("%ifnos", s, sizeof("%ifnos")-1)) {
133 + const char *os = rpmExpand("%{_target_os}", NULL);
135 + match = !matchTok(os, s);
137 + } else if (! strncmp("%if", s, sizeof("%if")-1)) {
139 + match = parseExpressionBoolean(spec, s);
141 + rpmError(RPMERR_UNMATCHEDIF,
142 + _("%s:%d: parseExpressionBoolean returns %d\n"),
143 + ofi->fileName, ofi->lineNum, match);
144 + return RPMERR_BADSPEC;
146 + } else if (! strncmp("%else", s, sizeof("%else")-1)) {
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;
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)) {
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;
167 + rl = spec->readStack;
168 + spec->readStack = spec->readStack->next;
170 + spec->line[0] = '\0';
171 + } else if (! strncmp("%include", s, sizeof("%include")-1)) {
172 + char *fileName, *endFileName, *p;
176 + if (! isspace(*fileName)) {
177 + rpmError(RPMERR_BADSPEC, _("malformed %%include statement\n"));
178 + return RPMERR_BADSPEC;
180 + SKIPSPACE(fileName);
181 + endFileName = fileName;
182 + SKIPNONSPACE(endFileName);
186 + rpmError(RPMERR_BADSPEC, _("malformed %%include statement\n"));
187 + return RPMERR_BADSPEC;
189 + *endFileName = '\0';
191 - forceIncludeFile(spec, fileName);
192 + forceIncludeFile(spec, fileName);
194 - ofi = spec->fileStack;
196 + ofi = spec->fileStack;
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
206 --- rpm-4.0.2/build/rpmbuild.h Thu Jan 11 15:15:15 2001
207 +++ rpm-4.0.2.patched/build/rpmbuild.h Sat Sep 1 15:11:55 2001
209 #define STRIP_NOTHING 0
210 #define STRIP_TRAILINGSPACE (1 << 0)
211 #define STRIP_COMMENTS (1 << 1)
212 +#define STRIP_NOEXPAND (1 << 2)