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

pavlinamv notifications at github.com
Tue May 14 13:13:02 UTC 2019


pavlinamv commented on this pull request.



> +    size_t textLen;
+    const char *text;
+    int withArgs;
+    int isConditional;
+    int wrongPrecursors;
+    const char *info_text;
+} * parsedSpecLine;
+
+static struct parsedSpecLine_s const lineTypes[] = {
+    { LINE_ENDIF,      LEN_AND_STR("%endif")  , 0, 1, LINE_ENDIF, "with no %%if"},
+    { LINE_ELSE,       LEN_AND_STR("%else")   , 0, 1, LINE_ENDIF | LINE_ELSE, "after %%else" },
+    { LINE_IF,         LEN_AND_STR("%if")     , 1, 1, 0, "after %%if"},
+    { LINE_IFARCH,     LEN_AND_STR("%ifarch") , 1, 1, 0, "after %%ifarch"},
+    { LINE_IFNARCH,    LEN_AND_STR("%ifnarch"), 1, 1, 0, "after %%ifnarch"},
+    { LINE_IFOS,       LEN_AND_STR("%ifos")   , 1, 1, 0, "after %%ifos"},
+    { LINE_IFNOS,      LEN_AND_STR("%ifnos")  , 1, 1, 0, "after %%ifnos"},

>The %ifs should not have any info text because there are no such error cases, and the texts should be marked for translation.

>Programmatically constructed messages tend to be a problem for translators, might better to have the whole string in one piece, ie "%s with no %s" and "%s after %s" to allow translators to at least reorder the words.

Changed in the new version

>  Also, isn't this now missing the else-with-no-if case, or am I just misreading it?

No in this case it wrote e.g.
/data/SPECS/attrtest.spec:1: %%endif with no %%if
/data/SPECS/configtest.spec:1: %%else with no %%if

> Hmm, "with no" could just as well be changed into "before", which makes the messages more in line with each other: this is just about the order of things, so things are either before or after its proper place.

This message appears e.g. in case that in spec file is only one conditional: %endif. So in this case there is no %if after the %endif, thus changing "with no" into "before" good idea.

-- 
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_r283789959
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20190514/6466bed8/attachment.html>


More information about the Rpm-maint mailing list