pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
mk/*-package.mk: clean up code for SCM tests
Module Name: pkgsrc-wip
Committed By: Roland Illig <rillig%NetBSD.org@localhost>
Pushed By: rillig
Date: Sat Mar 3 12:34:39 2018 +0000
Changeset: 15a3e3a4bd6f8e555e2825b78e9adfc0bb9aa718
Modified Files:
mk-scm-tests/Makefile
mk-scm-tests/files/test
mk/cvs-package.mk
mk/fossil-package.mk
mk/git-package.mk
mk/hg-package.mk
mk/svn-package.mk
Log Message:
mk/*-package.mk: clean up code for SCM tests
For CVS, the PKGREVISION had been changed to six digits during the
latest commits. This had been by mistake and is reverted to eight
digits again.
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=15a3e3a4bd6f8e555e2825b78e9adfc0bb9aa718
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
mk-scm-tests/Makefile | 14 ++++++-------
mk-scm-tests/files/test | 54 ++++++++++++++++++++++++-------------------------
mk/cvs-package.mk | 8 ++++----
mk/fossil-package.mk | 4 ++--
mk/git-package.mk | 8 ++++----
mk/hg-package.mk | 5 +++--
mk/svn-package.mk | 16 +++++++--------
7 files changed, 55 insertions(+), 54 deletions(-)
diffs:
diff --git a/mk-scm-tests/Makefile b/mk-scm-tests/Makefile
index b9eee9a0d0..45ab191682 100644
--- a/mk-scm-tests/Makefile
+++ b/mk-scm-tests/Makefile
@@ -9,6 +9,8 @@ HOMEPAGE= https://www.pkgsrc.org/
COMMENT= System tests for wip/mk infrastructure
LICENSE= 2-clause-bsd
+SCM_UNDER_TEST?= # none; is set by files/test
+
.if empty(SCM_UNDER_TEST)
DISTNAME= mk-scm-tests-1.0
DISTFILES= # none
@@ -25,29 +27,27 @@ do-install:
.include "../../mk/bsd.prefs.mk"
-SCM_UNDER_TEST?= # none; is set by files/test
-
-.if ${SCM_UNDER_TEST} == CVS
+.if ${SCM_UNDER_TEST} == cvs
CVS_ROOT= ${.CURDIR}/tmp/repo
.include "../../wip/mk/cvs-package.mk"
.endif
-.if ${SCM_UNDER_TEST} == Fossil
+.if ${SCM_UNDER_TEST} == fossil
FOSSIL_REPO= ${.CURDIR}/tmp/repo/pkgbase/pkgbase.fossil
.include "../../wip/mk/fossil-package.mk"
.endif
-.if ${SCM_UNDER_TEST} == Git
+.if ${SCM_UNDER_TEST} == git
GIT_REPO= ${.CURDIR}/tmp/repo/pkgbase
.include "../../wip/mk/git-package.mk"
.endif
-.if ${SCM_UNDER_TEST} == Mercurial
+.if ${SCM_UNDER_TEST} == hg
HG_REPO= ${.CURDIR}/tmp/repo/pkgbase
.include "../../wip/mk/hg-package.mk"
.endif
-.if ${SCM_UNDER_TEST} == Subversion
+.if ${SCM_UNDER_TEST} == svn
SVN_REPO= file://${.CURDIR}/tmp/repo/pkgbase
.include "../../wip/mk/svn-package.mk"
.endif
diff --git a/mk-scm-tests/files/test b/mk-scm-tests/files/test
index 6ec5a8fdce..c7d7e3cdcb 100644
--- a/mk-scm-tests/files/test
+++ b/mk-scm-tests/files/test
@@ -11,22 +11,6 @@ die() {
exit 1
}
-# Sets up a repository in $repodir, with these commits:
-# - at 2018-01-01TZ, the file "today" contains "2018-01-01".
-# - at 2018-03-01TZ, the file "today" contains "2018-03-01".
-setup_repository() {
- rm -rf "$repodir"
-
- case "$1" in
- (CVS) setup_cvs_repository ;;
- (Fossil) setup_fossil_repository ;;
- (Git) setup_git_repository ;;
- (Mercurial) setup_hg_repository ;;
- (Subversion) setup_svn_repository ;;
- (*) die "setup_repository $1"
- esac
-}
-
setup_cvs_repository() {
cvs -d "$repodir" init
mkdir "$repodir/pkgbase"
@@ -148,8 +132,8 @@ setup_svn_repository() {
}
pkgsrc_make() {
- DISTDIR="$basedir/distfiles" \
- `type "bmake" 1>/dev/null 2>&1 && echo "bmake" || echo "make"` "$@"
+ bmake=`type "bmake" 1>/dev/null 2>&1 && echo "bmake" || echo "make"`
+ DISTDIR="$basedir/distfiles" "$bmake" "$@"
}
assert_that() {
@@ -163,23 +147,39 @@ assert_that() {
}
test_scm() { # usage: test_scm scm-name
- step "Setting up $1 repository"
- setup_repository "$1"
+ case "$1" in
+ (cvs) scm_display_name="CVS" ;;
+ (fossil) scm_display_name="Fossil" ;;
+ (git) scm_display_name="Git" ;;
+ (hg) scm_display_name="Mercurial" ;;
+ (svn) scm_display_name="Subversion" ;;
+ esac
+
+ # Sets up a repository in $repodir, with these commits:
+ # - at 2018-01-01TZ, the file "today" contains "2018-01-01".
+ # - at 2018-03-01TZ, the file "today" contains "2018-03-01".
+ #
+ step "Setting up $scm_display_name repository"
+ rm -rf "$repodir"
+ setup_${1}_repository
wrkdir=`pkgsrc_make show-var VARNAME=WRKDIR`
- step "Testing $1"
+ step "Testing $scm_display_name"
SCM_UNDER_TEST="$1" pkgsrc_make clean
SCM_UNDER_TEST="$1" pkgsrc_make patch
assert_that --file "$wrkdir/pkgbase/today" --has-content "2018-03-01"
- step "Testing $1 with CHECKOUT_DATE"
+ step "Testing $scm_display_name with CHECKOUT_DATE"
SCM_UNDER_TEST="$1" pkgsrc_make clean
SCM_UNDER_TEST="$1" CHECKOUT_DATE="2018-02-01" pkgsrc_make patch
assert_that --file "$wrkdir/pkgbase/today" --has-content "2018-01-01"
SCM_UNDER_TEST="$1" pkgsrc_make clean
+
+ step "Dumping API variables for $scm_display_name (for manual inspection)"
+ SCM_UNDER_TEST="$1" pkgsrc_make "show-all-$1"
}
main() {
@@ -188,11 +188,11 @@ main() {
rm -rf "$basedir"
mkdir "$basedir"
- test_scm "CVS"
- test_scm "Fossil"
- test_scm "Git"
- test_scm "Mercurial"
- test_scm "Subversion"
+ test_scm "cvs"
+ test_scm "fossil"
+ test_scm "git"
+ test_scm "hg"
+ test_scm "svn"
rm -rf "$basedir"
step "OK"
diff --git a/mk/cvs-package.mk b/mk/cvs-package.mk
index 9dd2343432..8572ec6ebf 100644
--- a/mk/cvs-package.mk
+++ b/mk/cvs-package.mk
@@ -97,11 +97,11 @@ PKGREVISION?= ${_CVS_PKGVERSION:S/.//g}
# The common case of a single repository
.if defined(CVS_ROOT)
CVS_MODULE?= ${PKGBASE:S,-cvs$,,}
-CVS_REPOSITORIES+= _default
+CVS_REPOSITORIES+= default
WRKSRC?= ${WRKDIR}/${CVS_MODULE}
. for varbase in CVS_ROOT CVS_MODULE CVS_TAG
. if defined(${varbase})
-${varbase}._default= ${${varbase}}
+${varbase}.default= ${${varbase}}
. endif
. endfor
.endif
@@ -123,7 +123,7 @@ PKG_FAIL_REASON+= "[cvs-package.mk] CVS_ROOT."${repo:Q}" must be set."
. endif
.endfor
-USE_TOOLS+= date pax
+USE_TOOLS+= date gzip pax
_CVS_RSH= ssh
_CVS_CMD= cvs
@@ -136,7 +136,7 @@ _CVS_CHECKOUT_FLAGS= -P
_CVS_PASSFILE= ${WRKDIR}/.cvs_passwords
_CVS_TODAY_CMD= ${DATE} -u +'%Y-%m-%d'
_CVS_TODAY= ${_CVS_TODAY_CMD:sh}
-_CVS_PKGVERSION_CMD= ${DATE} -u +'%y.%m.%d'
+_CVS_PKGVERSION_CMD= ${DATE} -u +'%Y.%m.%d'
_CVS_PKGVERSION?= ${_CVS_PKGVERSION_CMD:sh}
_CVS_DISTDIR= ${DISTDIR}/cvs-packages
diff --git a/mk/fossil-package.mk b/mk/fossil-package.mk
index 785bc3f38e..62f022b8b9 100644
--- a/mk/fossil-package.mk
+++ b/mk/fossil-package.mk
@@ -75,9 +75,9 @@ PKGREVISION?= ${${DATE} -u +'%Y%m%d':L:sh}
FOSSIL_REPOSITORIES+= default
FOSSIL_REPO.default= ${FOSSIL_REPO}
FOSSIL_MODULE.default= ${DISTNAME:C,-[0-9].*,,}
-.if defined(FOSSIL_VERSION)
+. if defined(FOSSIL_VERSION)
FOSSIL_VERSION.default= ${FOSSIL_VERSION}
-.endif
+. endif
WRKSRC?= ${WRKDIR}/${FOSSIL_MODULE.default}
.endif
diff --git a/mk/git-package.mk b/mk/git-package.mk
index 265b78b4a5..e05e990c65 100644
--- a/mk/git-package.mk
+++ b/mk/git-package.mk
@@ -121,9 +121,9 @@ PKG_FAIL_REASON+= "[git-package.mk] GIT_REPO."${repo:Q}" must be set."
. endif
.endfor
-USE_TOOLS+= date pax
+USE_TOOLS+= date gzip pax
-_GIT_CMD= git
+_GIT_CMD= ${PREFIX}/bin/git
_GIT_CHECKOUT_FLAGS= --quiet
_GIT_PKGVERSION_CMD= ${DATE} -u +'%Y.%m.%d'
_GIT_PKGVERSION= ${_GIT_PKGVERSION_CMD:sh}
@@ -151,10 +151,10 @@ _GIT_FETCH_FLAGS.${repo}= --quiet --recurse-submodules=yes --tags
_GIT_CLONE_FLAGS.${repo}= --quiet --recursive
# For revision checkout we need deep copy
-. if !defined(GIT_REVISION.${repo}) && !empty(GIT_DEEP_CLONE.${repo}:M[yY][eE][sS])
+. if !defined(GIT_REVISION.${repo}) && !empty(GIT_DEEP_CLONE.${repo}:M[yY][eE][sS])
_GIT_FETCH_FLAGS.${repo}+= --depth 1
_GIT_CLONE_FLAGS.${repo}+= --depth 1
-. endif
+. endif
# The cached archive
_GIT_DISTFILE.${repo}= ${PKGBASE}-${GIT_MODULE.${repo}}-gitarchive.tar.gz
diff --git a/mk/hg-package.mk b/mk/hg-package.mk
index f91190941c..e42b7d69df 100644
--- a/mk/hg-package.mk
+++ b/mk/hg-package.mk
@@ -75,7 +75,7 @@ PKG_FAIL_REASON+= "[hg-package.mk] HG_REPO."${repo:Q}" must be set."
. endif
.endfor
-USE_TOOLS+= date pax
+USE_TOOLS+= date gzip pax
_HG_CMD= ${PREFIX}/bin/hg
_HG_FLAGS= -q
@@ -135,7 +135,8 @@ _HG_CMD.checkout.${repo}= \
_HG_CMD.create_archive.${repo}= \
${STEP_MSG} "Creating cached Mercurial archive $${archive\#\#*/}."; \
${MKDIR} "$${archive%/*}"; \
- pax -w "$$module" | gzip > "$$archive"
+ pax -w "$$module" | gzip > "$$archive.tmp"; \
+ ${MV} "$$archive.tmp" "$$archive"
.endfor
hg-cleandir: .PHONY
diff --git a/mk/svn-package.mk b/mk/svn-package.mk
index acee0b5e1b..5e2c41fe8b 100644
--- a/mk/svn-package.mk
+++ b/mk/svn-package.mk
@@ -57,9 +57,9 @@ PKGREVISION?= ${_SVN_PKGREVISION_CMD:sh}
# The common case of a single repository
.if defined(SVN_REPO)
SVN_MODULE?= ${SVN_REPO:S,/$,,:S,/trunk$,,:S,/code$,,:T}
-SVN_REPOSITORIES+= _default
-SVN_REPO._default= ${SVN_REPO}
-SVN_MODULE._default= ${SVN_MODULE}
+SVN_REPOSITORIES+= default
+SVN_REPO.default= ${SVN_REPO}
+SVN_MODULE.default= ${SVN_MODULE}
WRKSRC?= ${WRKDIR}/${SVN_MODULE}
.endif
@@ -74,9 +74,9 @@ PKG_FAIL_REASON+= "[svn-package.mk] SVN_REPO."${repo:Q}" must be set."
. endif
.endfor
-USE_TOOLS+= date pax
+USE_TOOLS+= date gzip pax
-_SVN_CMD= svn
+_SVN_CMD= ${PREFIX}/bin/svn
_SVN_CONFIG_DIR= ${WRKDIR}/.subversion
_SVN_CHECKOUT_FLAGS= --config-dir=${_SVN_CONFIG_DIR} --non-interactive
_SVN_PKGREVISION_CMD= ${DATE} -u +'%Y%m%d'
@@ -109,14 +109,14 @@ _SVN_CMD.extract_archive.${repo}= \
fi
# Install client certificates for authentication
-.if !empty(SVN_CERTS.${repo})
+. if !empty(SVN_CERTS.${repo})
_SVN_CMD.install_certs.${repo}= \
${MKDIR} ${_SVN_CONFIG_DIR}/auth/svn.ssl.server; \
${CP} ${SVN_CERTS.${repo}} ${_SVN_CONFIG_DIR}/auth/svn.ssl.server
-.else
+. else
_SVN_CMD.install_certs.${repo}= \
${DO_NADA}
-.endif
+. endif
# Check out the repository or update the cached one
_SVN_CMD.fetch_repo.${repo}= \
Home |
Main Index |
Thread Index |
Old Index