pkgsrc-WIP-changes archive

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

mk/git-package.mk: only create the Git archive if necessary



Module Name:	pkgsrc-wip
Committed By:	Roland Illig <rillig%NetBSD.org@localhost>
Pushed By:	rillig
Date:		Thu Apr 12 21:24:09 2018 +0000
Changeset:	e5fc07c8f779745b1e41ed7ee5af2001f10ac469

Modified Files:
	mk/git-package.mk

Log Message:
mk/git-package.mk: only create the Git archive if necessary

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

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

diffstat:
 mk/git-package.mk | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diffs:
diff --git a/mk/git-package.mk b/mk/git-package.mk
index 7932bb99a5..2829bc892a 100644
--- a/mk/git-package.mk
+++ b/mk/git-package.mk
@@ -202,8 +202,10 @@ _GIT_CMD.checkout.${repo}= \
 	    checkout ${_GIT_CHECKOUT_FLAGS} "$$ref";			\
 	else								\
 	  ${STEP_MSG} "Checking out $$revision.";			\
+	  rev_before=`${_GIT_CMDLINE.${repo}} -C "$$extractdir" show-ref HEAD`; \
 	  ${_GIT_CMDLINE.${repo}} -C "$$extractdir"			\
 	    checkout ${_GIT_CHECKOUT_FLAGS} "$$revision";		\
+	  rev_after=`${_GIT_CMDLINE.${repo}} -C "$$extractdir" show-ref HEAD`; \
 	fi;								\
 	\
 	${STEP_MSG} "Updating submodules of $$extractdir.";		\
@@ -212,10 +214,12 @@ _GIT_CMD.checkout.${repo}= \
 
 # Create the cached archive from the checked out repository
 _GIT_CMD.create_archive.${repo}= \
-	${STEP_MSG} "Creating cached Git archive $${archive\#\#*/}.";	\
-	${MKDIR} "$${archive%/*}";					\
-	pax -w "$$extractdir" | gzip > "$$archive.tmp";			\
-	${MV} "$$archive.tmp" "$$archive"
+	if [ "$${rev_before-unknown}" != "$${rev_after-unknown}" ]; then \
+	  ${STEP_MSG} "Creating cached Git archive $${archive\#\#*/}.";	\
+	  ${MKDIR} "$${archive%/*}";					\
+	  pax -w "$$extractdir" | gzip > "$$archive.tmp";		\
+	  ${MV} "$$archive.tmp" "$$archive";				\
+	fi
 .endfor
 
 pre-extract: do-git-extract


Home | Main Index | Thread Index | Old Index