git: 862270f918c7 - 2026Q3 - Mk/Uses/npm.mk: Remove temp directory in pnpm store before making archive

From: Hiroki Tagato <tagattie_at_FreeBSD.org>
Date: Thu, 10 Sep 2026 20:54:49 UTC
The branch 2026Q3 has been updated by tagattie:

URL: https://cgit.FreeBSD.org/ports/commit/?id=862270f918c762545a0a159ba0a22ea41f59f571

commit 862270f918c762545a0a159ba0a22ea41f59f571
Author:     Hiroki Tagato <tagattie@FreeBSD.org>
AuthorDate: 2026-07-19 13:13:17 +0000
Commit:     Hiroki Tagato <tagattie@FreeBSD.org>
CommitDate: 2026-09-10 20:54:25 +0000

    Mk/Uses/npm.mk: Remove temp directory in pnpm store before making archive
    
    Leaving the directory in place may cause the node modules archive to
    be unreproducible.
    
    (cherry picked from commit 89e5e41d60c17231cadec381931ae4f095e1752a)
---
 Mk/Uses/npm.mk | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Mk/Uses/npm.mk b/Mk/Uses/npm.mk
index ee5b8e96bc7c..ec5cd61d4489 100644
--- a/Mk/Uses/npm.mk
+++ b/Mk/Uses/npm.mk
@@ -309,9 +309,10 @@ npm-archive-node-modules:
 	@if [ ! -f ${DISTDIR}/${DIST_SUBDIR}/${_DISTFILE_prefetch} ] && [ -d ${WRKDIR}/node-modules-cache ]; then \
 		${ECHO_MSG} "===>  Normalizing timestamps and permissions of prefetched node modules"; \
 		tmpdir=${WRKDIR}/pnpm_tmp; \
-		input_db=${WRKDIR}/node-modules-cache/${NPM_MODULE_CACHE}/v11/index.db; \
+		storedir=${WRKDIR}/node-modules-cache/${NPM_MODULE_CACHE}/v11; \
+		input_db=$${storedir}/index.db; \
 		output_db=$${tmpdir}/index.db; \
-		output_db_dump=${WRKDIR}/node-modules-cache/${NPM_MODULE_CACHE}/v11/index_dump.sql; \
+		output_db_dump=$${storedir}/index_dump.sql; \
 		${MKDIR} $${tmpdir}; \
 		cd $${tmpdir} && ${SETENV} ${MAKE_ENV} ${NPM_CMDNAME} add --ignore-scripts --silent msgpackr; \
 		sqlite3 $${input_db} \
@@ -389,7 +390,7 @@ npm-archive-node-modules:
 		done; \
 		sqlite3 $${output_db} "REINDEX; VACUUM;"; \
 		sqlite3 $${output_db} ".dump" > $${output_db_dump}; \
-		${RM} $${input_db}; \
+		${RM} -r $${input_db} $${storedir}/tmp; \
 	fi
 .        else
 	@if [ ! -f ${DISTDIR}/${DIST_SUBDIR}/${_DISTFILE_prefetch} ] && [ -d ${WRKDIR}/node-modules-cache ]; then \