Lubos Kardos 977533
From 655ca18630d4a89e022b51ea495fa63718303413 Mon Sep 17 00:00:00 2001
Lubos Kardos 977533
From: Lubos Kardos <lkardos@redhat.com>
Lubos Kardos 977533
Date: Thu, 30 Jul 2015 16:23:58 +0200
Lubos Kardos 977533
Subject: [PATCH] Don't warn when an escaped macro is in comment.
Lubos Kardos 977533
Lubos Kardos 977533
- Related to 2a3f49585e5bd82d0bbfe5b9d6cdf24d9501b5cd
Lubos Kardos 977533
---
Lubos Kardos 977533
 build/parseSpec.c | 23 ++++++++++++++++++-----
Lubos Kardos 977533
 1 file changed, 18 insertions(+), 5 deletions(-)
Lubos Kardos 977533
Lubos Kardos 977533
diff --git a/build/parseSpec.c b/build/parseSpec.c
Lubos Kardos 977533
index 706579d..edc3d00 100644
Lubos Kardos 977533
--- a/build/parseSpec.c
Lubos Kardos 977533
+++ b/build/parseSpec.c
Lubos Kardos 977533
@@ -189,12 +189,25 @@ static int expandMacrosInSpecBuf(rpmSpec spec, int strip)
Lubos Kardos 977533
 	goto exit;
Lubos Kardos 977533
     }
Lubos Kardos 977533
 
Lubos Kardos 977533
-    if (strip & STRIP_COMMENTS &&
Lubos Kardos 977533
-	isComment && !rstreq(spec->lbuf, lbuf)) {
Lubos Kardos 977533
+    if (strip & STRIP_COMMENTS && isComment) {
Lubos Kardos 977533
+	char *bufA = lbuf;
Lubos Kardos 977533
+	char *bufB = spec->lbuf;
Lubos Kardos 977533
 
Lubos Kardos 977533
-	rpmlog(RPMLOG_WARNING,
Lubos Kardos 977533
-	    _("Macro expanded in comment on line %d: %s\n"),
Lubos Kardos 977533
-	    spec->lineNum, lbuf);
Lubos Kardos 977533
+	while (*bufA != '\0' && *bufB != '\0') {
Lubos Kardos 977533
+	    if (*bufA == '%' && *(bufA + 1) == '%')
Lubos Kardos 977533
+		bufA++;
Lubos Kardos 977533
+
Lubos Kardos 977533
+	    if (*bufA != *bufB)
Lubos Kardos 977533
+		break;
Lubos Kardos 977533
+
Lubos Kardos 977533
+	    bufA++;
Lubos Kardos 977533
+	    bufB++;
Lubos Kardos 977533
+	}
Lubos Kardos 977533
+
Lubos Kardos 977533
+	if (*bufA != '\0' || *bufB != '\0')
Lubos Kardos 977533
+	    rpmlog(RPMLOG_WARNING,
Lubos Kardos 977533
+		_("Macro expanded in comment on line %d: %s\n"),
Lubos Kardos 977533
+		spec->lineNum, lbuf);
Lubos Kardos 977533
     }
Lubos Kardos 977533
 
Lubos Kardos 977533
 exit:
Lubos Kardos 977533
-- 
Lubos Kardos 977533
1.9.3
Lubos Kardos 977533