From 06ccc49bf35dc68b78a88cc23308aff6655a9305 Mon Sep 17 00:00:00 2001 From: Jason Tibbitts Date: Dec 15 2015 05:06:09 +0000 Subject: More massaging; should actually work now. --- diff --git a/epel-rpm-macros.spec b/epel-rpm-macros.spec index a04d5a2..5bb244b 100644 --- a/epel-rpm-macros.spec +++ b/epel-rpm-macros.spec @@ -10,28 +10,30 @@ License: GPLv2 # our distribution. Thus the source is only available from # within this srpm. URL: http://download.fedoraproject.org/pub/epel -Source0: macros.epel-rpm-macros + +# Please see the file itself for an explanation of its odd name. +Source0: macros.zzz-epel Source1: GPL BuildArch: noarch -Requires: redhat-release >= %{version} +Requires: epel-release = %{version} %description -This package contains the Extra Packages for Enterprise Linux (EPEL) RPM -macros for building EPEL packages. +This package contains some RPM macros which minimize the differences in the +packaging process between Fedora and EPEL. %prep +%setup -c %name-%version -T install -pm 644 %{SOURCE1} . %install -#GPG Key install -Dpm 644 %{SOURCE0} \ - %{buildroot}/etc/rpm/macros.epel-rpm-macros + %{buildroot}/etc/rpm/macros.zzz-epel %files -# Can't use %% license yet because this package is adding it +# Can't use %%license here yet %doc GPL -/etc/rpm/macros.epel-rpm-macros +/etc/rpm/macros.zzz-epel %changelog * Wed Dec 02 2015 Jason L Tibbitts III - 6-1 diff --git a/macros.epel-rpm-macros b/macros.epel-rpm-macros deleted file mode 100644 index 19169ad..0000000 --- a/macros.epel-rpm-macros +++ /dev/null @@ -1,3 +0,0 @@ -# epel macros - -%license %doc diff --git a/macros.zzz-epel b/macros.zzz-epel new file mode 100644 index 0000000..60055f1 --- /dev/null +++ b/macros.zzz-epel @@ -0,0 +1,62 @@ +# 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}