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, 30 May 2016 08:21:59 +0000 (UTC)

branch: master
commit 76ddf3dc409c8397eca813a49a0856aaae77429f
Author: Mohammad Akhlaghi <address@hidden>
Date:   Mon May 30 14:35:59 2016 +0900

    .version is prerequisite of AUTHORS
    
    Following commit 2e0cfea (configure is now a prerequisite of .version), the
    `.version' file is now a prerequisite of `AUTHORS' (`.version' is used by
    the `genauthors' script to add the version number to `AUTHORS'). Since
    `.version' also depends on `configure', so AUTHORS will now be generated
    every time that Autoconf re-builds the `configure' script. During
    development, updating the `configure' scripot is not too common, so this
    won't slow down the process.
---
 Makefile.am |  107 ++++++++++++++++++++++++++++++++++++++---------------------
 genauthors  |   37 +++++++++++++++------
 2 files changed, 96 insertions(+), 48 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 75c750f..533262a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,29 +23,22 @@
 
 
 
+
+
 ## Sources to be run before everything else
 ## ========================================
 ##
-## The .version file is created from the $(VERSION) variable which was
-## defined by the git-version-gen script at:
-##
-##    bootstrapped/build-aux/git-version-gen
-##
-## we want it to be created before anything else when running `make', `make
-## check', or `make install', see the "Built sources" section of the
-## AUTOMAKE manual and the git-version-gen script comments for more
-## information.
-##
-## Note that contrary to what is proposed by git-version-gen, here the
-## `.version' file's creation depends on the `configure' script, so anytime
-## a the VERSION variable is updated, `.version' is also updated. During
-## development of the main functionality of Gnuastro (utilities and
-## libraries), the `configure' script is rarely updated, so `.version' will
-## not be rebuilt and thus it won't harm the speed of testing.
-BUILT_SOURCES = $(top_srcdir)/.version
-$(top_srcdir)/.version: $(top_srcdir)/configure
-       echo $(VERSION) > address@hidden && mv address@hidden $@
-dist-hook:; echo $(VERSION) > $(distdir)/.tarball-version
+## These target(s) will be created before anything else when running
+## `make', `make check', or `make install', see the "Built sources" section
+## of the AUTOMAKE manual and the git-version-gen script comments for more
+## information. Note that AUTHORS depends on `$(top_srcdir)/.version', and
+## `$(top_srcdir)/.version' depends on $(top_srcdir)/configure'. So any
+## time the version is updated, both of these will be re-built. But during
+## usual utility and library development, `$(top_srcdir)/configure' is not
+## commonly updated, so this will not slow down the process.
+BUILT_SOURCES = $(top_srcdir)/AUTHORS
+
+
 
 
 
@@ -227,7 +220,7 @@ install-exec-local:
         echo;                                                                  
     \
         echo;                                                                  
     \
         echo "Environment variables to check: ";                               
     \
-        echo "  - '$(prefix)/bin' in PATH.";                                   
   \
+        echo "  - '$(prefix)/bin' in PATH.";                                   
     \
         echo "(for an intro, run 'info gnuastro \"Installation directory\"')"; 
     \
         echo;                                                                  
     \
         echo;                                                                  
     \
@@ -243,24 +236,62 @@ install-exec-local:
 
 
 
-## Generate AUTHORS for distributions
-## ==================================
+
+
+## $(top_srcdir)/.version
+## ======================
+##
+## This file is created from the $(VERSION) variable which was defined by
+## the `git-version-gen' script (located at address below), which is run
+## when the `$(top_srcdir)/configure' script is being built by Autoconf.
+##
+##    $(top_srcdir)/bootstrapped/build-aux/git-version-gen
+##
+## Note that contrary to what is proposed by `git-version-gen', here the
+## creation of `$(top_srcdir)/.version' depends on the
+## `$(top_srcdir)/configure' script. Therefore, anytime a the VERSION
+## variable is updated there, `$(top_srcdir)/.version' is also
+## updated. During development, of the main functionality of Gnuastro
+## (utilities and libraries), the `$(top_srcdir/configure' script is rarely
+## updated, so `$(top_srcdir)/.version' will not be rebuilt and thus it
+## won't harm the speed of tests during development.
+$(top_srcdir)/.version: $(top_srcdir)/configure
+       echo $(VERSION) > address@hidden && mv address@hidden $@
+
+
+
+
+
+## $(top_srcdir)/AUTHORS
+## =====================
+##
+## This file is generated automatically from the version controlled
+## history. Note the following:
 ##
-## The AUTHORS file is generated automatically from the version
-## control history. Note the following two cases:
+##   - `$(top_srcdir)/AUTHORS' is defined as a BUILT_SOURCES variable, so
+##     it is the first thing that is built (even in multi-threaded runs).
 ##
