python-pathvalidate: bump version to 0.14.1
[buildroot-gz.git] / support / download / cvs
blob50050ab1c9c5e411dc004e3eeedaa31557a9c4a8
1 #!/usr/bin/env bash
3 # We want to catch any unexpected failure, and exit immediately
4 set -e
6 # Download helper for cvs, to be called from the download wrapper script
8 # Call it as:
9 # .../cvs [-q] OUT_FILE CVS_URL REV PKG_NAME BASENAME
11 # Environment:
12 # CVS : the cvs command to call
14 verbose=
15 while getopts :q OPT; do
16 case "${OPT}" in
17 q) verbose=-Q;;
18 \?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
19 esac
20 done
21 shift $((OPTIND-1))
23 output="${1}"
24 repo="${2}"
25 rev="${3}"
26 rawname="${4}"
27 basename="${5}"
29 shift 5 # Get rid of our options
31 # Caller needs to single-quote its arguments to prevent them from
32 # being expanded a second time (in case there are spaces in them)
33 _cvs() {
34 eval ${CVS} "${@}"
37 if [[ ${rev} =~ ^[0-9] ]]; then
38 # Date, because a tag or a branch cannot begin with a number
39 select="-D"
40 else
41 # Tag or branch
42 select="-r"
45 # The absence of an initial : on ${repo} means access method undefined
46 if [[ ! "${repo}" =~ ^: ]]; then
47 # defaults to anonymous pserver
48 repo=":pserver:anonymous@${repo}"
51 export TZ=UTC
52 _cvs ${verbose} -z3 -d"'${repo}'" \
53 co "${@}" -d "'${basename}'" ${select} "'${rev}'" -P "'${rawname}'"
55 tar czf "${output}" "${basename}"