3 # We want to catch any unexpected failure, and exit immediately
6 # Download helper for bzr, to be called from the download wrapper script
9 # .../bzr [-q] OUT_FILE REPO_URL REV BASENAME
12 # BZR : the bzr command to call
16 while getopts :q OPT
; do
19 \?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
29 shift 4 # 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)
37 # --per-file-timestamps comes with bzr-2.2 (released August 2010),
38 # so only pass it if bzr is recent enough. We compute versions as:
41 bzr_version
=$
(($
(bzr
--version |
42 sed -r -n 's/^Bazaar \(bzr\) ([[:digit:]]+)\.([[:digit:]]+)\..*$/\1*1000+\2/p')
45 # If the version is recent enough, we can generate reproducible
46 # archives; otherwise, we just hope for the best (as it would
47 # be downloaded from the BR mirror if what we generate here does
48 # not match the hash we have for it).
49 if [ ${bzr_version} -ge ${bzr_min_version} ]; then
50 timestamp_opt
="--per-file-timestamps"
53 _bzr
export ${verbose} --root="'${basename}/'" --format=tgz \
54 ${timestamp_opt} - "${@}" "'${repo}'" -r "'${rev}'" \