Kiril Nesenko has uploaded a new change for review.

Change subject: Change versioning schema and fix tarball
......................................................................

Change versioning schema and fix tarball

Change-Id: I4337150f58cd7d9b3a04a12a3afa9acd8a826a22
Signed-off-by: Kiril Nesenko <[email protected]>
---
M .gitignore
M AUTHORS
M Makefile.am
D build-aux/Makefile.subs
D build-aux/gitlog-to-changelog
D build-aux/pkg-version
M configure.ac
A m4/.keep
M mom.spec.in
9 files changed, 99 insertions(+), 333 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/mom refs/changes/74/22874/1

diff --git a/.gitignore b/.gitignore
index bda93fc..28a614c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
 *.pyc
 *.tar.gz
 mom.spec
+install-sh
 setup.py
 MANIFEST
 Makefile
@@ -14,3 +15,7 @@
 build-aux/install-sh
 build-aux/missing
 INSTALL
+missing
+
+tmp.repos/
+rpmbuild/
diff --git a/AUTHORS b/AUTHORS
index e69de29..53d72df 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -0,0 +1,3 @@
+The following people have contributed to this project.
+
+* Kiril Nesenko <[email protected]>
diff --git a/Makefile.am b/Makefile.am
index bece1a7..cd1979f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,51 +13,54 @@
 # License along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-include $(top_srcdir)/build-aux/Makefile.subs
+AUTOMAKE_OPTIONS = foreign 1.9
+ACLOCAL_AMFLAGS = -I m4
 
 # This is an *exception*, we ship also mom.spec and setup.py so it's possible 
to build
 # the rpm from the tarball.
 EXTRA_DIST = \
-       build-aux/pkg-version \
-       mom.spec \
-       mom.spec.in \
        setup.py \
-       setup.py.in
+       setup.py.in \
+       mom \
+       momd \
+       doc \
+       contrib \
+       tests \
+       $(NULL)
 
 CLEANFILES = \
        setup.py \
        mom.spec \
-       $(DIST_ARCHIVES)
+       $(DIST_ARCHIVES) \
+       $(NULL)
+
+dist_noinst_DATA = \
+       mom.spec \
+       $(NULL)
+
+dist_noinst_SCRIPTS = \
+       autobuild.sh \
+       $(NULL)
 
 all-local: \
-       mom.spec\
-       setup.py
+       mom.spec \
+       setup.py \
+       $(NULL)
 
 .PHONY: srpm rpm
 
-sdist:
-       python setup.py sdist -d $(top_builddir)
-srpm: sdist
-       rpmbuild -ts $(if $(BUILDID),--define="extra_release .$(BUILDID)") 
$(DIST_ARCHIVES)
-rpm: sdist
-       rpmbuild -ta $(if $(BUILDID),--define="extra_release .$(BUILDID)") 
$(DIST_ARCHIVES)
-dist-hook: gen-VERSION gen-ChangeLog
-.PHONY: gen-VERSION gen-ChangeLog
+TMPREPOS = tmp.repos
 
-# Generate the ChangeLog file and insert it into the directory
-# we're about to use to create a tarball.
-gen-ChangeLog:
-       if test -d .git; then                                   \
-         $(top_srcdir)/build-aux/gitlog-to-changelog           \
-           > $(distdir)/cl-t;                                  \
-         rm -f $(distdir)/ChangeLog;                           \
-         mv $(distdir)/cl-t $(distdir)/ChangeLog;              \
-       fi
+srpm: dist
+       rm -fr "$(TMPREPOS)"
+       mkdir -p $(TMPREPOS)/{SPECS,RPMS,SRPMS,SOURCES}
+       rpmbuild --define="_topdir `pwd`/$(TMPREPOS)" -ts 
"$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).tar.gz"
+       @echo
+       @echo "srpm available at '$(TMPREPOS)'"
+       @echo
 
