diff options
author | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2019-11-29 15:59:57 +0000 |
---|---|---|
committer | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2019-11-29 15:59:57 +0000 |
commit | 891e91f0762011594d46034368c8e36a9cde39d8 (patch) | |
tree | 3ae6b75e1459e67f62ff6183d429444611f13359 /reproduce/analysis | |
parent | 042563213e3a2641dd914470cfd98d63aef67b64 (diff) |
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.
Diffstat (limited to 'reproduce/analysis')
-rw-r--r-- | reproduce/analysis/make/download.mk | 10 |
1 files 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" \ |