<p>Michael Bradeen has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/18808">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Makefile: Avoid git-make user conflict<br><br>make_version now silently checks if the required git commands will<br>fail. If they do, then return UNKNOWN__git_check_fail to<br>distinguish this failure from other UNKNOWN__ version failures<br><br>Makefile checks for this value on install and exits out with<br>instructions<br><br>ASTERISK-30029<br><br>Change-Id: If8f10cac8f509c08981120f17555762342020221<br>---<br>M Makefile<br>M build_tools/make_version<br>2 files changed, 28 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/08/18808/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/Makefile b/Makefile</span><br><span>index 8c9498c..f435ac9 100644</span><br><span>--- a/Makefile</span><br><span>+++ b/Makefile</span><br><span>@@ -327,6 +327,9 @@</span><br><span> SUBMAKE:=$(MAKE) --quiet --no-print-directory</span><br><span> endif</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))</span><br><span style="color: hsl(120, 100%, 40%);">+mkfile_dir := $(dir $(mkfile_path))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> # $(MAKE) is printed in several places, and we want it to be a</span><br><span> # fixed size string. Define a variable whose name has also the</span><br><span> # same size, so we can easily align text.</span><br><span>@@ -693,7 +696,17 @@</span><br><span> @exit 1</span><br><span> endif</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-install: badshell bininstall datafiles</span><br><span style="color: hsl(120, 100%, 40%);">+versioncheck:</span><br><span style="color: hsl(120, 100%, 40%);">+ifeq ($(ASTERISKVERSION),UNKNOWN__git_check_fail)</span><br><span style="color: hsl(120, 100%, 40%);">+ @echo "Asterisk Version is unknown due to a git error. If you are running make"</span><br><span style="color: hsl(120, 100%, 40%);">+ @echo "as a different user than the project owner, this can be resolved by"</span><br><span style="color: hsl(120, 100%, 40%);">+ @echo "running the following command as the user currently executing make: "$$USER</span><br><span style="color: hsl(120, 100%, 40%);">+ @echo "git config --global --add safe.directory "$(mkfile_dir:/=)</span><br><span style="color: hsl(120, 100%, 40%);">+ @exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+endif</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%);">+install: badshell versioncheck bininstall datafiles</span><br><span> @if [ -x /usr/sbin/asterisk-post-install ]; then \</span><br><span> /usr/sbin/asterisk-post-install "$(DESTDIR)" . ; \</span><br><span> fi</span><br><span>@@ -878,6 +891,12 @@</span><br><span> endif</span><br><span> ifeq ($(ASTERISKVERSION),UNKNOWN__and_probably_unsupported)</span><br><span> @echo "Asterisk Version is unknown, not configuring Doxygen PROJECT_NUMBER."</span><br><span style="color: hsl(120, 100%, 40%);">+else ifeq ($(ASTERISKVERSION),UNKNOWN__git_check_fail)</span><br><span style="color: hsl(120, 100%, 40%);">+ @echo "Asterisk Version is unknown due to a git error. If you are running make"</span><br><span style="color: hsl(120, 100%, 40%);">+ @echo "as a different user than the project owner, this can be resolved by"</span><br><span style="color: hsl(120, 100%, 40%);">+ @echo "running the following command as the user currently executing make: "$$USER</span><br><span style="color: hsl(120, 100%, 40%);">+ @echo "git config --global --add safe.directory "$(mkfile_dir:/=)</span><br><span style="color: hsl(120, 100%, 40%);">+ @echo "not configuring Doxygen PROJECT_NUMBER."</span><br><span> else</span><br><span> @echo "PROJECT_NUMBER = $(ASTERISKVERSION)" >> doc/Doxyfile</span><br><span> endif</span><br><span>@@ -968,6 +987,7 @@</span><br><span> @$(MAKE) clean</span><br><span> @[ -f "$(DESTDIR)$(ASTDBDIR)/astdb.sqlite3" ] || [ ! -f "$(DESTDIR)$(ASTDBDIR)/astdb" ] || [ ! -f menuselect.makeopts ] || grep -q MENUSELECT_UTILS=.*astdb2sqlite3 menuselect.makeopts || (sed -i.orig -e's/MENUSELECT_UTILS=\(.*\)/MENUSELECT_UTILS=\1 astdb2sqlite3/' menuselect.makeopts && echo "Updating menuselect.makeopts to include astdb2sqlite3" && echo "Original version backed up to menuselect.makeopts.orig")</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> $(SUBDIRS_UNINSTALL):</span><br><span> +@DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" ASTDATADIR="$(ASTDATADIR)" $(SUBMAKE) -C $(@:-uninstall=) uninstall</span><br><span> </span><br><span>diff --git a/build_tools/make_version b/build_tools/make_version</span><br><span>index 9dca4bd..58395ca 100755</span><br><span>--- a/build_tools/make_version</span><br><span>+++ b/build_tools/make_version</span><br><span>@@ -95,6 +95,13 @@</span><br><span> echo "UNKNOWN__and_probably_unsupported"</span><br><span> exit 1</span><br><span> fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ GITCHECK=$(${GIT} describe --always 2>/dev/null || echo gitfail 2>/dev/null)</span><br><span style="color: hsl(120, 100%, 40%);">+ if [ "x${GITCHECK}" = "xgitfail" ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+ echo "UNKNOWN__git_check_fail"</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> cd ${1}</span><br><span> </span><br><span> # If the first log commit messages indicates that this is checked into</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18808">change 18808</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.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.asterisk.org/c/asterisk/+/18808"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 18 </div>
<div style="display:none"> Gerrit-Change-Id: If8f10cac8f509c08981120f17555762342020221 </div>
<div style="display:none"> Gerrit-Change-Number: 18808 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Michael Bradeen <mbradeen@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>