blob: 57f11bffba1d28c2c4c831a41719a04c35ff97a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/usr/bin/env build
build_make_fetch_cleanup()
{
for arg in ${BUILD_FETCH_CLEAN}; do
if [ -d "${arg}" ]; then
rm -rf "${arg}"
elif [ -f "${arg}" ]; then
rm "${arg}"
fi
done
}
build_make_fetch()
{
trap build_make_fetch_cleanup 0
echo "trying: fetch ${1}"
FETCH_LOG="${BUILDER_TMPDIR}/fetch/$(build-url --archive "${1}").log"
if ! test -d "${BUILDER_TMPDIR}/fetch"; then
mkdir -p "${BUILDER_TMPDIR}/fetch"
fi
build_fetch_proto="$(build-url --proto "${1}")"
if ! test -x "${BUILDER_LIBDIR}/build-fetch-${build_fetch_proto}"; then
die "do not know how to handle '${build_fetch_proto}'"
fi
set -- "build-fetch-${build_fetch_proto}" "${1}"
unset build_fetch_proto
"$@"
}
if test "${BUILDER_CALL_STACK}" = '__main__'; then
simple_usage 'fetch' '[all|[<category>/]<package|all>]' "$@"
build_fetch_file="$(build-url --archive "${1}")"
for mirror in ${MIRRORS}; do
build_make_fetch "${mirror}/${build_fetch_file}" && exit
done
unset build_fetch_file
build_make_fetch "${@}"
fi
# vim: filetype=sh
|