diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt
index 47f9e88..c0f96c2 100644
--- a/doc/PKGBUILD.5.txt
+++ b/doc/PKGBUILD.5.txt
@@ -405,7 +405,7 @@ Using VCS Sources[[VCS]]
------------------------
Building a developmental version of a package using sources from a version control
system (VCS) is enabled by specifying the source in the form
-`source=('folder::url#fragment')`. Currently makepkg supports the `git`, `hg` and
+`source=('folder::url#fragment')`. Currently makepkg supports the `git`, `hg`, `bzr` and
`svn` protocols.
The source URL is divided into three components:
@@ -433,6 +433,9 @@ The source URL is divided into three components:
*hg*;;
branch, revision, tag
+ *bzr*;;
+ revisionspec (see `bzr help revisionspec` for details)
+
*svn*;;
revision
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index dd4066b..3460824 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -200,7 +200,7 @@ get_filepath() {
local proto="$(get_protocol "$1")"
case $proto in
- git*|hg*|svn*)
+ git*|hg*|svn*|bzr*)
if [[ -d "$startdir/$file" ]]; then
file="$startdir/$file"
elif [[ -d "$SRCDEST/$file" ]]; then
@@ -236,7 +236,7 @@ get_filename() {
local proto=$(get_protocol "$netfile")
case $proto in
- git*|hg*|svn*)
+ git*|hg*|svn*|bzr*)
filename=${netfile##*/}
filename=${filename%%#*}
# fall-through
@@ -572,6 +572,57 @@ download_svn() {
popd &>/dev/null
}
+download_bzr() {
+ local netfile=$1
+
+ local url=$(get_url "$netfile")
+ url=${url##*bzr+}
+ url=${url%%#*}
+
+ local fragment=${netfile##*#}
+ if [[ $fragment = "$netfile" ]]; then
+ unset fragment
+ local revisionspec="-r-1"
+ local displaylocation="$url"
+ else
+ local revisionspec="-r$fragment"
+ local displaylocation="$url -r $fragment"
+ fi
+
+ local dir=$(get_filepath "$netfile")
+ [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
+
+ if [[ ! -d "$dir" ]]; then
+ msg2 "$(gettext "Branching %s ...")" "${displaylocation}"
+ if ! bzr branch "$url" "$dir" $revisionspec --no-tree; then
+ error "$(gettext "Failure while branching %s")" "${displaylocation}"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+ elif (( ! HOLDVER )); then
+ msg2 "$(gettext "Pulling %s ...")" "${displaylocation}"
+ cd_safe "$dir"
+ if ! bzr pull "$url" $revisionspec --overwrite; then
+ # only warn on failure to allow offline builds
+ warning "$(gettext "Failure while pulling %s")" "${displaylocation}"
+ fi
+ fi
+
+ msg2 "$(gettext "Creating working copy of %s %s repo...")" "${dir}" "bzr"
+ pushd "$srcdir" &>/dev/null
+ rm -rf "${dir##*/}"
+
+ if ! bzr checkout "$dir" --lightweight; then
+ error "$(gettext "Failure while creating working copy of %s %s repo")" "${dir}" "bzr"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+
+ cd_safe "${dir##*/}"
+
+ popd &>/dev/null
+}
+
download_sources() {
msg "$(gettext "Retrieving Sources...")"
diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt
index 47f9e88..c0f96c2 100644
--- a/doc/PKGBUILD.5.txt
+++ b/doc/PKGBUILD.5.txt
@@ -405,7 +405,7 @@ Using VCS Sources[[VCS]]
------------------------
Building a developmental version of a package using sources from a version control
system (VCS) is enabled by specifying the source in the form
-`source=('folder::url#fragment')`. Currently makepkg supports the `git`, `hg` and
+`source=('folder::url#fragment')`. Currently makepkg supports the `git`, `hg`, `bzr` and
`svn` protocols.
The source URL is divided into three components:
@@ -433,6 +433,9 @@ The source URL is divided into three components:
*hg*;;
branch, revision, tag
+ *bzr*;;
+ revisionspec (see `bzr help revisionspec` for details)
+
*svn*;;
revision
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index dd4066b..3460824 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -200,7 +200,7 @@ get_filepath() {
local proto="$(get_protocol "$1")"
case $proto in
- git*|hg*|svn*)
+ git*|hg*|svn*|bzr*)
if [[ -d "$startdir/$file" ]]; then
file="$startdir/$file"
elif [[ -d "$SRCDEST/$file" ]]; then
@@ -236,7 +236,7 @@ get_filename() {
local proto=$(get_protocol "$netfile")
case $proto in
- git*|hg*|svn*)
+ git*|hg*|svn*|bzr*)
filename=${netfile##*/}
filename=${filename%%#*}
# fall-through
@@ -572,6 +572,57 @@ download_svn() {
popd &>/dev/null
}
+download_bzr() {
+ local netfile=$1
+
+ local url=$(get_url "$netfile")
+ url=${url##*bzr+}
+ url=${url%%#*}
+
+ local fragment=${netfile##*#}
+ if [[ $fragment = "$netfile" ]]; then
+ unset fragment
+ local revisionspec="-r-1"
+ local displaylocation="$url"
+ else
+ local revisionspec="-r$fragment"
+ local displaylocation="$url -r $fragment"
+ fi
+
+ local dir=$(get_filepath "$netfile")
+ [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
+
+ if [[ ! -d "$dir" ]]; then
+ msg2 "$(gettext "Branching %s ...")" "${displaylocation}"
+ if ! bzr branch "$url" "$dir" $revisionspec --no-tree; then
+ error "$(gettext "Failure while branching %s")" "${displaylocation}"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+ elif (( ! HOLDVER )); then
+ msg2 "$(gettext "Pulling %s ...")" "${displaylocation}"
+ cd_safe "$dir"
+ if ! bzr pull "$url" $revisionspec --overwrite; then
+ # only warn on failure to allow offline builds
+ warning "$(gettext "Failure while pulling %s")" "${displaylocation}"
+ fi
+ fi
+
+ msg2 "$(gettext "Creating working copy of %s %s repo...")" "${dir}" "bzr"
+ pushd "$srcdir" &>/dev/null
+ rm -rf "${dir##*/}"
+
+ if ! bzr checkout "$dir" --lightweight; then
+ error "$(gettext "Failure while creating working copy of %s %s repo")" "${dir}" "bzr"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+
+ cd_safe "${dir##*/}"
+
+ popd &>/dev/null
+}
+
download_sources() {
msg "$(gettext "Retrieving Sources...")"
case $proto in
- git*|hg*|svn*)
+ git*|hg*|svn*|bzr*)
sum="SKIP"
;;
*)
--
1.7.11.4
08-16-2012, 03:38 AM
Allan McRae
makepkg: Bazaar VCS support.
On 13/08/12 17:27, Gary van der Merwe wrote:
> This patch adds Bazaar VCS support to makepkg.
>
> Fragments can be any bzr revision spec. eg:
>
> http://example.com/project/#revno:62
>
> or just
>
> http://example.com/project/#62
>
> For more info, see `bzr help revisionspec`.
All the current VCS use the format url#<what>=<value>. From your
patch, it seems that bzr has only one thing for "<what>", but we should
stick to that syntax anyway - much like SVN that only supports revision.
Maybe I should make the fragment syntax clearer in the man page.
Anyway, reading document for bzr, would using:
url#revision=revno:3:/path/to/branch
be suitable? From what I can see "revision" is used to describe the
parameter "e.g. --revision in bzr branch", so that should hopefully not
be too confusing (and all confusion might be due to my lack of bzr
knowledge).
> Writing a pkgver func is easy with `bzr version-info`, eg:
>
> pkgver() {
> cd $srcdir/$pkgname
> bzr version-info --custom --template="{revno}
"
> }
>
> ---
> doc/PKGBUILD.5.txt | 5 ++++-
> scripts/makepkg.sh.in | 60 ++++++++++++++++++++++++++++++++++++++++++++++++---
> 2 files changed, 61 insertions(+), 4 deletions(-)
>
> diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt
> index 47f9e88..c0f96c2 100644
> --- a/doc/PKGBUILD.5.txt
> +++ b/doc/PKGBUILD.5.txt
> @@ -405,7 +405,7 @@ Using VCS Sources[[VCS]]
> ------------------------
> Building a developmental version of a package using sources from a version control
> system (VCS) is enabled by specifying the source in the form
> -`source=('folder::url#fragment')`. Currently makepkg supports the `git`, `hg` and
> +`source=('folder::url#fragment')`. Currently makepkg supports the `git`, `hg`, `bzr` and
> `svn` protocols.
>
> The source URL is divided into three components:
> @@ -433,6 +433,9 @@ The source URL is divided into three components:
> *hg*;;
> branch, revision, tag
>
> + *bzr*;;
> + revisionspec (see `bzr help revisionspec` for details)
> +
> *svn*;;
> revision
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index dd4066b..3460824 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -200,7 +200,7 @@ get_filepath() {
> local proto="$(get_protocol "$1")"
>
> case $proto in
> - git*|hg*|svn*)
> + git*|hg*|svn*|bzr*)
> if [[ -d "$startdir/$file" ]]; then
> file="$startdir/$file"
> elif [[ -d "$SRCDEST/$file" ]]; then
> @@ -236,7 +236,7 @@ get_filename() {
> local proto=$(get_protocol "$netfile")
>
> case $proto in
> - git*|hg*|svn*)
> + git*|hg*|svn*|bzr*)
> filename=${netfile##*/}
> filename=${filename%%#*}
> # fall-through
> @@ -572,6 +572,57 @@ download_svn() {
> popd &>/dev/null
> }
>
> +download_bzr() {
> + local netfile=$1
> +
> + local url=$(get_url "$netfile")
> + url=${url##*bzr+}
> + url=${url%%#*}
> +
> + local fragment=${netfile##*#}
> + if [[ $fragment = "$netfile" ]]; then
> + unset fragment
> + local revisionspec="-r-1"
> + local displaylocation="$url"
> + else
> + local revisionspec="-r$fragment"
> + local displaylocation="$url -r $fragment"
> + fi
> +
> + local dir=$(get_filepath "$netfile")
> + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
> +
> + if [[ ! -d "$dir" ]]; then
Add check if directory is there but empty - recent patch by Mohammad
Alsaleh for git on this list.
> + msg2 "$(gettext "Branching %s ...")" "${displaylocation}"
> + if ! bzr branch "$url" "$dir" $revisionspec --no-tree; then
All other VCS functions do a full checkout here and do the checkout of
the revision when creating the working branch. With that, you can get
rid of the $displaylocation variable.