From: Thomas De Schampheleire <patrickdepinguin@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCHv4 4/8] support/download/file: implement source-check
Date: Fri, 15 Feb 2019 22:07:59 +0100 [thread overview]
Message-ID: <20190215210803.8969-4-patrickdepinguin@gmail.com> (raw)
In-Reply-To: <20190215210803.8969-1-patrickdepinguin@gmail.com>
From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
support/download/file | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
v4:
- use true/false as values to 'checkonly' (Yann E. Morin)
- replace incorrect 'exit $?' by explicit 'exit 0' (Yann E. Morin)
- replace 'test -e' by 'test -f' which is more specific
v3: no changes
diff --git a/support/download/file b/support/download/file
index e52fcf2c8c..059a8dde4c 100755
--- a/support/download/file
+++ b/support/download/file
@@ -7,6 +7,7 @@ set -e
#
# Options:
# -q Be quiet.
+# -C Only check that the source file exists.
# -o FILE Copy to file FILE.
# -f FILE Copy from basename file FILE.
# -u DIR Copy from FILE in DIR.
@@ -20,9 +21,11 @@ set -e
# Make 'cp' verbose by default, so it behaves a bit like the others.
verbose=-v
+checkonly=false
while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do
case "${OPT}" in
q) verbose=;;
+ C) checkonly=true;;
o) output="${OPTARG}";;
f) file="${OPTARG}";;
u) dir="${OPTARG}";;
@@ -39,4 +42,12 @@ _localfiles() {
eval ${LOCALFILES} "${@}"
}
-_localfiles ${verbose} "'${dir##file://}/${file}'" "'${output}'"
+# Remove any scheme prefix
+dir="${dir##file://}"
+
+if ${checkonly}; then
+ test -f "'${dir}/${file}'"
+ exit 0
+fi
+
+_localfiles ${verbose} "'${dir}/${file}'" "'${output}'"
--
2.19.2
next prev parent reply other threads:[~2019-02-15 21:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-15 21:07 [Buildroot] [PATCHv4 1/8] support/download: reintroduce 'source-check' target Thomas De Schampheleire
2019-02-15 21:07 ` [Buildroot] [PATCHv4 2/8] support/download/hg: implement source-check Thomas De Schampheleire
2019-02-15 21:07 ` [Buildroot] [PATCHv4 3/8] support/download/wget: " Thomas De Schampheleire
2019-02-15 21:07 ` Thomas De Schampheleire [this message]
2019-02-15 21:08 ` [Buildroot] [PATCHv4 5/8] Config.in: reintroduce BR2_SSH Thomas De Schampheleire
2019-02-16 12:34 ` Yann E. MORIN
2019-02-16 21:23 ` Thomas De Schampheleire
2019-02-16 22:29 ` Yann E. MORIN
2019-02-15 21:08 ` [Buildroot] [PATCHv4 6/8] support/download/scp: implement source-check Thomas De Schampheleire
2019-02-15 21:08 ` [Buildroot] [PATCHv4 7/8] support/download/svn: " Thomas De Schampheleire
2019-02-15 21:08 ` [Buildroot] [PATCHv4 8/8] support/download/{bzr, cvs, git}: highlight unimplemented source-check Thomas De Schampheleire
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190215210803.8969-4-patrickdepinguin@gmail.com \
--to=patrickdepinguin@gmail.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox