[lxc-devel] [PATCH] rpm spec: fix version numbering when building alpha, beta, rc

Dwight Engen dwight.engen at oracle.com
Fri Oct 25 23:02:01 UTC 2013


We want to ensure smooth upgrades when doing rpm -U throughout the
release cycle so this change implements the scheme documented at:
http://fedoraproject.org/wiki/Packaging%3aNamingGuidelines#NonNumericRelease

Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
---
 configure.ac | 13 ++++++++++++-
 lxc.spec.in  | 18 ++++++++++++++----
 2 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2066952..9fedf55 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,18 @@
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
 
-AC_INIT([lxc], [1.0.0.alpha2])
+m4_define([lxc_version_major], 1)
+m4_define([lxc_version_minor], 0)
+m4_define([lxc_version_micro], 0)
+m4_define([lxc_version_beta], [alpha2])
+
+m4_define([lxc_version_base], [lxc_version_major.lxc_version_minor.lxc_version_micro])
+m4_define([lxc_version],
+	  [ifelse(lxc_version_beta, [], [lxc_version_base], [lxc_version_base.lxc_version_beta])])
+
+AC_INIT([lxc], [lxc_version])
+AC_SUBST(LXC_VERSION_BASE, lxc_version_base)
+AC_SUBST(LXC_VERSION_BETA, lxc_version_beta)
 
 AC_CONFIG_SRCDIR([configure.ac])
 AC_CONFIG_AUX_DIR([config])
diff --git a/lxc.spec.in b/lxc.spec.in
index 0f7f22f..a6c96a2 100644
--- a/lxc.spec.in
+++ b/lxc.spec.in
@@ -23,11 +23,21 @@
 %global with_python %{?_with_python: 1} %{?!_with_python: 0}
 %global with_lua %{?_with_lua: 1} %{?!_with_lua: 0}
 
+# RPM needs alpha/beta/rc in Release: not Version: to ensure smooth
+# package upgrades from alpha->beta->rc->release. For more info see:
+# http://fedoraproject.org/wiki/Packaging%3aNamingGuidelines#NonNumericRelease
+%if "x at LXC_VERSION_BETA@" != "x"
+%global beta_rel @LXC_VERSION_BETA@
+%global beta_dot .%{beta_rel}
+%else
+%global norm_rel 1
+%endif
+
 Name: @PACKAGE@
-Version: @VERSION@
-Release: 1%{?dist}
+Version: @LXC_VERSION_BASE@
+Release: %{?beta_rel:0.1.%{beta_rel}}%{?!beta_rel:%{norm_rel}}%{?dist}
 URL: http://linuxcontainers.org
-Source: http://linuxcontainers.org/downloads/%{name}-%{version}.tar.gz
+Source: http://linuxcontainers.org/downloads/%{name}-%{version}%{?beta_dot}.tar.gz
 Summary: Linux Containers userspace tools
 Group: Applications/System
 License: LGPLv2+
@@ -75,7 +85,7 @@ The %{name}-lua package contains %{name} bindings for lua.
 %endif
 
 %prep
-%setup -q
+%setup -q -n %{name}-%{version}%{?beta_dot}
 %build
 PATH=$PATH:/usr/sbin:/sbin %configure $args \
 %if %{with_lua}
-- 
1.8.3.1





More information about the lxc-devel mailing list