From db2562113ba014442568f9ba76a0c6a01674fcd4 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Tue, 1 Jul 2014 11:38:44 +0200 Subject: makepkg: bzr: update existing sources in srcdir without removing them first. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ý Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 16 +++++++++++----- 1 file 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 -- cgit v1.2.3-70-g09d2