|
|
5335ee5 |
# Some miscellaneous Fedora-related macros
|
|
|
5335ee5 |
|
|
|
5335ee5 |
# List files matching inclusion globs, excluding files matching exclusion blogs
|
|
|
5335ee5 |
# Parameters:
|
|
|
5335ee5 |
# -i "<globs>" include shell globs (also takes all other macro arguments)
|
|
|
5335ee5 |
# -x "<globs>" exclude shell globs
|
|
|
5335ee5 |
%listfiles(i:x:) %{expand:
|
|
|
5335ee5 |
while IFS= read -r -d $'\\n' finc ; do
|
|
|
5335ee5 |
printf "%s\\n" %{?-x*} \\
|
|
|
5335ee5 |
| xargs -i realpath --relative-base=. '{}' \\
|
|
|
5335ee5 |
| grep "${finc}" >/dev/null || echo "${finc}"
|
|
|
5335ee5 |
done <<< $(printf "%s\\n" %{?-i*} %* | xargs -i realpath --relative-base=. '{}' | sort -u)
|
|
|
5335ee5 |
}
|
|
|
5335ee5 |
|
|
|
5335ee5 |
# https://github.com/rpm-software-management/rpm/issues/581
|
|
|
5335ee5 |
# Write the contents of a list of rpm variables to a macro file.
|
|
|
5335ee5 |
# The target file must contain the corresponding anchors.
|
|
|
5335ee5 |
# For example %writevars -f myfile foo bar will replace:
|
|
|
5335ee5 |
# @@FOO@@ with the rpm evaluation of %{foo} and
|
|
|
5335ee5 |
# @@BAR@@ with the rpm evaluation of %{bar}
|
|
|
5335ee5 |
# in myfile
|
|
|
5335ee5 |
%writevars(f:) %{lua:
|
|
|
5335ee5 |
local fedora = require "fedora.common"
|
|
|
5335ee5 |
local macrofile = rpm.expand("%{-f*}")
|
|
|
5335ee5 |
local rpmvars = {}
|
|
|
5335ee5 |
for i = 1, rpm.expand("%#") do
|
|
|
5335ee5 |
table.insert(rpmvars, rpm.expand("%" .. i))
|
|
|
5335ee5 |
end
|
|
|
5335ee5 |
fedora.writevars(macrofile,rpmvars)
|
|
|
5335ee5 |
}
|