diff --git a/Projects/AthDataQuality/CMakeLists.txt b/Projects/AthDataQuality/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..61d4cfbd0a81e5ca968983284c917b64d3aa541a --- /dev/null +++ b/Projects/AthDataQuality/CMakeLists.txt @@ -0,0 +1,87 @@ + +# Set the minimum required CMake version: +cmake_minimum_required( VERSION 3.2 FATAL_ERROR ) + +# Read in the project's version from a file called version.txt. But let it be +# overridden from the command line if necessary. +file( READ ${CMAKE_SOURCE_DIR}/version.txt _version ) +string( STRIP ${_version} _version ) +set( ATHDATAQUALITY_PROJECT_VERSION ${_version} + CACHE STRING "Version of the AthDataQuality project to build" ) +unset( _version ) + +# Set the version of tdaq-common to use for the build: +set( TDAQ-COMMON_VERSION "02-02-00" ) +set( TDAQ-COMMON_ROOT + "$ENV{TDAQ_RELEASE_BASE}/tdaq-common/tdaq-common-${TDAQ-COMMON_VERSION}" ) + +# Set the version of dqm-common to use for the build: +set( DQM-COMMON_VERSION "01-02-00" ) +set( DQM-COMMON_ROOT + "$ENV{TDAQ_RELEASE_BASE}/dqm-common/dqm-common-${DQM-COMMON_VERSION}" ) + +# Pick up the AtlasCMake code: +find_package( AtlasCMake REQUIRED ) + +# Build the project against LCG: +set( LCG_VERSION_POSTFIX "" + CACHE STRING "Version postfix for the LCG release to use" ) +set( LCG_VERSION_NUMBER 88 + CACHE STRING "Version number for the LCG release to use" ) +find_package( LCG ${LCG_VERSION_NUMBER} EXACT REQUIRED ) + +#find_package( ROOT ) +find_package( Xrootd ) +find_package( GSL ) + +# Make CMake find the project specific code we have here: +list( INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/modules ) + +# Set up CTest: +atlas_ctest_setup() + +# Set up a work directory project: +atlas_project( AthDataQuality ${ATHDATAQUALITY_PROJECT_VERSION} + PROJECT_ROOT ${CMAKE_SOURCE_DIR}/../../ ) + +# Generate the environment setup for the externals, to be used during the build: +lcg_generate_env( SH_FILE ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}/env_setup.sh ) + +# Generate replacement rules for the installed paths: +set( _replacements ) +if( NOT "$ENV{NICOS_PROJECT_HOME}" STREQUAL "" ) + get_filename_component( _buildDir $ENV{NICOS_PROJECT_HOME} PATH ) + list( APPEND _replacements ${_buildDir} "\${Athena_DIR}/../../../.." ) +endif() +if( NOT "$ENV{NICOS_PROJECT_RELNAME}" STREQUAL "" ) + list( APPEND _replacements $ENV{NICOS_PROJECT_RELNAME} + "\${Athena_VERSION}" ) +endif() +if( NOT "$ENV{TDAQ_RELEASE_BASE}" STREQUAL "" ) + list( APPEND _replacements $ENV{TDAQ_RELEASE_BASE} + "\${TDAQ_RELEASE_BASE}" ) +endif() + +# Now generate and install the installed setup files: +lcg_generate_env( SH_FILE + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/env_setup_install.sh + REPLACE ${_replacements} ) +install( FILES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/env_setup_install.sh + DESTINATION . RENAME env_setup.sh ) + +# Configure and install the post-configuration file: +string( REPLACE "$ENV{TDAQ_RELEASE_BASE}" "\$ENV{TDAQ_RELEASE_BASE}" + TDAQ-COMMON_ROOT "${TDAQ-COMMON_ROOT}" ) +string( REPLACE "${TDAQ-COMMON_VERSION}" "\${TDAQ-COMMON_VERSION}" + TDAQ-COMMON_ROOT "${TDAQ-COMMON_ROOT}" ) +string( REPLACE "$ENV{TDAQ_RELEASE_BASE}" "\$ENV{TDAQ_RELEASE_BASE}" + DQM-COMMON_ROOT "${DQM-COMMON_ROOT}" ) +string( REPLACE "${DQM-COMMON_VERSION}" "\${DQM-COMMON_VERSION}" + DQM-COMMON_ROOT "${DQM-COMMON_ROOT}" ) +configure_file( ${CMAKE_SOURCE_DIR}/PostConfig.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake @ONLY ) +install( FILES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake + DESTINATION ${CMAKE_INSTALL_CMAKEDIR} ) + +# Set up CPack: +atlas_cpack_setup() diff --git a/Projects/AthDataQuality/PostConfig.cmake.in b/Projects/AthDataQuality/PostConfig.cmake.in new file mode 100644 index 0000000000000000000000000000000000000000..8d8218256cb333bcc7ecd13342b79b6380e2f385 --- /dev/null +++ b/Projects/AthDataQuality/PostConfig.cmake.in @@ -0,0 +1,11 @@ +# +# File taking care of pointing the downstream projects at the right +# version of the externals. +# + +# Set the versions of the TDAQ projects: +set( TDAQ-COMMON_VERSION "@TDAQ-COMMON_VERSION@" ) +set( TDAQ-COMMON_ROOT "@TDAQ-COMMON_ROOT@" ) + +set( DQM-COMMON_VERSION "@DQM-COMMON_VERSION@" ) +set( DQM-COMMON_ROOT "@DQM-COMMON_ROOT@" ) diff --git a/Projects/AthDataQuality/Readme.txt b/Projects/AthDataQuality/Readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f23122a37920a71d4204aba0316136b24fef638 --- /dev/null +++ b/Projects/AthDataQuality/Readme.txt @@ -0,0 +1,5 @@ + +Project build versioning scheme to be updated in AthDataQuality/version.txt + +Whenever PROC builds new Athena 21.0.X, the AthDataQuality is also updated by PROC to 21.0.X.1 +Whenever DQ team builds new AthDataQuality 21.0.X.Y, the AthDataQuality is updated to 21.0.X.(Y+1) diff --git a/Projects/AthDataQuality/build.sh b/Projects/AthDataQuality/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..cf1c7ed70b74856c7147bcb7c0daceea60a04003 --- /dev/null +++ b/Projects/AthDataQuality/build.sh @@ -0,0 +1,128 @@ +#!/bin/bash +# +# Script for building the release on top of externals built using one of the +# scripts in this directory. +# + +# Function printing the usage information for the script +usage() { + echo "Usage: build.sh [-t build type] [-b build dir] [-c] [-m] [-i] [-p] [-a]" + echo " -c: Execute CMake step" + echo " -m: Execute make step" + echo " -i: Execute install step" + echo " -p: Execute CPack step" + echo " -a: Abort on error" + echo "If none of the c, m, i or p options are set then the script will do" + echo "*all* steps. Otherwise only the enabled steps are run - it's your" + echo "reponsibility to ensure that precusors are in good shape" +} + +# Parse the command line arguments: +BUILDDIR="" +BUILDTYPE="RelWithDebInfo" +EXE_CMAKE="" +EXE_MAKE="" +EXE_INSTALL="" +EXE_CPACK="" +NIGHTLY=true +while getopts ":t:b:hcmipa" opt; do + case $opt in + t) + BUILDTYPE=$OPTARG + ;; + b) + BUILDDIR=$OPTARG + ;; + c) + EXE_CMAKE="1" + ;; + m) + EXE_MAKE="1" + ;; + i) + EXE_INSTALL="1" + ;; + p) + EXE_CPACK="1" + ;; + a) + NIGHTLY=false + ;; + h) + usage + exit 0 + ;; + :) + echo "Argument -$OPTARG requires a parameter!" + usage + exit 1 + ;; + ?) + echo "Unknown argument: -$OPTARG" + usage + exit 1 + ;; + esac +done + +# If no step was explicitly specified, turn them all on: +if [ -z "$EXE_CMAKE" -a -z "$EXE_MAKE" -a -z "$EXE_INSTALL" -a -z "$EXE_CPACK" ]; then + EXE_CMAKE="1" + EXE_MAKE="1" + EXE_INSTALL="1" + EXE_CPACK="1" +fi + +# Stop on errors from here on out: +set -e + +# Source in our environment +AthDataQualitySrcDir=$(dirname ${BASH_SOURCE[0]}) +if [ -z "$BUILDDIR" ]; then + BUILDDIR=${AthDataQualitySrcDir}/../../../build +fi +mkdir -p ${BUILDDIR} +BUILDDIR=$(cd ${BUILDDIR} && pwd) +source $AthDataQualitySrcDir/build_env.sh -b $BUILDDIR + +# create the actual build directory +mkdir -p ${BUILDDIR}/build/AthDataQuality +cd ${BUILDDIR}/build/AthDataQuality + +# consider a pipe failed if ANY of the commands fails +set -o pipefail + +# CMake: +if [ -n "$EXE_CMAKE" ]; then + # Remove the CMakeCache.txt file, to force CMake to find externals + # from scratch in an incremental build. + rm -f CMakeCache.txt + # Now run the actual CMake configuration: + time cmake -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} \ + -DCTEST_USE_LAUNCHERS:BOOL=TRUE \ + ${AthDataQualitySrcDir} 2>&1 | tee cmake_config.log +fi + +# for nightly builds we want to get as far as we can +if [ "$NIGHTLY" = true ]; then + # At this point stop worrying about errors: + set +e +fi + +# make: +if [ -n "$EXE_MAKE" ]; then + time make -k 2>&1 | tee cmake_build.log +fi + +# Install the results: +if [ -n "$EXE_INSTALL" ]; then + time make install/fast \ + DESTDIR=${BUILDDIR}/install/AthDataQuality/${NICOS_PROJECT_VERSION} \ + 2>&1 | tee cmake_install.log +fi + +# Build an RPM for the release: +if [ -n "$EXE_CPACK" ]; then + time cpack 2>&1 | tee cmake_cpack.log + cp AthDataQuality*.rpm ${BUILDDIR}/ +fi diff --git a/Projects/AthDataQuality/build_env.sh b/Projects/AthDataQuality/build_env.sh new file mode 100644 index 0000000000000000000000000000000000000000..47d6e42371baa676f7af00dd1f9fd8f8e0987f2f --- /dev/null +++ b/Projects/AthDataQuality/build_env.sh @@ -0,0 +1,101 @@ +# This script sets up the build enironment for an AthDataQuality +# build. +# +# This script is kept separate from the build.sh +# wrapper so it can be sourced separately from it when +# clients want to manage their own build and just want +# to setup the build environment + +env_usage() { + echo "Usage: build_env.sh [-b build dir]" +} + +# This function actually sets up the environment for us +# (factorise it here in case it needs skipped) +env_setup() { + startdir=$(pwd) + # As this script can be sourced we need to support zsh and + # possibly other Bourne shells + if [ "x${BASH_SOURCE[0]}" = "x" ]; then + # This trick should do the right thing under ZSH: + thisdir=$(dirname `print -P %x`) + if [ $? != 0 ]; then + echo "ERROR: This script must be sourced from BASH or ZSH" + return 1 + fi + else + # The BASH solution is a bit more straight forward: + thisdir=$(dirname ${BASH_SOURCE[0]}) + fi + AthDataQualitySrcDir=$(cd ${thisdir};pwd) + + # The directory holding the helper scripts: + scriptsdir=${AthDataQualitySrcDir}/../../Build/AtlasBuildScripts + + # Go to the main directory of the repository: + cd ${AthDataQualitySrcDir}/../.. + + # Check if the user specified any source/build directories: + if [ "$BUILDDIR" = "" ]; then + BUILDDIR=${AthDataQualitySrcDir}/../../../build + fi + + # Set up the environment for the build: + export NICOS_PROJECT_VERSION=`cat ${AthDataQualitySrcDir}/version.txt` + export NICOS_ATLAS_RELEASE=${NICOS_PROJECT_VERSION} + export NICOS_PROJECT_RELNAME=${NICOS_PROJECT_VERSION} + export NICOS_PROJECT_HOME=${BUILDDIR}/install/AthDataQuality + + # Set up the environment variables for finding LCG and the TDAQ externals: + source ${scriptsdir}/LCG_RELEASE_BASE.sh + source ${scriptsdir}/TDAQ_RELEASE_BASE.sh + + # Set up the environment variables necessary to find the CMake code from + # atlasexternals: + extDir=${BUILDDIR}/src/atlasexternals + if [ ! -d ${extDir} ]; then + echo "Didn't find atlasexternals under ${extDir}!" + fi + export AtlasCMake_DIR=${extDir}/Build/AtlasCMake + export LCG_DIR=${extDir}/Build/AtlasLCG + echo "Picking up AtlasCMake from: ${AtlasCMake_DIR}" + echo "Picking up AtlasLCG from : ${LCG_DIR}" + + # Return to the original directory: + cd $startdir +} + +# we need to reset the option index as we are sourcing this script +# http://stackoverflow.com/questions/23581368/bug-in-parsing-args-with-getopts-in-bash +OPTIND=1 + +# Parse the command line arguments: +BUILDDIR="" +while getopts "b:h" opt; do + case $opt in + b) + BUILDDIR=$OPTARG + ;; + h) + env_usage + ABORT=1 + ;; + :) + echo "Argument -$OPTARG requires a parameter!" + env_usage + ABORT=1 + ;; + ?) + echo "Unknown argument: -$OPTARG" + env_usage + ABORT=1 + ;; + esac +done + +# Put a big wrapper around bad argument case, because +# a sourced script should not call "exit". This is quite +# annoying... +if [ -z "$ABORT" ]; then + env_setup +fi diff --git a/Projects/AthDataQuality/build_externals.sh b/Projects/AthDataQuality/build_externals.sh new file mode 100755 index 0000000000000000000000000000000000000000..11afff5cffa7b90b970a4381f219d800cd3821cd --- /dev/null +++ b/Projects/AthDataQuality/build_externals.sh @@ -0,0 +1,117 @@ +#!/bin/bash +# +# Script building all the externals necessary for the nightly build. +# + +# Function printing the usage information for the script +usage() { + echo "Usage: build_externals.sh [-t build_type] [-b build_dir] [-f] [-c]" + echo " -f: Force rebuild of externals from scratch, otherwise if script" + echo " finds an external build present it will only do an incremental" + echo " build. (unused)" + echo " -c: Build the externals for the continuous integration (CI) system," + echo " skipping the build of the externals RPMs. (unused)" + echo "If a build_dir is not given the default is '../build'" + echo "relative to the athena checkout" +} + +# Parse the command line arguments: +BUILDDIR="" +BUILDTYPE="RelWithDebInfo" +FORCE="" +CI="" +while getopts ":t:b:fch" opt; do + case $opt in + t) + BUILDTYPE=$OPTARG + ;; + b) + BUILDDIR=$OPTARG + ;; + f) + FORCE="1" + ;; + c) + CI="1" + ;; + h) + usage + exit 0 + ;; + :) + echo "Argument -$OPTARG requires a parameter!" + usage + exit 1 + ;; + ?) + echo "Unknown argument: -$OPTARG" + usage + exit 1 + ;; + esac +done + +# Version comparison function. Taken from a StackOverflow article. +verlte() { + if [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]; then + return 1 + fi + return 0 +} + +# First off, check that we are using a new enough version of Git. We need +# at least version 1.8.1. +git_min_version=1.8.1 +git_version=`git --version | awk '{print $3}'` +verlte "${git_min_version}" "${git_version}" +if [ $? = 0 ]; then + echo "Detected git version (${git_version}) not new enough." + echo "Need at least: ${git_min_version}" + exit 1 +fi + +# Stop on errors from here on out: +set -e + +# We are in BASH, get the path of this script in a simple way: +thisdir=$(dirname ${BASH_SOURCE[0]}) +thisdir=$(cd ${thisdir};pwd) + +# Go to the main directory of the repository: +cd ${thisdir}/../.. + +# Check if the user specified any source/build directories: +if [ "$BUILDDIR" = "" ]; then + BUILDDIR=${thisdir}/../../../build +fi +mkdir -p ${BUILDDIR} +BUILDDIR=$(cd $BUILDDIR; pwd) + +# Create some directories: +mkdir -p ${BUILDDIR}/src + +# Set some environment variables that the builds use internally: +export NICOS_PROJECT_VERSION=`cat ${thisdir}/version.txt` +export NICOS_ATLAS_RELEASE=${NICOS_PROJECT_VERSION} +export NICOS_PROJECT_RELNAME=${NICOS_PROJECT_VERSION} + +# The directory holding the helper scripts: +scriptsdir=${thisdir}/../../Build/AtlasBuildScripts +scriptsdir=$(cd ${scriptsdir}; pwd) + +# Set the environment variable for finding LCG releases: +source ${scriptsdir}/LCG_RELEASE_BASE.sh + +# Flag for triggering the build of RPMs for the externals: +RPMOPTIONS="-r ${BUILDDIR}" +if [ "$CI" = "1" ]; then + RPMOPTIONS= +fi + +# Read in the tag/branch to use for atlasexternals: +AtlasExternalsVersion=$(awk '/^AtlasExternalsVersion/{print $3}' ${thisdir}/externals.txt) + +# Check out AthenaExternals from the right branch/tag: +${scriptsdir}/checkout_atlasexternals.sh \ + -t ${AtlasExternalsVersion} \ + -s ${BUILDDIR}/src/atlasexternals 2>&1 | tee ${BUILDDIR}/src/checkout.atlasexternals.log diff --git a/Projects/AthDataQuality/externals.txt b/Projects/AthDataQuality/externals.txt new file mode 100644 index 0000000000000000000000000000000000000000..84f7191e0ce85ca285879f1d14e62c2e9a7e0fdf --- /dev/null +++ b/Projects/AthDataQuality/externals.txt @@ -0,0 +1,8 @@ +# Version(s) of the various externals to get/build before starting the build of +# this project, when doing a full stack nightly build. +# +# Remember that when specifying the name of a branch, you *must* put +# an "origin/" prefix before it. For tags however this is explicitly +# forbidden. + +AtlasExternalsVersion = 1.0.25 diff --git a/Projects/AthDataQuality/modules/skeletons/atlas_export_sanitizer.cmake.in b/Projects/AthDataQuality/modules/skeletons/atlas_export_sanitizer.cmake.in new file mode 100644 index 0000000000000000000000000000000000000000..debc9e4ddb5d02e5ea53f750a37d1b772a734943 --- /dev/null +++ b/Projects/AthDataQuality/modules/skeletons/atlas_export_sanitizer.cmake.in @@ -0,0 +1,72 @@ +# +# This script is used to tweak the exported file created by CMake for +# describing the installed targets of a release, not to treat it as a +# fatal error if one of the targets is missing. Which can very much +# be the case in a nightly, if a package fails building. But it should +# not stop the downstream projects from building all together. +# + +# Look for specific target files: +set( _fileName "$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/" ) +set( _fileName "${_fileName}@CMAKE_INSTALL_CMAKEDIR@/" ) +set( _fileName "${_fileName}@CMAKE_PROJECT_NAME@Config-targets-*.cmake" ) +file( GLOB _targetFiles ${_fileName} ) +foreach( _file ${_targetFiles} ) + # Add a line at the end of each file that clears out the + # _IMPORT_CHECK_TARGETS variable. So that no targets would be checked + # at the build configuration time. + file( APPEND "${_file}" + "# Don't check the imported targets:\n" + "set(_IMPORT_CHECK_TARGETS)\n" ) +endforeach() + +# The name of the main file to sanitize: +set( _fileName "$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/" ) +set( _fileName "${_fileName}@CMAKE_INSTALL_CMAKEDIR@/" ) +set( _fileName "${_fileName}@CMAKE_PROJECT_NAME@Config-targets.cmake" ) + +# Read in the generated targets file: +file( READ ${_fileName} _targetsContent ) + +# Do all the necessary string replacements. It has to be done in this +# complicated way, as semicolons in the string are interpreted by string(...) +# as list delimeters. And are removed if I give the content as a single +# value. +set( _outputContent ) +foreach( _element ${_targetsContent} ) + # Lower the level of fatal messages to warning. To make nightlies with + # package failures still useful for code development. + string( REPLACE "FATAL_ERROR" "WARNING" _newContent ${_element} ) + # Make the paths coming from LCG be treated as absolute paths, and not + # relative ones. + if( ${CMAKE_VERSION} VERSION_LESS 3.4.0 ) + string( REPLACE "\${_IMPORT_PREFIX}/\${LCG_RELEASE_BASE}" + "\${LCG_RELEASE_BASE}" _newContent ${_newContent} ) + else() + string( REPLACE "\${_IMPORT_PREFIX}/\\\${LCG_RELEASE_BASE}" + "\\\${LCG_RELEASE_BASE}" _newContent ${_newContent} ) + string( REPLACE "\\\${LCG_RELEASE_BASE}" + "\${LCG_RELEASE_BASE}" _newContent ${_newContent} ) + endif() + # Replace the absolute tdaq paths with ones relying on an environment + # variable: + if( NOT "$ENV{TDAQ_RELEASE_BASE}" STREQUAL "" ) + string( REPLACE "$ENV{TDAQ_RELEASE_BASE}" "\$ENV{TDAQ_RELEASE_BASE}" + _newContent ${_newContent} ) + endif() + # Append it to the full string: + if( _outputContent ) + set( _outputContent "${_outputContent}\;${_newContent}" ) + else() + set( _outputContent "${_newContent}" ) + endif() +endforeach() + +# Overwrite the original file with the new content: +file( WRITE ${_fileName} ${_outputContent} ) + +# Unset all created variables: +unset( _targetsContent ) +unset( _newContent ) +unset( _outputContent ) +unset( _fileName ) diff --git a/Projects/AthDataQuality/package_filters.txt b/Projects/AthDataQuality/package_filters.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e330d7eefcdc198ccc258ff9032a3b6421bb0a9 --- /dev/null +++ b/Projects/AthDataQuality/package_filters.txt @@ -0,0 +1,13 @@ +# +# Packages to build as part of the AthDataQuality project. +# ++ DataQuality/DQDefects ++ DataQuality/DQUtils ++ DataQuality/dqm_algorithms ++ DataQuality/DataQualityInterfaces ++ DataQuality/DataQualityUtils ++ DataQuality/DataQualityConfigurations ++ DataQuality/DCSCalculator2 ++ DataQuality/ZLumiScripts ++ Database/CoraCool +- .* diff --git a/Projects/AthDataQuality/version.txt b/Projects/AthDataQuality/version.txt new file mode 100644 index 0000000000000000000000000000000000000000..637cc5d54c5444f6b22885089e32df0a88507f1a --- /dev/null +++ b/Projects/AthDataQuality/version.txt @@ -0,0 +1 @@ +21.0.45.1