aboutsummaryrefslogtreecommitdiff
path: root/reproduce/analysis/make/download.mk
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2020-06-09 20:09:09 +0100
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2020-06-10 01:25:33 +0100
commit2bd2e2f1833300d5102339e2aa417a3099c13960 (patch)
tree23f3177723148402aa89e63e39bed399528f294b /reproduce/analysis/make/download.mk
parent7bdbd6e61f132ac8f6851637d40fd06f8d6b7182 (diff)
IMPORTANT: bug fix in default data download script of download.mk
Summary of possible semantic conflicts 1. The recipe to download input datasets has been modified. You have to re-set the old 'origname' variable to 'localname' (to avoid confusion) and the default dataset URL should now be complete (including the actual filename). See the newly added descriptions in 'INPUTS.conf' for more on this. Until now, when the dataset was already present on the host system, a link couldn't be made to it, causing the project to crash in the checksum phase. This has been fixed with properly naming the main variable as 'localname' to avoid the confusion that caused it. Some other problems have been fixed in this recipe in the meantime: - When the checksum is different, the expected and calculated checksums are printed. - In the default paper, we now print the full URL of the dataset, not just the server, so the checksum of the 'download.tex' step has been updated.
Diffstat (limited to 'reproduce/analysis/make/download.mk')
-rw-r--r--reproduce/analysis/make/download.mk24
1 files changed, 14 insertions, 10 deletions
diff --git a/reproduce/analysis/make/download.mk b/reproduce/analysis/make/download.mk
index 71ee7d3..bc8b8ce 100644
--- a/reproduce/analysis/make/download.mk
+++ b/reproduce/analysis/make/download.mk
@@ -58,7 +58,7 @@ $(inputdatasets): $(indir)/%.fits: | $(indir) $(lockdir)
# Set the necessary parameters for this input file.
if [ $* = wfpc2 ]; then
- origname=$(WFPC2IMAGE); url=$(WFPC2URL); mdf=$(WFPC2MD5);
+ localname=$(WFPC2IMAGE); url=$(WFPC2URL); mdf=$(WFPC2MD5);
else
echo; echo; echo "Not recognized input dataset: '$*.fits'."
echo; echo; exit 1
@@ -71,21 +71,25 @@ $(inputdatasets): $(indir)/%.fits: | $(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 $$url/$$origname $@
+ $(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