[Rpm-maint] [rpm-software-management/rpm] Warn if %else is after %else (#649)

Panu Matilainen notifications at github.com
Fri May 17 11:40:35 UTC 2019


pmatilai commented on this pull request.



> @@ -462,6 +430,22 @@ int readLine(rpmSpec spec, int strip)
     lineType = parseLineType(s);
     if (!lineType)
 	goto after_classification;
+
+    /* check ordering of the conditional */
+    if (lineType->isConditional &&
+	(spec->readStack->lastConditional->id & lineType->wrongPrecursors)) {
+	/* the conditional can't be after %endif or the 1. conditional */
+	if (spec->readStack->lastConditional->id == LINE_ENDIF)
+	    rpmlog(RPMLOG_ERR,_("%s:%d: %s with no %%if\n"),
+		ofi->fileName, ofi->lineNum, lineType->text);
+	else
+	/* wrong ordering of the last two conditionals */
+	    rpmlog(RPMLOG_ERR,_("%s:%d: %s after %s\n"),

Oh, and one more thing I just realized: most of our error messages are of the format "%s: line %d: <message>", lets be consistent with that in both these messages. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/649#discussion_r285088063
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20190517/8dd25b1f/attachment.html>


More information about the Rpm-maint mailing list