-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-src-snapshot.sh
121 lines (103 loc) · 3.16 KB
/
build-src-snapshot.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash
function usage() {
echo "Usage: $(basename $0)"
}
getArgs() {
while [[ $# -gt 0 ]]; do
if [[ "$1" = "--help" || "$1" = "-h" ]]; then
usage
exit 0
elif [[ "$1" = -* ]]; then
echo "Invalid option: $1, or missing argument"
usage
exit 1
elif [[ -z "${archiveFile}" ]]; then
archiveFile="$1"
else
echo "Invalid argument: $1"
usage
exit 1
fi
shift
done
}
setDefaults() {
archiveFile=""
tempDir="${HOME}/safariTemp"
safariHost="orquesta"
safariRepoPath="/usr/src/cvs/safari"
safariUser="rfuhrer"
updateProject="org.eclipse.imp.update"
featureProjects="org.eclipse.imp.runtime.feature org.eclipse.imp.feature org.eclipse.imp.lpg.feature"
# TODO read feature manifests to determine set of plugins
pluginProjects="org.eclipse.imp.cheatsheets org.eclipse.imp.xform org.eclipse.imp.smapi org.eclipse.imp.smapifier org.eclipse.imp.analysis org.eclipse.imp.lpg.runtime org.eclipse.imp.runtime org.eclipse.imp org.eclipse.imp.lpg.metatooling"
safariProjects="$updateProject $featureProjects $pluginProjects"
# TODO Extract this info from a CVS repo descriptor (e.g. ":ext:user@host:path")
polyglotHost="gforge.cis.cornell.edu"
polyglotRepoPath="/cvsroot/polyglot"
polyglotUser="rmfuhrer"
polyglotProjects="polyglot"
x10Host="x10.cvs.sourceforge.net"
x10RepoPath="/cvsroot/x10"
x10User="rmfuhrer"
x10Projects="x10.compiler x10.runtime"
lpgHost="lpg.cvs.sourceforge.net"
lpgRepoPath="/cvsroot/lpg"
lpgUser="rmfuhrer"
lpgProjects="lpg.runtime.java"
# These must be put in place manually
extraProjects="com.ibm.shrike"
}
checkSettings() {
echo "Archiving to $archiveFile"
echo "CVS host is $cvsHost"
echo "CVS repository path is $cvsRepoPath"
echo "Temporary source directory is $tempDir"
if [[ -z "$archiveFile" ]]; then
usage
exit 1
fi
if [[ ! -d "${tempDir}" ]]; then
mkdir ${tempDir}
fi
if [[ ! -d "${tempDir}" ]]; then
echo "Couldn't find/create temporary source directory ${tempDir}"
exit 1
fi
missing=""
for extraProject in ${extraProjects}; do
if [[ ! -d "${tempDir}/$extraProject" ]]; then
echo "You must obtain the source for $extraProject and place it in ${tempDir}"
missing="1"
fi
done
if [[ ! -z "$missing" ]]; then
echo "Missing source; aborting"
exit 1
fi
}
extractFromCVS() {
local cvsHost="$1"
local cvsRepoPath="$2"
local cvsUser="$3"
local cvsProjects="$4"
echo "Extracting source from CVS host ${cvsHost}..."
cvs -d :ext:${cvsUser}@${cvsHost}:${cvsRepoPath} co ${cvsProjects}
}
buildSnapshot() {
cd ${tempDir}
extractFromCVS $polyglotHost $polyglotRepoPath $polyglotUser "$polyglotProjects"
extractFromCVS $lpgHost $lpgRepoPath $lpgUser "$lpgProjects"
extractFromCVS $x10Host $x10RepoPath $x10User "$x10Projects"
extractFromCVS $safariHost $safariRepoPath $safariUser "$safariProjects"
tar czf ${archiveFile} .
echo "Done."
}
main() {
setDefaults
getArgs "$@"
checkSettings
buildSnapshot
}
main "$@"
exit 0