summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukáš Jirkovský <l.jirkovsky@gmail.com>2013-12-09 21:31:20 +0100
committerAllan McRae <allan@archlinux.org>2014-11-09 08:28:22 +0100
commitf66ae5334eb1b5b816346cc3e69d01cf5e7fe306 (patch)
tree5069589b87b25f23da217564d5077da1c41a2599
parentf6b3c9d8038085a9b8ac2151a0ca3dafd637d3e2 (diff)
downloadpacman-f66ae5334eb1b5b816346cc3e69d01cf5e7fe306.tar.gz
pacman-f66ae5334eb1b5b816346cc3e69d01cf5e7fe306.tar.xz
makepkg: checkout a revision specified in SVN fragment in download_svn.
Previously the sources were dowloaded in HEAD revision in the download_svn(). If a specific revision was requested in fragment, the code was updated to that revision in extract_svn(). However, because SVN is a centralized system, this means that the changed sources has to be downloaded again. By moving the fragment handling to download_svn(), we get the correct revision without having to download it later in extract_svn(). Signed-off-by: Lukáš Jirkovský <l.jirkovsky@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--scripts/makepkg.sh.in43
1 files changed, 15 insertions, 28 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index f5e6227d..af61ee71 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -714,10 +714,23 @@ download_svn() {
fi
url=${url%%#*}
+ local ref=HEAD
+ if [[ -n $fragment ]]; then
+ case ${fragment%%=*} in
+ revision)
+ ref="${fragment##*=}"
+ ;;
+ *)
+ error "$(gettext "Unrecognized reference: %s")" "${fragment}"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ esac
+ fi
+
if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then
msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "svn"
mkdir -p "$dir/.makepkg"
- if ! svn checkout --config-dir "$dir/.makepkg" "$url" "$dir"; then
+ if ! svn checkout -r ${ref} --config-dir "$dir/.makepkg" "$url" "$dir"; then
error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "svn"
plain "$(gettext "Aborting...")"
exit 1
@@ -725,7 +738,7 @@ download_svn() {
elif (( ! HOLDVER )); then
msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "svn"
cd_safe "$dir"
- if ! svn update; then
+ if ! svn update -r ${ref}; then
# only warn on failure to allow offline builds
warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "svn"
fi
@@ -735,11 +748,6 @@ download_svn() {
extract_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")"
@@ -750,29 +758,8 @@ extract_svn() {
pushd "$srcdir" &>/dev/null
rm -rf "${dir##*/}"
- local ref
- if [[ -n $fragment ]]; then
- case ${fragment%%=*} in
- revision)
- ref="${fragment##*=}"
- ;;
- *)
- error "$(gettext "Unrecognized reference: %s")" "${fragment}"
- plain "$(gettext "Aborting...")"
- exit 1
- esac
- fi
-
cp -a "$dir" .
- if [[ -n ${ref} ]]; then
- cd_safe "$(get_filename "$netfile")"
- if ! svn update -r ${ref}; then
- error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "svn"
- plain "$(gettext "Aborting...")"
- fi
- fi
-
popd &>/dev/null
}