diff options
author | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2009-03-08 11:14:54 (GMT) |
---|---|---|
committer | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2009-03-08 11:14:54 (GMT) |
commit | 8e49c292559a934308a8a5f6ed3e3bac830e0692 (patch) | |
tree | c65b1d2cc3ab6e487350905fe7ae932a9d1a211f /scripts/functions | |
parent | 5e2f711dbfa4c50335abe1247991a941cd7e418c (diff) |
Add CT_GetSVN to commonalise retrieval from SVN (ala CT_GetCVS).
/trunk/scripts/functions | 34 33 1 0 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
Diffstat (limited to 'scripts/functions')
-rw-r--r-- | scripts/functions | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/scripts/functions b/scripts/functions index 19acaed..34a3936 100644 --- a/scripts/functions +++ b/scripts/functions @@ -560,7 +560,7 @@ CT_GetCVS() { # No, it does not... # Are downloads allowed ? - CT_TestAndAbort "File '${file}' not present locally, and downloads are not allowed" "${CT_FORBID_DOWNLOAD}" = "y" + CT_TestAndAbort "File '${basename}' not present locally, and downloads are not allowed" "${CT_FORBID_DOWNLOAD}" = "y" CT_DoLog EXTRA "Retrieving '${basename}'" @@ -577,6 +577,38 @@ CT_GetCVS() { CT_DoExecLog ALL rm -rf "${tmp_dir}" } +# Check out from SVN, and build the associated tarball +# The tarball will be called ${basename}.tar.bz2 +# Prerequisite: either the server does not require password, +# or the user must already be logged in. +# 'rev' is the revision to retrieve +# Usage: CT_GetSVN <basename> <url> [rev] +CT_GetSVN() { + local basename="$1" + local uri="$2" + local rev="$3" + + # Does it exist localy? + CT_GetLocal "${basename}" && return 0 || true + # No, it does not... + + # Are downloads allowed ? + CT_TestAndAbort "File '${basename}' not present locally, and downloads are not allowed" "${CT_FORBID_DOWNLOAD}" = "y" + + CT_DoLog EXTRA "Retrieving '${basename}'" + + CT_MktempDir tmp_dir + CT_Pushd "${tmp_dir}" + + CT_DoSetProxy ${CT_PROXY_TYPE} + CT_DoExecLog ALL svn export ${rev:+-r ${rev}} "${uri}" "${basename}" + CT_DoExecLog ALL tar cjf "${CT_TARBALLS_DIR}/${basename}.tar.bz2" "${basename}" + CT_SaveLocal "${CT_TARBALLS_DIR}/${basename}.tar.bz2" + + CT_Popd + CT_DoExecLog ALL rm -rf "${tmp_dir}" +} + # Extract a tarball # Some tarballs need to be extracted in specific places. Eg.: glibc addons # must be extracted in the glibc directory; uCLibc locales must be extracted |