GitLab: Tarball Version Test (#2296)
* GitLab: Tarball Version Test Upload a test demonstrating #2290 * Add GitLab parsing
This commit is contained in:
@@ -154,6 +154,20 @@ def test_version_regular(self):
|
||||
'foo-bar', '1.21',
|
||||
'http://example.com/foo_bar-1.21.tar.gz')
|
||||
|
||||
def test_version_gitlab(self):
|
||||
self.check(
|
||||
'vtk', '7.0.0',
|
||||
'https://gitlab.kitware.com/vtk/vtk/repository/'
|
||||
'archive.tar.bz2?ref=v7.0.0')
|
||||
self.check(
|
||||
'icet', '1.2.3',
|
||||
'https://gitlab.kitware.com/icet/icet/repository/'
|
||||
'archive.tar.gz?ref=IceT-1.2.3')
|
||||
self.check(
|
||||
'foo', '42.1337',
|
||||
'http://example.com/org/foo/repository/'
|
||||
'archive.zip?ref=42.1337bar')
|
||||
|
||||
def test_version_github(self):
|
||||
self.check(
|
||||
'yajl', '1.0.5',
|
||||
|
@@ -106,19 +106,22 @@ def split_url_extension(path):
|
||||
|
||||
1. https://github.com/losalamos/CLAMR/blob/packages/PowerParser_v2.0.7.tgz?raw=true
|
||||
2. http://www.apache.org/dyn/closer.cgi?path=/cassandra/1.2.0/apache-cassandra-1.2.0-rc2-bin.tar.gz
|
||||
3. https://gitlab.kitware.com/vtk/vtk/repository/archive.tar.bz2?ref=v7.0.0
|
||||
|
||||
In (1), the query string needs to be stripped to get at the
|
||||
extension, but in (2), the filename is IN a single final query
|
||||
extension, but in (2) & (3), the filename is IN a single final query
|
||||
argument.
|
||||
|
||||
This strips the URL into three pieces: prefix, ext, and suffix.
|
||||
The suffix contains anything that was stripped off the URL to
|
||||
get at the file extension. In (1), it will be '?raw=true', but
|
||||
in (2), it will be empty. e.g.:
|
||||
in (2), it will be empty. In (3) the suffix is a parameter that follows
|
||||
after the file extension, e.g.:
|
||||
|
||||
1. ('https://github.com/losalamos/CLAMR/blob/packages/PowerParser_v2.0.7', '.tgz', '?raw=true')
|
||||
2. ('http://www.apache.org/dyn/closer.cgi?path=/cassandra/1.2.0/apache-cassandra-1.2.0-rc2-bin',
|
||||
'.tar.gz', None)
|
||||
3. ('https://gitlab.kitware.com/vtk/vtk/repository/archive', '.tar.bz2', '?ref=v7.0.0')
|
||||
"""
|
||||
prefix, ext, suffix = path, '', ''
|
||||
|
||||
@@ -203,6 +206,15 @@ def parse_version_offset(path, debug=False):
|
||||
# https://github.com/hpc/mpileaks/releases/download/v1.0/mpileaks-1.0.tar.gz
|
||||
(r'github.com/[^/]+/[^/]+/releases/download/v?([^/]+)/.*$', path),
|
||||
|
||||
# GitLab syntax:
|
||||
# {baseUrl}{/organization}{/projectName}/repository/archive.{fileEnding}?ref={gitTag}
|
||||
# as with github releases, we hope a version can be found in the
|
||||
# git tag
|
||||
# Search dotted versions:
|
||||
# e.g., https://gitlab.kitware.com/vtk/vtk/repository/archive.tar.bz2?ref=v7.0.0
|
||||
# e.g., https://example.com/org/repo/repository/archive.tar.bz2?ref=SomePrefix-2.1.1
|
||||
(r'\?ref=(?:.*-|v)*((\d+\.)+\d+).*$', suffix),
|
||||
|
||||
# e.g. boost_1_39_0
|
||||
(r'((\d+_)+\d+)$', stem),
|
||||
|
||||
@@ -291,6 +303,7 @@ def parse_name_offset(path, v=None, debug=False):
|
||||
(r'/([^/]+)/(tarball|zipball)/', path),
|
||||
(r'/([^/]+)[_.-](bin|dist|stable|src|sources)[_.-]%s' % v, path),
|
||||
(r'github.com/[^/]+/([^/]+)/archive', path),
|
||||
(r'[^/]+/([^/]+)/repository/archive', path), # gitlab
|
||||
|
||||
(r'([^/]+)[_.-]v?%s' % v, stem), # prefer the stem
|
||||
(r'([^/]+)%s' % v, stem),
|
||||
|
Reference in New Issue
Block a user