1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

makepkg: add support for SVN urls

Allow SVN repo sources in the form:

source=("<folder>::<repo>#<fragment>")

where <repo> must start with svn (e.g svn+http://) and a <fragment>
can specify a revision (e.g. revision=22).

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2012-06-07 18:12:31 +10:00
parent 888020de90
commit 2042b79bcc

View File

@ -198,7 +198,7 @@ get_filepath() {
local proto="$(get_protocol "$1")"
case $proto in
git*)
git*|svn*)
if [[ -d "$startdir/$file" ]]; then
file="$startdir/$file"
elif [[ -d "$SRCDEST/$file" ]]; then
@ -234,9 +234,12 @@ get_filename() {
local proto=$(get_protocol "$netfile")
case $proto in
git*)
git*|svn*)
filename=${netfile##*/}
filename=${filename%%#*}
# fall-through
;;&
git*)
filename=${filename%%.git*}
;;
*)
@ -446,6 +449,67 @@ download_git() {
popd &>/dev/null
}
download_svn() {
local netfile=$1
local fragment=${netfile##*#}
if [[ $fragment = "$netfile" ]]; then
unset fragment
fi
local dir=$(get_filepath "$netfile")
[[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
local repo=${netfile##*/}
repo=${repo%%#*}
local url=$(get_url "$netfile")
if [[ $url != svn+ssh* ]]; then
url=${url##*svn+}
fi
url=${url%%#*}
if [[ ! -d "$dir" ]]; then
msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "svn"
if ! svn checkout --config-dir "$dir" "$url" "$dir"; then
error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "svn"
plain "$(gettext "Aborting...")"
exit 1
fi
else
msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "svn"
cd_safe "$dir"
if ! svn update; then
# only warn on failure to allow offline builds
warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "svn"
fi
fi
msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "svn"
pushd "$srcdir" &>/dev/null
rm -rf "${dir##*/}"
local ref
if [[ -n $fragment ]]; then
case ${fragment%%=*} in
revision)
ref=('-r' "${fragment##*=}")
;;
*)
error "$(gettext "Unrecognized reference: %s")" "${fragment}"
plain "$(gettext "Aborting...")"
exit 1
esac
fi
if ! svn export $(ref[@]) "$dir"; then
error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "svn"
plain "$(gettext "Aborting...")"
fi
popd &>/dev/null
}
download_sources() {
msg "$(gettext "Retrieving Sources...")"
@ -465,6 +529,9 @@ download_sources() {
git*)
download_git "$netfile"
;;
svn*)
download_svn "$netfile"
;;
*)
error "$(gettext "Unknown download protocol: %s")" "$proto"
plain "$(gettext "Aborting...")"
@ -835,7 +902,7 @@ generate_checksums() {
proto="$(get_protocol "$netfile")"
case $proto in
git*)
git*|svn*)
sum="SKIP"
;;
*)