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 # Caller needs to single-quote its arguments to prevent them from
30 # being expanded a second time (in case there are spaces in them)
35 # --per-file-timestamps comes with bzr-2.2 (released August 2010),
36 # so only pass it if bzr is recent enough. We compute versions as:
39 bzr_version
=$
(($
(bzr
--version |
40 sed -r -n 's/^Bazaar \(bzr\) ([[:digit:]]+)\.([[:digit:]]+)\..*$/\1*1000+\2/p')
43 # If the version is recent enough, we can generate reproducible
44 # archives; otherwise, we just hope for the best (as it would
45 # be downloaded from the BR mirror if what we generate here does
46 # not match the hash we have for it).
47 if [ ${bzr_version} -ge ${bzr_min_version} ]; then
48 timestamp_opt
="--per-file-timestamps"
51 _bzr
export ${verbose} --root="'${basename}/'" --format=tgz \
52 ${timestamp_opt} - "'${repo}'" -r "'${rev}'" \