Blame SOURCES/load.inc

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