Blame SOURCES/load.inc

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