Skip to content

Commit

Permalink
TVB-3110: fixed validating library versions like (8, 6, 0); fixed get…
Browse files Browse the repository at this point in the history
… version for Jenkinsfile-TVBRun
  • Loading branch information
adrianciu committed Nov 22, 2024
1 parent 092d51a commit 73b77c5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tvb_build/Jenkinsfile-TVBRun
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pipeline {
unstash 'step1'
unzip zipFile: 'tvb_build/build/TVB_build_step1.zip', dir: 'tvb_build/docker/step1'
script {
VERSION_TAG = sh(script: "curl -s 'https://raw.githubusercontent.com/the-virtual-brain/tvb-root/master/tvb_framework/pyproject.toml' | grep VERSION | head -1 | tr -d 'VERSION = \"'", returnStdout: true). trim()
VERSION_TAG = sh(script: "curl -s 'https://raw.githubusercontent.com/the-virtual-brain/tvb-root/master/tvb_framework/pyproject.toml' | awk '/\\[project\\]/ {found=1} found && /version/ {print; exit}' | tr -d '\"' | awk -F'=' '{print \$2}'", returnStdout: true).trim()
LAST_SHA = sh(script: "curl -s 'https://api.github.com/repos/the-virtual-brain/tvb-root/commits' | grep sha | head -1 | cut -d ':' -f2 | tr -d '\",'", returnStdout: true).trim()

def dockerContext = "tvb_build/docker"
Expand Down
18 changes: 16 additions & 2 deletions tvb_build/tvb_build/third_party_licenses/build_licenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,20 @@
\n\n\n"


def parse_versions(str_versions: str):
versions = str_versions[1:-1].split(',')
parsed_versions = []
temp = ''
paren_level = 0
for version in versions:
paren_level += version.count('(') - version.count(')')
temp = temp + ',' + version if temp else version
if paren_level == 0:
parsed_versions.append(temp)
temp = ''
return parsed_versions


def _invalid_version(expected, actual):
"""
Check if current found version of 3rd party library is
Expand All @@ -86,7 +100,7 @@ def _invalid_version(expected, actual):
if actual.startswith(expected):
return False
if expected.startswith('['):
expected = expected[1:-1].split(',')
expected = parse_versions(expected)
return actual not in expected
return True

Expand Down Expand Up @@ -169,7 +183,7 @@ def generate_artefact(root_folder_to_introspect, excludes=None, actual_libs=None
# Run stand-alone.
all_libs = parser.read_default()
to_exclude = []
for libname, libattr in all_libs.iteritems():
for libname, libattr in all_libs.items():
if 'Desktop' in libattr["description"] or 'unused' in libattr['env']:
to_exclude.append(libname)
all_libs[libname] = libattr["version"]
Expand Down

0 comments on commit 73b77c5

Please sign in to comment.