summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2014-07-01 11:38:44 +0200
committerAllan McRae <allan@archlinux.org>2014-11-17 12:58:06 +1000
commitdb2562113ba014442568f9ba76a0c6a01674fcd4 (patch)
treeafd60c0b108a5680bf81339c8b1c1f48e4f13ba1 /scripts
parentbe3ce88bb21cc62a3788a7aca6322a312f6b87d7 (diff)
downloadpacman-db2562113ba014442568f9ba76a0c6a01674fcd4.tar.xz
makepkg: bzr: update existing sources in srcdir without removing them first.
The local changes are discarded when updating. This matches the behaviour when non-VCS sources are used. It also allows incremental builds. This also changes the checkout during bzr source "extraction" to a heavyweight checkout so that pulling a specific revision does not alter the original download. Original-work-by: Lukáš Jirkovský <l.jirkovsky@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/makepkg.sh.in16
1 files changed, 11 insertions, 5 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index e0cd2e4f..4f35f2d3 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -482,7 +482,7 @@ download_bzr() {
fi
msg2 "$(gettext "Pulling %s ...")" "${displaylocation}"
cd_safe "$dir"
- if ! bzr pull "$url" --overwrite; then
+ if ! bzr pull "$url"; then
# only warn on failure to allow offline builds
warning "$(gettext "Failure while pulling %s")" "${displaylocation}"
fi
@@ -498,10 +498,11 @@ extract_bzr() {
unset fragment
fi
+ rev="last:1"
if [[ -n $fragment ]]; then
case ${fragment%%=*} in
revision)
- revision=("-r" "${fragment#*=}")
+ rev="${fragment#*=}"
displaylocation="$url -r ${fragment#*=}"
;;
*)
@@ -516,10 +517,15 @@ extract_bzr() {
msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "bzr"
pushd "$srcdir" &>/dev/null
- rm -rf "${dir##*/}"
- if ! { bzr checkout "$dir" "${revision[@]}" --lightweight &&
- ( cd "$repo" && bzr pull "$dir" -q --overwrite "${revision[@]}" ); }; then
+ if [[ -d "${dir##*/}" ]]; then
+ cd_safe "${dir##*/}"
+ if ! (bzr pull "$dir" -q --overwrite -r "$rev" && bzr clean-tree -q --detritus --force); then
+ error "$(gettext "Failure while updating working copy of %s %s repo")" "${repo}" "bzr"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+ elif ! bzr checkout "$dir" -r "$rev"; then
error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "bzr"
plain "$(gettext "Aborting...")"
exit 1