-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_package.sh
59 lines (45 loc) · 1.95 KB
/
create_package.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
source /cvmfs/cms.cern.ch/cmsset_default.sh
SCRAMARCH=slc7_amd64_gcc700
CMSSWVERSION=CMSSW_10_2_13
# Go to a working directory that will be cleaned afterwards
rm -rf tmp_create_package
mkdir -p tmp_create_package
cd tmp_create_package
# Setup environment
export SCRAM_ARCH=${SCRAMARCH} && scramv1 project CMSSW ${CMSSWVERSION}
cd ${CMSSWVERSION}/src/ # tmp_create_package/CMSSW_10_2_13/src/
# git clone the nanoAOD-tools
git clone https://github.com/cms-nanoAOD/nanoAOD-tools.git PhysicsTools/NanoAODTools
cd PhysicsTools/NanoAODTools # tmp_create_package/CMSSW_10_2_13/src/PhysicsTools/NanoAODTools
git checkout e963c70
# Copy the extra files
cp ../../../../../extra/* python/postprocessing/examples
# Get the git information
cd ../../../../../
git diff > tmp_create_package/${CMSSWVERSION}/src/PhysicsTools/NanoAODTools/gitdiff.txt
git status > tmp_create_package/${CMSSWVERSION}/src/PhysicsTools/NanoAODTools/gitstatus.txt
git rev-parse HEAD > tmp_create_package/${CMSSWVERSION}/src/PhysicsTools/NanoAODTools/githash.txt
cd tmp_create_package/${CMSSWVERSION}/src/PhysicsTools/NanoAODTools/
# Setup and compile
cmsenv
scram b -j
# Copy NanoCORE
cp -r ../../../../../NanoTools .
cd NanoTools/NanoCORE # tmp_create_package/CMSSW_10_2_13/src/PhysicsTools/NanoAODTools/NanoTools/NanoCORE
# Re-compile NanoCORE to make sure
make clean
make -j
cd ../../../../ # tmp_create_package/CMSSW_10_2_13/src/
# Tar the PhysicsTools directory
tar -chJf package.tar.gz PhysicsTools \
--exclude="PhysicsTools/NanoAODTools/.git" \
--exclude="PhysicsTools/NanoAODTools/data" \
--exclude="PhysicsTools/NanoAODTools/python/postprocessing/data" \
--exclude="PhysicsTools/NanoAODTools/NanoTools/.git" \
--exclude="PhysicsTools/NanoAODTools/package.tar.gz"
# Copy the package back down to parent directory
mv package.tar.gz ../../../
# Go back down to parent directory and clean up the tmp_create_package
cd ../../../ # back to where I started
rm -rf tmp_create_package