Skip to content

Instantly share code, notes, and snippets.

@blinkseb
Last active May 4, 2016 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blinkseb/ef079e273a5b28ca95348f62c4f6f2c5 to your computer and use it in GitHub Desktop.
Save blinkseb/ef079e273a5b28ca95348f62c4f6f2c5 to your computer and use it in GitHub Desktop.
Small script for bootstrapping the CP3 llbb framework
#! /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