Monday, January 03, 2022

Re: cmake: don't allow DOWNLOAD/UPLOAD in ports builds

On Mon Jan 03, 2022 at 12:31:06PM +0000, Stuart Henderson wrote:
> Network access is not allowed during port builds. This modifies the
> cmake port to disable DOWNLOAD/UPLOAD commands when MODCMAKE_PORT_BUILD
> is used. Tested with the last games/openmw commit backed-out.
>
> OK?
>
>
> [...]
> -- Configuring OpenMW...
> -- Found OpenGL: /usr/X11R6/lib/libGL.so.17.1
> -- Found LZ4: /usr/local/lib/liblz4.so.3.1
> [1/9] Creating directories for 'recastnavigation-populate'
> [1/9] Performing download step (download, verify and extract) for 'recastnavigation-populate'
> -- Downloading...
> dst='/usr/obj/ports/openmw-0.47.0/build-amd64/_deps/recastnavigation-subbuild/recastnavigation-populate-prefix/src/e75adf86f91eb3082220085e42dda62679f9a3ea.zip'
> timeout='none'
> inactivity timeout='none'
> -- Using src='https://github.com/recastnavigation/recastnavigation/archive/e75adf86f91eb3082220085e42dda62679f9a3ea.zip'
> CMake Error at /usr/obj/ports/openmw-0.47.0/build-amd64/_deps/recastnavigation-subbuild/recastnavigation-populate-prefix/src/recastnavigation-populate-stamp/download-recastnavigation-populate.cmake:127 (file):
> file DOWNLOAD not supported in OpenBSD ports builds.
>
>

I love it! Thanks Stuart. OK rsadowski@

>
>
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/cmake/Makefile,v
> retrieving revision 1.200
> diff -u -p -r1.200 Makefile
> --- Makefile 3 Jan 2022 12:21:50 -0000 1.200
> +++ Makefile 3 Jan 2022 12:28:21 -0000
> @@ -8,7 +8,7 @@ VER = 3.20.3
> EPOCH = 0
> DISTNAME = cmake-${VER}
> CATEGORIES = devel
> -REVISION = 0
> +REVISION = 1
>
> HOMEPAGE = https://www.cmake.org/
>
> Index: patches/patch-Source_cmFileCommand_cxx
> ===================================================================
> RCS file: patches/patch-Source_cmFileCommand_cxx
> diff -N patches/patch-Source_cmFileCommand_cxx
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-Source_cmFileCommand_cxx 3 Jan 2022 12:28:21 -0000
> @@ -0,0 +1,31 @@
> +$OpenBSD$
> +
> +Index: Source/cmFileCommand.cxx
> +--- Source/cmFileCommand.cxx.orig
> ++++ Source/cmFileCommand.cxx
> +@@ -1599,6 +1599,12 @@ bool HandleDownloadCommand(std::vector<std::string> co
> + cmExecutionStatus& status)
> + {
> + #if !defined(CMAKE_BOOTSTRAP)
> ++ std::string openbsd_build;
> ++ if ((cmSystemTools::GetEnv("MODCMAKE_PORT_BUILD", openbsd_build) &&
> ++ openbsd_build == std::string("yes"))) {
> ++ status.SetError("DOWNLOAD not supported in OpenBSD ports builds.");
> ++ return false;
> ++ }
> + auto i = args.begin();
> + if (args.size() < 2) {
> + status.SetError("DOWNLOAD must be called with at least two arguments.");
> +@@ -1985,6 +1991,12 @@ bool HandleUploadCommand(std::vector<std::string> cons
> + cmExecutionStatus& status)
> + {
> + #if !defined(CMAKE_BOOTSTRAP)
> ++ std::string openbsd_build;
> ++ if ((cmSystemTools::GetEnv("MODCMAKE_PORT_BUILD", openbsd_build) &&
> ++ openbsd_build == std::string("yes"))) {
> ++ status.SetError("UPLOAD not supported in OpenBSD ports builds.");
> ++ return false;
> ++ }
> + if (args.size() < 3) {
> + status.SetError("UPLOAD must be called with at least three arguments.");
> + return false;
>

No comments:

Post a Comment