Blob Blame History Raw
# EPEL6-specific macros

# This file is named such that it appears alphabetically after other macro
# files in /etc/rpm.  This allows us to overwrite RHEL-provided macros if
# necessary.  (It turns out that it is necessary; see _font_pkg below.)


# This macro defines %license to work like %doc.
#
# This isn't as simple as it might seem, because RPM will write over the
# %license macro as soon as it sees the License: tag.  This means that the
# macro has to be defined later, and rpm gives us no hooks to do that.  We
# could add a simple macro that just defines the thing, but that only saves
# users having to paste in some line noise.  Which is still an improvement, but
# we can do better.
#
# For whatever reason rpm lets us redefine %files.  Since every package that's
# going to have a license file will have a %files section, we're golden.
%files(f:n:) %{lua:
    rpm.define("license %doc")
    local args = rpm.expand("%**")
    if type(args) == "nil" or string.len(args) == 0 then
        print("%files\\n")
    else
        print("%files " .. args .. "\\n")
    end
}

# This macro overrides the existing macro from macros.fonts (part of the
# fontpackages-devel package).  This is necessary because that macro has a bug
# which causes it to expand recursively if expanded in certain contextx.  It is
# possible but not likely that Red Hat would update this package in RHEL6.
#
# The only difference is that a define is changed to a global on the third
# line, and that a guard against the font macros not actually being installed
# is added.
%_font_pkg(n:f:) \
%{?_font_pkg_name:\
%global spn %_font_pkg_name %{-n:%{-n*}} \
%post -n %{spn} \
if [ -x %{_bindir}/fc-cache ]; then \
    %{_bindir}/fc-cache %{_fontdir} || : \
fi \
\
\
%postun -n %{spn}  \
if [ $1 -eq 0 -a -x %{_bindir}/fc-cache ] ; then \
    %{_bindir}/fc-cache %{_fontdir} || : \
fi\
\
\
%files -n %{spn} \
%defattr(0644,root,root,0755) \
\
%dir %{_fontdir} \
%{lua: \
for arg=1,rpm.expand("%#") do \
  print(rpm.expand("%{_fontdir}/%" .. arg) .. "\\n") \
end} \
%{-f:%{_fontconfig_templatedir}/%{-f*}} \
%{-f:%config(noreplace) %{_fontconfig_confdir}/%{-f*} \
}} %{nil}