pkgsrc-WIP-changes archive

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

mk/*-package.mk: provide show-all targets for the VCS include files



Module Name:	pkgsrc-wip
Committed By:	Roland Illig <rillig%NetBSD.org@localhost>
Pushed By:	rillig
Date:		Mon Feb 26 22:40:09 2018 +0000
Changeset:	81036444d1054a99f3cf717f2be590d57f4c6f85

Modified Files:
	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: provide show-all targets for the VCS include files

For understanding the mk files for the version control systems, it is
helpful to get a concise list of the input and output variables. This is
done by the show-all target, or more specialized by show-all-cvs,
show-all-git, etc.

Having this information condensed in a single place also helps
implementing new features, like optimizing for packages that only need a
single repository. In many cases this can be configured with a single
variable, instead of currently 4.

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

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

diffstat:
 mk/cvs-package.mk    | 93 +++++++++++++++++++++++++++++++++++++---------------
 mk/fossil-package.mk | 46 +++++++++++++++++---------
 mk/git-package.mk    | 28 ++++++++--------
 mk/hg-package.mk     | 43 ++++++++++++++++--------
 mk/svn-package.mk    | 49 ++++++++++++++++++---------
 5 files changed, 173 insertions(+), 86 deletions(-)

diffs:
diff --git a/mk/cvs-package.mk b/mk/cvs-package.mk
index 180920f3fa..8f745bab03 100644
--- a/mk/cvs-package.mk
+++ b/mk/cvs-package.mk
@@ -1,25 +1,46 @@
-# $Id: cvs-package.mk,v 1.44 2013/02/19 10:28:14 fhajny Exp $
-
+# $NetBSD$
+#
 # This file provides simple access to CVS repositories, so that packages
 # can be created from CVS instead of from released tarballs. Whenever a
 # package is fetched from CVS, an archive is created from it and saved
 # in ${DISTDIR}/cvs-packages, to save bandwidth.
 #
-# === User-settable variables ===
+# === Package-settable variables ===
 #
-# CHECKOUT_DATE
-#	Date to check out in ISO format (YYYY-MM-DD).
+# CVS_ROOT (required)
+#	The CVSROOT for the CVS repository, including anoncvs password,
+#	if applicable.
 #
-# === Package-settable variables ===
+#	Examples:
+#		${CVS_ROOT_GNU}/emacs
+#		:pserver:anoncvs:@anoncvs.example.com:/cvsroot/project
+#
+# CVS_MODULE (optional)
+#	The CVS module to check out. This typically corresponds to one
+#	of the directories below CVS_ROOT.
+#
+#	Default: ${PKGBASE}
 #
-# A package using this file shall define the following variables:
+# CVS_TAG (optional)
+#	The CVS tag that is checked out. If no tag is specified, the
+#	latest daily version is checked out, influencing the PKGREVISION.
 #
-# CVS_REPOSITORIES
+#	Default: (today at midnight)
+#	Example: v1.0.0
+#
+# CHECKOUT_DATE (optional)
+#	Date to check out in ISO format (YYYY-MM-DD).
+#
+# If a package needs to checkout from more than one CVS repository, the
+# setup is a little more complicated, using parameterized variables as
+# variants of the above variables.
+#
+# CVS_REPOSITORIES (required)
 #	A list of unique identifiers. For each of those identifiers, the
 #	following variables define the details of how to access the
 #	CVS repository.
 #
-# CVS_ROOT.${id}
+# CVS_ROOT.${id} (required)
 #	The CVSROOT for the CVS repository, including anoncvs password,
 #	if applicable.
 #
@@ -27,24 +48,16 @@
 #		${CVS_ROOT_GNU}/emacs
 #		:pserver:anoncvs:@anoncvs.example.com:/cvsroot/project
 #
-# CVS_MODULE.${id}
+# CVS_MODULE.${id} (optional)
 #	The CVS module to check out.
 #
 #	Default value: ${id}
 #
-# It may define the following variables:
-#
-# CVS_TAG.${id}
-#	Overridable CVS tag for a repository.
+# CVS_TAG.${id} (optional)
+#	The CVS tag to check out.
 #
 #	Default: ${CVS_TAG} (today at midnight)
 #
-# CVS_TAG
-#	The default CVS tag that is checked out. May be overridden by
-#	CVS_TAG.${id}.
-#
-#	Default value: today at midnight.
-#
 # CVS_PROJECT
 #	The project name to be used in CVS_ROOT_SOURCEFORGE.
 #
@@ -93,9 +106,9 @@ PKGNAME?=		${DISTNAME:C,-[0-9].*,,}-cvs-${_CVS_PKGVERSION}
 # Enforce PKGREVISION unless CVS_TAG is set:
 .if empty(CVS_TAG)
 . if defined(CHECKOUT_DATE)
-PKGREVISION?=		$(CHECKOUT_DATE:S/-//g)
+PKGREVISION?=		${CHECKOUT_DATE:S/-//g}
 . else
-PKGREVISION?=		$(_CVS_PKGVERSION:S/.//g)
+PKGREVISION?=		${_CVS_PKGVERSION:S/.//g}
 . endif
 .endif
 
@@ -117,6 +130,17 @@ CVS_PROJECT?=		${PKGBASE}
 # Input validation
 #
 
+# The common case of a single CVS repository.
+.if defined(CVS_ROOT)
+CVS_REPOSITORIES+=	_default
+.  for varbase in CVS_ROOT CVS_MODULE CVS_TAG
+.    if defined(${varbase})
+${varbase}._default=	${${varbase}}
+.    endif
+.  endfor
+.endif
+
+
 .if !defined(CVS_REPOSITORIES)
 PKG_FAIL_REASON+=	"[cvs-package.mk] CVS_REPOSITORIES must be set."
 CVS_REPOSITORIES?=	# none
@@ -176,9 +200,9 @@ _CVS_DISTFILE.${repo}=	${PKGBASE}-${CVS_MODULE.${repo}}-${_CVS_TAG.${repo}}.tar.
 
 #   command to extract cache file
 _CVS_EXTRACT_CACHED.${repo}=	\
-	if [ -f ${_CVS_DISTDIR}/${_CVS_DISTFILE.${repo}:Q} ]; then		\
+	if [ -f ${_CVS_DISTDIR}/${_CVS_DISTFILE.${repo}:Q} ]; then	\
 	  ${STEP_MSG} "Extracting cached CVS archive "${_CVS_DISTFILE.${repo}:Q}"."; \
-	  gzip -d -c ${_CVS_DISTDIR}/${_CVS_DISTFILE.${repo}:Q} | pax -r;	\
+	  gzip -d -c ${_CVS_DISTDIR}/${_CVS_DISTFILE.${repo}:Q} | pax -r; \
 	  exit 0;							\
 	fi
 
@@ -194,9 +218,9 @@ pre-extract: do-cvs-extract
 do-cvs-extract: .PHONY
 .for repo in ${CVS_REPOSITORIES}
 	${RUN} cd ${WRKDIR};						\
-	if [ ! -d ${_CVS_DISTDIR} ]; then mkdir -p ${_CVS_DISTDIR:Q}; fi;	\
+	if [ ! -d ${_CVS_DISTDIR} ]; then mkdir -p ${_CVS_DISTDIR:Q}; fi; \
 	${_CVS_EXTRACT_CACHED.${repo}};					\
-	p="$$(cd ${_CVS_DISTDIR} && ls -t ${PKGBASE}-${CVS_MODULE.${repo}}-* | head -n 1)";	\
+	p="$$(cd ${_CVS_DISTDIR} && ls -t ${PKGBASE}-${CVS_MODULE.${repo}}-* | head -n 1)"; \
 	if [ -n "$$p" ]; then						\
 	  ${STEP_MSG} "Extracting cached CVS archive \"""$$p\".";	\
 	  pax -r -z -f ${_CVS_DISTDIR:Q}/"$$p";				\
@@ -214,8 +238,23 @@ do-cvs-extract: .PHONY
 	${SETENV} ${_CVS_ENV}						\
 	  ${_CVS_CMD} ${_CVS_FLAGS} -d ${CVS_ROOT.${repo}:Q}		\
 	    checkout ${_CVS_CHECKOUT_FLAGS} ${_CVS_TAG_FLAG.${repo}}	\
-	      -d ${repo} ${CVS_MODULE.${repo}:Q};				\
+	      -d ${repo} ${CVS_MODULE.${repo}:Q};			\
 	${_CVS_CREATE_CACHE.${repo}}
 .endfor
 
+# Debug info for show-all and show-all-cvs
+_VARGROUPS+=		cvs
+_PKG_VARS.cvs+=		CVS_ROOT CVS_MODULE CVS_TAG CHECKOUT_DATE CVS_REPOSITORIES
+_SYS_VARS.cvs+=		DISTFILES PKGNAME PKGREVISION
+_SYS_VARS.cvs+=		CVS_ROOT_GNU CVS_ROOT_NONGNU CVS_ROOT_SOURCEFORGE CVS_PROJECT
+_SYS_VARS.cvs+=		_CVS_DISTDIR _CVS_PKGVERSION
+.for repo in ${CVS_REPOSITORIES}
+.  for pkgvar in CVS_ROOT CVS_MODULE CVS_TAG
+_PKG_VARS.cvs+=		${pkgvar}.${repo}
+.  endfor
+.  for sysvar in _CVS_DISTFILE
+_SYS_VARS.cvs+=		${sysvar}.${repo}
+.  endfor
+.endfor
+
 .endif
diff --git a/mk/fossil-package.mk b/mk/fossil-package.mk
index 3198be83d0..aad8a49649 100644
--- a/mk/fossil-package.mk
+++ b/mk/fossil-package.mk
@@ -1,28 +1,28 @@
+# $NetBSD$
+#
 # This file provides simple access to Fossil repositories, so that packages
 # can be created from Fossil instead of from released tarballs.
 #
-# A package using this file shall define the following variables:
-#
-#	FOSSIL_REPOSITORIES
-#		A list of unique identifiers /id/ for which appropriate
-#		FOSSIL_REPO must be defined.
+# Package-settable variables:
 #
-#	FOSSIL_REPO.${id}
-#		The fossil repository
+# FOSSIL_REPOSITORIES (required)
+#	A list of unique identifiers /id/ for which appropriate
+#	FOSSIL_REPO must be defined.
 #
-# It may define the following variables:
+# FOSSIL_REPO.${id} (required)
+#	The fossil repository
 #
-#	FOSSIL_BRANCH.${id}
-#		The branch to check out.
+# FOSSIL_BRANCH.${id} (optional)
+#	The branch to check out.
 #
-#	FOSSIL_REVISION.${id}
-#		The revision to check out.
+# FOSSIL_REVISION.${id} (optional)
+#	The revision to check out.
 #
-#	FOSSIL_TAG.${id}
-#		Overridable FOSSIL tag for a repository.
+# FOSSIL_TAG.${id} (optional)
+#	Overridable FOSSIL tag for a repository.
 #
-#	FOSSIL_ENV.${id}
-#		The environment for fossil, to set e.g. FOSSIL_SSL_NO_VERIFY=true
+# FOSSIL_ENV.${id} (optional)
+#	The environment for fossil, to set e.g. FOSSIL_SSL_NO_VERIFY=true
 
 .if !defined(_PKG_MK_FOSSIL_PACKAGE_MK)
 _PKG_MK_FOSSIL_PACKAGE_MK=	# defined
@@ -144,4 +144,18 @@ do-fossil-extract:
 
 .endfor
 
+# Debug info for show-all and show-all-fossil
+_VARGROUPS+=		fossil
+_PKG_VARS.fossil+=	FOSSIL_REPOSITORIES
+_SYS_VARS.fossil+=	DISTFILES PKGREVISION
+_SYS_VARS.fossil+=	_FOSSIL_PKGVERSION _FOSSIL_DISTDIR
+.for repo in ${FOSSIL_REPOSITORIES}
+.  for varbase in FOSSIL_REPO FOSSIL_MODULE FOSSIL_ENV FOSSIL_BRANCH FOSSIL_REVISION FOSSIL_TAG
+_PKG_VARS.fossil+=	${varbase}.${repo}
+.  endfor
+.  for varbase in _FOSSIL_ENV _FOSSIL_FLAG _FOSSIL_DISTFILE _FOSSIL_CLONE
+_SYS_VARS.fossil+=	${varbase}.${repo}
+.  endfor
+.endfor
+
 .endif
diff --git a/mk/git-package.mk b/mk/git-package.mk
index 3e0b7c004c..c853608f95 100644
--- a/mk/git-package.mk
+++ b/mk/git-package.mk
@@ -118,20 +118,6 @@ PKG_FAIL_REASON+=	"[git-package.mk] GIT_REPO."${repo:Q}" must be set."
 .  endif
 .endfor
 
-# Debug info for show-all and show-all-git
-_VARGROUPS+=		git
-_PKG_VARS.git=		GIT_REPOSITORIES
-_PKG_VARS.git+=		GIT_REPO GIT_MODULE GIT_BRANCH GIT_REVISION GIT_TAG GIT_ENV
-.for repo in ${GIT_REPOSITORIES}
-.  for pkgvar in GIT_REPO GIT_MODULE GIT_BRANCH GIT_REVISION GIT_TAG GIT_ENV
-_PKG_VARS.git+=		${pkgvar}.${repo}
-.  endfor
-.  for sysvar in _GIT_FLAG _GIT_DISTFILE
-_SYS_VARS.git+=		${sysvar}.${repo}
-.  endfor
-.endfor
-_SYS_VARS.git=		DISTFILES PKGREVISION WRKSRC
-
 #
 # Internal variables
 #
@@ -225,4 +211,18 @@ do-git-extract:
 
 .endfor
 
+# Debug info for show-all and show-all-git
+_VARGROUPS+=		git
+_PKG_VARS.git=		GIT_REPOSITORIES
+_PKG_VARS.git+=		GIT_REPO GIT_MODULE GIT_BRANCH GIT_REVISION GIT_TAG GIT_ENV
+_SYS_VARS.git=		DISTFILES PKGREVISION WRKSRC
+.for repo in ${GIT_REPOSITORIES}
+.  for varbase in GIT_REPO GIT_MODULE GIT_BRANCH GIT_REVISION GIT_TAG GIT_ENV
+_PKG_VARS.git+=		${varbase}.${repo}
+.  endfor
+.  for varbase in _GIT_FLAG _GIT_DISTFILE
+_SYS_VARS.git+=		${varbase}.${repo}
+.  endfor
+.endfor
+
 .endif
diff --git a/mk/hg-package.mk b/mk/hg-package.mk
index 1889c3107e..a1498f2891 100644
--- a/mk/hg-package.mk
+++ b/mk/hg-package.mk
@@ -1,5 +1,5 @@
-# $Id: hg-package.mk,v 1.9 2013/02/19 10:28:14 fhajny Exp $
-
+# $NetBSD$
+#
 # This file provides simple access to Mercurial repositories, so that packages
 # can be created from Mercurial instead of from released tarballs.
 #
@@ -14,22 +14,24 @@
 #
 # === Package-settable variables ===
 #
-# A package using this file shall define the following variables:
+# HG_REPOSITORIES (required)
+#	A list of unique identifiers /id/ for which appropriate
+#	HG_REPO must be defined.
+#
+# HG_REPO.${id} (required)
+#	The Mercurial repository URL.
 #
-#	HG_REPOSITORIES
-#		A list of unique identifiers /id/ for which appropriate
-#		HG_REPO must be defined.
+#	Example: https://hg.mozilla.org/projects/nspr
 #
-#	HG_REPO.${id}
-#		The Mercurial repository
+# HG_TAG.${id} (optional)
+#	The Mercurial tag to check out.
 #
-# It may define the following variables:
+#	Default: ${HG_TAG}
 #
-#	HG_TAG
-#		The HG tag to check out (default: HEAD).
+# HG_TAG (optional)
+#	The fallback Mercurial tag to check out.
 #
-#	HG_TAG.${id}
-#		Overridable HG tag for a repository.
+#	Default: HEAD
 #
 
 .if !defined(_PKG_MK_HG_PACKAGE_MK)
@@ -173,4 +175,19 @@ do-hg-extract:
 	fi
 .endfor
 
+# Debug info for show-all and show-all-hg
+_VARGROUPS+=	hg
+_USR_VARS.hg+=	HG_DISTDIR
+_PKG_VARS.hg+=	HG_TAG CHECKOUT_DATE HG_REPOSITORIES
+_SYS_VARS.hg+=	DISTFILES PKGNAME PKGREVISION HG_ROOT_SOURCEFORGE HG_PROJECT
+_SYS_VARS.hg+=	_HG_PKGVERSION
+.for repo in ${HG_REPOSITORIES}
+.  for varbase in HG_REPO HG_MODULE HG_TAG
+_PKG_VARS.hg+=	${varbase}.${repo}
+.  endfor
+.  for varbase in _HG_TAG_FLAG _HG_TAG _HG_DISTFILE
+_SYS_VARS.hg+=	${varbase}.${repo}
+.  endfor
+.endfor
+
 .endif
diff --git a/mk/svn-package.mk b/mk/svn-package.mk
index 73cc9dd705..6c2afa2650 100644
--- a/mk/svn-package.mk
+++ b/mk/svn-package.mk
@@ -1,30 +1,33 @@
+# $NetBSD$
+#
 # This file provides simple access to svn repositories, so that packages
 # can be created from svn instead of from released tarballs.
 #
-# A package using this file shall define the following variables:
+# Package-settable variables:
 #
-#	SVN_REPOSITORIES
-#		A list of unique identifiers /id/ for which appropriate
-#		SVN_REPO must be defined.
+# SVN_REPOSITORIES (required)
+#	A list of unique identifiers /id/ for which appropriate
+#	SVN_REPO must be defined.
 #
-#	SVN_REPO.${id}
-#		The svn repository
+# SVN_REPO.${id} (required)
+#	The svn repository
 #
-#	SVN_MODULE.${id}
-#		The svn module to check out.
+# SVN_MODULE.${id} (optional)
+#	The svn module to check out.
 #
-#               Default value: ${id}
+#	Default value: ${id}
 #
-# It may define the following variables:
+# SVN_BRANCH.${id} (optional)
+#	The branch to check out. Whenever possible, a fixed revision should
+#	be used instead of a branch.
 #
-#	SVN_BRANCH.${id}
-#		The branch to check out.
+# SVN_REVISION.${id} (optional)
+#	The revision to check out.
 #
-#	SVN_REVISION.${id}
-#		The revision to check out.
+# SVN_ENV.${id} (optional)
+#	The environment for the svn command.
 #
-#	SVN_ENV.${id}
-#		The environment for svn
+# Keywords: svn subversion
 
 .if !defined(_PKG_MK_SVN_PACKAGE_MK)
 _PKG_MK_SVN_PACKAGE_MK=	# defined
@@ -134,4 +137,18 @@ do-svn-extract:
 	${_SVN_CREATE_CACHE.${_repo_}};
 .endfor
 
+# Debug info for show-all and show-all-svn
+_VARGROUPS+=	svn
+_PKG_VARS.svn+=	SVN_REPOSITORIES
+_SYS_VARS.svn+=	DISTFILES PKGREVISION
+_SYS_VARS.svn+=	_SVN_PKGVERSION _SVN_DISTDIR
+.for repo in ${SVN_REPOSITORIES}
+.  for varbase in SVN_REPO SVN_MODULE SVN_REVISION SVN_CERTS
+_PKG_VARS.svn+=	${varbase}.${repo}
+.  endfor
+.  for varbase in _SVN_FLAG _SVN_DISTFILE
+_SYS_VARS.svn+=	${varbase}.${repo}
+.  endfor
+.endfor
+
 .endif


Home | Main Index | Thread Index | Old Index