blob: 3fa4fab4ccb4970217eae91d70cfcf2135107165 (
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
51
52
|
#!/usr/bin/env build
build_fetch_svn()
{
build_fetch_svn_uri="$(build-url --base "${1}")"
build_fetch_svn_uri="${build_fetch_svn_uri%%\?*}"
build_fetch_svn_proto=svn
for arg in $(build-url --arg "${1}"); do
case "${arg}" in
(archive=*) build_fetch_svn_var="${arg##*=}";;
(proto=*) build_fetch_svn_proto="${arg##*=}";;
esac
done
if test -z "${build_fetch_svn_var}"; then
die "do not know how to store source from '${1}'"
fi
build_fetch_svn_dir="${build_fetch_svn_var%%.t*}"
build_fetch_svn_tmp="$(mktemp -d "${BUILDER_TMPDIR}/${build_fetch_svn_dir}.XXXXXX")"
cd "${build_fetch_svn_tmp}"
BUILD_FETCH_CLEAN="${BUILD_FETCH_CLEAN} ${build_fetch_svn_tmp}"
if ! svn checkout "${build_fetch_svn_proto}${build_fetch_svn_uri#svn}" "${build_fetch_svn_dir}"; then
die "failed to checkout svn source at '${build_fetch_svn_uri}'"
fi
cd "${build_fetch_svn_tmp}"
tar caf "${build_fetch_svn_var}" "${build_fetch_svn_dir}"
if test ! -d "${BUILDER_SRCDIR}"; then
mkdir -p "${BUILDER_SRCDIR}"
fi
mv "${build_fetch_svn_var}" "${BUILDER_SRCDIR}/${build_fetch_svn_var}"
if [ -d "${build_fetch_svn_tmp}" ]; then
rm -rf "${build_fetch_svn_tmp}"
fi
unset build_fetch_svn_tmp
unset build_fetch_svn_var
unset build_fetch_svn_proto
unset build_fetch_svn_dir
unset build_fetch_svn_uri
}
if test "${BUILDER_CALL_STACK}" = '__main__'; then
simple_usage 'fetch-svn' '<url>' "$@"
build_fetch_svn "${1}"
fi
# vim: filetype=sh
|