aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-06-11 22:33:20 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-06-11 22:33:20 +0000
commit557c3dd03a88239c90ef6df9602f712fc2ad4891 (patch)
tree12847ad85b57f4120242ef8c3daaff1aac0df626
parent512b20f073a1bee3adf778106a512d2bfe4316ad (diff)
downloadpaludis-557c3dd03a88239c90ef6df9602f712fc2ad4891.tar.gz
paludis-557c3dd03a88239c90ef6df9602f712fc2ad4891.tar.xz
Move fetching things out into wrapper scripts rather than hardcoding wget. Add file:/// URL support.
-rw-r--r--configure.ac1
-rw-r--r--ebuild/Makefile.am2
-rw-r--r--ebuild/builtin_fetch.bash9
-rw-r--r--ebuild/fetchers/Makefile.am27
-rwxr-xr-xebuild/fetchers/dofile6
-rwxr-xr-xebuild/fetchers/dowget.in10
6 files changed, 50 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index bd52e60..d2680fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -394,6 +394,7 @@ AC_OUTPUT(
doc/doxygen.conf
ebuild/Makefile
ebuild/digests/Makefile
+ ebuild/fetchers/Makefile
ebuild/utils/Makefile
ebuild/echo_functions.bash
eselect/Makefile
diff --git a/ebuild/Makefile.am b/ebuild/Makefile.am
index 1aa2692..041af67 100644
--- a/ebuild/Makefile.am
+++ b/ebuild/Makefile.am
@@ -1,6 +1,6 @@
MAINTAINERCLEANFILES = Makefile.in
CLEANFILES = *~
-SUBDIRS = . utils digests
+SUBDIRS = . utils digests fetchers
libexecprogdir = $(libexecdir)/paludis/
diff --git a/ebuild/builtin_fetch.bash b/ebuild/builtin_fetch.bash
index a8b0d34..33a5772 100644
--- a/ebuild/builtin_fetch.bash
+++ b/ebuild/builtin_fetch.bash
@@ -20,7 +20,6 @@
builtin_fetch()
{
local a nofetch unique_aa old_aa
- local LOCAL_WGET=${WGET:-wget}
for a in ${FLAT_SRC_URI} ; do
local aa=${a##*/}
hasq "${aa}" ${unique_aa} || unique_aa="${unique_aa} ${aa}"
@@ -41,9 +40,11 @@ builtin_fetch()
ebuild_section "Need to fetch ${aa}"
old_aa="${aa}"
fi
- echo ${WGET_WRAPPER} ${LOCAL_WGET} ${EXTRA_WGET} -T 30 -t 1 -O "${DISTDIR}/${aa}" "${a}" 1>&2
- if ! ${WGET_WRAPPER} ${LOCAL_WGET} ${EXTRA_WGET} -T 30 -t 1 -O "${DISTDIR}/${aa}" "${a}" ; then
- rm -f "${DISTDIR}/${aa}"
+ prg="${PALUDIS_EBUILD_DIR}/fetchers/do$(echo ${a%%://*} )"
+ if [[ -x "${prg}" ]] ; then
+ ${prg} "${a}" "${DISTDIR}/${aa}"
+ else
+ eerror "Don't know how to fetch '${a}'"
fi
else
if ! [[ "${old_aa}" != "${aa}" ]] ; then
diff --git a/ebuild/fetchers/Makefile.am b/ebuild/fetchers/Makefile.am
new file mode 100644
index 0000000..4b57221
--- /dev/null
+++ b/ebuild/fetchers/Makefile.am
@@ -0,0 +1,27 @@
+MAINTAINERCLEANFILES = Makefile.in
+CLEANFILES = *~ dohttp dohttps doftp
+SUBDIRS = .
+
+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
+
+TESTS =
+EXTRA_DIST = $(libexecprog_SCRIPTS) dowget.in
+
+check_SCRIPTS =
+check_PROGRAMS = $(TESTS)
+
+AM_CXXFLAGS = -I$(top_srcdir)
+
+dohttp dohttps doftp : dowget.in
+ cat $< > $@
diff --git a/ebuild/fetchers/dofile b/ebuild/fetchers/dofile
new file mode 100755
index 0000000..80ecbf2
--- /dev/null
+++ b/ebuild/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/ebuild/fetchers/dowget.in b/ebuild/fetchers/dowget.in
new file mode 100755
index 0000000..a6d8007
--- /dev/null
+++ b/ebuild/fetchers/dowget.in
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+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
+