summaryrefslogtreecommitdiff
path: root/mk/fetch
diff options
context:
space:
mode:
authorjoerg <joerg>2015-09-08 12:37:56 +0000
committerjoerg <joerg>2015-09-08 12:37:56 +0000
commit393ad636a0fdbdfebc84acecec552dbcc14b560d (patch)
tree145ee12d3a5a37b94b76503391e73e8f5df5553b /mk/fetch
parentcccbe0a395a76e5e7951d41323fdd7a884615178 (diff)
downloadpkgsrc-393ad636a0fdbdfebc84acecec552dbcc14b560d.tar.gz
Make the post-fetch hook a bit more useful by also handing down the URL
the file was obtained from. This makes it easier to skip any local mirrors.
Diffstat (limited to 'mk/fetch')
-rw-r--r--mk/fetch/bsd.fetch-vars.mk5
-rwxr-xr-xmk/fetch/fetch9
2 files changed, 8 insertions, 6 deletions
diff --git a/mk/fetch/bsd.fetch-vars.mk b/mk/fetch/bsd.fetch-vars.mk
index 61dcdb574c7..0239e2579bf 100644
--- a/mk/fetch/bsd.fetch-vars.mk
+++ b/mk/fetch/bsd.fetch-vars.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.fetch-vars.mk,v 1.20 2015/09/08 11:13:12 joerg Exp $
+# $NetBSD: bsd.fetch-vars.mk,v 1.21 2015/09/08 12:37:56 joerg Exp $
#
# This Makefile fragment is included separately by bsd.pkg.mk and
# defines some variables which must be defined earlier than where
@@ -14,7 +14,8 @@
# No files will ever be created in these directories.
#
# POST_FETCH_HOOK is a program to execute after fetch successfully
-# obtained a file. It is called with the path as argument.
+# obtained a file. It is called with the relative path of the distfile
+# in ${DISTDIR} and the full URL it was obtained from.
#
# The following variables may be set in a package Makefile:
#
diff --git a/mk/fetch/fetch b/mk/fetch/fetch
index b4fe25a64d6..00cf4828293 100755
--- a/mk/fetch/fetch
+++ b/mk/fetch/fetch
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: fetch,v 1.16 2015/09/08 11:13:12 joerg Exp $
+# $NetBSD: fetch,v 1.17 2015/09/08 12:37:56 joerg Exp $
#
# Copyright (c) 2006, 2015 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -68,8 +68,9 @@
# needed by the pkgsrc/mk/checksum/checksum script.
#
# -p hook
-# After a successful fetch, run hook with the relative path
-# as argument.
+# After a successful fetch, run hook. The first argument is
+# the relative path of the distfile and the second argument
+# the full URL the file was obtained from.
#
# -r Resume a previous fetch for the file. In this case,
# the file is first saved to a ".pkgsrc.resume" file,
@@ -308,7 +309,7 @@ while ${TEST} $# -gt 0; do
fi
done
if ${TEST} -f $path && ${TEST} -n "$post_fetch"; then
- "$post_fetch" $path
+ "$post_fetch" $path "$url"
fi
if ${TEST} -f $path; then
exit 0