gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] (no subject)


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] (no subject)
Date: Mon, 23 May 2016 10:56:26 +0000 (UTC)

branch: master
commit 6193a4083739ebe4dc16437bbdb03332ea69071c
Author: Mohammad Akhlaghi <address@hidden>
Date:   Mon May 23 16:59:12 2016 +0900

    doc/genauthors works on a separate build directory
    
    Until now, the `doc/genauthors' script was only set up to work when the
    build and source directories where the same. If they were different, this
    script would fail to find a Git repository. So it now takes in an argument
    (the `top_srcdir' variable) and uses it in checking for a `.git' directory
    and importing the `.mailmap' file. It then uses them with Git to build the
    authors.texi file in the output directory.
---
 doc/Makefile.am |    4 ++--
 doc/genauthors  |   46 +++++++++++++++++++++++++++++++---------------
 2 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/doc/Makefile.am b/doc/Makefile.am
index 49f6c81..089e8c8 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -50,9 +50,9 @@ EXTRA_DIST = genauthors README
 ## We want to build the authors.texi file only when we are building in the
 ## version controlled source. For the non version controlled souce,
 ## deleting this file is like somehow deleting formath.texi, it will not be
-## rebuilt.
+## rebuilt and result in an error.
 authors.texi: $(top_srcdir)/configure
-       $(top_srcdir)/doc/genauthors
+       $(top_srcdir)/doc/genauthors $(top_srcdir)
 
 
 ## Images:
diff --git a/doc/genauthors b/doc/genauthors
index 38e0368..1b1f7dc 100755
--- a/doc/genauthors
+++ b/doc/genauthors
@@ -1,10 +1,13 @@
 #! /bin/sh
 #
 # Update/create authors for the documentation. But only when there is a Git
-# repository. When there is no ../.git directory, rely on the existing
-# authors list. If the authors.texi file has for some reason been deleted
-# from the non version controlled source, then the book will not be made
-# (Texinfo will complain about a missing authors.texi).
+# repository. When there is no $(top_srcdir)/.git directory, rely on the
+# existing authors list. If the authors.texi file has for some reason been
+# deleted from the non version controlled source, then the book will not be
+# made (Texinfo will complain about a missing authors.texi).
+#
+# Call like this:
+#     genauthors TOP_SRCDIR
 #
 # Original author:
 #     Mohammad Akhlaghi <address@hidden>
@@ -26,16 +29,29 @@
 # with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 
 
-# Only do the job if a .git directory exists (recall that this script
-# is also present in the tar-ball with no .git directory and might be
-# run from there)
-if [ ! -d "../.git" ]; then exit 0; fi
+# Only do the job if a .git directory exists in the top source directory
+# (recall that this script is also present in the tar-ball with no .git
+# directory and might be run from there)
+if [ -d $1/.git ]; then
+
+    # We will need to import the `.mailmap' file from the source directory
+    # temporarily to correct the changing emails (see the comments in
+    # `.mailmap'). Note that this script is run from within the
+    # `TOP_SRCDIR/doc/' directory. The original `.mailmap' is in the
+    # `TOP_SRCDIR', so even when the source and build directories are the
+    # same, there is no problem.
+    ln -s $1/.mailmap .mailmap
 
+    # Do NOT test if authors.texi is newer than ../.git.  In some cases the
+    # list of authors is created empty when running make in top directory
+    # (in particular "make -jN" with N > 1), so authors.texi needs to be
+    # recreated anyway.
+    git --git-dir=$1/.git shortlog --numbered --summary --email --no-merges \
+        | sed -e 's/</ /' -e 's/>/ /' -e 's/@/@@/' -e "s/è/@\`e/"           \
+        | awk '{printf "%s %s (%s, %s)@*\n", $2, $3, $4, $1}' > authors.texi
 
-# Do NOT test if authors.texi is newer than ../.git.  In some cases the
-# list of authors is created empty when running make in top directory
-# (in particular "make -jN" with N > 1), so authors.texi needs to be
-# recreated anyway.
-git shortlog --numbered --summary --email --no-merges          \
-    | sed -e 's/</ /' -e 's/>/ /' -e 's/@/@@/' -e "s/è/@\`e/"  \
-    | awk '{printf "%s %s (%s, %s)@*\n", $2, $3, $4, $1}' > authors.texi
+    # Clean up:
+    rm .mailmap
+else
+    echo "No Git repository detected, leaving authors.texi unchanged."
+fi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]