blob: 90abfb49d023115575cca853d38d50abc7a088df (
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
50
|
#!/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}"
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_fetch "${mirror}/${build_fetch_file}" && exit
done
build_make_fetch "${1}"
unset build_fetch_file
if ! test -d "${BUILDER_TMPDIR}/fetch"; then
mkdir -p "${BUILDER_TMPDIR}/fetch"
fi
FETCH_LOG="${BUILDER_TMPDIR}/fetch/$(build-url --archive "${1}").log"
rm -f "${FETCH_LOG}"
touch "${FETCH_LOG}"
build_make_fetch "${@}"
fi
# vim: filetype=sh
|