<p>osmith has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/simtrace2/+/23253">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">host: use git-version-gen/tarball-v. from topdir<br><br>Use .tarball-version from the topdir, because it only gets written there<br>when generating the OBS package. Remove the duplicate git-version-gen<br>script and use the one from the topdir to generate a version string if<br>building from the git tree.<br><br>Related: OS#4413<br>Change-Id: I4b197a218ab44632ff182ffbd72e15c2b20db341<br>---<br>M host/Makefile.am<br>M host/configure.ac<br>D host/git-version-gen<br>3 files changed, 2 insertions(+), 153 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/53/23253/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/host/Makefile.am b/host/Makefile.am</span><br><span>index de76851..338a46b 100644</span><br><span>--- a/host/Makefile.am</span><br><span>+++ b/host/Makefile.am</span><br><span>@@ -3,7 +3,7 @@</span><br><span> AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include</span><br><span> SUBDIRS = include lib src contrib #tests examples doc</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-EXTRA_DIST = .version git-version-gen</span><br><span style="color: hsl(120, 100%, 40%);">+EXTRA_DIST = .version</span><br><span> </span><br><span> pkgconfigdir = $(libdir)/pkgconfig</span><br><span> pkgconfig_DATA = libosmo-simtrace2.pc</span><br><span>diff --git a/host/configure.ac b/host/configure.ac</span><br><span>index bcdda08..2e4dcf7 100644</span><br><span>--- a/host/configure.ac</span><br><span>+++ b/host/configure.ac</span><br><span>@@ -1,5 +1,5 @@</span><br><span> AC_INIT([simtrace2],</span><br><span style="color: hsl(0, 100%, 40%);">- m4_esyscmd([./git-version-gen .tarball-version]),</span><br><span style="color: hsl(120, 100%, 40%);">+     m4_esyscmd([../git-version-gen ../.tarball-version]),</span><br><span>        [simtrace@lists.osmocom.org])</span><br><span> </span><br><span> dnl *This* is the root dir, even if an install-sh exists in ../ or ../../</span><br><span>diff --git a/host/git-version-gen b/host/git-version-gen</span><br><span>deleted file mode 100755</span><br><span>index 42cf3d2..0000000</span><br><span>--- a/host/git-version-gen</span><br><span>+++ /dev/null</span><br><span>@@ -1,151 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-#!/bin/sh</span><br><span style="color: hsl(0, 100%, 40%);">-# Print a version string.</span><br><span style="color: hsl(0, 100%, 40%);">-scriptversion=2010-01-28.01</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-# Copyright (C) 2007-2010 Free Software Foundation, Inc.</span><br><span style="color: hsl(0, 100%, 40%);">-#</span><br><span style="color: hsl(0, 100%, 40%);">-# This program is free software: you can redistribute it and/or modify</span><br><span style="color: hsl(0, 100%, 40%);">-# it under the terms of the GNU General Public License as published by</span><br><span style="color: hsl(0, 100%, 40%);">-# the Free Software Foundation; either version 3 of the License, or</span><br><span style="color: hsl(0, 100%, 40%);">-# (at your option) any later version.</span><br><span style="color: hsl(0, 100%, 40%);">-#</span><br><span style="color: hsl(0, 100%, 40%);">-# This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(0, 100%, 40%);">-# but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(0, 100%, 40%);">-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(0, 100%, 40%);">-# GNU General Public License for more details.</span><br><span style="color: hsl(0, 100%, 40%);">-#</span><br><span style="color: hsl(0, 100%, 40%);">-# You should have received a copy of the GNU General Public License</span><br><span style="color: hsl(0, 100%, 40%);">-# along with this program.  If not, see <http://www.gnu.org/licenses/>.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/.</span><br><span style="color: hsl(0, 100%, 40%);">-# It may be run two ways:</span><br><span style="color: hsl(0, 100%, 40%);">-# - from a git repository in which the "git describe" command below</span><br><span style="color: hsl(0, 100%, 40%);">-#   produces useful output (thus requiring at least one signed tag)</span><br><span style="color: hsl(0, 100%, 40%);">-# - from a non-git-repo directory containing a .tarball-version file, which</span><br><span style="color: hsl(0, 100%, 40%);">-#   presumes this script is invoked like "./git-version-gen .tarball-version".</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-# In order to use intra-version strings in your project, you will need two</span><br><span style="color: hsl(0, 100%, 40%);">-# separate generated version string files:</span><br><span style="color: hsl(0, 100%, 40%);">-#</span><br><span style="color: hsl(0, 100%, 40%);">-# .tarball-version - present only in a distribution tarball, and not in</span><br><span style="color: hsl(0, 100%, 40%);">-#   a checked-out repository.  Created with contents that were learned at</span><br><span style="color: hsl(0, 100%, 40%);">-#   the last time autoconf was run, and used by git-version-gen.  Must not</span><br><span style="color: hsl(0, 100%, 40%);">-#   be present in either $(srcdir) or $(builddir) for git-version-gen to</span><br><span style="color: hsl(0, 100%, 40%);">-#   give accurate answers during normal development with a checked out tree,</span><br><span style="color: hsl(0, 100%, 40%);">-#   but must be present in a tarball when there is no version control system.</span><br><span style="color: hsl(0, 100%, 40%);">-#   Therefore, it cannot be used in any dependencies.  GNUmakefile has</span><br><span style="color: hsl(0, 100%, 40%);">-#   hooks to force a reconfigure at distribution time to get the value</span><br><span style="color: hsl(0, 100%, 40%);">-#   correct, without penalizing normal development with extra reconfigures.</span><br><span style="color: hsl(0, 100%, 40%);">-#</span><br><span style="color: hsl(0, 100%, 40%);">-# .version - present in a checked-out repository and in a distribution</span><br><span style="color: hsl(0, 100%, 40%);">-#   tarball.  Usable in dependencies, particularly for files that don't</span><br><span style="color: hsl(0, 100%, 40%);">-#   want to depend on config.h but do want to track version changes.</span><br><span style="color: hsl(0, 100%, 40%);">-#   Delete this file prior to any autoconf run where you want to rebuild</span><br><span style="color: hsl(0, 100%, 40%);">-#   files to pick up a version string change; and leave it stale to</span><br><span style="color: hsl(0, 100%, 40%);">-#   minimize rebuild time after unrelated changes to configure sources.</span><br><span style="color: hsl(0, 100%, 40%);">-#</span><br><span style="color: hsl(0, 100%, 40%);">-# It is probably wise to add these two files to .gitignore, so that you</span><br><span style="color: hsl(0, 100%, 40%);">-# don't accidentally commit either generated file.</span><br><span style="color: hsl(0, 100%, 40%);">-#</span><br><span style="color: hsl(0, 100%, 40%);">-# Use the following line in your configure.ac, so that $(VERSION) will</span><br><span style="color: hsl(0, 100%, 40%);">-# automatically be up-to-date each time configure is run (and note that</span><br><span style="color: hsl(0, 100%, 40%);">-# since configure.ac no longer includes a version string, Makefile rules</span><br><span style="color: hsl(0, 100%, 40%);">-# should not depend on configure.ac for version updates).</span><br><span style="color: hsl(0, 100%, 40%);">-#</span><br><span style="color: hsl(0, 100%, 40%);">-# AC_INIT([GNU project],</span><br><span style="color: hsl(0, 100%, 40%);">-#         m4_esyscmd([build-aux/git-version-gen .tarball-version]),</span><br><span style="color: hsl(0, 100%, 40%);">-#         [bug-project@example])</span><br><span style="color: hsl(0, 100%, 40%);">-#</span><br><span style="color: hsl(0, 100%, 40%);">-# Then use the following lines in your Makefile.am, so that .version</span><br><span style="color: hsl(0, 100%, 40%);">-# will be present for dependencies, and so that .tarball-version will</span><br><span style="color: hsl(0, 100%, 40%);">-# exist in distribution tarballs.</span><br><span style="color: hsl(0, 100%, 40%);">-#</span><br><span style="color: hsl(0, 100%, 40%);">-# BUILT_SOURCES = $(top_srcdir)/.version</span><br><span style="color: hsl(0, 100%, 40%);">-# $(top_srcdir)/.version:</span><br><span style="color: hsl(0, 100%, 40%);">-#    echo $(VERSION) > $@-t && mv $@-t $@</span><br><span style="color: hsl(0, 100%, 40%);">-# dist-hook:</span><br><span style="color: hsl(0, 100%, 40%);">-#    echo $(VERSION) > $(distdir)/.tarball-version</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-case $# in</span><br><span style="color: hsl(0, 100%, 40%);">-    1) ;;</span><br><span style="color: hsl(0, 100%, 40%);">-    *) echo 1>&2 "Usage: $0 \$srcdir/.tarball-version"; exit 1;;</span><br><span style="color: hsl(0, 100%, 40%);">-esac</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-tarball_version_file=$1</span><br><span style="color: hsl(0, 100%, 40%);">-nl='</span><br><span style="color: hsl(0, 100%, 40%);">-'</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-# First see if there is a tarball-only version file.</span><br><span style="color: hsl(0, 100%, 40%);">-# then try "git describe", then default.</span><br><span style="color: hsl(0, 100%, 40%);">-if test -f $tarball_version_file</span><br><span style="color: hsl(0, 100%, 40%);">-then</span><br><span style="color: hsl(0, 100%, 40%);">-    v=`cat $tarball_version_file` || exit 1</span><br><span style="color: hsl(0, 100%, 40%);">-    case $v in</span><br><span style="color: hsl(0, 100%, 40%);">- *$nl*) v= ;; # reject multi-line output</span><br><span style="color: hsl(0, 100%, 40%);">- [0-9]*) ;;</span><br><span style="color: hsl(0, 100%, 40%);">-      *) v= ;;</span><br><span style="color: hsl(0, 100%, 40%);">-    esac</span><br><span style="color: hsl(0, 100%, 40%);">-    test -z "$v" \</span><br><span style="color: hsl(0, 100%, 40%);">-    && echo "$0: WARNING: $tarball_version_file seems to be damaged" 1>&2</span><br><span style="color: hsl(0, 100%, 40%);">-fi</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-if test -n "$v"</span><br><span style="color: hsl(0, 100%, 40%);">-then</span><br><span style="color: hsl(0, 100%, 40%);">-    : # use $v</span><br><span style="color: hsl(0, 100%, 40%);">-elif</span><br><span style="color: hsl(0, 100%, 40%);">-       v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \</span><br><span style="color: hsl(0, 100%, 40%);">-       || git describe --abbrev=4 HEAD 2>/dev/null` \</span><br><span style="color: hsl(0, 100%, 40%);">-    && case $v in</span><br><span style="color: hsl(0, 100%, 40%);">-     [0-9]*) ;;</span><br><span style="color: hsl(0, 100%, 40%);">-      v[0-9]*) ;;</span><br><span style="color: hsl(0, 100%, 40%);">-     *) (exit 1) ;;</span><br><span style="color: hsl(0, 100%, 40%);">-       esac</span><br><span style="color: hsl(0, 100%, 40%);">-then</span><br><span style="color: hsl(0, 100%, 40%);">-    # Is this a new git that lists number of commits since the last</span><br><span style="color: hsl(0, 100%, 40%);">-    # tag or the previous older version that did not?</span><br><span style="color: hsl(0, 100%, 40%);">-    #   Newer: v6.10-77-g0f8faeb</span><br><span style="color: hsl(0, 100%, 40%);">-    #   Older: v6.10-g0f8faeb</span><br><span style="color: hsl(0, 100%, 40%);">-    case $v in</span><br><span style="color: hsl(0, 100%, 40%);">-       *-*-*) : git describe is okay three part flavor ;;</span><br><span style="color: hsl(0, 100%, 40%);">-      *-*)</span><br><span style="color: hsl(0, 100%, 40%);">-        : git describe is older two part flavor</span><br><span style="color: hsl(0, 100%, 40%);">-         # Recreate the number of commits and rewrite such that the</span><br><span style="color: hsl(0, 100%, 40%);">-      # result is the same as if we were using the newer version</span><br><span style="color: hsl(0, 100%, 40%);">-      # of git describe.</span><br><span style="color: hsl(0, 100%, 40%);">-      vtag=`echo "$v" | sed 's/-.*//'`</span><br><span style="color: hsl(0, 100%, 40%);">-      numcommits=`git rev-list "$vtag"..HEAD | wc -l`</span><br><span style="color: hsl(0, 100%, 40%);">-       v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`;</span><br><span style="color: hsl(0, 100%, 40%);">-           ;;</span><br><span style="color: hsl(0, 100%, 40%);">-    esac</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-    # Change the first '-' to a '.', so version-comparing tools work properly.</span><br><span style="color: hsl(0, 100%, 40%);">-    # Remove the "g" in git describe's output string, to save a byte.</span><br><span style="color: hsl(0, 100%, 40%);">-    v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;</span><br><span style="color: hsl(0, 100%, 40%);">-else</span><br><span style="color: hsl(0, 100%, 40%);">-    v=UNKNOWN</span><br><span style="color: hsl(0, 100%, 40%);">-fi</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-v=`echo "$v" |sed 's/^v//'`</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-# Don't declare a version "dirty" merely because a time stamp has changed.</span><br><span style="color: hsl(0, 100%, 40%);">-git status > /dev/null 2>&1</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty=</span><br><span style="color: hsl(0, 100%, 40%);">-case "$dirty" in</span><br><span style="color: hsl(0, 100%, 40%);">-    '') ;;</span><br><span style="color: hsl(0, 100%, 40%);">-    *) # Append the suffix only if there isn't one already.</span><br><span style="color: hsl(0, 100%, 40%);">-      case $v in</span><br><span style="color: hsl(0, 100%, 40%);">-        *-dirty) ;;</span><br><span style="color: hsl(0, 100%, 40%);">-     *) v="$v-dirty" ;;</span><br><span style="color: hsl(0, 100%, 40%);">-  esac ;;</span><br><span style="color: hsl(0, 100%, 40%);">-esac</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-# Omit the trailing newline, so that m4_esyscmd can use the result directly.</span><br><span style="color: hsl(0, 100%, 40%);">-echo "$v" | tr -d '\012'</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-# Local variables:</span><br><span style="color: hsl(0, 100%, 40%);">-# eval: (add-hook 'write-file-hooks 'time-stamp)</span><br><span style="color: hsl(0, 100%, 40%);">-# time-stamp-start: "scriptversion="</span><br><span style="color: hsl(0, 100%, 40%);">-# time-stamp-format: "%:y-%02m-%02d.%02H"</span><br><span style="color: hsl(0, 100%, 40%);">-# time-stamp-end: "$"</span><br><span style="color: hsl(0, 100%, 40%);">-# End:</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/simtrace2/+/23253">change 23253</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/c/simtrace2/+/23253"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: simtrace2 </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I4b197a218ab44632ff182ffbd72e15c2b20db341 </div>
<div style="display:none"> Gerrit-Change-Number: 23253 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>