tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

no downloads except during fetch phase



Hi!

Since this keeps popping up, I thought how we could disable downloads
during configure/build/test, and came up with the attached patch.

Basically, it's setting the proxy environment variables to an invalid
value, so everything that honors them will break with a hopefully easy
to understand error.

I tried this on a constructed package that ran wget, ftp, and curl
during the build and got:

# wget http://example.com
--2024-04-29 13:14:07--  http://example.com
Resolving downloads-forbidden-except-during-fetch (downloads-forbidden-except-during-fetch)... failed: No address associated with hostname.
wget: unable to resolve host address 'downloads-forbidden-except-during-fetch'

# ftp http://example.com/index.html
ftp: Invalid proxy URL `downloads-forbidden-except-during-fetch'

# curl http://example.com
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (5) Could not resolve proxy: downloads-forbidden-except-during-fetch


Comments?
 Thomas
Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.2053
diff -u -r1.2053 bsd.pkg.mk
--- bsd.pkg.mk	20 Aug 2023 18:38:37 -0000	1.2053
+++ bsd.pkg.mk	29 Apr 2024 11:14:46 -0000
@@ -184,6 +184,10 @@
 ALL_ENV+=	MAKELEVEL=0
 ALL_ENV+=	CONFIG_SITE=${PKGSRC_CONFIG_SITE:U}
 
+NO_FETCH_ENV+=	ftp_proxy=downloads-forbidden-except-during-fetch
+NO_FETCH_ENV+=	http_proxy=downloads-forbidden-except-during-fetch
+NO_FETCH_ENV+=	https_proxy=downloads-forbidden-except-during-fetch
+
 # This variable can be added to MAKE_ENV to ease installation of packages
 # that use BSD-style Makefiles.
 BSD_MAKE_ENV=	BINOWN=${BINOWN} BINGRP=${BINGRP}
Index: build/build.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/build/build.mk,v
retrieving revision 1.34
diff -u -r1.34 build.mk
--- build/build.mk	12 Jun 2020 17:33:23 -0000	1.34
+++ build/build.mk	29 Apr 2024 11:14:46 -0000
@@ -49,7 +49,7 @@
 BUILD_TARGET?=		all
 
 BUILD_MAKE_CMD= \
-	${PKGSRC_SETENV} ${MAKE_ENV}					\
+	${PKGSRC_SETENV} ${MAKE_ENV} ${NO_FETCH_ENV}			\
 		${MAKE_PROGRAM} ${_MAKE_JOBS}				\
 			${MAKE_FLAGS} ${BUILD_MAKE_FLAGS}		\
 			-f ${MAKE_FILE}
@@ -215,4 +215,4 @@
 		${BUILD_DIRS:S,^${WRKSRC}$,.,:S,^${WRKSRC}/,,:Q}
 .endif
 	${RUN}${_ULIMIT_CMD}						\
-	cd ${WRKSRC} && ${PKGSRC_SETENV} ${MAKE_ENV} ${BUILD_ENV_SHELL}
+	cd ${WRKSRC} && ${PKGSRC_SETENV} ${MAKE_ENV} ${NO_FETCH_ENV} ${BUILD_ENV_SHELL}
Index: build/test.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/build/test.mk,v
retrieving revision 1.25
diff -u -r1.25 test.mk
--- build/test.mk	23 Nov 2022 13:30:38 -0000	1.25
+++ build/test.mk	29 Apr 2024 11:14:46 -0000
@@ -55,6 +55,7 @@
 
 TEST_DIRS?=		${BUILD_DIRS}
 TEST_ENV+=		${MAKE_ENV}
+TEST_ENV+=		${NO_FETCH_ENV}
 TEST_MAKE_FLAGS?=	# none
 
 TEST_MAKE_CMD= \
Index: configure/configure.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/configure/configure.mk,v
retrieving revision 1.32
diff -u -r1.32 configure.mk
--- configure/configure.mk	12 Jan 2023 19:37:35 -0000	1.32
+++ configure/configure.mk	29 Apr 2024 11:14:46 -0000
@@ -56,6 +56,7 @@
 
 CONFIGURE_SCRIPT?=	./configure
 CONFIGURE_ENV+=		${ALL_ENV}
+CONFIGURE_ENV+=		${NO_FETCH_ENV}
 CONFIGURE_ARGS?=	# empty
 CONFIG_SHELL?=		${SH}
 CONFIG_SHELL_FLAGS?=	# none


Home | Main Index | Thread Index | Old Index