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 25, 2024
1 parent 5f37174 commit 7545215
Show file tree
Hide file tree
Showing 4 changed files with 50 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright (c) 2017-2019, Intel Corporation

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Copyright (c) 2011, Zakaria Zajac
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 comments on commit 7545215

Please sign in to comment.