- Don't warn when an escaped macro is in a comment

- Related: #1224660
This commit is contained in:
Lubos Kardos 2015-07-30 16:50:54 +02:00
parent 77efb7ee50
commit 977533abf2
2 changed files with 53 additions and 1 deletions

View File

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

View File

@ -27,7 +27,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
Release: %{?snapver:0.%{snapver}.}3%{?dist}
Release: %{?snapver:0.%{snapver}.}4%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/rpm-4.12.x/%{name}-%{srcver}.tar.bz2
@ -52,6 +52,7 @@ Patch5: rpm-4.12.0-rpm2cpio-hack.patch
# Patches already upstream:
Patch100: rpm-4.12.90-braces-expansion.patch
Patch101: rpm-4.12.90-Fix-compressed-patches.patch
Patch102: rpm-4.12.90-fix-macro-warning.patch
# These are not yet upstream
Patch302: rpm-4.7.1-geode-i686.patch
@ -536,6 +537,9 @@ exit 0
%doc doc/librpm/html/*
%changelog
* Thu Jul 30 2015 Lubos Kardos <lkardos@redhat.com> - 4.12.90-4
- Don't warn when an escaped macro is in a comment (#1224660)
* Mon Jul 27 2015 Florian Festi <ffesti@rpm.org> - 4.12.90-3
- Fix compressed patches (#1247248)