Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:11:35

0001 #!/bin/bash
0002 
0003 # script updated, cleaned and basically rewritten by Steven Lowette
0004 # when updating to include python, on 7 May 2009
0005 
0006 # check that there is exactly one good command line argument
0007 if   [[ ($# -eq 1) && ($1 == "all") ]] ; then
0008   subdirs="data interface plugins python"
0009 elif [[ ($# -eq 1) && ($1 == "data" || $1 == "interface" || $1 == "plugins" || $1 == "python") ]] ; then
0010   subdirs="$1"
0011 else
0012   echo "No correct target specified, stopping!"
0013   echo "Possibilities are data, interface, plugins, python or all."
0014   exit 1
0015 fi
0016 echo "Command line argument is $1. Good."
0017 
0018 # check that this script is run in the project area that you want to make the copy of
0019 if [ ! -d "cmssw" ] ; then
0020   echo "No cmssw directory found! Check where you are running this script and make sure a cmssw subdir exists"
0021   exit 1
0022 fi
0023 echo "Found a cmssw directory. Good."
0024 
0025 # do the copy
0026 for dirtype in $subdirs ; do
0027   echo "Copying files in $dirtype directories ..."
0028   for cmsswbaseidx in "$CMSSW_RELEASE_BASE" "." ; do
0029     export cmsswbase="${cmsswbaseidx}"
0030     # build list with directories
0031     cd ${cmsswbase}
0032     ls src/*/*/${dirtype} | grep ${dirtype}":" > $OLDPWD/${dirtype}tmp.lst
0033     cd - > /dev/null
0034     awk -F : '{print $1}' ${dirtype}tmp.lst > ${dirtype}.lst
0035     # create necessary directories
0036     awk -F / '{print "mkdir -p cmssw/"$0}' ${dirtype}.lst > ${dirtype}mkdir.sh
0037     . ${dirtype}mkdir.sh
0038     # build a file with stuff to copy
0039     awk -F / '{print "cp -Rp "ENVIRON["cmsswbase"]"/"$0"/* cmssw/"$0}' ${dirtype}.lst > ${dirtype}copy.sh
0040     . ${dirtype}copy.sh
0041     # cleanup
0042     rm -f ${dirtype}tmp.lst ${dirtype}mkdir.sh ${dirtype}copy.sh ${dirtype}.lst
0043     # extra stuff for the python dir needed for PYTHONPATH
0044     if [ ${dirtype} == "python" ] ; then
0045       cp -pLR ${cmsswbase}/python cmssw  # using no-dereference causes problems later
0046     fi
0047   done
0048 done
0049 echo "done."