From 080d9176fa3fc281cf7974b8431a6c5f3be62dab Mon Sep 17 00:00:00 2001
From: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Date: Tue, 13 Nov 2018 14:09:13 +0000
Subject: Version of programs checked on each run of pipeline

The version of all programs is now checked in
`reproduce/make/src/initialize.mk' and the pipeline won't complete if any
of the program versions change from those listed in
`reproduce/config/pipeline/dependency-versions.mk'.

Since the pipeline is systematically checking all program versions, we
don't need Gnuastro's `--onlyversion' option any more. So it (and all
references to it) have been removed.
---
 reproduce/src/make/initialize.mk | 41 +++++++++++++++++++++++++++++++---------
 1 file changed, 32 insertions(+), 9 deletions(-)

(limited to 'reproduce/src')

diff --git a/reproduce/src/make/initialize.mk b/reproduce/src/make/initialize.mk
index c5f8620..b8d71c6 100644
--- a/reproduce/src/make/initialize.mk
+++ b/reproduce/src/make/initialize.mk
@@ -145,6 +145,22 @@ distclean: clean
 
 
 
+# Check the version of programs which write their version
+# -------------------------------------------------------
+vercheck = prog="$(strip $(1))";                                          \
+	   ver="$(strip $(2))";                                           \
+	   name="$(strip $(3))";                                          \
+	   macro="$(strip $(4))";                                         \
+	   v=$$($$prog --version | awk '/'$$ver'/{print "y"}');           \
+	   if [ x$$v != xy ]; then                                        \
+	     echo; echo "PIPELINE ERROR: Not running $$name $$ver"; echo; \
+	     exit 1;                                                      \
+	   fi;                                                            \
+	   echo "\newcommand{\\$$macro}{$$ver}" >> $@
+
+
+
+
 # Pipeline initialization results
 # -------------------------------
 #
@@ -154,15 +170,22 @@ distclean: clean
 # actually exists, it is also aded as a `.PHONY' target above.
 $(mtexdir)/initialize.tex: | $(mtexdir)
 
-        # Version of the pipeline.
+        # Version of the pipeline and build directory (for LaTeX inputs).
 	@v=$$(git describe --dirty --always);
 	echo "\newcommand{\pipelineversion}{$$v}"  > $@
-
-# --------- Delete for no Gnuastro ---------
-        # Version of Gnuastro.
-	@v=$$(astnoisechisel --version | awk 'NR==1{print $$NF}');
-	echo "\newcommand{\gnuastroversion}{$$v}" >> $@
-# ------------------------------------------
-
-        # Location of the build directory (for LaTeX inputs).
 	@echo "\newcommand{\bdir}{$(BDIR)}"       >> $@
+
+        # Versions of programs (same order as `dependency-versions.mk').
+	$(call vercheck, bash, $(bash-version), GNU Bash, bashversion)
+	$(call vercheck, cmake, $(cmake-version), CMake, cmakeversion)
+	$(call vercheck, ls, $(coreutils-version), GNU Coreutils,       \
+                         coreutilsversion)
+	$(call vercheck, awk, $(gawk-version), GNU AWK, gawkversion)
+	$(call vercheck, gs, $(ghostscript-version), GPL Ghostscript,   \
+	                 ghostscriptversion)
+	$(call vercheck, git, $(git-version), Git, gitversion)
+	$(call vercheck, astnoisechisel, $(gnuastro-version), Gnuastro, \
+                         gnuastroversion)
+	$(call vercheck, grep, $(grep-version), GNU Grep, grepversion)
+	$(call vercheck, make, $(make-version), GNU Make, makeversion)
+	$(call vercheck, sed, $(sed-version), GNU SED, sedversion)
-- 
cgit v1.2.1