[PATCH util/macros 1/2] Rework CHANGELOG_CMD to touch/echo >&2 only as needed

Emil Velikov emil.l.velikov at gmail.com
Tue Feb 14 11:38:20 UTC 2017


From: Emil Velikov <emil.velikov at collabora.com>

Currently CHANGELOG_CMD issues a

  touch ChangeLog; echo "Scary message" >&2

even if the file is already present. For example, when running `make
distcheck' the following is observed:

"
/bin/sh: ../../.changelog.tmp: Permission denied
git directory not found: installing possibly empty changelog.
...
/bin/sh: ../../.changelog.tmp: Permission denied
git directory not found: installing possibly empty changelog.
"

That in itself happens since srcdir is RO, thus shell redirection [to
srcddir/.changelog.tmp] fails. At the same time the latter message is
wrong and misleading since the file is already there, with the correct
contents.

Silence the permissing warning (/dev/null is our friend), and add
a simple `test -e .../ChangeLog || (...' prior to the touch/echo combo.

As we're here also update the message to be more generic, since there
are multiple other reasons why things can fail.

Cc: Gaetan Nadon <memsize at videotron.ca>
Cc: Peter Hutterer <peter.hutterer at who-t.net>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
So here it is gents - hopefully this is the last round.

Even though this/these two patches should cause no functional change,
I've tested the whole ecosistem and did not see any regressions. There
were a _lot_ of projects failing even without my patches though, but
that's for another day ;-)

Some WIP/RFC patches for build.sh are coming in a minute
---
 xorgversion.m4 | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/xorgversion.m4 b/xorgversion.m4
index 19f2ffd..8d9b634 100644
--- a/xorgversion.m4
+++ b/xorgversion.m4
@@ -56,9 +56,10 @@ AC_DEFUN([XORG_RELEASE_VERSION],[
 #
 #
 AC_DEFUN([XORG_CHANGELOG], [
-CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
+CHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
 mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
-|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
-echo 'git directory not found: installing possibly empty changelog.' >&2)"
+|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
+touch \$(top_srcdir)/ChangeLog; \
+echo 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
 AC_SUBST([CHANGELOG_CMD])
 ]) # XORG_CHANGELOG
-- 
2.11.0



More information about the xorg-devel mailing list