aboutsummaryrefslogtreecommitdiff
path: root/reproduce/analysis/make
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2020-06-10 02:43:54 +0100
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2020-06-10 02:43:54 +0100
commit7009163a8bc55df553de8c4764b4b7aee43ffa0b (patch)
tree3aa85f9b94e82fdb2389b1e743d8cc67afbff1da /reproduce/analysis/make
parenta5417f6b100363eeed6ad3300a873ca066bcc506 (diff)
Corrected bug in using local copy of input dataset
As described in Maneage's commit 2bd2e2f18 (which I found while testing this project), the existing download recipe had problems when using a local copy of the input dataset. It was first fixed here, then implemented there. Also, to clarify things for a new user, some long comments were added at the top of 'INPUTS.conf' to describe each of the variables, that comment has also been put here (and is also in commit 2bd2e2f18 of Maneage).
Diffstat (limited to 'reproduce/analysis/make')
-rw-r--r--reproduce/analysis/make/download.mk26
1 files changed, 15 insertions, 11 deletions
diff --git a/reproduce/analysis/make/download.mk b/reproduce/analysis/make/download.mk
index 8d9c164..d5f8cef 100644
--- a/reproduce/analysis/make/download.mk
+++ b/reproduce/analysis/make/download.mk
@@ -58,9 +58,9 @@ $(inputdatasets): $(indir)/%: | $(indir) $(lockdir)
# Set the necessary parameters for this input file.
if [ $* = menke20.xlsx ]; then
- origname=$(MK20DATA); fullurl=$(MK20URL); mdf=$(MK20MD5);
+ localname=$(MK20DATA); url=$(MK20URL); mdf=$(MK20MD5);
else
- echo; echo; echo "Not recognized input dataset: '$*.fits'."
+ echo; echo; echo "Not recognized input dataset: '$*'."
echo; echo; exit 1
fi
@@ -71,21 +71,25 @@ $(inputdatasets): $(indir)/%: | $(indir) $(lockdir)
# here points to the final file directly (note that `readlink' is
# part of GNU Coreutils). If its not a link, the `readlink' part
# has no effect.
- if [ -f $(INDIR)/$$origname ]; then
- ln -fs $$(readlink -f $(INDIR)/$$origname) $$out
+ unchecked=$@.unchecked
+ if [ -f $(INDIR)/$$localname ]; then
+ ln -fs $$(readlink -f $(INDIR)/$$localname) $$unchecked
else
touch $(lockdir)/download
$(downloadwrapper) "wget --no-use-server-timestamps -O" \
- $(lockdir)/download $$fullurl $@
+ $(lockdir)/download $$url $$unchecked
fi
# Check the md5 sum to see if this is the proper dataset.
- sum=$$(md5sum $@ | awk '{print $$1}')
- if [ $$sum != $$mdf ]; then
- wrongname=$(dir $@)/wrong-$(notdir $@)
- mv $@ $$wrongname
- echo; echo; echo "Wrong MD5 checksum for '$$origname' in $$wrongname"
- echo; echo; exit 1
+ sum=$$(md5sum $$unchecked | awk '{print $$1}')
+ if [ $$sum = $$mdf ]; then
+ mv $$unchecked $@
+ else
+ echo; echo;
+ echo "Wrong MD5 checksum for input file '$$localname':"
+ echo " Expected MD5 checksum: $$mdf"; \
+ echo " Calculated MD5 checksum: $$sum"; \
+ echo; exit 1
fi