rpm spec: fix version numbering when building alpha, beta, rc

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@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
Serge Hallyn 2013-10-29 12:48:46 -05:00 committed by Stéphane Graber
parent 5da6aa8c71
commit 9588a6cecb
2 changed files with 26 additions and 5 deletions

View File

@ -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])

View File

@ -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@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}