Skip to content

Commit

Permalink
spec_query: add elif support
Browse files Browse the repository at this point in the history
rpm 4.15 and above has support for %elif which is a handy shortcut for
%else/%if + %endif combinations.

  %if "%{x}" == "a"
  %else
  %if "%{x}" == "b"
  %endif
  %endif

can be rewritten into

  %if "%{x}" == "a"
  %elif "%{x}" == "b"
  %endif

Add minimal support by just skipping over it.
  • Loading branch information
dirkmueller committed Feb 23, 2022
1 parent c116a7b commit f49d8d9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions helpers/spec_query
Expand Up @@ -43,6 +43,9 @@ sub prepare_spec {
} elsif (/^\s*%if/) {
unshift @ifs, { $st_if => $line };
next;
} elsif (/^\s*%elif/) {
die($line . ": %elif without %if\n") unless @ifs;
next;
} elsif (/^\s*%else/) {
die($line . ": %else without %if\n") unless @ifs;
if (exists $ifs[0]{$st_ifname}) {
Expand Down

0 comments on commit f49d8d9

Please sign in to comment.