Skip to content
Snippets Groups Projects
Commit f7f9cde4 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

genconfuser.py: exclude <Project>.confdb when scanning the environment

parent 82b26efb
No related branches found
No related tags found
1 merge request!1280Improve configurables db exclusion
...@@ -100,8 +100,6 @@ view-gcc8: ...@@ -100,8 +100,6 @@ view-gcc8:
# Override CMake from the view (too old in LCG 97a) # Override CMake from the view (too old in LCG 97a)
- export PATH="/cvmfs/sft.cern.ch/lcg/contrib/CMake/3.18.3/Linux-x86_64/bin:$PATH" - export PATH="/cvmfs/sft.cern.ch/lcg/contrib/CMake/3.18.3/Linux-x86_64/bin:$PATH"
- PYTHON_MAJOR_VERSION=$(python -c "import sys; print(sys.version_info[0])") - PYTHON_MAJOR_VERSION=$(python -c "import sys; print(sys.version_info[0])")
# Ignore .confdb file from Gaudi installation in LCG view
- export CONFIGURABLE_DB_IGNORE=/cvmfs/sft.cern.ch/lcg/views/LCG_${LCG_VERSION}/x86_64-centos7-gcc8-opt/lib/Gaudi.confdb
- cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGAUDI_USE_PYTHON_MAJOR=${PYTHON_MAJOR_VERSION} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGAUDI_USE_PYTHON_MAJOR=${PYTHON_MAJOR_VERSION} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- ccache -z - ccache -z
# pre-heat ccache cache for GaudiKernel # pre-heat ccache cache for GaudiKernel
......
...@@ -49,7 +49,7 @@ def _inheritsfrom(derived, basenames): ...@@ -49,7 +49,7 @@ def _inheritsfrom(derived, basenames):
return False return False
def loadConfigurableDb(build_dir=None): def loadConfigurableDb(build_dir=None, project_name=None):
''' '''
Equivalent to GaudiKernel.ConfigurableDb.loadConfigurableDb(), but does a Equivalent to GaudiKernel.ConfigurableDb.loadConfigurableDb(), but does a
deep search and executes the '*.confdb' files instead of importing them. deep search and executes the '*.confdb' files instead of importing them.
...@@ -79,10 +79,20 @@ def loadConfigurableDb(build_dir=None): ...@@ -79,10 +79,20 @@ def loadConfigurableDb(build_dir=None):
if f.endswith('.confdb') if f.endswith('.confdb')
] ]
] ]
# - get the list of ignored files
ignored_files = set(
os.environ.get("CONFIGURABLE_DB_IGNORE", "").split(","))
# - load the confdb files # - load the confdb files
for confDb in (set(confDbFiles) - set( for confDb in set(confDbFiles):
os.environ.get("CONFIGURABLE_DB_IGNORE", "").split(","))): if confDb in ignored_files or (project_name
log.debug("\t-loading [%s]..." % confDb) and os.path.basename(confDb) ==
("{}.confdb".format(project_name))):
# skip ignored files and the project's own confdb
log.debug("\t-ignoring [%s]", confDb)
# make sure we count also <project_name>.confdb for GaudiKernel
ignored_files.add(confDb)
continue
log.debug("\t-loading [%s]...", confDb)
try: try:
cfgDb._loadModule(confDb) cfgDb._loadModule(confDb)
except Exception as err: except Exception as err:
...@@ -91,6 +101,8 @@ def loadConfigurableDb(build_dir=None): ...@@ -91,6 +101,8 @@ def loadConfigurableDb(build_dir=None):
log.warning("Could not load file [%s] !", confDb) log.warning("Could not load file [%s] !", confDb)
log.warning("Reason: %s", err) log.warning("Reason: %s", err)
# top up with the regular merged confDb (for the used projects) # top up with the regular merged confDb (for the used projects)
# (make sure GaudiKernel gets the right exclusions)
os.environ["CONFIGURABLE_DB_IGNORE"] = ",".join(ignored_files)
GaudiKernel.ConfigurableDb.loadConfigurableDb() GaudiKernel.ConfigurableDb.loadConfigurableDb()
...@@ -188,6 +200,12 @@ def main(): ...@@ -188,6 +200,12 @@ def main():
help= help=
"build directory where to look for .confdb files (search all subdirectories)" "build directory where to look for .confdb files (search all subdirectories)"
) )
parser.add_option(
"--project-name",
action="store",
help=
"name of the current project (used to exclude spurious versions of the .confdb file for the current project)"
)
parser.set_defaults(root=os.path.join("..", "python")) parser.set_defaults(root=os.path.join("..", "python"))
opts, args = parser.parse_args() opts, args = parser.parse_args()
...@@ -233,7 +251,7 @@ def main(): ...@@ -233,7 +251,7 @@ def main():
except: except:
pass pass
# load configurables database to avoid fake duplicates # load configurables database to avoid fake duplicates
loadConfigurableDb(opts.build_dir) loadConfigurableDb(opts.build_dir, opts.project_name)
# ensure that local configurables are in the database # ensure that local configurables are in the database
try: try:
# Add the local python directories to the python path to be able to import the local # Add the local python directories to the python path to be able to import the local
......
...@@ -988,6 +988,7 @@ function(gaudi_generate_confuserdb) ...@@ -988,6 +988,7 @@ function(gaudi_generate_confuserdb)
add_custom_command(OUTPUT "${output_file}" add_custom_command(OUTPUT "${output_file}"
COMMAND run genconfuser.py COMMAND run genconfuser.py
--build-dir ${CMAKE_BINARY_DIR} --build-dir ${CMAKE_BINARY_DIR}
--project-name ${PROJECT_NAME}
--root ${CMAKE_CURRENT_SOURCE_DIR}/python --root ${CMAKE_CURRENT_SOURCE_DIR}/python
--output "${output_file}" --output "${output_file}"
${ARG_OPTIONS} ${ARG_OPTIONS}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment