Blame macros.zzz-epel

06ccc49
# EPEL6-specific macros
06ccc49
06ccc49
# This file is named such that it appears alphabetically after other macro
06ccc49
# files in /etc/rpm.  This allows us to overwrite RHEL-provided macros if
06ccc49
# necessary.  (It turns out that it is necessary; see _font_pkg below.)
06ccc49
06ccc49
06ccc49
# This macro defines %license to work like %doc.
06ccc49
#
06ccc49
# This isn't as simple as it might seem, because RPM will write over the
06ccc49
# %license macro as soon as it sees the License: tag.  This means that the
06ccc49
# macro has to be defined later, and rpm gives us no hooks to do that.  We
06ccc49
# could add a simple macro that just defines the thing, but that only saves
06ccc49
# users having to paste in some line noise.  Which is still an improvement, but
06ccc49
# we can do better.
06ccc49
#
06ccc49
# For whatever reason rpm lets us redefine %files.  Since every package that's
06ccc49
# going to have a license file will have a %files section, we're golden.
06ccc49
%files(f:n:) %{lua:
06ccc49
    rpm.define("license %doc")
06ccc49
    local args = rpm.expand("%**")
06ccc49
    if type(args) == "nil" or string.len(args) == 0 then
06ccc49
        print("%files\\n")
06ccc49
    else
06ccc49
        print("%files " .. args .. "\\n")
06ccc49
    end
06ccc49
}
06ccc49
06ccc49
# This macro overrides the existing macro from macros.fonts (part of the
06ccc49
# fontpackages-devel package).  This is necessary because that macro has a bug
06ccc49
# which causes it to expand recursively if expanded in certain contextx.  It is
06ccc49
# possible but not likely that Red Hat would update this package in RHEL6.
06ccc49
#
06ccc49
# The only difference is that a define is changed to a global on the third
06ccc49
# line, and that a guard against the font macros not actually being installed
06ccc49
# is added.
06ccc49
%_font_pkg(n:f:) \
06ccc49
%{?_font_pkg_name:\
06ccc49
%global spn %_font_pkg_name %{-n:%{-n*}} \
06ccc49
%post -n %{spn} \
06ccc49
if [ -x %{_bindir}/fc-cache ]; then \
06ccc49
    %{_bindir}/fc-cache %{_fontdir} || : \
06ccc49
fi \
06ccc49
\
06ccc49
\
06ccc49
%postun -n %{spn}  \
06ccc49
if [ $1 -eq 0 -a -x %{_bindir}/fc-cache ] ; then \
06ccc49
    %{_bindir}/fc-cache %{_fontdir} || : \
06ccc49
fi\
06ccc49
\
06ccc49
\
06ccc49
%files -n %{spn} \
06ccc49
%defattr(0644,root,root,0755) \
06ccc49
\
06ccc49
%dir %{_fontdir} \
06ccc49
%{lua: \
06ccc49
for arg=1,rpm.expand("%#") do \
06ccc49
  print(rpm.expand("%{_fontdir}/%" .. arg) .. "\\n") \
06ccc49
end} \
06ccc49
%{-f:%{_fontconfig_templatedir}/%{-f*}} \
06ccc49
%{-f:%config(noreplace) %{_fontconfig_confdir}/%{-f*} \
06ccc49
}} %{nil}
Orion Poplawski 504c59d
Orion Poplawski 504c59d
# Add nodejs_arches - in redhat-rpm-config in EL7
Orion Poplawski 504c59d
%nodejs_arches %{ix86} x86_64 %{arm}