Forgot to make sure this went to the list.

On 05/08/2013 11:21 AM, Willy Tarreau wrote:
Hello Clayton,

On Wed, May 08, 2013 at 11:13:04AM -0500, Clayton Keller wrote:
Is this along the lines of what you had in mind:

%define full_version 1.5-dev18
%define version %(echo %{full_version} | awk -F "-" '{print $1}')
%define release %(echo %{full_version} | awk -F "-" '{print $2}')
<snip>
Version: %{version}
Release: %{release}

Yes I didn't know this was possible. Seems a little bit dirty but is
handy. You can even use "cut -d- -f1" / "cut -d- -f2".

I like the cut variation. I'll attach a patch file this time rather than muddy up the post with the full diff again with it using the cut command instead.


Here is my current diff containing this and the previous discussed
changes in comparison to the existing haproxy.spec in examples/:
(...)

I'm seeing one issue here :

-BuildRoot: %{_tmppath}/%{name}-%{version}-root
+BuildRoot: %{_tmppath}/%{name}-%{version}.root

I think you wanted to use ".../%{name}-%{version}-%{release}-root" instead.


Yes, I saw that too. I sent a follow-up email shortly after with the adjusted/correct diff. This patch includes that as well as the cut command change.

I hope this has been helpful.

Clay

--- haproxy.spec.orig	2013-05-06 10:19:48.462440897 -0500
+++ haproxy.spec	2013-05-06 22:57:38.567834726 -0500
@@ -1,11 +1,15 @@
+%define full_version 1.5-dev18
+%define version %(echo %{full_version} | cut -d- -f1)
+%define release %(echo %{full_version} | cut -d- -f2)
+
 Summary: HA-Proxy is a TCP/HTTP reverse proxy for high availability environments
 Name: haproxy
-Version: 1.5-dev18
-Release: 1
+Version: %{version} 
+Release: %{release}
 License: GPL
 Group: System Environment/Daemons
 URL: http://haproxy.1wt.eu/
-Source0: http://haproxy.1wt.eu/download/1.5/src/devel/%{name}-%{version}.tar.gz
+Source0: http://haproxy.1wt.eu/download/1.5/src/devel/%{name}-%{version}-%{release}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 BuildRequires: pcre-devel
 Requires: /sbin/chkconfig, /sbin/service
@@ -27,7 +31,7 @@
 risking the system's stability.
 
 %prep
-%setup -q
+%setup -q -n %{name}-%{version}-%{release}
 
 # We don't want any perl dependecies in this RPM:
 %define __perl_requires /bin/true

Reply via email to