<p>osmith has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/11797">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">prepare for autotools: add git-version-gen<br><br>Add the latestest upstream version of git-version-gen:<br>https://git.savannah.gnu.org/cgit/autoconf.git/plain/build-aux/git-version-gen?h=v2.69<br><br>git-version-gen generates a version string derived from the git<br>repository, or from a .tarball-version file when running outside of a<br>git folder. It is used by all other Osmocom repositories, that use<br>autotools. Unfortunatelly it seems to be impossible to use<br>git-version-gen from autoconf without adding it to the source tree.<br><br>Autotools will be used to install the shared manual files into the<br>system in a way that is consistent with the other Osmocom repositories:<br><br>$ autoreconf -fi<br>$ ./configure --prefix=/usr/local<br>$ make<br>$ make install<br><br>Project repositories will check with pkg-config if osmo-gsm-manuals is<br>installed (like any other shared Osmocom component), when a new<br>configure flag for building the manuals is passed. This will also work<br>with distribution's package managers, for instance we could have a<br>osmo-gsm-manuals-dev package in Debian on which the other packages<br>would have a build-time dependency to build the UNIX man pages<br>(OS#3386).<br><br>(moving manuals to project repositories 4/16)<br><br>Related: OS#3385<br>Change-Id: I34b0d20046417179250a5065574e2bc303889cf6<br>---<br>M .gitignore<br>A git-version-gen<br>2 files changed, 224 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/97/11797/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/.gitignore b/.gitignore</span><br><span>index 1e0984f..fbe2111 100644</span><br><span>--- a/.gitignore</span><br><span>+++ b/.gitignore</span><br><span>@@ -10,3 +10,7 @@</span><br><span> *.check</span><br><span> generated/</span><br><span> tests/test-usermanual.adoc</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# git-version-gen</span><br><span style="color: hsl(120, 100%, 40%);">+.tarball-version</span><br><span style="color: hsl(120, 100%, 40%);">+.version</span><br><span>diff --git a/git-version-gen b/git-version-gen</span><br><span>new file mode 100755</span><br><span>index 0000000..0fa9063</span><br><span>--- /dev/null</span><br><span>+++ b/git-version-gen</span><br><span>@@ -0,0 +1,220 @@</span><br><span style="color: hsl(120, 100%, 40%);">+#!/bin/sh</span><br><span style="color: hsl(120, 100%, 40%);">+# Print a version string.</span><br><span style="color: hsl(120, 100%, 40%);">+scriptversion=2012-03-18.17; # UTC</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Copyright (C) 2007-2012 Free Software Foundation, Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# This program is free software: you can redistribute it and/or modify</span><br><span style="color: hsl(120, 100%, 40%);">+# it under the terms of the GNU General Public License as published by</span><br><span style="color: hsl(120, 100%, 40%);">+# the Free Software Foundation; either version 3 of the License, or</span><br><span style="color: hsl(120, 100%, 40%);">+# (at your option) any later version.</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+# but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+# GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# You should have received a copy of the GNU General Public License</span><br><span style="color: hsl(120, 100%, 40%);">+# along with this program.  If not, see <http://www.gnu.org/licenses/>.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/.</span><br><span style="color: hsl(120, 100%, 40%);">+# It may be run two ways:</span><br><span style="color: hsl(120, 100%, 40%);">+# - from a git repository in which the "git describe" command below</span><br><span style="color: hsl(120, 100%, 40%);">+#   produces useful output (thus requiring at least one signed tag)</span><br><span style="color: hsl(120, 100%, 40%);">+# - from a non-git-repo directory containing a .tarball-version file, which</span><br><span style="color: hsl(120, 100%, 40%);">+#   presumes this script is invoked like "./git-version-gen .tarball-version".</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# In order to use intra-version strings in your project, you will need two</span><br><span style="color: hsl(120, 100%, 40%);">+# separate generated version string files:</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# .tarball-version - present only in a distribution tarball, and not in</span><br><span style="color: hsl(120, 100%, 40%);">+#   a checked-out repository.  Created with contents that were learned at</span><br><span style="color: hsl(120, 100%, 40%);">+#   the last time autoconf was run, and used by git-version-gen.  Must not</span><br><span style="color: hsl(120, 100%, 40%);">+#   be present in either $(srcdir) or $(builddir) for git-version-gen to</span><br><span style="color: hsl(120, 100%, 40%);">+#   give accurate answers during normal development with a checked out tree,</span><br><span style="color: hsl(120, 100%, 40%);">+#   but must be present in a tarball when there is no version control system.</span><br><span style="color: hsl(120, 100%, 40%);">+#   Therefore, it cannot be used in any dependencies.  GNUmakefile has</span><br><span style="color: hsl(120, 100%, 40%);">+#   hooks to force a reconfigure at distribution time to get the value</span><br><span style="color: hsl(120, 100%, 40%);">+#   correct, without penalizing normal development with extra reconfigures.</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# .version - present in a checked-out repository and in a distribution</span><br><span style="color: hsl(120, 100%, 40%);">+#   tarball.  Usable in dependencies, particularly for files that don't</span><br><span style="color: hsl(120, 100%, 40%);">+#   want to depend on config.h but do want to track version changes.</span><br><span style="color: hsl(120, 100%, 40%);">+#   Delete this file prior to any autoconf run where you want to rebuild</span><br><span style="color: hsl(120, 100%, 40%);">+#   files to pick up a version string change; and leave it stale to</span><br><span style="color: hsl(120, 100%, 40%);">+#   minimize rebuild time after unrelated changes to configure sources.</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# As with any generated file in a VC'd directory, you should add</span><br><span style="color: hsl(120, 100%, 40%);">+# /.version to .gitignore, so that you don't accidentally commit it.</span><br><span style="color: hsl(120, 100%, 40%);">+# .tarball-version is never generated in a VC'd directory, so needn't</span><br><span style="color: hsl(120, 100%, 40%);">+# be listed there.</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Use the following line in your configure.ac, so that $(VERSION) will</span><br><span style="color: hsl(120, 100%, 40%);">+# automatically be up-to-date each time configure is run (and note that</span><br><span style="color: hsl(120, 100%, 40%);">+# since configure.ac no longer includes a version string, Makefile rules</span><br><span style="color: hsl(120, 100%, 40%);">+# should not depend on configure.ac for version updates).</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# AC_INIT([GNU project],</span><br><span style="color: hsl(120, 100%, 40%);">+#         m4_esyscmd([build-aux/git-version-gen .tarball-version]),</span><br><span style="color: hsl(120, 100%, 40%);">+#         [bug-project@example])</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Then use the following lines in your Makefile.am, so that .version</span><br><span style="color: hsl(120, 100%, 40%);">+# will be present for dependencies, and so that .version and</span><br><span style="color: hsl(120, 100%, 40%);">+# .tarball-version will exist in distribution tarballs.</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# EXTRA_DIST = $(top_srcdir)/.version</span><br><span style="color: hsl(120, 100%, 40%);">+# BUILT_SOURCES = $(top_srcdir)/.version</span><br><span style="color: hsl(120, 100%, 40%);">+# $(top_srcdir)/.version:</span><br><span style="color: hsl(120, 100%, 40%);">+#       echo $(VERSION) > $@-t && mv $@-t $@</span><br><span style="color: hsl(120, 100%, 40%);">+# dist-hook:</span><br><span style="color: hsl(120, 100%, 40%);">+#        echo $(VERSION) > $(distdir)/.tarball-version</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+me=$0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+version="git-version-gen $scriptversion</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Copyright 2011 Free Software Foundation, Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+There is NO warranty.  You may redistribute this software</span><br><span style="color: hsl(120, 100%, 40%);">+under the terms of the GNU General Public License.</span><br><span style="color: hsl(120, 100%, 40%);">+For more information about these matters, see the files named COPYING."</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+usage="\</span><br><span style="color: hsl(120, 100%, 40%);">+Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT]</span><br><span style="color: hsl(120, 100%, 40%);">+Print a version string.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Options:</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   --prefix           prefix of git tags (default 'v')</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   --help             display this help and exit</span><br><span style="color: hsl(120, 100%, 40%);">+   --version          output version information and exit</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Running without arguments will suffice in most cases."</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+prefix=v</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+while test $# -gt 0; do</span><br><span style="color: hsl(120, 100%, 40%);">+  case $1 in</span><br><span style="color: hsl(120, 100%, 40%);">+    --help) echo "$usage"; exit 0;;</span><br><span style="color: hsl(120, 100%, 40%);">+    --version) echo "$version"; exit 0;;</span><br><span style="color: hsl(120, 100%, 40%);">+    --prefix) shift; prefix="$1";;</span><br><span style="color: hsl(120, 100%, 40%);">+    -*)</span><br><span style="color: hsl(120, 100%, 40%);">+      echo "$0: Unknown option '$1'." >&2</span><br><span style="color: hsl(120, 100%, 40%);">+      echo "$0: Try '--help' for more information." >&2</span><br><span style="color: hsl(120, 100%, 40%);">+      exit 1;;</span><br><span style="color: hsl(120, 100%, 40%);">+    *)</span><br><span style="color: hsl(120, 100%, 40%);">+      if test -z "$tarball_version_file"; then</span><br><span style="color: hsl(120, 100%, 40%);">+        tarball_version_file="$1"</span><br><span style="color: hsl(120, 100%, 40%);">+      elif test -z "$tag_sed_script"; then</span><br><span style="color: hsl(120, 100%, 40%);">+        tag_sed_script="$1"</span><br><span style="color: hsl(120, 100%, 40%);">+      else</span><br><span style="color: hsl(120, 100%, 40%);">+        echo "$0: extra non-option argument '$1'." >&2</span><br><span style="color: hsl(120, 100%, 40%);">+        exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+      fi;;</span><br><span style="color: hsl(120, 100%, 40%);">+  esac</span><br><span style="color: hsl(120, 100%, 40%);">+  shift</span><br><span style="color: hsl(120, 100%, 40%);">+done</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+if test -z "$tarball_version_file"; then</span><br><span style="color: hsl(120, 100%, 40%);">+    echo "$usage"</span><br><span style="color: hsl(120, 100%, 40%);">+    exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+tag_sed_script="${tag_sed_script:-s/x/x/}"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+nl='</span><br><span style="color: hsl(120, 100%, 40%);">+'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Avoid meddling by environment variable of the same name.</span><br><span style="color: hsl(120, 100%, 40%);">+v=</span><br><span style="color: hsl(120, 100%, 40%);">+v_from_git=</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# First see if there is a tarball-only version file.</span><br><span style="color: hsl(120, 100%, 40%);">+# then try "git describe", then default.</span><br><span style="color: hsl(120, 100%, 40%);">+if test -f $tarball_version_file</span><br><span style="color: hsl(120, 100%, 40%);">+then</span><br><span style="color: hsl(120, 100%, 40%);">+    v=`cat $tarball_version_file` || v=</span><br><span style="color: hsl(120, 100%, 40%);">+    case $v in</span><br><span style="color: hsl(120, 100%, 40%);">+        *$nl*) v= ;; # reject multi-line output</span><br><span style="color: hsl(120, 100%, 40%);">+        [0-9]*) ;;</span><br><span style="color: hsl(120, 100%, 40%);">+        *) v= ;;</span><br><span style="color: hsl(120, 100%, 40%);">+    esac</span><br><span style="color: hsl(120, 100%, 40%);">+    test -z "$v" \</span><br><span style="color: hsl(120, 100%, 40%);">+        && echo "$0: WARNING: $tarball_version_file is missing or damaged" 1>&2</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+if test -n "$v"</span><br><span style="color: hsl(120, 100%, 40%);">+then</span><br><span style="color: hsl(120, 100%, 40%);">+    : # use $v</span><br><span style="color: hsl(120, 100%, 40%);">+# Otherwise, if there is at least one git commit involving the working</span><br><span style="color: hsl(120, 100%, 40%);">+# directory, and "git describe" output looks sensible, use that to</span><br><span style="color: hsl(120, 100%, 40%);">+# derive a version string.</span><br><span style="color: hsl(120, 100%, 40%);">+elif test "`git log -1 --pretty=format:x . 2>&1`" = x \</span><br><span style="color: hsl(120, 100%, 40%);">+    && v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \</span><br><span style="color: hsl(120, 100%, 40%);">+          || git describe --abbrev=4 HEAD 2>/dev/null` \</span><br><span style="color: hsl(120, 100%, 40%);">+    && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \</span><br><span style="color: hsl(120, 100%, 40%);">+    && case $v in</span><br><span style="color: hsl(120, 100%, 40%);">+         $prefix[0-9]*) ;;</span><br><span style="color: hsl(120, 100%, 40%);">+         *) (exit 1) ;;</span><br><span style="color: hsl(120, 100%, 40%);">+       esac</span><br><span style="color: hsl(120, 100%, 40%);">+then</span><br><span style="color: hsl(120, 100%, 40%);">+    # Is this a new git that lists number of commits since the last</span><br><span style="color: hsl(120, 100%, 40%);">+    # tag or the previous older version that did not?</span><br><span style="color: hsl(120, 100%, 40%);">+    #   Newer: v6.10-77-g0f8faeb</span><br><span style="color: hsl(120, 100%, 40%);">+    #   Older: v6.10-g0f8faeb</span><br><span style="color: hsl(120, 100%, 40%);">+    case $v in</span><br><span style="color: hsl(120, 100%, 40%);">+        *-*-*) : git describe is okay three part flavor ;;</span><br><span style="color: hsl(120, 100%, 40%);">+        *-*)</span><br><span style="color: hsl(120, 100%, 40%);">+            : git describe is older two part flavor</span><br><span style="color: hsl(120, 100%, 40%);">+            # Recreate the number of commits and rewrite such that the</span><br><span style="color: hsl(120, 100%, 40%);">+            # result is the same as if we were using the newer version</span><br><span style="color: hsl(120, 100%, 40%);">+            # of git describe.</span><br><span style="color: hsl(120, 100%, 40%);">+            vtag=`echo "$v" | sed 's/-.*//'`</span><br><span style="color: hsl(120, 100%, 40%);">+            commit_list=`git rev-list "$vtag"..HEAD 2>/dev/null` \</span><br><span style="color: hsl(120, 100%, 40%);">+                || { commit_list=failed;</span><br><span style="color: hsl(120, 100%, 40%);">+                     echo "$0: WARNING: git rev-list failed" 1>&2; }</span><br><span style="color: hsl(120, 100%, 40%);">+            numcommits=`echo "$commit_list" | wc -l`</span><br><span style="color: hsl(120, 100%, 40%);">+            v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`;</span><br><span style="color: hsl(120, 100%, 40%);">+            test "$commit_list" = failed && v=UNKNOWN</span><br><span style="color: hsl(120, 100%, 40%);">+            ;;</span><br><span style="color: hsl(120, 100%, 40%);">+    esac</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    # Change the first '-' to a '.', so version-comparing tools work properly.</span><br><span style="color: hsl(120, 100%, 40%);">+    # Remove the "g" in git describe's output string, to save a byte.</span><br><span style="color: hsl(120, 100%, 40%);">+    v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;</span><br><span style="color: hsl(120, 100%, 40%);">+    v_from_git=1</span><br><span style="color: hsl(120, 100%, 40%);">+else</span><br><span style="color: hsl(120, 100%, 40%);">+    v=UNKNOWN</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+v=`echo "$v" |sed "s/^$prefix//"`</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Test whether to append the "-dirty" suffix only if the version</span><br><span style="color: hsl(120, 100%, 40%);">+# string we're using came from git.  I.e., skip the test if it's "UNKNOWN"</span><br><span style="color: hsl(120, 100%, 40%);">+# or if it came from .tarball-version.</span><br><span style="color: hsl(120, 100%, 40%);">+if test -n "$v_from_git"; then</span><br><span style="color: hsl(120, 100%, 40%);">+  # Don't declare a version "dirty" merely because a time stamp has changed.</span><br><span style="color: hsl(120, 100%, 40%);">+  git update-index --refresh > /dev/null 2>&1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty=</span><br><span style="color: hsl(120, 100%, 40%);">+  case "$dirty" in</span><br><span style="color: hsl(120, 100%, 40%);">+      '') ;;</span><br><span style="color: hsl(120, 100%, 40%);">+      *) # Append the suffix only if there isn't one already.</span><br><span style="color: hsl(120, 100%, 40%);">+          case $v in</span><br><span style="color: hsl(120, 100%, 40%);">+            *-dirty) ;;</span><br><span style="color: hsl(120, 100%, 40%);">+            *) v="$v-dirty" ;;</span><br><span style="color: hsl(120, 100%, 40%);">+          esac ;;</span><br><span style="color: hsl(120, 100%, 40%);">+  esac</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Omit the trailing newline, so that m4_esyscmd can use the result directly.</span><br><span style="color: hsl(120, 100%, 40%);">+echo "$v" | tr -d "$nl"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Local variables:</span><br><span style="color: hsl(120, 100%, 40%);">+# eval: (add-hook 'write-file-hooks 'time-stamp)</span><br><span style="color: hsl(120, 100%, 40%);">+# time-stamp-start: "scriptversion="</span><br><span style="color: hsl(120, 100%, 40%);">+# time-stamp-format: "%:y-%02m-%02d.%02H"</span><br><span style="color: hsl(120, 100%, 40%);">+# time-stamp-time-zone: "UTC"</span><br><span style="color: hsl(120, 100%, 40%);">+# time-stamp-end: "; # UTC"</span><br><span style="color: hsl(120, 100%, 40%);">+# End:</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/11797">change 11797</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/11797"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-gsm-manuals </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I34b0d20046417179250a5065574e2bc303889cf6 </div>
<div style="display:none"> Gerrit-Change-Number: 11797 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: osmith <osmith@sysmocom.de> </div>