forked from ekfriis/farmout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackUserCode
executable file
·47 lines (37 loc) · 1.17 KB
/
packUserCode
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
#!/bin/bash
#
# Packs all the necessary binaries, libraries, and data from a CMSSW release
# area into a standalone area.
#
# Usage:
# packUserCode <CMSSW BASE> <output.tgz>
PrintUsage() {
echo "USAGE: packUserCode \$CMSSW_BASE output.tgz"
exit 2
}
MINARGS=2
if [ $# -lt $MINARGS ]; then PrintUsage; fi
logerror() {
echo 2>&1 "$@"
}
die() {
if [ $# -gt 0 ]; then
logerror
logerror "$@"
fi
exit 1
}
release_area="$1"
tgz="$2"
# Move to release area and pack things up.
cd "$release_area" || die "Failed to access $release_area"
# Find data directories stored in working area.
# Note the -L so we will respect packages symlinked into $CMSSW_BASE/src
# The maxdepth 3 so we only tar things of the form: Package/SubPackage/data
src_files="$(find -L src -maxdepth 3 -type d -name data)"
# Pick up python directories
src_files="${src_files} $(find -L src -type d -name python)"
# Note that while the python directory contains symlinks into src/, the "h"
# option to tar follows them as though they are regular files.
tar czf "$tgz" bin lib python $src_files || die \
"Failed to pack working area into $tgz - The command was: "packUserCode $release_area $tgz""