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