improvement of "make rpm"
PATCH 1/1 improvement of "make rpm"
Hi,
I updated the patch of the following thread.
http://thread.gmane.org/gmane.comp.emulators.kvm.devel/8899
Changelog:
- don't change Makefile
- put back some options (BuildRequires and so on).
If you try my patch with kvm-49, you can do the below.
1. rm SOURCES
2. mkdir SOURCES
3. ./configure
4. make rpm
I tested this patch on RHEL5.
Best Regards,
Akio Takebe
---
kvm.spec +9 -1
@@ -1,3 +1,12 @@ +%define Distribution %(rpm -q -qf /etc/redhat-release --qf '%{name}' | cut -d - -f 1) +%define os_release %(rpm -q --qf '%%{version}' /etc/redhat-release) +%define bindir /usr/bin +%define bin %{bindir}/kvm +%define initdir /etc/init.d +%define confdir /etc/kvm +%define utilsdir /etc/kvm/utils +%define _prebuilt %{?prebuilt:1}%{!?prebuilt:0} + Name: kvm Version: 0.0
Release: 0
@@ -11,20 +20,8 @@ BuildRoot: %{_tmppath}/%{name}-%{ve
ExclusiveArch: i386 x86_64
Requires: kvm-kmod bridge-utils
-
-%define Distribution %(cat /etc/redhat-release | awk '{ print $1}' | tr [A-Z] [a-z])
-%define os_release %(rpm -q --qf '%%{version}' %{Distribution}-release) -
-%if %{Distribution} == "fedora" && %{os_release} == 5 || %{Distribution} == "centos" && %{os_release} == 4
-BuildRequires: compat-gcc-32
-%else
-BuildRequires: compat-gcc-34
-%endif
-
BuildRequires: SDL-devel zlib-devel alsa-lib-devel
-%define _prebuilt %{?prebuilt:1}%{!?prebuilt:0}
-
%if !%{_prebuilt}
Source0: kvm.tar.gz
Source1: user.tar.gz
@@ -32,15 +29,32 @@ Source2: kernel.tar.gz
Source3: scripts.tar.gz
Source4: Makefile
Source5: configure
-Source5: kvm_stat
+Source6: kvm_stat
%endif
%description
The Kernel Virtual Machine provides a virtualization enviroment for processors with hardware support for virtualization: Intel's VT and AMD's AMD-V.
-%prep
+%if %([ x"%{Distribution}" = x"fedora" -a x"%{os_release}" = x"5" ] && echo 1 | | echo 0)
+%define fedora5 1
+%endif
+
+%if %([ x"%{Distribution}" = x"centos" -a x"%{os_release}" = x"4" ] && echo 1 | | echo 0)
+%define centos4 1
+%endif
+
+%if %([ %{fedora5} -o %{centos4} ] && echo 1 || echo 0) +BuildRequires: compat-gcc-32
+%else
+BuildRequires: compat-gcc-34
+%endif
+%if %([ -f "/etc/redhat-release" ] && echo 0 || echo 1) +BuildRequires: compat-gcc-34
+%endif
+
+%prep
%if !%{_prebuilt}
%setup -T -b 0 -n qemu
%setup -T -b 1 -n user -D
@@ -51,9 +65,7 @@ cp %{_sourcedir}/Makefile %{_sourcedir}/
%endif
%build
-
rm -rf %{buildroot}
-
%if !%{_prebuilt}
cd ..
./configure --prefix=/usr/kvm
@@ -71,7 +83,6 @@ make -C qemu
%endif
%install
-
%if !%{_prebuilt}
cd ..
%else
@@ -80,18 +91,16 @@ cd %{objdir}
make DESTDIR=%{buildroot} install-rpm
-%define bindir /usr/bin
-%define bin %{bindir}/kvm
-%define initdir /etc/init.d
-%define confdir /etc/kvm
-%define utilsdir /etc/kvm/utils
-
%post
+/sbin/chkconfig --add kvm
/sbin/chkconfig --level 2345 kvm on
/sbin/chkconfig --level 16 kvm off
/usr/sbin/groupadd -fg 444 kvm
%postun
+/sbin/service kvm stop
+/sbin/chkconfig --level 2345 kvm off
+/sbin/chkconfig --del kvm
%clean
%{__rm} -rf %{buildroot}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
A message that is not in the archive (sent off-list or not yet received): EAC81BCAE411F0takebe_akio-+CUm20s59erQFUHtdCDX3A@public.gmane.org
Quoted 9 lines · Akio Takebe
Hi,
I updated the patch of the following thread.
http://thread.gmane.org/gmane.comp.emulators.kvm.devel/8899
Changelog:
- don't changeMakefile
- put back some options (BuildRequires and so on).
Thanks, it's much improved.
However, kvm.spec has already changed, so the patch won't apply. Please pull from kvm.git to get the latest sources. Also note the comments below.
Quoted 20 lines
If you try my patch with kvm-49, you can do the below.
1. rm SOURCES
2. mkdir SOURCES
3. ./configure
4. make rpmI tested this patch on RHEL5.
Signed-off-by Akio Takebe <[email protected]>Best Regards,
Akio Takebe
---
kvm.spec +1
-0@@ -1,3 +1,12 @@ +%define Distribution %(rpm -q -qf /etc/redhat-release --qf '%{name}' | cut -d -
kvm.spec line 10
Quoted 10 lines
kvm.spec +8
-1-f 1) +%define os_release %(rpm -q --qf '%%{version}' /etc/redhat-release) +%define bindir /usr/bin +%define bin %{bindir}/kvm +%define initdir /etc/init.d +%define confdir /etc/kvm +%define utilsdir /etc/kvm/utils +%define _prebuilt %{?prebuilt:1}%{!?prebuilt:0} +
Why are you moving this around? It makes the patch harder to review because you can't immediately see if the code has changed.
Quoted 34 lines
kvm.spec +0
-5Name: kvm Version: 0.0 Release: 0@@ -11,20 +20,8 @@ BuildRoot: %{_tmppath}/%{name}-%{ve ExclusiveArch: i386 x86_64 Requires: kvm-kmod bridge-utils - -%define Distribution %(cat /etc/redhat-release | awk '{ print $1}' | tr [A-Z] [a-z]) -%define os_release %(rpm -q --qf '%%{version}' %{Distribution}-release) - -%if %{Distribution} == "fedora" && %{os_release} == 5 || %{Distribution} =="centos" && %{os_release} == 4
kvm.spec +1
-8-BuildRequires: compat-gcc-32 -%else -BuildRequires: compat-gcc-34 -%endif - BuildRequires: SDL-devel zlib-devel alsa-lib-devel -%define _prebuilt %{?prebuilt:1}%{!?prebuilt:0} - %if !%{_prebuilt} Source0: kvm.tar.gz Source1: user.tar.gz@@ -32,15 +29,32 @@ Source2: kernel.tar.gz Source3: scripts.tar.gz Source4: Makefile Source5: configure -Source5: kvm_stat +Source6: kvm_stat %endif
kvm.spec Source2: kernel.tar.gz · line 43
Quoted 10 lines
kvm.spec +3
-1%description The Kernel Virtual Machine provides a virtualization enviroment for processors with hardware support for virtualization: Intel's VT and AMD's AMD-V. -%prep +%if %([ x"%{Distribution}" = x"fedora" -a x"%{os_release}" = x"5" ] && echo 1 | | echo 0) +%define fedora5 1 +%endif
Why not use regular rpm conditionals instead of calling the shell?
Can you add an explicit test for RHEL 5?
Signature · 8 lines
Any sufficiently difficult bug is indistinguishable from a feature. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
A message that is not in the archive (sent off-list or not yet received): 4729C8FF.8020607-atKUWr5tajBWk0Htik3J/[email protected]
Hi, Avi
Sorry for my late responce, and thank you for your review.
Quoted 10 lines
Quoted 10 lines
kvm.spec +1
-0@@ -1,3 +1,12 @@ +%define Distribution %(rpm -q -qf /etc/redhat-release --qf '%{name}' |cut -d -
-f 1)
+%defineos_release%(rpm -q --qf '%%{version}'/etc/redhat-release) +%define bindir/usr/bin
+%define bin %{bindir}/kvm
+%define initdir/etc/init.d
Quoted 9 lines
Quoted 5 lines
+%define confdir
/etc/kvm
+%define utilsdir/etc/kvm/utils
+%define_prebuilt%{?prebuilt:1}%{!?prebuilt:0}
+Why are you moving this around? It makes the patch harder to review because you can't immediately see if the code has changed.
It was for cleanup. I'll put it back.
Quoted 41 lines
Quoted 41 lines
Name: kvm Version: 0.0 Release: 0kvm.spec +0
-2@@ -11,20 +20,8 @@ BuildRoot: %{_tmppath}/%{name}-%{ve ExclusiveArch: i386 x86_64 Requires: kvm-kmod bridge-utils - -%define Distribution %(cat /etc/redhat-release | awk '{ print $1}' | tr [A-Z]
[a-z])
-%defineos_release%(rpm -q --qf '%%{version}' %{Distribution}-release) -
-%if %{Distribution} == "fedora" && %{os_release} == 5 || %{Distribution} ==
"centos" && %{os_release} == 4kvm.spec +1
-8-BuildRequires: compat-gcc-32 -%else -BuildRequires: compat-gcc-34 -%endif - BuildRequires: SDL-devel zlib-devel alsa-lib-devel -%define _prebuilt %{?prebuilt:1}%{!?prebuilt:0} - %if !%{_prebuilt} Source0: kvm.tar.gz Source1: user.tar.gz@@ -32,15 +29,32 @@ Source2: kernel.tar.gz Source3: scripts.tar.gz Source4: Makefile Source5: configure -Source5: kvm_stat +Source6: kvm_stat %endif %description The Kernel Virtual Machine provides a virtualization enviroment forprocessors
with hardware support for virtualization: Intel's VT and AMD's AMD-V.
Quoted 10 lines
Quoted 7 lines
-%prep
+%if %([ x"%{Distribution}" = x"fedora" -a x"%{os_release}" = x"5" ] && echo 1 |
| echo 0)
+%define fedora5 1
+%endifWhy not use regular rpm conditionals instead of calling the shell?
The regular rpm conditionals are poor facilities. Shell has better parsing facilities.
The original checking fedora5 and centos4 doesn't work on RHEL5. So I changed the checking with shell.
Quoted 1 line
Can you add an explicit test for RHEL 5?
OK, I'll add it.
Best Reagards,
Akio Takebe
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines · Akio Takebe
Quoted 9 lines
Quoted 9 lines
-%prep
+%if %([ x"%{Distribution}" = x"fedora" -a x"%{os_release}" = x"5" ] && echo 1 |
| echo 0)
+%define fedora5 1
+%endif
Quoted 9 lines
Quoted 3 lines
Why not use regular rpm conditionals instead of calling the shell?
The regular rpm conditionals are poor facilities. Shell has better parsing facilities.
The original checking fedora5 and centos4 doesn't work on RHEL5. So I changed the checking with shell.
Okay.
Quoted 4 lines
Quoted 2 lines
Can you add an explicit test for RHEL 5?
OK, I'll add it.
Okay, thanks.
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/