This repository has been archived by the owner on Jan 25, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.txt
286 lines (172 loc) · 7.73 KB
/
README.txt
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
This document describes the setup for building Linux packages (RPMs) of
CellProfiler and its dependencies and publishing them on the web.
SSH is set up to allow logging into the build machines without
paswords, but there have been some problems with this due to a CentOS
6 bug. You should make RSA public and private key files (id_rsa and id_rsa.pub)
in the subdirectory, `ssh_keys`. Then, run `restorecon -R -v /root/.ssh` to make
password-less login work on CentOS 6.
## Environment
Make sure to use Python 2.6 or 2.7, then activate the virtual environment
. venv/bin/activate
## Changing Centos 6 RPM dependencies in CellProfiler
CellProfiler has a spec file stored in its GIT repository:
jenkins/linux/cellprofiler-centos6.spec
Each commit has its own set of dependencies because the
spec file is part of the commit. Dependencies can be
modified and added by editing the "Requires" and
"BuildRequires" sections of the .spec file.
## Files and directories
fabfile.py
: Fabric tasks for building and testing.
htdocs/linux
: This is the directory that is exposed on the web. It contains a subdirectory
: for each Linux distribution. For RPM-based distributions such as CentOS, that
: directory is a yum repository created by createrepo (see below).
ssh_keys
: Contains SSH keys that are installed on the build and test machines by some
: of the fabric tasks.
SPECS
: RPM spec files.
## How to rebuild only CellProfiler
0. Edit SPECS/cellprofiler.spec and update the version, release, and/or
tarname. The tarname should be the git hash. Example:
%define version 2.1.0.Release
%define release 1
%define tarname 0c7fb94
1. Activate the virtualenv.
. venv/bin/activate
2. Make a working directory. This directory will contain RPMs as you build
them and test; you will finally copy them to the website.
$ mkdir foo
$ cd foo
3. Start a clean build machine by going to http://broad.io/imagingcloud,
logging in, and add a vApp based on the template "Cent OS 6 x64" in
the Build Catalog.
4. Wait for the build machine to start and get its IP address,
192.168.195.XXX.
5. Upgrade the operating system and install packages needed to build.
$ fab -H 192.168.195.XXX deploy_build_machine
6. Build the cellprofiler RPM.
$ fab -H 192.168.195.XXX build_cellprofiler_only
7. Start a clean test machine by going to http://broad.io/imagingcloud,
logging in, and add a vApp based on the template "Cent OS 6 x64" in
the Build Catalog.
8. Wait for the test machine to start and get its IP address, 192.168.195.YYY.
9. Upgrade the operating system and install packages needed to test.
$ fab -H 192.168.195.YYY deploy_test_machine
10. Tell the test machine to get the dependencies from the public repository.
$ fab -H 192.168.195.YYY use_public_repo
11. Copy the new RPM to the test machine.
$ fab -H 192.168.195.YYY push
13. Install CellProfiler on the test machine.
$ fab -H 192.168.195.YYY install_cp
(Not 100% sure that this will get the newly built version and not the
version that is in the public repository. Check.)
14. Log in and check that it works to start CellProfiler.
$ ssh -Y johndoe@192.168.195.YYY cellprofiler
15. Add the new RPM files to the public repository.
$ cp *.rpm ../htdocs/linux/centos6/
$ createrepo ../htdocs/linux/centos6/
16. Delete the working directory.
$ cd ..
$ rm -rf foo
## How to build a particular version
1. Create an OAUTH token at github.com (needed to allow the script to
make unlimited calls to the github API). Go to
https://github.com/settings/applications and create a personal access
token with all permissions unchecked.
2. Create and cd into a temporary directory
3. Run fab like this:
$ fab -H 192.168.xxx.xxx build_cellprofiler_version:<git-hash>,<token>
## How to rebuild everything
0. Activate the virtualenv.
. venv/bin/activate
1. Make a working directory. This directory will contain RPMs as you build
them and test; you will finally copy them to the website.
$ mkdir foo
$ cd foo
2. Start a clean build machine by going to http://broad.io/imagingcloud,
logging in, and add a vApp based on the template "Cent OS 6 x64" in
the Build Catalog.
3. Wait for the build machine to start and get its IP address,
192.168.195.XXX.
4. Upgrade the operating system and install packages needed to build.
$ fab -H 192.168.195.XXX deploy_build_machine
5. Copy the contents of the SOURCES directory to the build machine.
$ fab -H 192.168.195.XXX push_sources
6. Build all the RPMs.
$ fab -H 192.168.195.XXX maybe_build_all_rpms
7. If something won't build, modify the .spec file as needed and repeat
step 6 until it works. If you add a file to SOURCES, run step 5 again.
8. Copy all the RPMs from the build machine.
$ fab -H 192.168.195.XXX pull
9. Start a clean test machine by going to http://broad.io/imagingcloud,
logging in, and add a vApp based on the template "Cent OS 6 x64" in
the Build Catalog.
10. Wait for the test machine to start and get its IP address, 192.168.195.YYY.
11. Upgrade the operating system and install packages needed to test.
$ fab -H 192.168.195.YYY deploy_test_machine
12. Copy the RPMs to the test machine.
$ fab -H 192.168.195.YYY push
13. Install CellProfiler on the test machine.
$ fab -H 192.168.195.YYY install_cp
14. Log in and start CellProfiler.
$ ssh -Y johndoe@192.168.195.YYY cellprofiler
15. Add the new RPM files to the public repository.
$ cp *.rpm ../htdocs/linux/centos6/
$ createrepo ../htdocs/linux/centos6/
16. Delete the working directory.
$ cd ..
$ rm -rf foo
## How to build one thing
0. Activate the virtualenv.
. venv/bin/activate
1. Make a working directory. This directory will contain RPMs as you build
them and test; you will finally copy them to the website.
$ mkdir foo
$ cd foo
2. Start a clean build machine by going to http://broad.io/imagingcloud,
logging in, and add a vApp based on the template "Cent OS 6 x64" in
the Build Catalog.
3. Wait for the build machine to start and get its IP address,
192.168.195.XXX.
4. Upgrade the operating system and install packages needed to build.
$ fab -H 192.168.195.XXX deploy_build_machine
5. Copy the contents of the SOURCES directory to the build machine.
$ fab -H 192.168.195.XXX push_sources
6. Push the existing RPMs to the build machine
$ fab -H 192.168.195.XXX push
7. Use public repositories
$ fab -H 192.168.195.xxx use_public_repo
8. Make the single RPM, for instance cellprofiler-foo
$ fab -H 192.168.195.XXX maybe_build_rpm:<package-name>
9. Copy all the RPMs from the build machine.
$ fab -H 192.168.195.XXX pull
## Reindexing a yum repository
After adding or removing RPM files from a yum repository, run createrepo
in order to recreate the index files. For instance:
createrepo htdocs/linux/centos6
## Testing CellProfiler
fab -H 192.168.195.XXX deploy_test_machine
fab -H 192.168.195.XXX install_cp
## How the virtualenv was made
The directory venv is a python virtualenv that contains software needed
to start builds and create repositories. The virtualenv was made as
follows:
1. Create virtualenv
virtualenv --prompt='(linux_repositories)' venv
2. Activate virtualenv
. venv/bin/activate
3. Install createrepo
mkdir venv/src
cd venv/src
wget http://createrepo.baseurl.org/download/createrepo-0.3.6.tar.gz
tar xzf createrepo-0.3.6.tar.gz
cd createrepo-0.3.6
patch < ../../../createrepo-sysconfdir.patch
make prefix=$(dirname $(dirname $(pwd))) install
cd ../../..
# ManuallyrReplace /usr/share with $(dirname $(dirname "$0")) in
# venv/bin/createrepo.
4. Install fabric
pip install fabric