-##   - The AUTHORS file is a prerequisite for the make dist* commands (all
-##     make targets including "dist") in the Makefile.in that Automake
-##     builds from this file. So it is not needed when we only run "make".
+##   - `$(top_srcdir)/AUTHORS' is updated only when
+##     `$(top_srcdir)/.version' is updated. `$(top_srcdir)/.version' its
+##     self is only updated when `$(top_srcdir)/configure' is updated. But
+##     generally, the `$(top_srcdir)/configure' script is not updated
+##     regularly during development and outside of version control.
 ##
-##   - AUTHORS is defined as a double colon rule so that it is called every
-##     time any "make dist*" is called, even if AUTHORS already exists. It
-##     is possible for it to be called in a non version controlled source,
-##     in that case, it will not be updated (or created if it doesn't
-##     already exist, see `genauthors'). But generally, "make dist*" is not
-##     called too often and outside of version control.
+##   - The `$(top_srcdir)/genauthors' script will not do anything
+##     (make/update the `$(top_srcdir)AUTHORS' file) when there is no git
+##     repository. `$(top_srcdir)/AUTHORS' is only necessary when building
+##     a tarball distribution.
+$(top_srcdir)/AUTHORS: $(top_srcdir)/.version
+       $(top_srcdir)/genauthors $(top_srcdir)
+
+
+
+
+
+## Run when building a distribution
+## ================================
 ##
-##   - The genauthors script will not do anything (make/update the
-##     AUTHORS file) when there is no git repository.
-AUTHORS:: $(top_srcdir)/.version $(top_srcdir)/genauthors
-       $(top_srcdir)/genauthors $(top_srcdir)/.version
+## These targets will be created when building a (tarball)
+## distribution. Note that AUTHORS depends on `.version'.
+dist-hook: $(top_srcdir)/AUTHORS
+       echo $(VERSION) > $(distdir)/.tarball-version
diff --git a/genauthors b/genauthors
index 87094c7..6e92331 100755
--- a/genauthors
+++ b/genauthors
@@ -3,7 +3,7 @@
 # Generate a list of authors from the git repository, it will only
 # actually do anything if a .git file exists. Run like this:
 #
-#    ./genauthors path/to/.version
+#    ./genauthors top/src/dir
 #
 # Note that some authors might have changed their email addresses over
 # the course of their contributions to Gnuastro. Fortunately Git has a
@@ -46,7 +46,11 @@ set -o errexit                  # Stop if a program returns 
false.
 # 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
+if [ ! -d "$1/.git" ]; then
+    echo "There is no Git repository in the source directory."
+    echo "AUTHORS cannot be generated."
+    exit 0
+fi
 
 
 
@@ -61,9 +65,21 @@ echo "Generating AUTHORS from the version controlled 
source..."
 
 
 
+# Make sure the .mailmap file is present in this directory, so Git can fix
+# the different email addresses and names of one person. Note that while
+# this is in the top source directory, it is possible for the source and
+# build directories to be different, and we have to be prepared for that.
+if [ ! -f .mailmap ]; then
+    ln -s $1/.mailmap .mailmap
+fi
+
+
+
+
 
 # Print the top of the AUTHORS file:
-gnuastroversion=$(cat $1)
+outauthors="$1/AUTHORS"
+gnuastroversion=$(cat "$1/.version")
 echo "GNU Astronomy Utilities authors
 ===============================
 
@@ -82,11 +98,11 @@ Aggregate list of all authors
 
 List of everyone who has made a commit irrespective of which part of
 Gnuastro they contributed to, the rows are ordered alphabetically." > \
-AUTHORS
+"$outauthors"
 
 
 # Generate the aggregate list
-git shortlog --summary --email --no-merges >> AUTHORS
+git --git-dir=$1/.git shortlog --summary --email --no-merges >> "$outauthors"
 
 
 # For each utility, print the list of authors:
@@ -99,10 +115,10 @@ Authors listed under the respective part of Gnuastro: 
utility,
 libraries, or documentation. Note that a single commit might include
 multiple parts of Gnuastro (especially in the libraries and
 documentation). The authors in each part are sorted by the number of
-commits." >> AUTHORS
+commits." >> "$outauthors"
 
 # A blank line to separate the list below from the explanations.
-echo "" >> AUTHORS
+echo "" >> "$outauthors"
 
 
 # Go over each part of Gnuastro and add the authors:
@@ -128,7 +144,8 @@ for util in src/* "lib/" "doc/"; do
     fi
 
     # Fill in the authors of each part:
-    echo $name >> AUTHORS
-    git shortlog --numbered --summary --email --no-merges -- $util >> AUTHORS
-    echo "" >> AUTHORS
+    echo $name >> "$outauthors"
+    git --git-dir=$1/.git shortlog --numbered --summary --email    \
+        --no-merges -- $util >> "$outauthors"
+    echo "" >> "$outauthors"
 done



reply via email to

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