pkgsrc-WIP-changes archive

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

git-package.mk: Make cache creation more atomic



Module Name:	pkgsrc-wip
Committed By:	Mateusz Poszwa <old4%o2.pl@localhost>
Pushed By:	f8l
Date:		Fri Dec 11 02:45:43 2015 +0100
Changeset:	cd1f8ce54ffb8eb43a5b2ba27b90a33e806de8d0

Modified Files:
	mk/git-package.mk

Log Message:
git-package.mk: Make cache creation more atomic

Interrupting cache creation could lead to truncation of the cache file.
The cache is now created in a separate file and moved upon completion.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=cd1f8ce54ffb8eb43a5b2ba27b90a33e806de8d0

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 mk/git-package.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diffs:
diff --git a/mk/git-package.mk b/mk/git-package.mk
index d59fc7a..c519ad5 100644
--- a/mk/git-package.mk
+++ b/mk/git-package.mk
@@ -103,7 +103,8 @@ _GIT_EXTRACT_CACHED.${repo}=	\
 _GIT_CREATE_CACHE.${repo}=	\
 	${STEP_MSG} "Creating cached GIT archive "${_GIT_DISTFILE.${repo}:Q}"."; \
 	${MKDIR} ${_GIT_DISTDIR:Q};					\
-	pax -w ${GIT_MODULE.${repo}:Q} | gzip > ${_GIT_DISTDIR}/${_GIT_DISTFILE.${repo}:Q}
+	pax -w ${GIT_MODULE.${repo}:Q} | gzip > ${_GIT_DISTDIR}/${_GIT_DISTFILE.${repo}:Q}.tmp;	\
+	$(MV) '${_GIT_DISTDIR}/${_GIT_DISTFILE.${repo}:Q}.tmp' '${_GIT_DISTDIR}/${_GIT_DISTFILE.${repo}:Q}'
 
 #   fetch git repo or update cached one
 _GIT_FETCH_REPO.${repo}=	\


Home | Main Index | Thread Index | Old Index