aboutsummaryrefslogtreecommitdiff
path: root/paludis/fetchers
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/fetchers')
-rw-r--r--paludis/fetchers/Makefile.am37
-rwxr-xr-xpaludis/fetchers/dofile6
-rwxr-xr-xpaludis/fetchers/dowget.in54
3 files changed, 97 insertions, 0 deletions
diff --git a/paludis/fetchers/Makefile.am b/paludis/fetchers/Makefile.am
new file mode 100644
index 000000000..37e646344
--- /dev/null
+++ b/paludis/fetchers/Makefile.am
@@ -0,0 +1,37 @@
+MAINTAINERCLEANFILES = Makefile.in
+CLEANFILES = *~ dohttp dohttps doftp .keep
+SUBDIRS = .
+
+.keep :
+ touch $@
+
+libexecprogdir = $(libexecdir)/paludis/fetchers/
+
+libexecprog_SCRIPTS = \
+ dohttp \
+ dohttps \
+ doftp \
+ dofile
+
+TESTS_ENVIRONMENT = env \
+ PALUDIS_EBUILD_DIR="$(srcdir)/ebuild/" \
+ TEST_SCRIPT_DIR="$(srcdir)/" \
+ bash $(top_srcdir)/test/run_test.sh
+
+installuserfetchersdir = $(datadir)/paludis/fetchers
+installuserfetchers_DATA = .keep
+
+TESTS =
+EXTRA_DIST = $(libexecprog_SCRIPTS) dowget.in
+
+check_SCRIPTS =
+check_PROGRAMS = $(TESTS)
+
+AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@
+
+dohttp dohttps doftp : dowget.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/paludis/fetchers/dofile b/paludis/fetchers/dofile
new file mode 100755
index 000000000..fd3e54bf5
--- /dev/null
+++ b/paludis/fetchers/dofile
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+shopt -s extglob
+echo cp "/${1##file:+(/)}" "${2}" 1>&2
+cp "/${1##file:+(/)}" "${2}"
+
diff --git a/paludis/fetchers/dowget.in b/paludis/fetchers/dowget.in
new file mode 100755
index 000000000..41e645ab1
--- /dev/null
+++ b/paludis/fetchers/dowget.in
@@ -0,0 +1,54 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+# Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+#
+# This file is part of the Paludis package manager. Paludis is free software;
+# you can redistribute it and/or modify it under the terms of the GNU General
+# Public License, version 2, as published by the Free Software Foundation.
+#
+# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+export PATH="$(${PALUDIS_EBUILD_DIR}/utils/canonicalise ${PALUDIS_EBUILD_DIR}/utils/ ):${PATH}"
+source ${PALUDIS_EBUILD_DIR}/echo_functions.bash
+
+if [[ -n "${PALUDIS_USE_SAFE_RESUME}" ]] ; then
+
+ if [[ -f "${2}.-PARTIAL-" ]] ; then
+ if [[ $(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 ${WGET_WRAPPER} ${LOCAL_WGET:-wget} ${EXTRA_WGET} -T 30 -t 1 --continue -O "${2}".-PARTIAL- "${1}" 1>&2
+ if ${WGET_WRAPPER} ${LOCAL_WGET:-wget} ${EXTRA_WGET} -T 30 -t 1 --continue -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 ${WGET_WRAPPER} ${LOCAL_WGET:-wget} ${EXTRA_WGET} -T 30 -t 1 -O "${2}" "${1}" 1>&2
+ if ${WGET_WRAPPER} ${LOCAL_WGET:-wget} ${EXTRA_WGET} -T 30 -t 1 -O "${2}" "${1}" ; then
+ exit 0
+ else
+ rm -f "${2}"
+ exit 1
+ fi
+
+fi
+