aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-03 11:36:57 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-03 11:36:57 +0000
commit396988536407ff9e99137eb65652753a8011dbe7 (patch)
tree56a38d886fb6d499189ce735143b367b3a69b1e2
parenta67c4aa51393832cd8f15aae6e696f0bfb4af580 (diff)
downloadpaludis-396988536407ff9e99137eb65652753a8011dbe7.tar.gz
paludis-396988536407ff9e99137eb65652753a8011dbe7.tar.xz
Add a dummy syncer, for testing
-rw-r--r--paludis/syncers/Makefile.am4
-rw-r--r--paludis/syncers/dodummy68
2 files changed, 71 insertions, 1 deletions
diff --git a/paludis/syncers/Makefile.am b/paludis/syncers/Makefile.am
index e1850bf..85627d2 100644
--- a/paludis/syncers/Makefile.am
+++ b/paludis/syncers/Makefile.am
@@ -24,7 +24,8 @@ libexecprog_SCRIPTS = \
dosvn+ssh \
dotar+file \
dotar+ftp \
- dotar+http
+ dotar+http \
+ dodummy
TESTS_ENVIRONMENT = env \
PALUDIS_EBUILD_DIR="$(srcdir)/paludis/syncers/" \
@@ -66,3 +67,4 @@ distcheck-deps : distcheck-deps-subdirs
distcheck-deps-subdirs :
for s in $(SUBDIRS) . ; do if test x$$s = x. ; then $(MAKE) distcheck-deps-local || exit 1 ; \
else $(MAKE) -C $$s distcheck-deps || exit 1 ; fi ; done
+
diff --git a/paludis/syncers/dodummy b/paludis/syncers/dodummy
new file mode 100644
index 0000000..602783f
--- /dev/null
+++ b/paludis/syncers/dodummy
@@ -0,0 +1,68 @@
+#!/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=
+
+delay=0
+
+while [[ $# -gt 0 ]]; do
+ case "${1}" in
+
+ --help)
+ PROTO="${0##*/do}"
+ echo " URL syntax: dummy://whatever/"
+ echo " Options:"
+ echo " --count-to=n Delay noisily for n seconds"
+ echo " Notes:"
+ echo " This syncer creates a single timestamp file in the target directory. It"
+ echo " has no practical purpose, but it can be useful for testing."
+ exit 0
+ ;;
+
+ --delay=*)
+ delay="${1#*=}"
+ ;;
+
+ --*)
+ 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
+
+for (( x = 1 ; x <= ${delay} ; ++x )) ; do
+ echo "${REMOTE} -> ${LOCAL}: delaying for ${x} of ${delay}"
+ sleep 1
+done
+
+date +'%s' > ${LOCAL}/timestamp
+