Last active
May 4, 2016 12:06
-
-
Save blinkseb/ef079e273a5b28ca95348f62c4f6f2c5 to your computer and use it in GitHub Desktop.
Small script for bootstrapping the CP3 llbb framework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# Bootstrap a CMSSW installation ready for a given framework version | |
# Usage: ./frameworkBootstrap.sh [-j N] [-o NAME] BRANCH | |
FRAMEWORK_GITHUB_SSH=git@github.com:cp3-llbb/Framework.git | |
FRAMEWORK_GITHUB_RAW=https://raw.githubusercontent.com/cp3-llbb/Framework | |
# Default options | |
CORE=4 | |
OUTPUT="" | |
# Parse command line | |
while [[ $# > 1 ]] | |
do | |
key="$1" | |
case $key in | |
-j|--core) | |
CORE="$2" | |
shift # past argument | |
;; | |
-o|--output) | |
OUTPUT="$2" | |
shift # past argument | |
;; | |
*) | |
# unknown option | |
echo "Usage: ./frameworkBootstrap.sh [-j N] [-o NAME] BRANCH" | |
exit 1 | |
;; | |
esac | |
shift # past argument or value | |
done | |
BRANCH=$1 | |
ARCH=$(curl -s ${FRAMEWORK_GITHUB_RAW}/${BRANCH}/CMSSW.arch) | |
RELEASE=$(curl -s ${FRAMEWORK_GITHUB_RAW}/${BRANCH}/CMSSW.release) | |
DEPENDENCIES=$(curl -s ${FRAMEWORK_GITHUB_RAW}/${BRANCH}/bootstrap_jenkins.sh) | |
if [ -z "$OUTPUT" ]; then | |
OUTPUT=${RELEASE} | |
fi | |
echo "Bootstrapping ${RELEASE} (${ARCH}) for framework branch ${BRANCH} into ${OUTPUT}" | |
echo "" | |
export SCRAM_ARCH=${ARCH} | |
# Setup CMS env | |
source /cvmfs/cms.cern.ch/cmsset_default.sh | |
# Create release | |
scram project -n ${OUTPUT} CMSSW ${RELEASE} | |
pushd ${OUTPUT}/src &> /dev/null | |
cmsenv | |
# Install dependencies | |
eval "${DEPENDENCIES}" | |
# Install framework | |
git clone -b ${BRANCH} -o upstream ${FRAMEWORK_GITHUB_SSH} cp3_llbb/Framework | |
# Configure git remotes | |
pushd cp3_llbb/Framework &> /dev/null | |
source first_setup.sh | |
popd &> /dev/null | |
echo "" | |
echo "Bootstrapping done. Launching build using ${CORE} cores" | |
echo "" | |
scram b -j ${CORE} | |
popd &> /dev/null | |
echo "" | |
echo "All done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment