<p>Michael Bradeen has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/18605">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Makefile: Avoid git-make user conflict<br><br>Makefile will now check to see if the running user id matches<br>the uid of the running directory.  If matched, then the existing<br>method of using git to determine ASTERISKVERSION is maintained<br>with the addition of echoing this to a new .versionlabel. If the<br>users do not match, then Makefile will look in .versionlabel.<br>The intent is that a 'make' followed by a 'sudo make install' will<br>work, with the first make setting .versionlabel and the second then<br>using it. This avoids calling git which will fail due to the user<br>mismatch.<br><br>build_tools/list_valid_installed_externals now exclusively uses<br>.versionlabel which will have been set on the preceeding make<br><br>.gitignore updated to include .versionlabel<br><br>ASTERISK-30029<br><br>Change-Id: If8f10cac8f509c08981120f17555762342020221<br>---<br>M .gitignore<br>M Makefile<br>M build_tools/list_valid_installed_externals<br>3 files changed, 17 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/05/18605/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/.gitignore b/.gitignore</span><br><span>index 1ba75fa..2c84000 100644</span><br><span>--- a/.gitignore</span><br><span>+++ b/.gitignore</span><br><span>@@ -38,3 +38,4 @@</span><br><span> *.orig</span><br><span> tests/CI/output</span><br><span> .develvars</span><br><span style="color: hsl(120, 100%, 40%);">+.versionlabel</span><br><span>\ No newline at end of file</span><br><span>diff --git a/Makefile b/Makefile</span><br><span>index 858aaa3..f2e7657 100644</span><br><span>--- a/Makefile</span><br><span>+++ b/Makefile</span><br><span>@@ -248,10 +248,17 @@</span><br><span>   _ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include -D_XPG4_2 -D__EXTENSIONS__</span><br><span> endif</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+_MAKINGUID:= $(shell id -u)</span><br><span style="color: hsl(120, 100%, 40%);">+_GITUD:= $(shell stat -c '%u' .)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> ifeq ($(GREP),)</span><br><span> else ifeq ($(GREP),:)</span><br><span> else</span><br><span style="color: hsl(0, 100%, 40%);">-  ASTERISKVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) GIT=$(GIT) build_tools/make_version .)</span><br><span style="color: hsl(120, 100%, 40%);">+  ifeq ($(_MAKINGUID),$(_GITUD))</span><br><span style="color: hsl(120, 100%, 40%);">+    ASTERISKVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) GIT=$(GIT) build_tools/make_version .)</span><br><span style="color: hsl(120, 100%, 40%);">+  else</span><br><span style="color: hsl(120, 100%, 40%);">+    ASTERISKVERSION:=$(shell cat .versionlabel)</span><br><span style="color: hsl(120, 100%, 40%);">+  endif</span><br><span> endif</span><br><span> ifneq ($(AWK),)</span><br><span>   ifneq ($(wildcard .version),)</span><br><span>@@ -374,7 +381,7 @@</span><br><span>  +@$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) moduleinfo</span><br><span>      +@$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) makeopts</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-$(SUBDIRS): makeopts .lastclean main/version.c include/asterisk/build.h include/asterisk/buildopts.h defaults.h</span><br><span style="color: hsl(120, 100%, 40%);">+$(SUBDIRS): makeopts .lastclean .versionlabel main/version.c include/asterisk/build.h include/asterisk/buildopts.h defaults.h</span><br><span> </span><br><span> ifeq ($(findstring $(OSARCH), mingw32 cygwin ),)</span><br><span> main: third-party</span><br><span>@@ -400,7 +407,7 @@</span><br><span>   @cmp -s $@.tmp $@ || mv $@.tmp $@</span><br><span>    @rm -f $@.tmp</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-main/version.c: FORCE menuselect.makeopts .lastclean</span><br><span style="color: hsl(120, 100%, 40%);">+main/version.c: FORCE menuselect.makeopts .lastclean .versionlabel</span><br><span>    @build_tools/make_version_c > $@.tmp</span><br><span>      @cmp -s $@.tmp $@ || mv $@.tmp $@</span><br><span>    @rm -f $@.tmp</span><br><span>@@ -410,6 +417,9 @@</span><br><span>  @cmp -s $@.tmp $@ || mv $@.tmp $@</span><br><span>    @rm -f $@.tmp</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+.versionlabel: menuselect.makeopts .lastclean</span><br><span style="color: hsl(120, 100%, 40%);">+      @echo $(ASTERISKVERSION) > .versionlabel</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> # build.h must depend on .lastclean, or parallel make may wipe it out after it's</span><br><span> # been created.</span><br><span> include/asterisk/build.h: .lastclean</span><br><span>@@ -433,6 +443,7 @@</span><br><span>       rm -f doxygen.log</span><br><span>    rm -rf latex</span><br><span>         rm -f rest-api-templates/*.pyc</span><br><span style="color: hsl(120, 100%, 40%);">+        rm -f .versionlabel</span><br><span>  @$(MAKE) -C menuselect clean</span><br><span>         cp -f .cleancount .lastclean</span><br><span> </span><br><span>@@ -968,6 +979,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/list_valid_installed_externals b/build_tools/list_valid_installed_externals</span><br><span>index 862447a..e6f03d7 100755</span><br><span>--- a/build_tools/list_valid_installed_externals</span><br><span>+++ b/build_tools/list_valid_installed_externals</span><br><span>@@ -38,7 +38,7 @@</span><br><span>     exit 1</span><br><span> fi</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-version=$(${ASTTOPDIR}/build_tools/make_version ${ASTTOPDIR})</span><br><span style="color: hsl(120, 100%, 40%);">+version=$(cat ${ASTTOPDIR}/.versionlabel)</span><br><span> if [[ ! ${version} =~ ^(GIT-)?([^.-]+)[.-].* ]] ; then</span><br><span>   echo "${module_name}: Couldn't parse version ${version}"</span><br><span>       exit 1</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18605">change 18605</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/+/18605"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: If8f10cac8f509c08981120f17555762342020221 </div>
<div style="display:none"> Gerrit-Change-Number: 18605 </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>