From 4221d242a3bd9a658285756f8d43a855e2014f7e Mon Sep 17 00:00:00 2001 From: Jason Tibbitts Date: Feb 18 2016 21:50:16 +0000 Subject: More autosetup work. --- diff --git a/TODO b/TODO index 5078125..62d7e31 100644 --- a/TODO +++ b/TODO @@ -1,19 +1,9 @@ Things I'd like to add. Assuming these are actually possible. -%autosetup for EL6 and 5 - %_smp_ncpus_max for EL5 python2 macros for EL6 and EL5 -%install buildroot cleaning in EL5 - -%clean section in EL5 - Tack this onto %files? - -BuildRoot: definition in EL5 - Not sure this is possible. Maybe tack it onto %files as well? - %__global_ldflags in EL6 (and maybe EL5) Requires redefinition of %cmake, %cmake_kde4, %qmake_qt4 and %configure diff --git a/epel-rpm-macros.spec b/epel-rpm-macros.spec index 63a3d6e..8f61450 100644 --- a/epel-rpm-macros.spec +++ b/epel-rpm-macros.spec @@ -4,7 +4,7 @@ Release: 5 Summary: Extra Packages for Enterprise Linux RPM macros Group: System Environment/Base -License: GPLv2 +License: GPLv2+ # This is a EPEL maintained package which is specific to # our distribution. Thus the source is only available from @@ -13,7 +13,9 @@ URL: http://download.fedoraproject.org/pub/epel # Please see the file itself for an explanation of its odd name. Source0: macros.zzz-epel -Source1: GPL +Source1: macros.zzz-epel-autosetup + +Source9: GPL BuildArch: noarch Requires: epel-release = %{version} @@ -24,17 +26,20 @@ packaging process between Fedora and EPEL. %prep %setup -c %name-%version -T -install -pm 644 %{SOURCE1} . +install -pm 644 %{SOURCE9} . %install install -Dpm 644 %{SOURCE0} \ %{buildroot}/etc/rpm/macros.zzz-epel +install -Dpm 644 %{SOURCE1} \ + %{buildroot}/etc/rpm/macros.zzz-epel-autosetup %files # Explicitly don't use %%license so that this package can be built without this # package being installed. %doc GPL /etc/rpm/macros.zzz-epel +/etc/rpm/macros.zzz-epel-autosetup %changelog * Thu Feb 18 2016 Jason L Tibbitts III - 6-5 diff --git a/macros.zzz-epel b/macros.zzz-epel index e10d15e..4a7c168 100644 --- a/macros.zzz-epel +++ b/macros.zzz-epel @@ -21,89 +21,3 @@ # Add nodejs_arches - in redhat-rpm-config in EL7 %nodejs_arches %{ix86} x86_64 %{arm} - -# Some convenience function copied from the current Fedora macros -%patches %{lua: for i, p in ipairs(patches) do print(p.." ") end} -%sources %{lua: for i, s in ipairs(sources) do print(s.." ") end} - -# Macros for further automated spec %setup and patch application -# default to plain patch -%__scm patch -# meh, figure something saner -%__scm_username rpm-build -%__scm_usermail -%__scm_author %{__scm_username} %{__scm_usermail} - -# Plain patch (-m is unused) -%__scm_setup_patch(q) %{nil} -%__scm_apply_patch(qp:m:)\ -%{__patch} %{-p:-p%{-p*}} %{-q:-s} - -# Mercurial (aka hg) -%__scm_setup_hg(q)\ -%{__hg} init %{-q} .\ -%{__hg} add %{-q} .\ -%{__hg} commit %{-q} --user "%{__scm_author}" -m "%{name}-%{version} base" - -%__scm_apply_hg(qp:m:)\ -%{__hg} import - %{-p:-p%{-p*}} %{-q} -m %{-m*} --user "%{__scm_author}" - -# Git -%__scm_setup_git(q)\ -%{__git} init %{-q}\ -%{__git} config user.name "%{__scm_username}"\ -%{__git} config user.email "%{__scm_usermail}"\ -%{__git} add .\ -%{__git} commit %{-q} -a\\\ - --author "%{__scm_author}" -m "%{name}-%{version} base" - -%__scm_apply_git(qp:m:)\ -%{__git} apply --index %{-p:-p%{-p*}} -\ -%{__git} commit %{-q} -m %{-m*} --author "%{__scm_author}" - -# Git, using "git am" (-m is unused) -%__scm_setup_git_am(q)\ -%{expand:%__scm_setup_git %{-q}} - -%__scm_apply_git_am(qp:m:)\ -%{__git} am %{-q} %{-p:-p%{-p*}} - -# Quilt -%__scm_setup_quilt(q) %{nil} -%__scm_apply_quilt(qp:m:)\ -%{__quilt} import %{-p:-p%{-p*}} %{1} && %{__quilt} push - -# Bzr -%__scm_setup_bzr(q)\ -%{__bzr} init %{-q}\ -%{__bzr} whoami --branch "%{__scm_author}"\ -%{__bzr} add .\ -%{__bzr} commit %{-q} -m "%{name}-%{version} base" - -# bzr doesn't seem to have its own command to apply patches? -%__scm_apply_bzr(qp:m:)\ -%{__patch} %{-p:-p%{-p*}} %{-q:-s}\ -%{__bzr} commit %{-q} -m %{-m*} - -# Single patch application -%apply_patch(qp:m:)\ -%{uncompress:%{1}} | %{expand:%__scm_apply_%{__scm} %{-q} %{-p:-p%{-p*}} %{-m:-m%{-m*}}} - -# Automatically apply all patches -%autopatch(vp:)\ -%{lua:\ -local options = rpm.expand("%{!-v:-q} %{-p:-p%{-p*}} ")\ -for i, p in ipairs(patches) do\ - print(rpm.expand("%apply_patch -m %{basename:"..p.."} "..options..p.."\\n"))\ -end} - -# One macro to (optionally) do it all. -# -S Sets the used patch application style, eg '-S git' enables -# usage of git repository and per-patch commits. -# -N Disable automatic patch application -# -p Use -p for patch application -%autosetup(a:b:cDn:TvNS:p:)\ -%setup %{-a} %{-b} %{-c} %{-D} %{-n} %{-T} %{!-v:-q}\ -%{-S:%global __scm %{-S*}}\ -%{-S:%{expand:%__scm_setup_%{-S*} %{!-v:-q}}}\ -%{!-N:%autopatch %{-v} %{-p:-p%{-p*}}} diff --git a/macros.zzz-epel-autosetup b/macros.zzz-epel-autosetup new file mode 100644 index 0000000..33d65e4 --- /dev/null +++ b/macros.zzz-epel-autosetup @@ -0,0 +1,94 @@ +# EPEL6-specific macros - autosetup +# +# Define some SCM locations which are not defined by default on EL6 +%__bzr /usr/bin/bzr +%__git /usr/bin/git +%__hg /usr/bin/hg +%__quilt /usr/bin/quilt + +# These were copied verbatim from the Fedora 23 rpm macros on 2016-02-17. + +%patches %{lua: for i, p in ipairs(patches) do print(p.." ") end} +%sources %{lua: for i, s in ipairs(sources) do print(s.." ") end} + +# Macros for further automated spec %setup and patch application +# default to plain patch +%__scm patch +# meh, figure something saner +%__scm_username rpm-build +%__scm_usermail +%__scm_author %{__scm_username} %{__scm_usermail} + +# Plain patch (-m is unused) +%__scm_setup_patch(q) %{nil} +%__scm_apply_patch(qp:m:)\ +%{__patch} %{-p:-p%{-p*}} %{-q:-s} + +# Mercurial (aka hg) +%__scm_setup_hg(q)\ +%{__hg} init %{-q} .\ +%{__hg} add %{-q} .\ +%{__hg} commit %{-q} --user "%{__scm_author}" -m "%{name}-%{version} base" + +%__scm_apply_hg(qp:m:)\ +%{__hg} import - %{-p:-p%{-p*}} %{-q} -m %{-m*} --user "%{__scm_author}" + +# Git +%__scm_setup_git(q)\ +%{__git} init %{-q}\ +%{__git} config user.name "%{__scm_username}"\ +%{__git} config user.email "%{__scm_usermail}"\ +%{__git} add .\ +%{__git} commit %{-q} -a\\\ + --author "%{__scm_author}" -m "%{name}-%{version} base" + +%__scm_apply_git(qp:m:)\ +%{__git} apply --index %{-p:-p%{-p*}} -\ +%{__git} commit %{-q} -m %{-m*} --author "%{__scm_author}" + +# Git, using "git am" (-m is unused) +%__scm_setup_git_am(q)\ +%{expand:%__scm_setup_git %{-q}} + +%__scm_apply_git_am(qp:m:)\ +%{__git} am %{-q} %{-p:-p%{-p*}} + +# Quilt +%__scm_setup_quilt(q) %{nil} +%__scm_apply_quilt(qp:m:)\ +%{__quilt} import %{-p:-p%{-p*}} %{1} && %{__quilt} push + +# Bzr +%__scm_setup_bzr(q)\ +%{__bzr} init %{-q}\ +%{__bzr} whoami --branch "%{__scm_author}"\ +%{__bzr} add .\ +%{__bzr} commit %{-q} -m "%{name}-%{version} base" + +# bzr doesn't seem to have its own command to apply patches? +%__scm_apply_bzr(qp:m:)\ +%{__patch} %{-p:-p%{-p*}} %{-q:-s}\ +%{__bzr} commit %{-q} -m %{-m*} + +# Single patch application +%apply_patch(qp:m:)\ +%{uncompress:%{1}} | %{expand:%__scm_apply_%{__scm} %{-q} %{-p:-p%{-p*}} %{-m:-m%{-m*}}} + +# Automatically apply all patches +%autopatch(vp:)\ +%{lua:\ +local options = rpm.expand("%{!-v:-q} %{-p:-p%{-p*}} ")\ +for i, p in ipairs(patches) do\ + print(rpm.expand("%apply_patch -m %{basename:"..p.."} "..options..p.."\\n"))\ +end} + +# One macro to (optionally) do it all. +# -S Sets the used patch application style, eg '-S git' enables +# usage of git repository and per-patch commits. +# -N Disable automatic patch application +# -p Use -p for patch application +%autosetup(a:b:cDn:TvNS:p:)\ +%setup %{-a} %{-b} %{-c} %{-D} %{-n} %{-T} %{!-v:-q}\ +%{-S:%global __scm %{-S*}}\ +%{-S:%{expand:%__scm_setup_%{-S*} %{!-v:-q}}}\ +%{!-N:%autopatch %{-v} %{-p:-p%{-p*}}}