<p>osmith <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/11797">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  Pau Espin Pedrol: Looks good to me, approved
  Neels Hofmeyr: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">prepare for autotools: add git-version-gen<br><br>Add the same version of git-version-gen, which most other Osmocom<br>repositories (libasn1c, libosmocore, libosmo-netif, libosmo-sccp, ...)<br>are using, so they behave the same.<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 directory. 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/19)<br><br>Related: OS#3385<br>Change-Id: I34b0d20046417179250a5065574e2bc303889cf6<br>---<br>M .gitignore<br>A git-version-gen<br>2 files changed, 155 insertions(+), 0 deletions(-)<br><br></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..42cf3d2</span><br><span>--- /dev/null</span><br><span>+++ b/git-version-gen</span><br><span>@@ -0,0 +1,151 @@</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=2010-01-28.01</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Copyright (C) 2007-2010 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%);">+# It is probably wise to add these two files to .gitignore, so that you</span><br><span style="color: hsl(120, 100%, 40%);">+# don't accidentally commit either generated file.</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 .tarball-version will</span><br><span style="color: hsl(120, 100%, 40%);">+# exist in distribution tarballs.</span><br><span style="color: hsl(120, 100%, 40%);">+#</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%);">+case $# in</span><br><span style="color: hsl(120, 100%, 40%);">+    1) ;;</span><br><span style="color: hsl(120, 100%, 40%);">+    *) echo 1>&2 "Usage: $0 \$srcdir/.tarball-version"; exit 1;;</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%);">+tarball_version_file=$1</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%);">+# 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` || exit 1</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 seems to be 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%);">+elif</span><br><span style="color: hsl(120, 100%, 40%);">+       v=`git describe --abbrev=4 --match='v*' 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%);">+    && case $v in</span><br><span style="color: hsl(120, 100%, 40%);">+         [0-9]*) ;;</span><br><span style="color: hsl(120, 100%, 40%);">+    v[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%);">+            numcommits=`git rev-list "$vtag"..HEAD | 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%);">+         ;;</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%);">+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/^v//'`</span><br><span style="color: hsl(120, 100%, 40%);">+</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 status > /dev/null 2>&1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || 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%);">+</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 '\012'</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-end: "$"</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: merged </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: 2 </div>
<div style="display:none"> Gerrit-Owner: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Pau Espin Pedrol <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: osmith <osmith@sysmocom.de> </div>