pkgsrc-WIP-changes archive

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

mk/tests: adjust Git test to latest change in mk/git-package.mk



Module Name:	pkgsrc-wip
Committed By:	Roland Illig <rillig%NetBSD.org@localhost>
Pushed By:	rillig
Date:		Mon Mar 14 20:11:38 2022 +0000
Changeset:	6ae3820cb95f1c61db29cee75f4fd5e84636eb9b

Modified Files:
	mk/tests/git-update
	mk/tests/test.subr

Log Message:
mk/tests: adjust Git test to latest change in mk/git-package.mk

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

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

diffstat:
 mk/tests/git-update | 26 ++++++++++++++++++--------
 mk/tests/test.subr  |  3 ++-
 2 files changed, 20 insertions(+), 9 deletions(-)

diffs:
diff --git a/mk/tests/git-update b/mk/tests/git-update
index 3509ce4468..0c4f6a5e9b 100644
--- a/mk/tests/git-update
+++ b/mk/tests/git-update
@@ -4,27 +4,37 @@
 set_up_package "git-update.mk"
 set_up_repository git
 
-step "Testing Git before a remote update"
+step "Testing Git before an update in the remote repository"
 package_make patch
 
 assert_that --file "$wrkdir/pkgbase/today" --has-content "2018-03-01"
 
-step "Testing Git after a remote update"
+
+# A newer version becomes available in the remote repository.  Since the
+# package uses the default reference origin/HEAD, it will pick up these
+# changes.
 cd "$repoworkdir"
 scm_git_commit "2022-03-01"
+
+step "Testing Git after an update in the remote repository"
 package_make clean
 package_make patch
+# The output contains "Creating cached Git archive".
 
-# The working copy of the package has been updated to reflect the remote
-# change.
 assert_that --file "$wrkdir/pkgbase/today" --has-content "2022-03-01"
-# TODO: The archive in ${DISTDIR} should be updated, but it isn't.
+
+# Ensure that the archive in ${DISTDIR} has been updated, to avoid
+# unnecessary downloads in the future.
+cd "$wrkdir"
+echo "before-tar" > pkgbase/today
+tar xfz "$distdir/git-packages/pkgbase-default-gitarchive.tar.gz" pkgbase/today
+assert_that --file "pkgbase/today" --has-content "2022-03-01"
 
 
-step "Testing Git after a remote update"
+step "Testing Git from a cached archive that has been updated"
 package_make clean
 package_make patch
+# The output does not contain "Creating cached Git archive" since origin/HEAD
+# still points to the same commit as before.
 
-# The working copy of the package has been updated to reflect the remote
-# change.
 assert_that --file "$wrkdir/pkgbase/today" --has-content "2022-03-01"
diff --git a/mk/tests/test.subr b/mk/tests/test.subr
index c93a17b417..60e8042d3d 100644
--- a/mk/tests/test.subr
+++ b/mk/tests/test.subr
@@ -52,6 +52,7 @@ set_up_package() {
 
 	reposdir="$categorydir/repos"
 	repoworkdir="$categorydir/repo-work"
+	distdir="$categorydir/distfiles"
 
 	# Install the VCS if necessary; needed by set_up_repository.
 	package_make depends
@@ -233,7 +234,7 @@ scm_svn_tag() {
 package_make() {
 	cd "$pkgdir"
 	bmake=`type "bmake" 1>/dev/null 2>&1 && echo "bmake" || echo "make"`
-	DISTDIR="$categorydir/distfiles" "$bmake" "$@"
+	DISTDIR="$distdir" "$bmake" "$@"
 }
 
 assert_that() {


Home | Main Index | Thread Index | Old Index