aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-04-22 14:50:14 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-04-22 14:50:14 +0000
commit8209c37ee2595093596371a6b3c901604d0b66e4 (patch)
tree48be8c4325b5bb00accd356d8037d24654a73d62
parentfec689907dd15993d73245ce85d27178e786f3b3 (diff)
downloadpaludis-8209c37ee2595093596371a6b3c901604d0b66e4.tar.gz
paludis-8209c37ee2595093596371a6b3c901604d0b66e4.tar.xz
Add bzr syncer. from: arnetheduck, fixes: ticket:514
-rw-r--r--NEWS2
-rw-r--r--paludis/syncers/Makefile.am12
-rw-r--r--paludis/syncers/dobzr.in90
3 files changed, 103 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 4d2ab15..d76312c 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,8 @@ trunk/:
* Extended attributes are now preserved when merging, where supported.
+ * paludis now supports syncing from bzr repositories.
+
0.26.0_pre3:
* reconcilio no longer accepts the --verbose switch; verbose display is
now turned on unconditionally.
diff --git a/paludis/syncers/Makefile.am b/paludis/syncers/Makefile.am
index e54d3b8..33d43f7 100644
--- a/paludis/syncers/Makefile.am
+++ b/paludis/syncers/Makefile.am
@@ -1,5 +1,5 @@
MAINTAINERCLEANFILES = Makefile.in
-CLEANFILES = *~ .keep docvs+ext docvs+pserver docvs+ssh dodarcs+file dodarcs+http dodarcs+https dodarcs+ssh dofile dogit dogit+file dogit+http dogit+https dogit+rsync dogit+ssh dorsync dorsync+ssh dosvn dosvn+file dosvn+http dosvn+https dosvn+ssh dotar+file dotar+ftp dotar+http dotar+https
+CLEANFILES = *~ .keep dobzr dobzr+aftp dobzr+file dobzr+ftp dobzr+http dobzr+https dobzr+sftp dobzr+ssh docvs+ext docvs+pserver docvs+ssh dodarcs+file dodarcs+http dodarcs+https dodarcs+ssh dofile dogit dogit+file dogit+http dogit+https dogit+rsync dogit+ssh dorsync dorsync+ssh dosvn dosvn+file dosvn+http dosvn+https dosvn+ssh dotar+file dotar+ftp dotar+http dotar+https
SUBDIRS = .
.keep :
@@ -8,6 +8,14 @@ SUBDIRS = .
libexecprogdir = $(libexecdir)/paludis/syncers/
libexecprog_SCRIPTS = \
+ dobzr \
+ dobzr+aftp \
+ dobzr+file \
+ dobzr+ftp \
+ dobzr+http \
+ dobzr+https \
+ dobzr+sftp \
+ dobzr+ssh \
docvs+ext \
docvs+pserver \
docvs+ssh \
@@ -52,6 +60,8 @@ check_PROGRAMS = $(TESTS)
AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@
+dobzr dobzr+aftp dobzr+file dobzr+ftp dobzr+http dobzr+https dobzr+sftp dobzr+ssh : dobzr.in
+ cat $? > $@
docvs+ext docvs+pserver docvs+ssh : docvs.in
cat $? > $@
dodarcs+file dodarcs+http dodarcs+https dodarcs+ssh : dodarcs.in
diff --git a/paludis/syncers/dobzr.in b/paludis/syncers/dobzr.in
new file mode 100644
index 0000000..0872a90
--- /dev/null
+++ b/paludis/syncers/dobzr.in
@@ -0,0 +1,90 @@
+#!/bin/bash
+
+source "${PALUDIS_EBUILD_DIR}/echo_functions.bash"
+
+old_set=$-
+set -a
+for f in ${PALUDIS_BASHRC_FILES}; do
+ [[ -f "${f}" ]] && source "${f}"
+done
+[[ "${old_set}" == *a* ]] || set +a
+
+LOCAL=
+REMOTE=
+
+BZR_CHECKOUT_OPTIONS=( )
+BZR_SWITCH_OPTIONS=( )
+
+while [[ $# -gt 0 ]]; do
+ case "${1}" in
+
+ --bzr-checkout-option=*)
+ BZR_CHECKOUT_OPTIONS[${#BZR_CHECKOUT_OPTIONS[@]}]="${1#*=}"
+ ;;
+
+ --bzr-switch-option=*)
+ BZR_SWITCH_OPTIONS[${#BZR_SWITCH_OPTIONS[@]}]="${1#*=}"
+ ;;
+
+ --help)
+ PROTO="${0##*/do}"
+ if [[ "${PROTO}" == bzr ]]; then
+ echo " URL syntax: ${PROTO}://SERVER/PATH"
+ elif [[ "${PROTO}" == bzr+file ]]; then
+ echo " URL syntax: ${PROTO}:///PATH"
+ elif [[ "${PROTO}" == bzr+ssh || "${PROTO}" == bzr+sftp ]]; then
+ echo " URL syntax: ${PROTO}://[USERNAME[:PASSWORD]@]SERVER/PATH"
+ elif [[ "${PROTO}" == bzr+ftp || "${PROTO}" == bzr+aftp ]]; then
+ echo " URL syntax: ${PROTO}://[USERNAME[:PASSWORD]@]SERVER/PATH"
+ elif [[ "${PROTO}" == bzr+http || "${PROTO}" == bzr+https ]]; then
+ echo " URL syntax: ${PROTO}://[USERNAME[:PASSWORD]@]SERVER[:PORT]/PATH"
+ else
+ ewarn "URL syntax for ${PROTO} is unknown. This script will likely not work with the ${PROTO} protocol"
+ fi
+
+ echo " Options:"
+ echo " --bzr-checkout-option=OPTION Pass OPTION to bzr checkout"
+ echo " --bzr-switch-option=OPTION Pass OPTION to bzr switch"
+ exit 0
+ ;;
+
+ --*)
+ ewarn "${0}: unknown option '${1%%=*}'"
+ ;;
+
+ *)
+ if [[ -z "${LOCAL}" ]]; then
+ LOCAL="${1}"
+ elif [[ -z "${REMOTE}" ]]; then
+ REMOTE="${1}"
+ else
+ eerror "${0}: extra argument '${1}'"
+ exit 1
+ fi
+ ;;
+
+ esac
+ shift
+done
+
+if [[ -z "${LOCAL}" ]]; then
+ eerror "${0}: unspecified local repository directory"
+ exit 1
+elif [[ -z "${REMOTE}" ]]; then
+ eerror "${0}: unspecified remote repository URL"
+ exit 1
+fi
+
+[[ "${REMOTE}" != bzr+ssh://* ]] && REMOTE="${REMOTE#bzr+}"
+
+if [[ -d "${LOCAL}" && ! -d "${LOCAL}/.bzr" ]]; then
+ eerror "'${LOCAL}' exists but it is not a Bzr repository"
+ exit 1
+fi
+
+if [[ -d "${LOCAL}/.bzr" ]]; then
+ cd "${LOCAL}" && ${BZR_WRAPPER} bzr switch "${BZR_SWITCH_OPTIONS[@]}" "${REMOTE}"
+else
+ ${BZR_WRAPPER} bzr checkout --lightweight "${BZR_CHECKOUT_OPTIONS[@]}" "${REMOTE}" "${LOCAL}"
+fi
+