Blame SOURCES/load.inc

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