Blame SOURCES/load.inc

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