Blame SOURCES/load.inc

7958ac
%{lua:
7958ac
7958ac
function source_macros(file)
7958ac
  local macro = nil
7958ac
7958ac
  for line in io.lines(file) do
7958ac
    if not macro and line:match("^%%") then
7958ac
      macro = line:match("^%%(.*)$")
7958ac
      line = nil
7958ac
    end
7958ac
7958ac
    if macro then
7958ac
      if line and macro:match("^.-%s*\\%s*$") then
7958ac
        macro = macro .. '\n' .. line
7958ac
      end
7958ac
7958ac
      if not macro:match("^.-%s*\\%s*$") then
7958ac
        rpm.define(macro)
7958ac
        macro = nil
7958ac
      end
7958ac
    end
7958ac
  end
7958ac
end
7958ac
7958ac
}
7958ac
7958ac
# Include the constants defined in macros files. Could be dropped as soon as
7958ac
# RPM supports the %%load macro (RPM 4.12+ probably).
7958ac
# http://lists.rpm.org/pipermail/rpm-maint/2014-February/003659.html
7958ac
%define load() %{lua:source_macros(rpm.expand("%1"))}