[Rpm-maint] [rpm-software-management/rpm] Implement %elif (#710)

Panu Matilainen notifications at github.com
Tue May 21 11:20:01 UTC 2019


pmatilai commented on this pull request.



>  	ARGMATCH(s, "%{_target_os}", match);
     } else if (lineType->id == LINE_IFNOS) {
 	ARGMATCH(s, "%{_target_os}", match);
 	match = !match;
-    } else if (lineType->id == LINE_IF) {
-	s += 3;
-        match = parseExpressionBoolean(s);
-	if (match < 0) {
-	    rpmlog(RPMLOG_ERR,
-			_("%s:%d: bad %%if condition\n"),
-			ofi->fileName, ofi->lineNum);
-	    return PART_ERROR;
+    } else if (lineType->id & (LINE_IF | LINE_ELIF)) {
+	s += lineType->textLen;
+	if (((lineType->id == LINE_IF) && (spec->readStack->reading)) ||
+	    ((lineType->id == LINE_ELIF) && (spec->readStack->readable))) {
+	    match = parseExpressionBoolean(s);

match = .. is at the same indentation level as the continued condition, please fix. Again, helper variable or two can be used to shorten the condition and will likely make it nicer overall.

-- 
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/710#pullrequestreview-239979706
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20190521/5566656b/attachment.html>


More information about the Rpm-maint mailing list