aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ali Polatel <polatel@gmail.com> 2009-02-19 17:15:02 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-19 15:25:37 +0000
commit54187e08ebffabe377081e0cd9ff2aff4cd0db58 (patch)
tree5ad33c61cfd098fadd9e69761167608e8bc4312e
parent2036d54b6482a7f1ce65264f210f9987b0e558c1 (diff)
downloadpaludis-54187e08ebffabe377081e0cd9ff2aff4cd0db58.tar.gz
paludis-54187e08ebffabe377081e0cd9ff2aff4cd0db58.tar.xz
Add a fetcher demo that uses curl
-rw-r--r--configure.ac1
-rw-r--r--paludis/fetchers/Makefile.am2
-rw-r--r--paludis/fetchers/demos/Makefile.am22
-rwxr-xr-xpaludis/fetchers/demos/docurl52
4 files changed, 76 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index ce70324..87c8f41 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1540,6 +1540,7 @@ AC_OUTPUT(
paludis/environments/portage/Makefile
paludis/environments/test/Makefile
paludis/fetchers/Makefile
+ paludis/fetchers/demos/Makefile
paludis/repositories/Makefile
paludis/repositories/accounts/Makefile
paludis/repositories/cran/Makefile
diff --git a/paludis/fetchers/Makefile.am b/paludis/fetchers/Makefile.am
index 6995b43..217c88d 100644
--- a/paludis/fetchers/Makefile.am
+++ b/paludis/fetchers/Makefile.am
@@ -1,6 +1,6 @@
MAINTAINERCLEANFILES = Makefile.in
CLEANFILES = *~ dohttp dohttps doftp .keep *.epicfail
-SUBDIRS = .
+SUBDIRS = . demos
.keep :
touch $@
diff --git a/paludis/fetchers/demos/Makefile.am b/paludis/fetchers/demos/Makefile.am
new file mode 100644
index 0000000..9732267
--- /dev/null
+++ b/paludis/fetchers/demos/Makefile.am
@@ -0,0 +1,22 @@
+SUBDIRS = .
+
+DEMOS = \
+ docurl
+
+MAINTAINERCLEANFILES = Makefile.in
+CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda *.loT *.o *.so $(DEMOS) *.epicfail
+
+fetchersdemosdir = $(datadir)/paludis/fetchers/demos/
+fetchersdemos_SCRIPTS = $(DEMOS)
+
+built-sources : $(BUILT_SOURCES)
+ for s in `echo $(SUBDIRS) | tr -d .` ; do $(MAKE) -C $$s built-sources || exit 1 ; done
+
+distcheck-deps-local : $(DISTCHECK_DEPS)
+
+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/fetchers/demos/docurl b/paludis/fetchers/demos/docurl
new file mode 100755
index 0000000..4b736e9
--- /dev/null
+++ b/paludis/fetchers/demos/docurl
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+# vim: set sw=4 sts=4 et :
+
+# Curl fetcher for paludis
+# Create a symbolic link to this file under SHAREDIR/paludis/fetchers/, where
+# SHAREDIR is probably /usr/share, with the name doftp, dohttp or dohttps
+# depending on the protocols you want to use it with.
+# Set EXTRA_CURL in paludis' bashrc for extra options for curl.
+
+export PATH="$(${PALUDIS_EBUILD_DIR}/utils/canonicalise ${PALUDIS_EBUILD_DIR}/utils/ ):${PATH}"
+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
+
+if [[ -n "${PALUDIS_USE_SAFE_RESUME}" ]] ; then
+
+ if [[ -f "${2}.-PARTIAL-" ]] ; then
+ if [[ $(wrapped_getfsize "${2}".-PARTIAL- ) -ge 123456 ]] ; then
+ einfo_unhooked "Attempting resume using ${2}.-PARTIAL-"
+ else
+ einfo_unhooked "Not attempting resume using ${2}.-PARTIAL- (too small)"
+ echo rm -f "${2}".-PARTIAL-
+ rm -f "${2}".-PARTIAL-
+ fi
+ fi
+
+ echo ${CURL_WRAPPER} ${LOCAL_CURL:-curl} ${EXTRA_CURL} --connect-timeout 30 --retry 1 -C - -o "${2}".-PARTIAL- "${1}" 1>&2
+ if ${CURL_WRAPPER} ${LOCAL_CURL:-curl} ${EXTRA_CURL} --connect-timeout 30 --retry 1 -C - -o "${2}".-PARTIAL- "${1}" ; then
+ echo mv -f "${2}".-PARTIAL- "${2}"
+ mv -f "${2}".-PARTIAL- "${2}"
+ exit 0
+ else
+ rm -f "${2}"
+ exit 1
+ fi
+
+else
+ echo ${CURL_WRAPPER} ${LOCAL_CURL:-curl} ${EXTRA_CURL} --connect-timeout 30 --retry 1 -o "${2}" "${1}" 1>&2
+ if ${CURL_WRAPPER} ${LOCAL_CURL:-curl} ${EXTRA_CURL} --connect-timeout 30 --retry 1 -o "${2}" "${1}" ; then
+ exit 0
+ else
+ rm -f "${2}"
+ exit 1
+ fi
+
+fi
+