Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159931068
D12162.id32512.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D12162.id32512.diff
View Options
Index: Mk/bsd.port.mk
===================================================================
--- Mk/bsd.port.mk
+++ Mk/bsd.port.mk
@@ -1575,6 +1575,13 @@
.if !defined(IGNORE_MASTER_SITE_GITHUB) && defined(USE_GITHUB) && empty(USE_GITHUB:Mnodefault)
WRKSRC?= ${WRKDIR}/${GH_PROJECT}-${GH_TAGNAME_EXTRACT}
.endif
+
+.if !default(IGNORE_MASTER_SITE_GITLAB) && defined(USE_GITLAB) && empty(USE_GITLAB:Mnodefault)
+. if empty(USE_GITLAB:Mcommit)
+WRKSRC?= ${WRKDIR}/${GL_PROJECT}-${DISTVERSIONFULL}-${GL_COMMIT}
+. endif
+WRKSRC?= ${WRKDIR}/${GL_PROJECT}-${GL_COMMIT}-${GL_COMMIT}
+.endif
# If the distname is not extracting into a specific subdirectory, have the
# ports framework force extract into a subdirectory so that metadata files
# do not get in the way of the build, and vice-versa.
@@ -2859,6 +2866,12 @@
DEPENDS_TARGET+= clean
DEPENDS_ARGS+= NOCLEANDEPENDS=yes
.endif
+.endif
+
+.if defined(USE_GITLAB) && !${USE_GITLAB:Mnodefault} && empty(GL_COMMIT_DEFAULT)
+check-makevars::
+ @${ECHO_MSG} "GL_COMMIT is a required 40 character hash for use USE_GITLAB"
+ @${FALSE}
.endif
################################################################
Index: Mk/bsd.sites.mk
===================================================================
--- Mk/bsd.sites.mk
+++ Mk/bsd.sites.mk
@@ -583,6 +583,145 @@
.endif # defined(USE_GITHUB)
.endif # !defined(IGNORE_MASTER_SITE_GITHUB)
+.if !defined(IGNORE_MASTER_SITE_GITLAB)
+#
+# In order to use GitLab your port must define USE_GITLAB and the following
+# variables:
+#
+# GL_SITE - site URL hosting GitLab and the project
+# default: https://gitlab.com
+#
+# GL_ACCOUNT - account name of the GitLab user hosting the project
+# default: ${PORTNAME}
+#
+# GL_PROJECT - name of the project on GitLab
+# default: ${PORTNAME}
+#
+# GL_COMMIT - the commit hash of the repository, must be the full hash and
+# is a required variable for GitLab. Optionally setting
+# USE_GITLAB= commit will download the commit instead of
+# DISTVERSIONFULL
+#
+# GL_SUBDIR - directory relative to WRKSRC where to move this distfile's
+# content after extracting.
+#
+# GL_TUPLE - above shortened to [site:]account:project:commit[:group][/subdir]
+#
+.if defined(USE_GITLAB)
+. if defined(GL_TUPLE)
+. for _tuple in ${GL_TUPLE}
+. if${_tuple:C@^(([^:]*://[^:]*)?)(:)?([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\6@:S/^://:C/[a-f0-9]//g}
+check-makevars::
+ @${ECHO_MSG} "The ${_tuple}"
+ @${ECHO_MSG} "GL_TUPLE is improperly formatted or, the commit"
+ @${ECHO_MSG} "section contains something other than [a-f0-9]"
+ @${FALSE}
+. endif
+. endfor
+GL_SITE+= ${GL_TUPLE:C@^(([^:]*://[^:]*)?)(:)?([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\1\7@:S@/:@:@}
+GL_ACCOUNT+= ${GL_TUPLE:C@^(([^:]*://[^:]*)?)(:)?([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\4\7@}
+GL_PROJECT+= ${GL_TUPLE:C@^(([^:]*://[^:]*)?)(:)?([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\5\7@}
+GL_COMMIT+= ${GL_TUPLE:C@^(([^:]*://[^:]*)?)(:)?([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\6\7@}
+GL_SUBDIR+= ${GL_TUPLE:C@^(([^:]*://[^:]*)?)(:)?([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\9\7@:M/*:S/^\///}
+. endif
+
+MASTER_SITE_GITLAB+= ${GL_SITE}/%SUBDIR%
+
+. if !defined(MASTER_SITES) || !${MASTER_SITES:MGL} && !${USE_GITLAB:Mnodefault}
+MASTER_SITES+= GL
+. endif
+
+GL_SITE_DEFAULT= https://gitlab.com
+GL_SITE?= ${GL_SITE_DEFAULT}
+GL_ACCOUNT_DEFAULT= ${PORTNAME}
+GL_ACCOUNT?= ${GL_ACCOUNT_DEFAULT}
+GL_PROJECT_DEFAULT= ${PORTNAME}
+GL_PROJECT?= ${GL_PROJECT_DEFAULT}
+_GITLAB_GROUPS= DEFAULT
+. for _gl_v in GL_SITE GL_ACCOUNT GL_PROJECT GL_COMMIT GL_SUBDIR
+. for _v_ex in ${${_gl_v}}
+_GL_GROUPS= ${_v_ex:S/^${_v_ex:C@:[^/:]+$@@}//:S/^://}
+. if !empty(_GL_GROUPS)
+. for _group in ${_GL_GROUPS:S/,/ /g}
+. if ${_group} == all || ${_group} == ALL || ${_group} == default
+check-makevars::
+ @${ECHO_MSG} "Makefile error: the words all, ALL and default are reserved and cannot be"
+ @${ECHO_MSG} "used in group definitions. Please fix your ${_gl_v}"
+ @${FALSE}
+. endif
+. if !${_GITLAB_GROUPS:M${_group}}
+_GITLAB_GROUPS+= ${_group}
+. endif
+${_gl_v}_${_group}= ${_v_ex:C@^(.*):[^/:]+$@\1@}
+. endfor
+. else
+${_gl_v}_DEFAULT= ${_v_ex:C@^(.*):[^/:]+$@\1@}
+. endif
+. endfor
+. endfor
+GL_SITE:= ${GL_SITE_DEFAULT}
+GL_ACCOUNT:= ${GL_ACCOUNT_DEFAULT}
+GL_PROJECT:= ${GL_PROJECT_DEFAULT}
+GL_COMMIT:= ${GL_COMMIT_DEFAULT}
+GL_SUBDIR:= ${GL_SUBDIR_DEFAULT}
+
+. if ${MASTER_SITES:MGL}
+DISTNAME:= ${GL_PROJECT}-${DISTVERSIONFULL}-${GL_COMMIT}
+. endif
+
+_GITLAB_EXTRACT_SUFX= .tar.gz
+
+_GITLAB_CLONE_DIR?= ${WRKDIR}/git-clone
+_PORTS_DIRECTORIES+= ${_GITLAB_CLONE_DIR}
+. if !${USE_GITLAB:Mnodefault}
+DISTFILES+= ${DISTNAME}${_GITLAB_EXTRACT_SUFX}
+git-clone: git-clone-DEFAULT
+git-clone-DEFAULT: ${_GITLAB_CLONE_DIR}
+ @git clone ${GL_SITE_DEFAULT}/${GL_ACCOUNT_DEFAULT}/${GL_PROJECT_DEFAULT}.git ${_GITLAB_CLONE_DIR}/${GL_PROJECT_DEFAULT}
+ @${ECHO_MSG} "Cloned the default GitLab repository into ${_GITLAB_CLONE_DIR}/${GL_PROJECT_DEFAULT}" | ${FMT_80}
+. endif
+. if !empty(GL_SUBDIR)
+_SITES_extract:= 690:post-extract-gl-DEFAULT
+post-extract-gl-DEFAULT:
+ @${RMDIR} ${WRKSRC}/${GL_SUBDIR_DEFAULT} 2>/dev/null || :
+ @${MKDIR} ${WRKSRC}/${GL_SUBDIR_DEFAULT:H} 2>/dev/null || :
+ @${LN} -s ${GL_SUBDIR_DEFAULT:C/[^\/]//g:C/\//..\//g:S/^$/./} ${WRKSRC}/${GL_SUBDIR_DEFAULT}
+. endif
+. if !empty(_GITLAB_GROUPS:NDEFAULT)
+. for _group in ${_GITLAB_GROUPS:NDEFAULT}
+# We set GL_SITE earlier, we need to verify its not empty
+. if empty(GL_SITE_${_group})
+GL_SITE_${_group}= ${GL_SITE_DEFAULT}
+. endif
+GL_ACCOUNT_${_group}?= ${GL_ACCOUNT_DEFAULT}
+GL_PROJECT_${_group}?= ${GL_PROJECT_DEFAULT}
+GL_COMMIT_${_group}?=
+
+_GL_TUPLE_OUT:= ${_GL_TUPLE_OUT} ${GL_SITE_${_group}}:${GL_ACCOUNT_${_group}}:${GL_PROJECT_${_group}}:${GL_COMMIT_${_group}}:${_group}/${GL_SUBDIR_${_group}}
+DISTNAME_${_group}:= ${GL_PROJECT_${_group}}-${GL_COMMIT_${_group}}
+DISTFILE_${_group}:= ${DISTNAME_${_group}}${_GITLAB_EXTRACT_SUFX}
+DISTFILES:= ${DISTFILES} ${DISTFILE_${_group}}:${_group}
+MASTER_SITES:= ${MASTER_SITES} ${GL_SITE_${_group}}/${GL_ACCOUNT_${_group}}/${GL_PROJECT_${_group}}/repository/${GL_COMMIT_${_group}}/archive.tar.gz?dummy=/:${_group}
+WRKSRC_${_group}:= ${WRKDIR}/${GL_PROJECT_${_group}}-${GL_COMMIT_${_group}}-${GL_COMMIT_${_group}}
+. if !empty(GL_SUBDIR_${_group})
+_SITES_extract:= ${_SITES_extract} 690:post-extract-gl-${_group}
+post-extract-gl-${_group}:
+ @${RMDIR} ${WRKSRC}/${GL_SUBDIR_${_group}} 2>/dev/null || :
+ @${MKDIR} ${WRKSRC}/${GL_SUBDIR_${_group}:H} 2>/dev/null || :
+ @${MV} ${WRKSRC_${_group}} ${WRKSRC}/${GL_SUBDIR_${_group}}
+ @${LN} -s ${WRKSRC:T}/${GL_SUBDIR_${_group}} ${WRKSRC_${_group}}
+. endif
+git-clone: git-clone-${_group}
+git-clone-${_group}: ${_GITLAB_CLONE_DIR}
+ @git clone ${GL_SITE_${_group}}/${GL_ACCOUNT_${_group}}/${GL_PROJECT_${_group}}.git ${_GITLAB_CLONE_DIR}/${GL_PROJECT_${_group}}
+ @${ECHO_MSG} "Cloned the ${_group} GitLab repository into ${_GITLAB_CLONE_DIR}/${GL_PROJECT_${_group}}" | ${FMT_80}
+. endfor
+. endif
+convert-to-gl-tuple:
+ @${ECHO_MSG} ${GL_SITE}:${GL_ACCOUNT}:${GL_PROJECT}:${GL_COMMIT} ${_GL_TUPLE_OUT:S/\/$//}
+.endif # defined(USE_GITLAB)
+.endif # !defined(IGNORE_MASTER_SITE_GITLAB)
+
.if !defined(IGNORE_MASTER_SITE_GNOME)
MASTER_SITE_GNOME+= \
https://download.gnome.org/%SUBDIR%/ \
@@ -1250,11 +1389,19 @@
${MASTER_SITE_LOCAL:S/%SUBDIR%/zi/}
.endif
+# We need to make sure MASTER_SITES_SUBDIRS is set properly
+.if !empty(USE_GITLAB:Mcommit)
+_GL_TAG= ${GL_COMMIT}
+.else
+_GL_TAG= ${DISTVERSIONFULL}
+.endif
+
# Macro magic
MASTER_SITES_ABBREVS= CPAN:PERL_CPAN \
GH:GITHUB \
GHC:GITHUB_CLOUD \
+ GL:GITLAB \
LODEV:LIBREOFFICE_DEV \
NL:NETLIB \
RG:RUBYGEMS \
@@ -1273,6 +1420,7 @@
GIMP:${PORTNAME}/${PORTVERSION:R}/ \
GITHUB:${GH_ACCOUNT}/${GH_PROJECT}/tar.gz/${GH_TAGNAME}?dummy=/ \
GITHUB_CLOUD:${GH_ACCOUNT}/${GH_PROJECT}/ \
+ GITLAB:${GL_ACCOUNT}/${GL_PROJECT}/repository/${_GL_TAG}/archive.tar.gz?dummy=/ \
GNOME:sources/${PORTNAME}/${PORTVERSION:C/^([0-9]+\.[0-9]+).*/\1/} \
GNU:${PORTNAME} \
GNUPG:${PORTNAME} \
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jun 20, 4:16 PM (3 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34121962
Default Alt Text
D12162.id32512.diff (8 KB)
Attached To
Mode
D12162: Add USE_GITLAB support
Attached
Detach File
Event Timeline
Log In to Comment