[pacman-dev] [PATCH] makepkg: bzr: update existing sources in srcdir without removing them first.
Lukáš Jirkovský
l.jirkovsky at gmail.com
Tue Jul 1 05:38:44 EDT 2014
The local changes are discarded when updating. This matches the behaviour
when non-VCS sources are used. It also allows incremental builds.
This changes semantics a bit. Previously using "bzr revno" would obtain
the revision of the working tree. After this change, it is necessary to use
"bzr revno --tree" to achieve the same result.
The reasoning behind this change is that "bzr pull" that was previously used
actually altered the original clone, making it impossible to freely navigate
through the history when the internet connection wasn't available.
Signed-off-by: Lukáš Jirkovský <l.jirkovsky at gmail.com>
---
scripts/makepkg.sh.in | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 7d3c28b..f0e19ed 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -499,10 +499,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#*=}"
;;
*)
@@ -517,10 +518,16 @@ 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 update -q -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" --lightweight &&
+ ( cd "$repo" && bzr pull "$dir" -q --overwrite -r "$rev" ); }; then
error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "bzr"
plain "$(gettext "Aborting...")"
exit 1
--
2.0.1
More information about the pacman-dev
mailing list