aboutsummaryrefslogtreecommitdiff
path: root/ebuild/syncers
diff options
context:
space:
mode:
Diffstat (limited to 'ebuild/syncers')
-rw-r--r--ebuild/syncers/Makefile.am55
-rw-r--r--ebuild/syncers/docvs.in25
-rw-r--r--ebuild/syncers/dodarcs.in24
-rw-r--r--ebuild/syncers/dogit.in19
-rw-r--r--ebuild/syncers/dorsync.in18
-rw-r--r--ebuild/syncers/dosvn.in10
6 files changed, 151 insertions, 0 deletions
diff --git a/ebuild/syncers/Makefile.am b/ebuild/syncers/Makefile.am
new file mode 100644
index 0000000..591c133
--- /dev/null
+++ b/ebuild/syncers/Makefile.am
@@ -0,0 +1,55 @@
+MAINTAINERCLEANFILES = Makefile.in
+CLEANFILES = *~ .keep docvs+ext docvs+pserver docvs+ssh dodarcs+http dodarcs+ssh dofile dogit dogit+http dogit+ssh dorsync dosvn dosvn+http dosvn+https dosvn+ssh
+SUBDIRS = .
+
+.keep :
+ touch $@
+
+libexecprogdir = $(libexecdir)/paludis/syncers/
+
+libexecprog_SCRIPTS = \
+ docvs+ext \
+ docvs+pserver \
+ docvs+ssh \
+ dodarcs+http \
+ dodarcs+ssh \
+ dofile \
+ dogit \
+ dogit+http \
+ dogit+ssh \
+ dorsync \
+ dosvn \
+ dosvn+http \
+ dosvn+https \
+ dosvn+ssh
+
+TESTS_ENVIRONMENT = env \
+ PALUDIS_EBUILD_DIR="$(srcdir)/paludis/syncers/" \
+ TEST_SCRIPT_DIR="$(srcdir)/" \
+ bash $(top_srcdir)/test/run_test.sh
+
+installusersyncersdir = $(datadir)/paludis/syncers
+installusersyncers_DATA = .keep
+
+TESTS =
+EXTRA_DIST = $(libexecprog_SCRIPTS) docvs.in dodarcs.in dogit.in dorsync.in dosvn.in
+
+check_SCRIPTS =
+check_PROGRAMS = $(TESTS)
+
+AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@
+
+docvs+ext docvs+pserver docvs+ssh : docvs.in
+ cat $? > $@
+dodarcs+http dodarcs+ssh : dodarcs.in
+ cat $? > $@
+dogit dogit+http dogit+ssh : dogit.in
+ cat $? > $@
+dofile dorsync : dorsync.in
+ cat $? > $@
+dosvn dosvn+http dosvn+https dosvn+ssh : dosvn.in
+ cat $? > $@
+
+built-sources : $(BUILT_SOURCES)
+ for s in `echo $(SUBDIRS) | tr -d .` ; do $(MAKE) -C $$s built-sources || exit 1 ; done
+
diff --git a/ebuild/syncers/docvs.in b/ebuild/syncers/docvs.in
new file mode 100644
index 0000000..2562e60
--- /dev/null
+++ b/ebuild/syncers/docvs.in
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+LOCAL="$1"
+REMOTE="$2"
+
+if [[ "${REMOTE}" == cvs+pserver* ]]; then
+ PSERVER=true
+ REMOTE=":pserver:${REMOTE:14}"
+elif [[ "${REMOTE}" == cvs+ssh* || "${REMOTE}" == cvs+ext* ]]; then
+ PSERVER=false
+ REMOTE=":ext:${REMOTE:10}"
+fi
+
+MODULE="${REMOTE##*:}"
+if [[ "${MODULE}" == "${REMOTE}" ]]; then
+ source "${PALUDIS_EBUILD_DIR}/echo_functions.bash"
+ eerror "'${REMOTE}' is not a valid URL for a CVS repository"
+ exit 1
+fi
+REMOTE="${REMOTE%:*}"
+
+[[ ! -d "${LOCAL}" ]] && mkdir -p "${LOCAL}"
+cd "${LOCAL}" && ( ! ${PSERVER} || cvs -d "${REMOTE}" login ) &&
+ cvs -d "${REMOTE}" checkout "${MODULE}"
+
diff --git a/ebuild/syncers/dodarcs.in b/ebuild/syncers/dodarcs.in
new file mode 100644
index 0000000..15e0b88
--- /dev/null
+++ b/ebuild/syncers/dodarcs.in
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+LOCAL="$1"
+REMOTE="$2"
+
+if [[ "${REMOTE}" == darcs+ssh* ]]; then
+ REMOTE="${REMOTE:12}"
+elif [[ "${REMOTE}" == darcs+* ]]; then
+ REMOTE="${REMOTE:6}"
+fi
+
+if [[ -d "${LOCAL}" && ! -d "${LOCAL}/_darcs" ]]; then
+ source "${PALUDIS_EBUILD_DIR}/echo_functions.bash"
+ eerror "'${LOCAL}' exists but it is not a Darcs repository"
+ exit 1
+fi
+
+if [[ -d "${LOCAL}/_darcs" ]]; then
+ cd "${LOCAL}" && darcs pull --all --set-scripts-executable "${REMOTE}"
+else
+ darcs get --partial --set-scripts-executable --repo-name="${LOCAL}" \
+ "${REMOTE}"
+fi
+
diff --git a/ebuild/syncers/dogit.in b/ebuild/syncers/dogit.in
new file mode 100644
index 0000000..9ee055d
--- /dev/null
+++ b/ebuild/syncers/dogit.in
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+LOCAL="$1"
+REMOTE="$2"
+
+[[ "${REMOTE}" == git+http* ]] && REMOTE="${REMOTE:4}"
+
+if [[ -d "${LOCAL}" && ! -d "${LOCAL}/.git" ]]; then
+ source "${PALUDIS_EBUILD_DIR}/echo_functions.bash"
+ eerror "'${LOCAL}' exists but it is not a Git repository"
+ exit 1
+fi
+
+if [[ -d "${LOCAL}/.git" ]]; then
+ cd "${LOCAL}" && git pull
+else
+ git clone "${REMOTE}" "${LOCAL}"
+fi
+
diff --git a/ebuild/syncers/dorsync.in b/ebuild/syncers/dorsync.in
new file mode 100644
index 0000000..f0ee64d
--- /dev/null
+++ b/ebuild/syncers/dorsync.in
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+LOCAL="$1"
+REMOTE="$2"
+
+[[ "${REMOTE}" == file* ]] && REMOTE="${REMOTE:7}"
+
+if [[ -n "${PALUDIS_SYNC_EXCLUDE_FROM}" ]]; then
+ EXCLUDE=( --exclude-from "${PALUDIS_SYNC_EXCLUDE_FROM}" )
+else
+ EXCLUDE=( )
+fi
+
+rsync --recursive --links --safe-links --perms --times --compress --force \
+ --whole-file --delete --delete-after --stats --timeout=180 \
+ --exclude=/distfiles --exclude=/packages --exclude=/local \
+ --exclude=/.cache --progress "${EXCLUDE[@]}" "${REMOTE}" "${LOCAL}/"
+
diff --git a/ebuild/syncers/dosvn.in b/ebuild/syncers/dosvn.in
new file mode 100644
index 0000000..a5484ad
--- /dev/null
+++ b/ebuild/syncers/dosvn.in
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+LOCAL="$1"
+REMOTE="$2"
+
+[[ "${REMOTE}" == svn+http* || "${REMOTE}" == svn+https* ]] &&
+ REMOTE="${REMOTE:4}"
+
+svn checkout "${REMOTE}" "${LOCAL}/"
+