From 891e91f0762011594d46034368c8e36a9cde39d8 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Fri, 29 Nov 2019 15:59:57 +0000 Subject: Download links directly to actual file if it exists in INDIR Until now, when an input dataset already exists in `INDIR', the template would just make a symbolic link to it in the build directory. However, in many cases, the files in INDIR will actually be links to other locations on the filesystem and some programs have problems following too many links. With this commit, the template is now using the `readlink' program (part of GNU Coreutils) to follow a possible link and point the link in the build directory directly to an actual non-link file. --- reproduce/analysis/make/download.mk | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/reproduce/analysis/make/download.mk b/reproduce/analysis/make/download.mk index a721863..ea74ce4 100644 --- a/reproduce/analysis/make/download.mk +++ b/reproduce/analysis/make/download.mk @@ -60,9 +60,15 @@ $(inputdatasets): $(indir)/%.fits: | $(indir) $(lockdir) echo; echo; exit 1 fi - # Download (or make the link to) the input dataset. + # Download (or make the link to) the input dataset. If the file + # exists in `INDIR', it may be a symbolic link to some other place + # in the filesystem. To avoid too many links when using these files + # during processing, we'll use `readlink -f' so the link we make + # 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 -s $(INDIR)/$$origname $@ + ln -fs $$(readlink -f $(INDIR)/$$origname) $$out else touch $(lockdir)/download $(downloadwrapper) "wget --no-use-server-timestamps -O" \ -- cgit v1.2.1