[paludis-commits] r4601 - in trunk: . paludis/syncers

dleverton at svn.pioto.org dleverton at svn.pioto.org
Tue Apr 22 14:50:14 UTC 2008


Author: dleverton
Date: 2008-04-22 14:50:14 +0000 (Tue, 22 Apr 2008)
New Revision: 4601

Added:
   trunk/paludis/syncers/dobzr.in
Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/paludis/syncers/Makefile.am
Log:
Add bzr syncer.  from: arnetheduck, fixes: ticket:514


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-04-22 13:10:57 UTC (rev 4600)
+++ trunk/ChangeLog	2008-04-22 14:50:14 UTC (rev 4601)
@@ -5,6 +5,12 @@
 only listed in SVN log. For a summary of what has changed between releases,
 see the NEWS file. This file is occasionally pruned to ChangeLog.old.bz2.
 
+2008-04-22 Jacek Sieka
+
+	* paludis/syncers/: Add bzr syncer.
+
+	+ Fixes: ticket:514
+
 2008-04-22 Ciaran McCreesh
 
 	* paludis/: Preserve extended attributes on merge, where supported.

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2008-04-22 13:10:57 UTC (rev 4600)
+++ trunk/NEWS	2008-04-22 14:50:14 UTC (rev 4601)
@@ -14,6 +14,8 @@
 
     * 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.

Modified: trunk/paludis/syncers/Makefile.am
===================================================================
--- trunk/paludis/syncers/Makefile.am	2008-04-22 13:10:57 UTC (rev 4600)
+++ trunk/paludis/syncers/Makefile.am	2008-04-22 14:50:14 UTC (rev 4601)
@@ -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 @@
 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 @@
 
 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

Added: trunk/paludis/syncers/dobzr.in
===================================================================
--- trunk/paludis/syncers/dobzr.in	                        (rev 0)
+++ trunk/paludis/syncers/dobzr.in	2008-04-22 14:50:14 UTC (rev 4601)
@@ -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
+



More information about the paludis-commits mailing list