tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
FETCH_PROXY
I often need to download distfiles over proxy and I either use
http_proxy/https_proxy environment variables or specify a custom
fetch command. The latter has a downside that your fetch command
won't get automatically updated by pkgsrc. The former is less
robust because you may accidentally unset http_proxy and the fetch
command may try connecting directly.
Attached patch introduces the FETCH_PROXY variable. All fetch tools
support http/https proxies, curl also supports socks protocol.
There is no support for ftp currently.
ok to commit?
Alex
Index: mk/fetch/fetch.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/fetch/fetch.mk,v
retrieving revision 1.69
diff -p -u -u -r1.69 fetch.mk
--- mk/fetch/fetch.mk 1 Aug 2017 13:15:32 -0000 1.69
+++ mk/fetch/fetch.mk 6 Jan 2018 19:21:59 -0000
@@ -197,6 +197,10 @@ fetch-check-interactive: .USEBEFORE
# connections after the given amount of seconds.
# The specific behavior depends on the command used.
#
+# FETCH_PROXY, if defined, will cause the fetch command to connect over
+# the specified proxy.
+# The specific behavior depends on the command used.
+#
# FETCH_USE_IPV4_ONLY, if defined, will cause the fetch command to force
# connecting to only IPv4 addresses.
#
@@ -208,14 +212,20 @@ _FETCH_BEFORE_ARGS.ftp= ${PASSIVE_FETCH
_FETCH_AFTER_ARGS.ftp= # empty
_FETCH_RESUME_ARGS.ftp= -R
_FETCH_OUTPUT_ARGS.ftp= -o
-_FETCH_CMD.ftp= ${TOOLS_PATH.ftp}
+_FETCH_CMD.ftp= ${PKGSRC_SETENV} \
+ ${FETCH_PROXY:Dhttp_proxy=${FETCH_PROXY:Q}} \
+ ${FETCH_PROXY:Dhttps_proxy=${FETCH_PROXY:Q}} \
+ ${TOOLS_PATH.ftp}
_FETCH_BEFORE_ARGS.fetch= ${FETCH_TIMEOUT:D-T ${FETCH_TIMEOUT}} \
${FETCH_USE_IPV4_ONLY:D-4}
_FETCH_AFTER_ARGS.fetch= # empty
_FETCH_RESUME_ARGS.fetch= -r
_FETCH_OUTPUT_ARGS.fetch= -o
-_FETCH_CMD.fetch= ${TOOLS_PATH.fetch}
+_FETCH_CMD.fetch= ${PKGSRC_SETENV} \
+ ${FETCH_PROXY:Dhttp_proxy=${FETCH_PROXY:Q}} \
+ ${FETCH_PROXY:Dhttps_proxy=${FETCH_PROXY:Q}} \
+ ${TOOLS_PATH.fetch}
_FETCH_BEFORE_ARGS.wget= ${PASSIVE_FETCH:D--passive-ftp} \
--no-check-certificate \
@@ -224,12 +234,16 @@ _FETCH_BEFORE_ARGS.wget= ${PASSIVE_FETCH
_FETCH_AFTER_ARGS.wget= # empty
_FETCH_RESUME_ARGS.wget= -c
_FETCH_OUTPUT_ARGS.wget= -O
-_FETCH_CMD.wget= ${TOOLS_PATH.wget}
+_FETCH_CMD.wget= ${PKGSRC_SETENV} \
+ ${FETCH_PROXY:Dhttp_proxy=${FETCH_PROXY:Q}} \
+ ${FETCH_PROXY:Dhttps_proxy=${FETCH_PROXY:Q}} \
+ ${TOOLS_PATH.wget}
_FETCH_BEFORE_ARGS.curl= ${PASSIVE_FETCH:D--ftp-pasv} \
--fail --insecure --location --remote-time \
${FETCH_TIMEOUT:D--connect-timeout ${FETCH_TIMEOUT}} \
${FETCH_TIMEOUT:D--speed-time ${FETCH_TIMEOUT}} \
+ ${FETCH_PROXY:D--proxy ${FETCH_PROXY:Q}} \
${FETCH_USE_IPV4_ONLY:D--ipv4}
_FETCH_AFTER_ARGS.curl= -O # must be here to honor -o option
_FETCH_RESUME_ARGS.curl= -C -
Home |
Main Index |
Thread Index |
Old Index