The following commit has been merged in the master branch:
commit 971e675a180c59642e2406acbb0c6f7bc68961e6
Author: Guillem Jover <[email protected]>
Date:   Sun Oct 25 23:56:30 2009 +0100

    Generate the autoconf version from git
    
    Use a new script to retrieve the version from a file shipped in the
    released tarballs, or from the git repository using “git describe”
    which will give an appropriate string in case of a snapshot, and add
    a possible “-dirty” suffix if the working dir has uncommitted changes.

diff --git a/Makefile.am b/Makefile.am
index 432b979..7274d53 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,6 +24,7 @@ EXTRA_DIST = \
        .mailmap \
        ChangeLog.old \
        README.translators \
+       get-version \
        doc/README.api \
        doc/README.feature-removal-schedule \
        doc/coding-style.txt \
@@ -67,6 +68,7 @@ ChangeLog:
 # If we create the dist tarball from the git repository, make sure
 # that we're not forgetting some files...
 dist-hook:
+       echo $(VERSION) >$(distdir)/.dist-version
        if [ -e .git ]; then \
                for file in `git ls-files | grep -v .gitignore`; do \
                        if [ ! -e "$(distdir)/$$file" ]; then \
diff --git a/configure.ac b/configure.ac
index 52f019c..19e9b3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.60)
-AC_INIT([dpkg], [1.15.5~], [[email protected]])
+AC_INIT([dpkg], m4_esyscmd([./get-version]), [[email protected]])
 AC_CONFIG_SRCDIR([lib/dpkg/dpkg.h])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_AUX_DIR([build-aux])
diff --git a/debian/changelog b/debian/changelog
index 8e1463b..d779bab 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -29,6 +29,8 @@ dpkg (1.15.5) UNRELEASED; urgency=low
   * Rework varbuf api to avoid increasing buffers indefinitely when adding
     content to them, regardless of space being already available.
   * Fix build macros to allow start-stop-deaemon to use TIOCNOTTY.
+  * Generate the autoconf version from git to make it easier to see when a
+    snapshot version is being used.
 
   [ Raphaël Hertzog ]
   * Add versioned dependency on base-files (>= 5.0.0) to dpkg-dev to ensure
diff --git a/get-version b/get-version
new file mode 100755
index 0000000..f16f183
--- /dev/null
+++ b/get-version
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# get-version
+#
+# Copyright © 2009 Guillem Jover <[email protected]>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+
+if [ -f .dist-version ]; then
+  # Get the version from the file distributed in the tarball.
+  version=$(cat .dist-version)
+elif [ -d .git ]; then
+  # Ger the version from the git repository.
+  version=$(git describe --abbrev=4 HEAD 2>/dev/null)
+
+  # Check if we are on a dirty checkout.
+  git update-index --refresh -q >/dev/null
+  dirty=$(git diff-index --name-only HEAD 2>/dev/null)
+  if [ -n "$dirty" ]; then
+    version="$version-dirty"
+  fi
+else
+  echo "error: cannot get project version." 1>&2
+  exit 1
+fi
+
+# Use printf to avoid the trailing new line that m4_esyscmd would not handle.
+printf "$version"
+

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to