Commit 7207905c authored by Ben Couturier's avatar Ben Couturier
Browse files

Added project list

parent 657c597e
Pipeline #2338841 passed with stages
in 2 minutes and 8 seconds
......@@ -53,4 +53,4 @@ generate_stacks:
- to_release.json
expire_in: 1 week
script:
- lb-stacks-to-release ./stacks /cvmfs/lhcb.cern.ch/lib/ | tee to_release.json
- lb-stacks-to-release ./data/stacks /cvmfs/lhcb.cern.ch/lib/ | tee to_release.json
......@@ -51,3 +51,12 @@ The project list should contain all *LHCb* project needed in the stack.
The toolchain refers to the release of the external software used by this stack (e.g. LCG 97a in the example).
The *tags* list is a free list that can be used by software querying this metadata.
## Validation and development
This packages uses *pre-commit* to manage its pre-commit hooks.
Make sure that this python package is installed and to install it in the .git subdirectory just run:
```
pre-commit install
```
###############################################################################
# (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
defaultSourceURI: gitlab-cern:lhcb
projects:
- name: Alignment
- name: AlignmentOnline
- name: Allen
- name: Analysis
- name: Bender
- name: Boole
- name: Brunel
- name: Castelao
- name: Curie
- name: Davinci
- name: Detector
- name: Erasmus
- name: Ganga
- name: Gaudi
sourceuri: gitlab-cern:Gaudi:Gaudi
- name: Gauss
- name: Geant4
- name: GitCondDB
- name: Hlt
- name: Kepler
- name: Lbcom
- name: LCG
- name: LHCb
- name: LHCbIntegrationTests
- name: Lovell
- name: Moore
- name: MooreAnalysis
- name: MooreOnline
- name: Noether
- name: Online
- name: Orwell
- name: Panoptes
- name: Panoramix
- name: Phys
- name: Rec
- name: Run2Support
- name: Stripping
- name: Urania
- name: Vandermeer
- name: Vetra
name: lhcbstacks-dev
channels:
- conda-forge
dependencies:
- python =3.8
- pip
# Required to avoid a bug in CentOS's git
- git
# Test tools
- pre-commit
- pylint
# - pyre-check
- pytest
- pytest-cov
......@@ -38,7 +38,8 @@ testing =
[options.entry_points]
console_scripts =
lb-stacks-to-release = lhcbstacks.cli:main
lb-stacks-to-release = lhcbstacks.cli:stacks_to_release_json
lb-projects = lhcbstacks.cli:projects_json
###############################################################################
# Linting
......
......@@ -176,3 +176,16 @@ class LHCbClassicStack(Stack):
tmplist += [self.get_toolchain()]
todo.append((platform, tmplist))
return todo
def list_projects(projects_data):
""" Returns the list of known projects """
info = None
with open(projects_data) as file:
info = yaml.load(file, Loader=yaml.FullLoader)
defaultSourceURI = info["defaultSourceURI"]
projects = info["projects"]
for p in projects:
if "sourceuri" not in p:
p["sourceuri"] = defaultSourceURI + "/" + p["name"]
return projects
......@@ -14,10 +14,18 @@ import json
import lhcbstacks
def main():
def stacks_to_release_json():
parser = argparse.ArgumentParser()
parser.add_argument("stack_dir")
parser.add_argument("siteroot")
args = parser.parse_args()
release = lhcbstacks.list_stacks_to_release(args.stack_dir, args.siteroot)
print(json.dumps(release, indent=4, sort_keys=True))
def projects_json():
parser = argparse.ArgumentParser()
parser.add_argument("projects_data")
args = parser.parse_args()
projects = lhcbstacks.list_projects(args.projects_data)
print(json.dumps(projects, indent=4, sort_keys=True))
###############################################################################
# (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
defaultSourceURI: gitlab-cern:lhcb
projects:
- name: LHCb
- name: Gaudi
sourceuri: gitlab-cern:Gaudi:Gaudi
- name: Gauss
......@@ -16,7 +16,8 @@ import pytest
import lhcbstacks
STACK_DIR = Path(__file__).parent / "data"
STACK_DIR = Path(__file__).parent / "data" / "stacks"
PROJECTS_DATA = Path(__file__).parent / "data" / "projects.yml"
LHCBSITEROOT = "/cvmfs/lhcb.cern.ch/lib"
TEST_STACK = "Run3Analysis202008"
TEST_PROJECT = "DaVinci"
......@@ -105,3 +106,10 @@ def test_stacks_to_release(lhcb_install_area):
result_json = json.dumps(release, sort_keys=True)
expected = '[{"build_tool": "cmt", "name": "CMTStack", "platforms": ["x86_64-centos7-gcc9-do0", "x86_64-centos7-gcc9-opt"], "projects": [["LHCb", "v1r1"]]}, {"build_tool": "cmake", "name": "Run3Analysis202008", "platforms": ["x86_64+avx2+fma-centos7-gcc9-opt", "x86_64-centos7-gcc9-do0"], "projects": [["Analysis", "v32r0"], ["Phys", "v31r1"], ["Rec", "v31r1"], ["Lbcom", "v31r1"], ["LHCb", "v51r1"], ["Gaudi", "v33r2"], ["Detector", "v0r5"], ["DaVinci", "v52r0"], ["LCG", "97a"]]}, {"build_tool": "cmake", "name": "Run3Analysis202008", "platforms": ["x86_64-centos7-clang8-dbg"], "projects": [["DaVinci", "v52r0"]]}]'
assert result_json == expected
def test_list_projects():
release = lhcbstacks.list_projects(PROJECTS_DATA)
result_json = json.dumps(release, sort_keys=True)
expected = '[{"name": "LHCb", "sourceuri": "gitlab-cern:lhcb/LHCb"}, {"name": "Gaudi", "sourceuri": "gitlab-cern:Gaudi:Gaudi"}, {"name": "Gauss", "sourceuri": "gitlab-cern:lhcb/Gauss"}]'
assert result_json == expected
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment