git: 3ee1d740c7ba - main - textproc/quarto: Add JULIA option and DEPENDENCIES options group

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 01 Oct 2024 06:03:33 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3ee1d740c7ba3b33783257a89436f1d2d3750e3d

commit 3ee1d740c7ba3b33783257a89436f1d2d3750e3d
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2024-10-01 06:02:32 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2024-10-01 06:03:19 +0000

    textproc/quarto: Add JULIA option and DEPENDENCIES options group
---
 textproc/quarto/Makefile                           | 37 +++++++++++++++++-----
 textproc/quarto/files/patch-repo_tests_Pipfile     |  8 +++++
 .../quarto/files/patch-repo_tests_run-tests.sh     | 25 ++++++++++-----
 3 files changed, 54 insertions(+), 16 deletions(-)

diff --git a/textproc/quarto/Makefile b/textproc/quarto/Makefile
index cf941ded3e38..7af1a22dec33 100644
--- a/textproc/quarto/Makefile
+++ b/textproc/quarto/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	quarto
 DISTVERSION=	1.6.15
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	textproc
 MASTER_SITES=	https://github.com/quarto-dev/quarto-cli/releases/download/v${DISTVERSION}/
 DISTFILES=	quarto-${DISTVERSION}-linux-amd64.tar.gz # same for all architectures
@@ -10,8 +10,9 @@ COMMENT=	Scientific and technical publishing system
 WWW=		https://quarto.org/
 
 LICENSE=	MIT
-LICENSE_FILE=	${WRKSRC}/repo/COPYRIGHT
+LICENSE_FILE=	${WRKSRC_repo}/COPYRIGHT
 
+# the recommended dependency versions are in the file 'configuration'
 RUN_DEPENDS=	bash:shells/bash \
 		deno:www/deno \
 		esbuild:devel/esbuild \
@@ -21,24 +22,33 @@ RUN_DEPENDS=	bash:shells/bash \
 		tex-xetex>0:print/tex-xetex \
 		${LOCALBASE}/lib/ruby/gems/3.2/gems/dartsass-1.49.8/exe/linux/sass:textproc/rubygem-dartsass \
 		${PYTHON_PKGNAMEPREFIX}jupyter>0:devel/py-jupyter@${PY_FLAVOR}
+TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pipenv>0:devel/py-pipenv@${PY_FLAVOR} \
+		${JULIA_RUN_DEPENS} \
+		${R_RUN_DEPENDS}
 
 USES=		python
 
 USE_GITHUB=	nodefault
 GH_TUPLE=	quarto-dev:quarto-cli:v${DISTVERSION}:repo/repo # only for tests
 
+WRKSRC_repo=	${WRKSRC}/repo
+
 XARCH!=		uname -m
 
 NO_BUILD=	yes
 
 PLIST_SUB+=	XARCH=${XARCH}
 
-OPTIONS_DEFINE=	R
+OPTIONS_GROUP=			DEPENDENCIES
+OPTIONS_GROUP_DEPENDENCIES=	JULIA R
+
+JULIA_DESC=			Install Julia dependency
+JULIA_RUN_DEPENS=		julia:lang/julia
 
-R_DESC=		Install R dependency
-R_RUN_DEPENDS=	R:math/R \
-		R-cran-knitr>0:print/R-cran-knitr \
-		R-cran-rmarkdown>0:textproc/R-cran-rmarkdown
+R_DESC=				Install R dependency
+R_RUN_DEPENDS=			R:math/R \
+				R-cran-knitr>0:print/R-cran-knitr \
+				R-cran-rmarkdown>0:textproc/R-cran-rmarkdown
 
 post-patch:
 	# replace tokens in the quarto executable and in run-tests.sh
@@ -46,7 +56,13 @@ post-patch:
 		-e 's|%%SCRIPT_PATH%%|${DATADIR}/bin|; s|%%ARCH_DIR%%|${XARCH}|' \
 		${WRKSRC}/bin/quarto
 	${REINPLACE_CMD} \
-		-e 's|%%SCRIPT_PATH%%|${STAGEDIR}${DATADIR}/bin|; s|%%ARCH_DIR%%|${XARCH}|; s|%%REPO%%|${WRKSRC}/repo|; s|$$DENO_DIR|${LOCALBASE}/bin|' \
+		-e ' \
+			s|%%SCRIPT_PATH%%|${STAGEDIR}${DATADIR}/bin|; \
+			s|%%ARCH_DIR%%|${XARCH}|; \
+			s|%%REPO%%|${WRKSRC}/repo|; \
+			s|$$DENO_DIR|${LOCALBASE}/bin|; \
+			s|export QUARTO_SHARE_PATH=.*|export QUARTO_SHARE_PATH=${WRKSRC_repo}/src/resources|; \
+		' \
 		${WRKSRC}/repo/tests/run-tests.sh
 	# replace python3 with the real python executable path
 	${REINPLACE_CMD} -i '' -e 's|"python3"|"${PYTHON_CMD}"|' ${WRKSRC}/bin/quarto.js
@@ -84,4 +100,9 @@ do-install:
 		${LOCALBASE}/lib/ruby/gems/3.2/gems/dartsass-1.49.8/exe/linux/sass \
 		${STAGEDIR}${DATADIR}/bin/tools/${XARCH}/dart-sass/sass
 
+do-test: # tests fail to run with: RuntimeError: Failed to lock Pipfile.lock!
+	@cd ${WRKSRC_repo}/tests && \
+		${SETENV} QUARTO_TESTS_FORCE_NO_PIPENV=yes \
+		./run-tests.sh smoke/extensions/extension-render-doc.test.ts
+
 .include <bsd.port.mk>
diff --git a/textproc/quarto/files/patch-repo_tests_Pipfile b/textproc/quarto/files/patch-repo_tests_Pipfile
new file mode 100644
index 000000000000..95f13aadc43c
--- /dev/null
+++ b/textproc/quarto/files/patch-repo_tests_Pipfile
@@ -0,0 +1,8 @@
+--- repo/tests/Pipfile.orig	2024-09-30 03:47:28 UTC
++++ repo/tests/Pipfile
+@@ -20,4 +20,4 @@ jupyter-cache = "*"
+ [dev-packages]
+ 
+ [requires]
+-python_version = "3.12"
++python_version = "3.11"
diff --git a/textproc/quarto/files/patch-repo_tests_run-tests.sh b/textproc/quarto/files/patch-repo_tests_run-tests.sh
index bb07b85be74d..01c5ac14ccd5 100644
--- a/textproc/quarto/files/patch-repo_tests_run-tests.sh
+++ b/textproc/quarto/files/patch-repo_tests_run-tests.sh
@@ -1,6 +1,6 @@
---- repo/tests/run-tests.sh.orig	2024-08-29 14:14:01 UTC
+--- repo/tests/run-tests.sh.orig	2024-09-27 21:54:30 UTC
 +++ repo/tests/run-tests.sh
-@@ -1,20 +1,14 @@
+@@ -1,26 +1,20 @@
  #!/usr/bin/env bash
  
 -# Determine the path to this script (we'll use this to figure out relative positions of other files)
@@ -11,19 +11,28 @@
 -  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
 -done
 -export SCRIPT_PATH="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
-+SCRIPT_PATH="%%SCRIPT_PATH%%"
-+ARCH_DIR=%%ARCH_DIR%%
++SCRIPT_PATH="/usr/ports/textproc/quarto/work/stage/usr/local/share/quarto/bin"
++ARCH_DIR=amd64
  
 -source $SCRIPT_PATH/../package/scripts/common/utils.sh
-+#source  %%REPO%%/package/scripts/common/utils.sh
++#source  /usr/ports/textproc/quarto/work/quarto-1.6.15/repo/package/scripts/common/utils.sh
  
 -export QUARTO_ROOT="`cd "$SCRIPT_PATH/.." > /dev/null 2>&1 && pwd`"
 -QUARTO_SRC_DIR="$QUARTO_ROOT/src"
-+export QUARTO_ROOT=$SCRIPT_PATH/..
-+QUARTO_SRC_DIR="%%REPO%%/src"
- DENO_ARCH_DIR=$DENO_DIR
+-DENO_ARCH_DIR=$DENO_DIR
 -DENO_DIR="$QUARTO_ROOT/package/dist/bin/"
++export QUARTO_ROOT=$SCRIPT_PATH/..
++QUARTO_SRC_DIR="/usr/ports/textproc/quarto/work/quarto-1.6.15/repo/src"
++DENO_ARCH_DIR=/usr/local/bin
 +DENO_DIR="$QUARTO_ROOT/bin/tools/$ARCH_DIR/bin/"
  
  # Local import map
  QUARTO_IMPORT_MAP_ARG=--importmap=$QUARTO_SRC_DIR/dev_import_map.json
+ 
+-export QUARTO_BIN_PATH=$DENO_DIR
+-export QUARTO_SHARE_PATH="`cd "$QUARTO_ROOT/src/resources/";pwd`"
++export QUARTO_BIN_PATH=/usr/local/bin
++export QUARTO_SHARE_PATH=/usr/ports/textproc/quarto/work/quarto-cli-1.6.15/src/resources
+ export QUARTO_DEBUG=true
+ 
+ QUARTO_DENO_OPTIONS="--config test-conf.json --v8-flags=--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192 --unstable-kv --unstable-ffi --allow-read --allow-write --allow-run --allow-env --allow-net"