pkgsrc-Changes archive

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

CVS commit: pkgsrc/mk/fetch



Module Name:    pkgsrc
Committed By:   nikita
Date:           Mon May 23 21:45:45 UTC 2022

Modified Files:
        pkgsrc/mk/fetch: bsd.fetch-vars.mk bsd.fetch.mk sites.mk
Added Files:
        pkgsrc/mk/fetch: gitlab.mk

Log Message:
Add USE_GITLAB, based on github.mk, to make gitlab MASTER_SITE
handling less repetitive.

 To use, set in Makefile:
 DISTNAME=     exampleproject-1.2
 MASTER_SITES= ${MASTER_SITE_GITLAB:=accountname/}

 The following variables alter gitlab.mk behavior:

 GITLAB_PROJECT        defaults to PKGBASE
 GITLAB_TAG            defaults to PKGVERSION_NOREV
                       sometimes you want to override with v${PKGVERSION_NOREV}
                       SHA-1 commit ids are also acceptable
 GITLAB_RELEASE        defaults to not defined, set this to ${DISTNAME}
                       when packaging a release not based on a git tag.
 GITLAB_SUBMODULES     manually set submodule information:
                       values should be:
                       GitLab_user GitLab_project tag_or_hash submodule_path
 GITLAB_TYPE           overrides the autodetected MASTER_SITE URL scheme:


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 pkgsrc/mk/fetch/bsd.fetch-vars.mk
cvs rdiff -u -r1.10 -r1.11 pkgsrc/mk/fetch/bsd.fetch.mk
cvs rdiff -u -r0 -r1.1 pkgsrc/mk/fetch/gitlab.mk
cvs rdiff -u -r1.178 -r1.179 pkgsrc/mk/fetch/sites.mk

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

Modified files:

Index: pkgsrc/mk/fetch/bsd.fetch-vars.mk
diff -u pkgsrc/mk/fetch/bsd.fetch-vars.mk:1.25 pkgsrc/mk/fetch/bsd.fetch-vars.mk:1.26
--- pkgsrc/mk/fetch/bsd.fetch-vars.mk:1.25      Tue Mar 30 16:47:03 2021
+++ pkgsrc/mk/fetch/bsd.fetch-vars.mk   Mon May 23 21:45:45 2022
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.fetch-vars.mk,v 1.25 2021/03/30 16:47:03 ryoon Exp $
+# $NetBSD: bsd.fetch-vars.mk,v 1.26 2022/05/23 21:45:45 nikita Exp $
 #
 # This Makefile fragment is included separately by bsd.pkg.mk and
 # defines some variables which must be defined earlier than where
@@ -54,6 +54,11 @@ _DISTDIR=            ${DISTDIR}/${DIST_SUBDIR}
 # distfile name. It would be better to use ${_GITHUB_DEFAULT_DISTFILES} here,
 # but that gets assigned much later.
 DEFAULT_DISTFILES=     ${DISTNAME}-${GITHUB_TAG}${EXTRACT_SUFX}
+.  elif defined(GITLAB_TAG) && !empty(GITLAB_TAG:M[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]*)
+# If the gitlab tag is a git hash (7 or more hex digits), encode it in the
+# distfile name. It would be better to use ${_GITLAB_DEFAULT_DISTFILES} here,
+# but that gets assigned much later.
+DEFAULT_DISTFILES=     ${DISTNAME}-${GITLAB_TAG}${EXTRACT_SUFX}
 .  else
 DEFAULT_DISTFILES=     ${DISTNAME}${EXTRACT_SUFX}
 .  endif