-gen-VERSION:
-       if test -d .git; then                                   \
-         $(top_srcdir)/build-aux/pkg-version --full            \
-           > $(distdir)/ve-t;                                  \
-         rm -f $(distdir)/VERSION;                             \
-         mv $(distdir)/ve-t $(distdir)/VERSION;                \
-       fi
+rpm: srpm
+       rpmbuild --define="_topdir `pwd`/$(TMPREPOS)" --rebuild 
"$(TMPREPOS)"/SRPMS/*.src.rpm
+       @echo
+       @echo "rpm(s) available at '$(TMPREPOS)'"
+       @echo
diff --git a/build-aux/Makefile.subs b/build-aux/Makefile.subs
deleted file mode 100644
index 721ae07..0000000
--- a/build-aux/Makefile.subs
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (C) 2012 Royce Lv, IBM Corporation
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US
-SUFFIXES: .in
-
-# Reference:
-# http://www.gnu.org/software/automake/manual/html_node/Scripts.html
-PATHSUBST = sed \
-       -e "s,[@]PACKAGE[@],$(package),g"
-
-CONFIGSUBST = $(top_builddir)/config.status --file=-
-
-%: %.in
-       @echo "  SED $@"; $(PATHSUBST) $< |$(CONFIGSUBST) >$@
diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog
deleted file mode 100755
index b0db305..0000000
--- a/build-aux/gitlog-to-changelog
+++ /dev/null
@@ -1,194 +0,0 @@
-eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
-  & eval 'exec perl -wS "$0" $argv:q'
-    if 0;
-# Convert git log output to ChangeLog format.
-
-my $VERSION = '2009-10-30 13:46'; # UTC
-# The definition above must lie within the first 8 lines in order
-# for the Emacs time-stamp write hook (at end) to update it.
-# If you change this file with Emacs, please let the write hook
-# do its job.  Otherwise, update this string manually.
-
-# Copyright (C) 2008-2011 Free Software Foundation, Inc.
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Written by Jim Meyering
-
-use strict;
-use warnings;
-use Getopt::Long;
-use POSIX qw(strftime);
-
-(my $ME = $0) =~ s|.*/||;
-
-# use File::Coda; # http://meyering.net/code/Coda/
-END {
-  defined fileno STDOUT or return;
-  close STDOUT and return;
-  warn "$ME: failed to close standard output: $!\n";
-  $? ||= 1;
-}
-
-sub usage ($)
-{
-  my ($exit_code) = @_;
-  my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
-  if ($exit_code != 0)
-    {
-      print $STREAM "Try `$ME --help' for more information.\n";
-    }
-  else
-    {
-      print $STREAM <<EOF;
-Usage: $ME [OPTIONS] [ARGS]
-
-Convert git log output to ChangeLog format.  If present, any ARGS
-are passed to "git log".  To avoid ARGS being parsed as options to
-$ME, they may be preceded by '--'.
-
-OPTIONS:
-
-   --since=DATE convert only the logs since DATE;
-                  the default is to convert all log entries.
-   --format=FMT set format string for commit subject and body;
-                  see 'man git-log' for the list of format metacharacters;
-                  the default is '%s%n%b%n'
-
-   --help       display this help and exit
-   --version    output version information and exit
-
-EXAMPLE:
-
-  $ME --since=2008-01-01 > ChangeLog
-  $ME -- -n 5 foo > last-5-commits-to-branch-foo
-
-EOF
-    }
-  exit $exit_code;
-}
-
-# If the string $S is a well-behaved file name, simply return it.
-# If it contains white space, quotes, etc., quote it, and return the new 
string.
-sub shell_quote($)
-{
-  my ($s) = @_;
-  if ($s =~ m![^\w+/.,-]!)
-    {
-      # Convert each single quote to '\''
-      $s =~ s/\'/\'\\\'\'/g;
-      # Then single quote the string.
-      $s = "'$s'";
-    }
-  return $s;
-}
-
-sub quoted_cmd(@)
-{
-  return join (' ', map {shell_quote $_} @_);
-}
-
-{
-  my $since_date = '1970-01-01 UTC';
-  my $format_string = '%s%n%b%n';
-  GetOptions
-    (
-     help => sub { usage 0 },
-     version => sub { print "$ME version $VERSION\n"; exit },
-     'since=s' => \$since_date,
-     'format=s' => \$format_string,
-    ) or usage 1;
-
-  my @cmd = (qw (git log --log-size), "--since=$since_date",
-             '--pretty=format:%ct  %an  <%ae>%n%n'.$format_string, @ARGV);
-  open PIPE, '-|', @cmd
-    or die ("$ME: failed to run `". quoted_cmd (@cmd) ."': $!\n"
-            . "(Is your Git too old?  Version 1.5.1 or later is required.)\n");
-
-  my $prev_date_line = '';
-  while (1)
-    {
-      defined (my $in = <PIPE>)
-        or last;
-      $in =~ /^log size (\d+)$/
-        or die "$ME:$.: Invalid line (expected log size):\n$in";
-      my $log_nbytes = $1;
-
-      my $log;
-      my $n_read = read PIPE, $log, $log_nbytes;
-      $n_read == $log_nbytes
-        or die "$ME:$.: unexpected EOF\n";
-
-      my @line = split "\n", $log;
-      my $author_line = shift @line;
-      defined $author_line
-        or die "$ME:$.: unexpected EOF\n";
-      $author_line =~ /^(\d+)  (.*>)$/
-        or die "$ME:$.: Invalid line "
-          . "(expected date/author/email):\n$author_line\n";
-
-      my $date_line = sprintf "%s  $2\n", strftime ("%F", localtime ($1));
-      # If this line would be the same as the previous date/name/email
-      # line, then arrange not to print it.
-      if ($date_line ne $prev_date_line)
-        {
-          $prev_date_line eq ''
-            or print "\n";
-          print $date_line;
-        }
-      $prev_date_line = $date_line;
-
-      # Omit "Signed-off-by..." lines.
-      @line = grep !/^Signed-off-by: .*>$/, @line;
-
-      # Omit gerrit lines.
-      @line = grep !/^(Change-Id|Reviewed-(on|by)|Tested-by): .*$/, @line;
-
-      # If there were any lines
-      if (@line == 0)
-        {
-          warn "$ME: warning: empty commit message:\n  $date_line\n";
-        }
-      else
-        {
-          # Remove leading and trailing blank lines.
-          while ($line[0] =~ /^\s*$/) { shift @line; }
-          while ($line[$#line] =~ /^\s*$/) { pop @line; }
-
-          # Prefix each non-empty line with a TAB.
-          @line = map { length $_ ? "\t$_" : '' } @line;
-
-          print "\n", join ("\n", @line), "\n";
-        }
-
-      defined ($in = <PIPE>)
-        or last;
-      $in ne "\n"
-        and die "$ME:$.: unexpected line:\n$in";
-    }
-
-  close PIPE
-    or die "$ME: error closing pipe from " . quoted_cmd (@cmd) . "\n";
-  # FIXME-someday: include $PROCESS_STATUS in the diagnostic
-}
-
-# Local Variables:
-# mode: perl
-# indent-tabs-mode: nil
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "my $VERSION = '"
-# time-stamp-format: "%:y-%02m-%02d %02H:%02M"
-# time-stamp-time-zone: "UTC"
-# time-stamp-end: "'; # UTC"
-# End:
diff --git a/build-aux/pkg-version b/build-aux/pkg-version
deleted file mode 100755
index 346ad23..0000000
--- a/build-aux/pkg-version
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-
-# tags and output versions:
-#   - v4.9.0   => 4.9.0 (upstream clean)
-#   - v4.9.0-1 => 4.9.0 (downstream clean)
-#   - v4.9.0-2-g34e62f   => 4.9.0 (upstream dirty)
-#   - v4.9.0-1-2-g34e62f => 4.9.0 (downstream dirty)
-AWK_VERSION='
-    BEGIN { FS="-" }
-    /^v[0-9]/ {
-      sub(/^v/,"") ; print $1
-    }'
-
-# tags and output releases:
-#   - v4.9.0   => 0 (upstream clean)
-#   - v4.9.0-1 => 1 (downstream clean)
-#   - v4.9.0-2-g34e62f1   => 0.2.git34e62f1 (upstream dirty)
-#   - v4.9.0-1-2-g34e62f1 => 1.2.git34e62f1 (downstream dirty)
-AWK_RELEASE='
-    BEGIN { FS="-"; OFS="." }
-    /^v[0-9]/ {
-      if (NF == 1) print 0
-      else if (NF == 2) print $2
-      else if (NF == 3) print 0, $2, "git" substr($3, 2)
-      else if (NF == 4) print $2, $3, "git" substr($4, 2)
-    }'
-
-PKG_VERSION=`cat VERSION 2> /dev/null || git describe --match "v[0-9]*"`
-
-if test "x$1" = "x--full"; then
-    echo $PKG_VERSION | tr -d '[:space:]'
-elif test "x$1" = "x--version"; then
-    echo $PKG_VERSION | awk "$AWK_VERSION" | tr -cd '[:alnum:].'
-elif test "x$1" = "x--release"; then
-    echo $PKG_VERSION | awk "$AWK_RELEASE" | tr -cd '[:alnum:].'
-else
-    echo "usage: $0 [--full|--version|--release]"
-    exit 1
-fi
diff --git a/configure.ac b/configure.ac
index 92a7e15..307183e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,20 +1,25 @@
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
+AC_PREREQ(2.60)
 
-AC_INIT([mom],
-        [m4_esyscmd([build-aux/pkg-version --version])],
-        [[email protected]])
+define([VERSION_MAJOR], [0])
+define([VERSION_MINOR], [3])
+define([VERSION_FIX], [2])
+define([VERSION_NUMBER], VERSION_MAJOR[.]VERSION_MINOR[.]VERSION_FIX)
+define([VERSION_SUFFIX], [_master])
 
-AC_CONFIG_AUX_DIR([build-aux])
+AC_INIT([mom], VERSION_NUMBER[]VERSION_SUFFIX, [[email protected]])
+PACKAGE_RPM_VERSION="VERSION_NUMBER"
+PACKAGE_RPM_RELEASE="3.20.$(echo VERSION_SUFFIX | sed 's/^_//')"
+PACKAGE_NAME="mom"
+AC_SUBST([PACKAGE_NAME])
+AC_SUBST([PACKAGE_RPM_VERSION])
+AC_SUBST([PACKAGE_RPM_RELEASE])
 
-# Checks for package release
-AC_SUBST([PACKAGE_RELEASE],
-         [m4_esyscmd([build-aux/pkg-version --release])])
-
-AS_IF([test "x$PACKAGE_VERSION" = x],
-      AC_MSG_ERROR([package version not defined]))
-AS_IF([test "x$PACKAGE_RELEASE" = x],
-      AC_MSG_ERROR([package release not defined]))
+AC_CONFIG_AUX_DIR([.])
+AC_CONFIG_MACRO_DIR([m4])
+AC_USE_SYSTEM_EXTENSIONS
+AM_INIT_AUTOMAKE
 
 # Automake initialization
 AM_INIT_AUTOMAKE([-Wno-portability])
@@ -28,4 +33,9 @@
   AC_MSG_ERROR([python-nose not found, please install it.])
 fi
 
-AC_OUTPUT([Makefile])
+AC_CONFIG_FILES([
+       Makefile
+       mom.spec
+       setup.py
+])
+AC_OUTPUT
diff --git a/m4/.keep b/m4/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/m4/.keep
diff --git a/mom.spec.in b/mom.spec.in
index fd6a31e..ae7214c 100644
--- a/mom.spec.in
+++ b/mom.spec.in
@@ -1,33 +1,36 @@
 %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from 
distutils.sysconfig import get_python_lib; print(get_python_lib())")}
 
-Name:           mom
-Version:        @PACKAGE_VERSION@
-Release:        @PACKAGE_RELEASE@%{?dist}%{?extra_release}
-Summary:        Dynamically manage system resources on virtualization hosts
+%global                        package_version @PACKAGE_VERSION@
+%global         package_name @PACKAGE_NAME@
 
-Group:          Applications/System
-License:        GPLv2
-URL:            http://wiki.github.com/aglitke/mom
-Source0:        %{name}-%{version}.tar.gz
-BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildArch:      noarch
-BuildRequires:  python-devel
-BuildRequires:  python-nose
+Name:                  %{package_name}
+Version:               @PACKAGE_RPM_VERSION@
+Release:               @PACKAGE_RPM_RELEASE@%{?release_suffix}%{?dist}
+Summary:               Dynamically manage system resources on virtualization 
hosts
+
+Group:                 Applications/System
+License:               GPLv2
+URL:                   http://wiki.github.com/aglitke/mom
+Source:                        %{package_name}-%{package_version}.tar.gz
+BuildRoot:             %{_tmppath}/%{name}-%{version}-%{release} 
+BuildArch:             noarch
+BuildRequires: python-devel
+BuildRequires: python-nose
 
 # MOM makes use of libvirt by way of the python bindings to monitor and
 # interact with virtual machines.
 %if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
-Requires:       libvirt-daemon-driver-qemu
+Requires:              libvirt-daemon-driver-qemu
 %else
-Requires:       libvirt
+Requires:              libvirt
 %endif
-Requires:       libvirt-python
-Requires:       procps-ng
+Requires:              libvirt-python
+Requires:              procps-ng
 
-Requires(post): chkconfig
-Requires(postun): initscripts
-Requires(preun): chkconfig
-Requires(preun): initscripts
+Requires(post):                chkconfig
+Requires(postun):      initscripts
+Requires(preun):       chkconfig
+Requires(preun):       initscripts
 
 %description
 MOM is a policy-driven tool that can be used to manage overcommitment on KVM
@@ -45,29 +48,29 @@
 
 
 %prep
-%setup -q
+%setup -q -n %{package_name}-%{package_version}
 
 %build
 %{__python} setup.py build
 
 %install
-rm -rf $RPM_BUILD_ROOT
-%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
-install -Dp contrib/momd.init $RPM_BUILD_ROOT/%{_initrddir}/momd
+rm -rf "%{buildroot}"
+%{__python} setup.py install -O1 --skip-build --root "%{buildroot}"
+install -Dp contrib/momd.init "%{buildroot}"/%{_initrddir}/momd
 
-cp $RPM_BUILD_ROOT/%{_defaultdocdir}/%{name}/examples/mom-balloon+ksm.conf \
-   $RPM_BUILD_ROOT/%{_sysconfdir}/momd.conf
+cp "%{buildroot}"/%{_defaultdocdir}/%{name}/examples/mom-balloon+ksm.conf \
+       "%{buildroot}"/%{_sysconfdir}/momd.conf
 
 # Correct the installed location of documentation files
-mv $RPM_BUILD_ROOT/%{_defaultdocdir}/%{name} \
-   $RPM_BUILD_ROOT/%{_defaultdocdir}/%{name}-%{version}
-cp COPYING README $RPM_BUILD_ROOT/%{_defaultdocdir}/%{name}-%{version}
+mv "%{buildroot}"/%{_defaultdocdir}/%{name} \
+       "%{buildroot}"/%{_defaultdocdir}/%{name}-%{version}
+cp COPYING README "%{buildroot}"/%{_defaultdocdir}/%{name}-%{version}
 
 %check
 nosetests tests/*.py
 
 %clean
-rm -rf $RPM_BUILD_ROOT
+rm -rf "%{buildroot}"
 
 
 %post


-- 
To view, visit http://gerrit.ovirt.org/22874
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4337150f58cd7d9b3a04a12a3afa9acd8a826a22
Gerrit-PatchSet: 1
Gerrit-Project: mom
Gerrit-Branch: master
Gerrit-Owner: Kiril Nesenko <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to