forked from EasyDarwin/EasyDarwin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dobuildit
171 lines (134 loc) · 4.06 KB
/
dobuildit
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/bin/sh
progname=`basename $0`
usage()
{
echo "Usage:";
echo " ${progname} -u cvs-user -r build-revision [-d destination_dir]";
echo
echo " -u cvs-user Your cvs username (typically the same as your NetInfo user)"
echo " -r build-revision The build number. Same as the number in revision.h"
echo " -d destination_dir The (existing) directory you'd like to check out into."
echo " \"/tmp\" is the default"
echo " -T Don't perform a 'cvs tag'"
echo " -F Force a 'cvs tag' (cvs tag -F)"
echo;
echo "${progname} will create a qtssServer-XXX directory, tag it, then run ~rc/bin/buildit on it."
}
echo
if [ `id -u` != 0 ]
then
echo "### You must be root to execute this script ###"
exit 1
fi
args=`getopt u:p:r:d:TFv $*`
stat=$?
if [ ${stat} -ne 0 ]
then
usage;
exit 2;
fi
do_tag=true
force_tag=""
set -- $args
for i
do
case "$i" in
-u) cvs_user=$2; shift; shift;;
-p) project_dir=$2; shift; shift;;
-r) build_number=$2; shift; shift;;
-d) dest_dir=$2; shift; shift;;
-T) do_tag=false; shift;;
-F) force_tag="-F"; shift;;
-v) usage; shift;;
\?) usage; exit 1;;
--) shift; break;;
esac
done
if [ ! ${build_number} ]
then
echo "## Error: Missing build-revision ##"
echo
usage;
exit 1;
fi
if [ ! ${cvs_user} ]
then
echo "## Error: Missing cvs-user ##"
echo
usage;
exit 1;
fi
##
##arguments look good...continue
##
orig_dir=`pwd` #remember our original working directory
slt_repository=/Network/Servers/svrsol/Workgroup/CVS-Repository
slt_parent_module=Servers/Mothra/
## use /tmp if a destination directory is not specified
if [ ! ${dest_dir} ]
then
echo Setting dest_dir to /tmp
dest_dir='/tmp'
fi
echo;echo "##"
echo "## Updating from CVS ##"
echo "##"
project_dirname=qtssServer-${build_number} #set project_dir to absolute path
project_path=${dest_dir}/${project_dirname} #set project_dir to absolute path
##remove and prior attampts
#
if [ -d ${project_path} ]
then
echo;echo Removing ${project_path}
rm -r ${project_path}
fi
##cd into ${dest_dir}
#
cd ${dest_dir}
##checkout main server source
#
echo; echo Checking out StreamingServer to ${project_path}
echo "___________________________________________________"
echo sudo -u ${cvs_user} cvs -d cvs.opensource.apple.com:/cvs/Darwin -s CVS_RSH=ssh -z3 checkout -d ${project_dirname} StreamingServer
sudo -u ${cvs_user} cvs -d cvs.opensource.apple.com:/cvs/Darwin -s CVS_RSH=ssh -z3 checkout -d ${project_dirname} StreamingServer
##cd into ${project_path}
#
cd ${project_path}
##checkout StreamingLoadTool
#
echo;echo Checking out StreamingLoadTool
echo sudo -u ${cvs_user} cvs -d ${slt_repository} -z3 checkout -d StreamingLoadTool ${slt_parent_module}StreamingLoadTool
sudo -u ${cvs_user} cvs -d ${slt_repository} -z3 checkout -d StreamingLoadTool ${slt_parent_module}StreamingLoadTool
if ( ${do_tag} ) then
echo;echo "Tagging current files as qtssServer-${build_number}"
echo "_____________________________________________"
cd ${project_path}
echo cvs ${cvs_options} -q tag ${force_tag} -R qtssServer-${build_number}
sudo -u ${cvs_user} cvs ${cvs_options} -q tag ${force_tag} -R qtssServer-${build_number}
cd ${project_path}/StreamingLoadTool
echo cvs ${cvs_options} -q tag ${force_tag} -R qtssServer-${build_number}
sudo -u ${cvs_user} cvs ${cvs_options} -q tag ${force_tag} -R qtssServer-${build_number}
fi
cd ${orig_dir}
echo "##"
echo "Executing buildit on ${project_path}"
echo "_________________________________________"
echo ~rc/bin/buildit ${project_path}
~rc/bin/buildit ${project_path}
echo "#################################"
echo "#################################"
echo;echo
echo If you would like to submit this project now, type the
echo train name (ex. Cartman) and hit enter:
read train_name
if [ ! ${train_name} ]
then
echo
exit 0;
fi
echo Copying ${project_path} to your home directoy
cp -r ${project_path} ~
cd ~
echo sudo -u ${cvs_user} ~rc/bin/submitproject ${project_dirname} ${train_name}
sudo -u ${cvs_user} ~rc/bin/submitproject ${project_dirname} ${train_name}
exit 0