summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Gauduin <alucryd@gmail.com>2013-04-10 18:54:02 +0200
committerAllan McRae <allan@archlinux.org>2013-04-11 10:56:50 +1000
commit2bf2700b744392ab3fb4e5295e3a2619b1ddfe28 (patch)
treeaab38714466229c107252186b55e5cc4dae6e375
parentb7c994db8b049b87df5ec5d6cada84a36c60c47d (diff)
Add support for all bzr URLs in the PKGBUILD source array
Add support for all bzr URLs, including "lp:" URLs, in the source array. This, however, requires an internet connection and will fall back to the current behavior for offline builds. In that case, only the URL reported by 'bzr config parent_location' run inside the local repo can be used, and is outputted. Signed-off-by: Maxime Gauduin <alucryd@gmail.com>
-rw-r--r--scripts/makepkg.sh.in25
1 files changed, 21 insertions, 4 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index c2f89c97..67ee22a6 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -245,6 +245,9 @@ get_filename() {
filename=${netfile%%#*}
filename=${filename%/}
filename=${filename##*/}
+ if [[ $proto = bzr* ]]; then
+ filename=${filename#*lp:}
+ fi
if [[ $proto = git* ]]; then
filename=${filename%%.git*}
fi
@@ -269,6 +272,9 @@ get_protocol() {
# strip leading filename
local proto="${1##*::}"
printf "%s\n" "${proto%%://*}"
+ elif [[ $1 = *lp:* ]]; then
+ local proto="${1##*::}"
+ printf "%s\n" "${proto%%lp:*}"
else
printf "%s\n" local
fi
@@ -471,10 +477,21 @@ download_bzr() {
fi
elif (( ! HOLDVER )); then
# Make sure we are fetching the right repo
- if [[ "$url" != "$(bzr config parent_location -d $dir)" ]] ; then
- error "$(gettext "%s is not a branch of %s")" "$dir" "$url"
- plain "$(gettext "Aborting...")"
- exit 1
+ local distant_url="$(bzr info $url 2> /dev/null | sed -n '/branch root/{s/ branch root: //p;q;}')"
+ local local_url="$(bzr config parent_location -d $dir)"
+ if [[ -n $distant_url ]]; then
+ if [[ $distant_url != "$local_url" ]]; then
+ error "$(gettext "%s is not a branch of %s")" "$dir" "$url"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+ else
+ if [[ $url != "$local_url" ]] ; then
+ error "$(gettext "%s is not a branch of %s")" "$dir" "$url"
+ error "$(gettext "The local URL is %s")" "$local_url"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
fi
msg2 "$(gettext "Pulling %s ...")" "${displaylocation}"
cd_safe "$dir"