makepkg: fixup broken revision and repo references

bzr support "worked", but didn't handle any of the actual features we
wanted with makepkg. This moves the revision specification to the proper
place (extraction, rather than download), and fixes an additional broken
reference to $repo which was never set.

Fixes FS#35281.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Dave Reisner 2013-05-15 09:58:42 -04:00 committed by Allan McRae
parent a4a7336dff
commit 72c6d19d64
1 changed files with 18 additions and 18 deletions

View File

@ -448,29 +448,14 @@ download_bzr() {
url=${url%%#*} url=${url%%#*}
local repo=$(get_filename "$netfile") local repo=$(get_filename "$netfile")
local displaylocation="$url" local displaylocation="$url"
local revision=('-r-1')
if [[ -n $fragment ]]; then
case ${fragment%%=*} in
revision)
revision=("-r${fragment##*=}")
displaylocation="$url -r ${fragment##*=}"
;;
*)
error "$(gettext "Unrecognized reference: %s")" "${fragment}"
plain "$(gettext "Aborting...")"
exit 1
esac
fi
local dir=$(get_filepath "$netfile") local dir=$(get_filepath "$netfile")
[[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then
msg2 "$(gettext "Branching %s ...")" "${displaylocation}" msg2 "$(gettext "Branching %s ...")" "${displaylocation}"
if ! bzr branch "$url" "$dir" ${revision[@]} --no-tree --use-existing-dir; then if ! bzr branch "$url" "$dir" --no-tree --use-existing-dir; then
error "$(gettext "Failure while branching %s")" "${displaylocation}" error "$(gettext "Failure while branching %s")" "${displaylocation}"
plain "$(gettext "Aborting...")" plain "$(gettext "Aborting...")"
exit 1 exit 1
@ -495,7 +480,7 @@ download_bzr() {
fi fi
msg2 "$(gettext "Pulling %s ...")" "${displaylocation}" msg2 "$(gettext "Pulling %s ...")" "${displaylocation}"
cd_safe "$dir" cd_safe "$dir"
if ! bzr pull "$url" ${revision[@]} --overwrite; then if ! bzr pull "$url" --overwrite; then
# only warn on failure to allow offline builds # only warn on failure to allow offline builds
warning "$(gettext "Failure while pulling %s")" "${displaylocation}" warning "$(gettext "Failure while pulling %s")" "${displaylocation}"
fi fi
@ -505,11 +490,25 @@ download_bzr() {
extract_bzr() { extract_bzr() {
local netfile=$1 local netfile=$1
local repo=$(get_filename "$netfile")
local fragment=${netfile#*#} local fragment=${netfile#*#}
if [[ $fragment = "$netfile" ]]; then if [[ $fragment = "$netfile" ]]; then
unset fragment unset fragment
fi fi
if [[ -n $fragment ]]; then
case ${fragment%%=*} in
revision)
revision=("-r" "${fragment#*=}")
displaylocation="$url -r ${fragment#*=}"
;;
*)
error "$(gettext "Unrecognized reference: %s")" "${fragment}"
plain "$(gettext "Aborting...")"
exit 1
esac
fi
local dir=$(get_filepath "$netfile") local dir=$(get_filepath "$netfile")
[[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
@ -517,7 +516,8 @@ extract_bzr() {
pushd "$srcdir" &>/dev/null pushd "$srcdir" &>/dev/null
rm -rf "${dir##*/}" rm -rf "${dir##*/}"
if ! bzr checkout "$dir" --lightweight; then if ! { bzr checkout "$dir" "${revision[@]}" --lightweight &&
( cd "$repo" && bzr pull "$dir" -q --overwrite "${revision[@]}" ); }; then
error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "bzr" error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "bzr"
plain "$(gettext "Aborting...")" plain "$(gettext "Aborting...")"
exit 1 exit 1