git: 89e5e41d60c1 - main - Mk/Uses/npm.mk: Remove temp directory in pnpm store before making archive

From: Hiroki Tagato <tagattie_at_FreeBSD.org>
Date: Sun, 19 Jul 2026 13:17:45 UTC
The branch main has been updated by tagattie:

URL: https://cgit.FreeBSD.org/ports/commit/?id=89e5e41d60c17231cadec381931ae4f095e1752a

commit 89e5e41d60c17231cadec381931ae4f095e1752a
Author:     Hiroki Tagato <tagattie@FreeBSD.org>
AuthorDate: 2026-07-19 13:13:17 +0000
Commit:     Hiroki Tagato <tagattie@FreeBSD.org>
CommitDate: 2026-07-19 13:15:36 +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.
---
 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 \