@@ -66,6 +71,11 @@ DISTFILES+=                  ${_GITHUB_SM_USER}-${_GITH
 .  endfor
 .endif
 
+.if !empty(GITLAB_SUBMODULES)
+.  for _GITLAB_SM_USER _GITLAB_SM_PROJECT _GITLAB_SM_TAG _GITLAB_SM_PLACE in ${GITLAB_SUBMODULES}
+DISTFILES+=                    ${_GITLAB_SM_USER}-${_GITLAB_SM_PROJECT}-${_GITLAB_SM_TAG}${EXTRACT_SUFX}
+.  endfor
+.endif
 
 # File lists, defined early to allow tool dependencies.
 ALLFILES?=     ${DISTFILES} ${PATCHFILES}

Index: pkgsrc/mk/fetch/bsd.fetch.mk
diff -u pkgsrc/mk/fetch/bsd.fetch.mk:1.10 pkgsrc/mk/fetch/bsd.fetch.mk:1.11
--- pkgsrc/mk/fetch/bsd.fetch.mk:1.10   Mon Jul  6 05:03:33 2015
+++ pkgsrc/mk/fetch/bsd.fetch.mk        Mon May 23 21:45:45 2022
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.fetch.mk,v 1.10 2015/07/06 05:03:33 rodent Exp $
+# $NetBSD: bsd.fetch.mk,v 1.11 2022/05/23 21:45:45 nikita Exp $
 #
 # This Makefile fragment is included by bsd.pkg.mk and defines the
 # relevant variables and targets for the "fetch" step.
@@ -39,4 +39,5 @@
 .include "fetch-list.mk"
 .include "distclean.mk"
 .include "github.mk"
+.include "gitlab.mk"
 .include "pypi.mk"

Index: pkgsrc/mk/fetch/sites.mk
diff -u pkgsrc/mk/fetch/sites.mk:1.178 pkgsrc/mk/fetch/sites.mk:1.179
--- pkgsrc/mk/fetch/sites.mk:1.178      Sat May 21 00:44:58 2022
+++ pkgsrc/mk/fetch/sites.mk    Mon May 23 21:45:45 2022
@@ -1,4 +1,4 @@
-# $NetBSD: sites.mk,v 1.178 2022/05/21 00:44:58 gutteridge Exp $
+# $NetBSD: sites.mk,v 1.179 2022/05/23 21:45:45 nikita Exp $
 #
 # This Makefile fragment defines read-only MASTER_SITE_* variables
 # representing some well-known master distribution sites for software.
@@ -21,6 +21,9 @@ MASTER_SITE_GNU+=       \
 MASTER_SITE_GITHUB+=    \
        https://github.com/
 
+MASTER_SITE_GITLAB+=   \
+       https://gitlab.com/
+
 MASTER_SITE_GNUSTEP+=   \
        ftp://ftp.gnustep.org/pub/gnustep/
 

Added files:

Index: pkgsrc/mk/fetch/gitlab.mk
diff -u /dev/null pkgsrc/mk/fetch/gitlab.mk:1.1
--- /dev/null   Mon May 23 21:45:45 2022
+++ pkgsrc/mk/fetch/gitlab.mk   Mon May 23 21:45:45 2022
@@ -0,0 +1,99 @@
+# $NetBSD: gitlab.mk,v 1.1 2022/05/23 21:45:45 nikita Exp $
+#
+# gitlab.com master site handling
+#
+# To use, set in Makefile:
+#
+# DISTNAME=    exampleproject-1.2
+# MASTER_SITES=        ${MASTER_SITE_GITLAB:=accountname/}
+#
+# The following variables alter gitlab.mk behavior:
+#
+# GITLAB_PROJECT       defaults to PKGBASE
+# GITLAB_TAG           defaults to PKGVERSION_NOREV
+#                      sometimes you want to override with v${PKGVERSION_NOREV}
+#                      SHA-1 commit ids are also acceptable
+# GITLAB_RELEASE       defaults to not defined, set this to ${DISTNAME}
+#                      when packaging a release not based on a git tag.
+# GITLAB_SUBMODULES    manually set submodule information:
+#                      values should be:
+#                      GitLab_user GitLab_project tag_or_hash submodule_path
+# GITLAB_TYPE          overrides the autodetected MASTER_SITE URL scheme:
+#
+# "tag"
+# This is the default when GITLAB_RELEASE is not defined. Example URL:
+# https://gitlab.com/acct/${GITLAB_PROJECT}/-/archive/${GITLAB_TAG}/${GITLAB_PROJECT}-${GITLAB_TAG}.tar.gz
+#
+# "release"
+# This is the default when GITLAB_RELEASE is set. Example URL:
+# https://gitlab.com/acct/${GITLAB_PROJECT}/-/archive/${GITLAB_RELEASE}/${DISTNAME}.tar.gz
+#
+# Keywords: gitlab
+
+.if defined(MASTER_SITES) && !empty(MASTER_SITES:C,^https\://gitlab.com/[-a-zA-Z0-9]*/$,match,:Mmatch)
+_USE_GITLAB=           YES
+.elif defined(MASTER_SITES) && !empty(MASTER_SITES:C,^https\://gitlab.com/[-a-zA-Z0-9]*/[-a-zA-Z0-9]*/$,match,:Mmatch)
+_USE_GITLAB=           YES
+.endif
+
+.if (defined(GITLAB_TAG) || defined(GITLAB_RELEASE)) && !defined(_USE_GITLAB)
+PKG_FAIL_REASON+=      "MASTER_SITES must match https://gitlab.com/account/";   \
+                       "when GITLAB_TAG or GITLAB_RELEASE is in use."          \
+                       "For more information: make help topic=gitlab"
+.endif
+
+.if defined(_USE_GITLAB) && !empty(_USE_GITLAB:M[yY][eE][sS])
+
+GITLAB_PROJECT?=       ${PKGBASE}
+GITLAB_TAG?=           ${PKGVERSION_NOREV}
+
+.  if !empty(GITLAB_TAG:Mmaster)
+PKG_FAIL_REASON+=      "master is not a valid tag name, use an explicit commit hash"
+.  endif
+
+.  if !defined(GITLAB_TYPE)
+.    if defined(GITLAB_RELEASE) && !empty(GITLAB_RELEASE)
+GITLAB_TYPE=   release
+.    else
+GITLAB_TYPE=   tag
+.    endif
+.  endif
+
+.  if !empty(GITLAB_TYPE:Mtag) && !empty(GITLAB_TAG:M[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]*)
+# If the gitlab tag is a git hash (7 or more hex digits), encode it in the
+# distfile name.
+_GITLAB_DEFAULT_DISTFILES=     ${DISTNAME}-${GITLAB_TAG}${EXTRACT_SUFX}
+.  else
+_GITLAB_DEFAULT_DISTFILES=     ${DISTNAME}${EXTRACT_SUFX}
+.  endif
+
+.  if !empty(GITLAB_TYPE:Mrelease)
+SITES.${_GITLAB_DEFAULT_DISTFILES}=    ${MASTER_SITES:=${GITLAB_PROJECT}/-/archive/${GITLAB_RELEASE}/}
+.  endif
+
+.  if !empty(GITLAB_TYPE:Mtag)
+SITES.${_GITLAB_DEFAULT_DISTFILES}=    -${MASTER_SITES:=${GITLAB_PROJECT}/-/archive/${GITLAB_TAG}/${GITLAB_PROJECT}-${GITLAB_TAG}${EXTRACT_SUFX}}
+.  endif
+
+.endif
+
+.if !empty(GITLAB_SUBMODULES)
+.  for _GITLAB_SM_USER _GITLAB_SM_PROJECT _GITLAB_SM_TAG _GITLAB_SM_PLACE in ${GITLAB_SUBMODULES}
+_GITLAB_SM_DISTFILE=                   ${_GITLAB_SM_USER}-${_GITLAB_SM_PROJECT}-${_GITLAB_SM_TAG}${EXTRACT_SUFX}
+_GITLAB_DEFAULT_DISTFILES+=            ${_GITLAB_SM_USER}-${_GITLAB_SM_PROJECT}-${_GITLAB_SM_TAG}${EXTRACT_SUFX}
+SITES.${_GITLAB_SM_DISTFILE}=          -${MASTER_SITE_GITLAB:=${_GITLAB_SM_USER}/${_GITLAB_SM_PROJECT}/-/archive/${_GITLAB_SM_TAG}/${_GITLAB_SM_PROJECT}-${_GITLAB_SM_TAG}${EXTRACT_SUFX}}
+EXTRACT_DIR.${_GITLAB_SM_DISTFILE}=    ${WRKSRC}/${_GITLAB_SM_PLACE}
+EXTRACT_OPTS_TAR.${_GITLAB_SM_DISTFILE}=       --strip-components=1
+.  endfor
+.endif
+
+_VARGROUPS+=           gitlab
+_PKG_VARS.gitlab=      GITLAB_PROJECT DISTNAME GITLAB_TYPE GITLAB_TAG \
+                       GITLAB_RELEASE MASTER_SITES EXTRACT_SUFX \
+                       GITLAB_SUBMODULES
+_DEF_VARS.gitlab=      _USE_GITLAB _GITLAB_DEFAULT_DISTFILES
+.for f in ${_GITLAB_DEFAULT_DISTFILES}
+_DEF_VARS.gitlab+=     SITES.${f}
+.endfor
+_USE_VARS.gitlab=      PKGBASE PKGVERSION_NOREV
+_LISTED_VARS.gitlab=   SITES.*



Home | Main Index | Thread Index | Old Index