commit 0e6c6a4052a07a98e176f03c6bf68b483b13b969
Author: Elan Ruusamäe <[email protected]>
Date:   Tue Dec 11 07:19:53 2012 +0200

    test cpuflags
    
    test cpuflags on x86_64 that the kernel is compatible with target cpu. thus 
if
    you install rpm on 32bit booted kernel it could be still validated to be 
arch
    compatible.
    
    cpuflags check may be too aggressive, it could restrict installing stuff
    to chroot if rpm implementation requires /proc to be mounted

 test.spec | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)
---
diff --git a/test.spec b/test.spec
index b2a04d8..05d237c 100644
--- a/test.spec
+++ b/test.spec
@@ -1,18 +1,19 @@
-%include       /usr/lib/rpm/macros.java
-Summary:       test package to run COMMAND like commands on builder :/
+Summary:       test cpuflags
 Name:          test
 Version:       5.3.11
 Release:       0.10
 License:       GPL
 Group:         Applications/System
-# extracted from 
http://rpm5.org/files/rpm/rpm-5.3/rpm-5.3.11-0.20110602.src.rpm
-Source0:       rpm-%{version}.tar.gz
-# Source0-md5: 7c1f624c22143324ee372dffd1a209c2
 BuildArch:     noarch
+%ifarch %{x8664}
+Requires(cpuflags):    lm
+%endif
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
-rpm5.org distributes now in src.rpm format, but we need tar.gz
+test cpuflags on x86_64 that the kernel is compatible with target cpu. thus if
+you install rpm on 32bit booted kernel it could be still validated to be arch
+compatible.
 
 %prep
 %setup -qcT
@@ -20,5 +21,21 @@ rpm5.org distributes now in src.rpm format, but we need 
tar.gz
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%pretrans
+%ifarch %{x8664}
+if [ -e /proc/cpuinfo ] && ! grep -q '\<lm\>' /proc/cpuinfo; then
+       echo >&2 "WARNING: This hardware does not support x86_64 architecture"
+       exit 1
+fi
+%endif
+
+%pre
+%ifarch %{x8664}
+if [ -e /proc/cpuinfo ] && ! grep -q '\<lm\>' /proc/cpuinfo; then
+       echo >&2 "WARNING: This hardware does not support x86_64 architecture"
+       exit 1
+fi
+%endif
+
 %files
 %defattr(644,root,root,755)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/test.git/commitdiff/d54b507d690282c90ea5e35b9967a4c6be8a7675

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to