summaryrefslogtreecommitdiffstats
path: root/support/download/dl-wrapper
diff options
context:
space:
mode:
authorYann E. MORIN <yann.morin.1998@free.fr>2018-04-02 17:13:58 +0200
committerPeter Korsgaard <peter@korsgaard.com>2018-04-02 17:48:56 +0200
commite80d1d0af448c33f93a9a913cd0a34c406a29cf4 (patch)
tree3974c768ed01b40b7971f506540711052cf86737 /support/download/dl-wrapper
parent5d2a018ddf950b53d1d50d09d3af92849d8f5994 (diff)
downloadbuildroot-e80d1d0af448c33f93a9a913cd0a34c406a29cf4.tar.gz
buildroot-e80d1d0af448c33f93a9a913cd0a34c406a29cf4.zip
core/download: look for archives in the global download dir first
For existing setups, the global donload directory may have a lot of the required archives, so look into there before attempting a download. We simply hard-link them if found there and not in the new per-package loaction. Then we resume the existing procedure (which means the new hardlink will get removed if it happened to not match the hash). Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com> Cc: Peter Korsgaard <peter@korsgaard.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'support/download/dl-wrapper')
-rwxr-xr-xsupport/download/dl-wrapper10
1 files changed, 9 insertions, 1 deletions
diff --git a/support/download/dl-wrapper b/support/download/dl-wrapper
index af2950ac3b..ce44752df0 100755
--- a/support/download/dl-wrapper
+++ b/support/download/dl-wrapper
@@ -27,11 +27,12 @@ main() {
local -a uris
# Parse our options; anything after '--' is for the backend
- while getopts ":hc:d:o:n:N:H:rf:u:q" OPT; do
+ while getopts ":hc:d:D:o:n:N:H:rf:u:q" OPT; do
case "${OPT}" in
h) help; exit 0;;
c) cset="${OPTARG}";;
d) dl_dir="${OPTARG}";;
+ D) old_dl_dir="${OPTARG}";;
o) output="${OPTARG}";;
n) raw_base_name="${OPTARG}";;
N) base_name="${OPTARG}";;
@@ -52,6 +53,13 @@ main() {
error "no output specified, use -o\n"
fi
+ # Legacy handling: check if the file already exists in the global
+ # download directory. If it does, hard-link it. If it turns out it
+ # was an incorrect download, we'd still check it below anyway.
+ if [ ! -e "${output}" -a -e "${old_dl_dir}/${filename}" ]; then
+ ln "${old_dl_dir}/${filename}" "${output}"
+ fi
+
# If the output file already exists and:
# - there's no .hash file: do not download it again and exit promptly
# - matches all its hashes: do not download it again and exit promptly
OpenPOWER on IntegriCloud