|
|
396caf |
# Fedora macros, safe to use after the SRPM build stage
|
|
|
396caf |
|
|
|
396caf |
# Lists files matching inclusion globs, excluding files matching exclusion
|
|
|
396caf |
# globs
|
|
|
396caf |
# – globs are space-separated lists of shell globs. Such lists require
|
|
|
396caf |
# %{quote:} use when passed as rpm arguments or flags.
|
|
|
396caf |
# Control variables, flags and arguments:
|
|
|
396caf |
# %{listfiles_include} inclusion globs
|
|
|
396caf |
# %{listfiles_exclude} exclusion globs
|
|
|
396caf |
# -i <globs> inclusion globs
|
|
|
396caf |
# -x <globs> exclusion globs
|
|
|
396caf |
# … arguments passed to the macro without flags will be
|
|
|
396caf |
# interpreted as inclusion globs
|
|
|
396caf |
%listfiles(i:x:) %{expand:
|
|
|
396caf |
%if %{lua: print(string.len(rpm.expand("%{?-i*}%{?listfiles_include}%*")))}
|
|
|
396caf |
listfiles_include=$(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u)
|
|
|
396caf |
%if %{lua: print(string.len(rpm.expand("%{?-x*}%{?listfiles_exclude}")))}
|
|
|
396caf |
while IFS= read -r finc ; do
|
|
|
396caf |
realpath -qe --relative-base=. %{?-x*} %{?listfiles_exclude} \\
|
|
|
396caf |
| sort -u | grep -q "${finc}" || echo "${finc}"
|
|
|
396caf |
done <<< "${listfiles_include}"
|
|
|
396caf |
%else
|
|
|
396caf |
echo "${listfiles_include}"
|
|
|
396caf |
%endif
|
|
|
396caf |
%endif
|
|
|
396caf |
}
|
|
|
396caf |
|
|
|
396caf |
# https://github.com/rpm-software-management/rpm/issues/581
|
|
|
396caf |
# Writes the contents of a list of rpm variables to a macro file
|
|
|
396caf |
# Control variables, flags and arguments:
|
|
|
396caf |
# -f <filename> the macro file to process:
|
|
|
396caf |
# – it must contain corresponding anchors
|
|
|
396caf |
# – for example %writevars -f myfile foo bar will replace:
|
|
|
396caf |
# @@FOO@@ with the rpm evaluation of %{foo} and
|
|
|
396caf |
# @@BAR@@ with the rpm evaluation of %{bar}
|
|
|
396caf |
# in myfile
|
|
|
396caf |
%writevars(f:) %{lua:
|
|
|
396caf |
local fedora = require "fedora.common"
|
|
|
396caf |
local macrofile = rpm.expand("%{-f*}")
|
|
|
396caf |
local rpmvars = {}
|
|
|
396caf |
for i = 1, rpm.expand("%#") do
|
|
|
396caf |
table.insert(rpmvars, rpm.expand("%" .. i))
|
|
|
396caf |
end
|
|
|
396caf |
fedora.writevars(macrofile,rpmvars)
|
|
|
396caf |
}
|
|
|
396caf |
|
|
|
396caf |
# gpgverify verifies signed sources. There is documentation in the script.
|
|
|
396caf |
%gpgverify(k:s:d:) %{lua:
|
|
|
396caf |
local script = rpm.expand("%{_rpmconfigdir}/redhat/gpgverify ")
|
|
|
396caf |
local keyring = rpm.expand("%{-k*}")
|
|
|
396caf |
local signature = rpm.expand("%{-s*}")
|
|
|
396caf |
local data = rpm.expand("%{-d*}")
|
|
|
396caf |
print(script)
|
|
|
396caf |
if keyring ~= "" then
|
|
|
396caf |
print(rpm.expand("--keyring='%{SOURCE" .. keyring .. "}' "))
|
|
|
396caf |
end
|
|
|
396caf |
if signature ~= "" then
|
|
|
396caf |
print(rpm.expand("--signature='%{SOURCE" .. signature .. "}' "))
|
|
|
396caf |
end
|
|
|
396caf |
if data ~= "" then
|
|
|
396caf |
print(rpm.expand("--data='%{SOURCE" .. data .. "}' "))
|
|
|
396caf |
end
|
|
|
396caf |
}
|