/[packages]/cauldron/rpm/current/SOURCES/rpm-forbid-badly-commented-define-in-spec.patch
ViewVC logotype

Contents of /cauldron/rpm/current/SOURCES/rpm-forbid-badly-commented-define-in-spec.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 343 - (show annotations) (download)
Sat Jan 8 00:05:19 2011 UTC (13 years, 3 months ago) by tmb
File size: 1414 byte(s)
imported package rpm
1 From d7390b31ac03f11365a2dde2a3963421565df323 Mon Sep 17 00:00:00 2001
2 From: unknown author <cooker@mandrivalinux.org>
3 Date: Mon, 5 Jan 2009 13:29:57 +0000
4 Subject: [PATCH 23/35] forbid badly commented define in spec
5
6 ---
7 build/parseSpec.c | 23 +++++++++++++++++++++++
8 1 files changed, 23 insertions(+), 0 deletions(-)
9
10 diff --git a/build/parseSpec.c b/build/parseSpec.c
11 index cf22db3..dad5403 100644
12 --- a/build/parseSpec.c
13 +++ b/build/parseSpec.c
14 @@ -104,6 +104,24 @@ void handleComments(char *s)
15 *s = '\0';
16 }
17
18 +static int begins_with(const char *s, const char *prefix)
19 +{
20 + return strncmp(s, prefix, strlen(prefix)) == 0;
21 +}
22 +
23 +static int isCommentedDefine(const char *line)
24 +{
25 + const char *p = line;
26 +
27 + SKIPSPACE(p);
28 + if (*p++ == '#') {
29 + SKIPSPACE(p);
30 + if (begins_with(p, "%define") &&
31 + isspace(p[strlen("%define")])) return 1;
32 + }
33 + return 0;
34 +}
35 +
36 /**
37 */
38 static void forceIncludeFile(rpmSpec spec, const char * fileName)
39 @@ -145,6 +163,11 @@ static int copyNextLineFromOFI(rpmSpec spec, OFI_t *ofi)
40 *to++ = '\0';
41 ofi->readPtr = from;
42
43 + if (isCommentedDefine(spec->lbuf)) {
44 + rpmlog(RPMLOG_ERR, _("%s:%d: #%%define is forbidden, use #define to comment a %%define\n"), ofi->fileName, ofi->lineNum);
45 + return -1;
46 + }
47 +
48 /* Check if we need another line before expanding the buffer. */
49 for (p = spec->lbuf; *p; p++) {
50 switch (*p) {
51 --
52 1.6.1.3
53

  ViewVC Help
Powered by ViewVC 1.1.30