[packages/rpm-build-macros] 1.664: do not memoize %releq_kernel* macros

glen glen at pld-linux.org
Sun Jun 2 12:28:20 CEST 2013


commit c1cc636b19315a8c8244051990167c215cb684eb
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sun Jun 2 13:25:53 2013 +0300

    1.664: do not memoize %releq_kernel* macros
    
    they take input and thus can't be memoized
    
    test:
    rpm --define 'alt_kernel longterm' -E '%{releq_kernel} %{releq_kernel -n drm} %{releq_kernel_up -n drm} %{releq_kernel_smp -n drm}'

 rpm-build-macros.spec |  4 ++--
 rpm.macros            | 13 ++++++++++---
 2 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/rpm-build-macros.spec b/rpm-build-macros.spec
index e0cd320..39d1349 100644
--- a/rpm-build-macros.spec
+++ b/rpm-build-macros.spec
@@ -1,10 +1,10 @@
-%define		rpm_macros_rev	1.663
+%define		rpm_macros_rev	1.664
 %define		find_lang_rev	1.36
 Summary:	PLD Linux RPM build macros
 Summary(pl.UTF-8):	Makra do budowania pakietów RPM dla Linuksa PLD
 Name:		rpm-build-macros
 Version:	%{rpm_macros_rev}
-Release:	2
+Release:	1
 License:	GPL
 Group:		Development/Building
 Source0:	rpm.macros
diff --git a/rpm.macros b/rpm.macros
index d0fe128..3ccc0e2 100644
--- a/rpm.macros
+++ b/rpm.macros
@@ -429,10 +429,17 @@ CXXFLAGS="%{rpmcxxflags}" \
 # and release 0.zzz.bootstrap if built with bootstrap
 %bootstrap_release() %{!?with_bootstrap:%{1}%{?2:.%{2}}}%{?with_bootstrap:%{!?2:%(expr %{1} - 1)}%{?2:%{1}.%(expr %{2} - 1)}.zzz.bootstrap}
 
+# rpm -qf on kernel version.h file
+%__kernel_qf()		%(R=$(cd %{_kernelsrcdir} 2>/dev/null && LC_ALL=C rpm -q --qf '%*' -f include/linux/version.h 2>/dev/null | grep -v 'is not'); echo ${R:-ERROR})
+
+# kernel %{name} and kernel %{epoch}:%{version}-%{release} macro respecing alt_kernel
+%kernel_name	%{expand:%%global kernel_name %(N=%{__kernel_qf %{N}};echo ${N%%-headers})}%kernel_name
+%kernel_version	%{expand:%%global kernel_version %{__kernel_qf %|E?{%{E}:}|%{V}-%{R}}}%kernel_version
+
 # -n drm to generate kernel%{_alt_kernel}-drm dependency
-%releq_kernel(n:)		%{expand:%%global releq_kernel %(R=$(cd %{_kernelsrcdir} 2>/dev/null && LC_ALL=C rpm -q --qf '%{N}%{?-n:-%{-n*}} = %|E?{%{E}:}|%{V}-%{R}' -f include/linux/version.h 2>/dev/null | grep -v 'is not' | sed -e 's:-headers::;s:-config::'); echo ${R:-ERROR})}%releq_kernel
-%releq_kernel_up(n:)	%{expand:%%global releq_kernel_up %(R=$(cd %{_kernelsrcdir} 2>/dev/null && LC_ALL=C rpm -q --qf '%{N}%{?-n:-%{-n*}}-up = %|E?{%{E}:}|%{V}-%{R}' -f include/linux/version.h 2>/dev/null | grep -v 'is not' | sed -e 's:-headers::;s:-config::'); echo ${R:-ERROR})}%releq_kernel_up
-%releq_kernel_smp(n:)	%{expand:%%global releq_kernel_smp %(R=$(cd %{_kernelsrcdir} 2>/dev/null && LC_ALL=C rpm -q --qf '%{N}%{?-n:-%{-n*}}-smp = %|E?{%{E}:}|%{V}-%{R}' -f include/linux/version.h 2>/dev/null | grep -v 'is not' | sed -e 's:-headers::;s:-config::'); echo ${R:-ERROR})}%releq_kernel_smp
+%releq_kernel(n:)		%{kernel_name}%{?-n:-%{-n*}} = %{kernel_version}
+%releq_kernel_up(n:)	%{kernel_name}-up%{?-n:-%{-n*}} = %{kernel_version}
+%releq_kernel_smp(n:)	%{kernel_name}-smp%{?-n:-%{-n*}} = %{kernel_version}
 
 # -s post to generate Requires(post) dependency
 %requires_releq_kernel(s:n:)		Requires%{-s:(%{-s*})}: %releq_kernel
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm-build-macros.git/commitdiff/c1cc636b19315a8c8244051990167c215cb684eb



More information about the pld-cvs-commit mailing list