| @@ -1,24 +1,24 @@ | | | @@ -1,24 +1,24 @@ |
1 | <!-- $NetBSD: bulk.xml,v 1.12 2013/12/31 19:27:06 dholland Exp $ --> | | 1 | <!-- $NetBSD: bulk.xml,v 1.13 2014/05/31 20:49:16 asau Exp $ --> |
2 | | | 2 | |
3 | <chapter id="bulk"> | | 3 | <chapter id="bulk"> |
4 | <title>Creating binary packages for everything in pkgsrc (bulk | | 4 | <title>Creating binary packages for everything in pkgsrc (bulk |
5 | builds)</title> | | 5 | builds)</title> |
6 | | | 6 | |
7 | <para>When you have multiple machines that should run the same packages, | | 7 | <para>When you have multiple machines that should run the same packages, |
8 | it is wasted time if they all build their packages themselves from | | 8 | it is wasted time if they all build their packages themselves from |
9 | source. There are two ways of getting a set of binary packages: The old | | 9 | source. There is a ways of getting a set of binary packages: |
10 | bulk build system, or the new (as of 2007) parallel bulk build (pbulk) | | 10 | The bulk build system, or pbulk ("p" stands for "parallel). |
11 | system. This chapter describes how to set them up so that the packages | | 11 | This chapter describes how to set it up so that the packages |
12 | are most likely to be usable later.</para> | | 12 | are most likely to be usable later.</para> |
13 | | | 13 | |
14 | <sect1 id="bulk.pre"> | | 14 | <sect1 id="bulk.pre"> |
15 | <title>Think first, build later</title> | | 15 | <title>Think first, build later</title> |
16 | | | 16 | |
17 | <para>Since a bulk build takes several days or even weeks to finish, you | | 17 | <para>Since a bulk build takes several days or even weeks to finish, you |
18 | should think about the setup before you start everything. Pay attention | | 18 | should think about the setup before you start everything. Pay attention |
19 | to at least the following points:</para> | | 19 | to at least the following points:</para> |
20 | | | 20 | |
21 | <itemizedlist> | | 21 | <itemizedlist> |
22 | | | 22 | |
23 | <listitem><para>If you want to upload the binary packages to | | 23 | <listitem><para>If you want to upload the binary packages to |
24 | ftp.NetBSD.org, make sure the setup complies to the requirements for binary | | 24 | ftp.NetBSD.org, make sure the setup complies to the requirements for binary |
| @@ -72,548 +72,26 @@ temporary filesystems, others must survi | | | @@ -72,548 +72,26 @@ temporary filesystems, others must survi |
72 | | | 72 | |
73 | <listitem><para>1 GB for the pkgsrc tree (read-only, remote, permanent)</para></listitem> | | 73 | <listitem><para>1 GB for the pkgsrc tree (read-only, remote, permanent)</para></listitem> |
74 | | | 74 | |
75 | <listitem><para>5 GB for <filename>LOCALBASE</filename> (read-write, local, temporary for pbulk, permanent for old-bulk)</para></listitem> | | 75 | <listitem><para>5 GB for <filename>LOCALBASE</filename> (read-write, local, temporary for pbulk, permanent for old-bulk)</para></listitem> |
76 | | | 76 | |
77 | <listitem><para>10 GB for the log files (read-write, remote, permanent)</para></listitem> | | 77 | <listitem><para>10 GB for the log files (read-write, remote, permanent)</para></listitem> |
78 | | | 78 | |
79 | <listitem><para>5 GB for temporary files (read-write, local, temporary)</para></listitem> | | 79 | <listitem><para>5 GB for temporary files (read-write, local, temporary)</para></listitem> |
80 | | | 80 | |
81 | </itemizedlist> | | 81 | </itemizedlist> |
82 | | | 82 | |
83 | </sect1> | | 83 | </sect1> |
84 | | | 84 | |
85 | <sect1 id="bulk.old"> | | | |
86 | <title>Running an old-style bulk build</title> | | | |
87 | | | | |
88 | <note><para>There are two ways of doing a bulk build. The old-style | | | |
89 | one and the new-style <quote>pbulk</quote>. The latter is the recommended | | | |
90 | way.</para></note> | | | |
91 | | | | |
92 | <sect2 id="binary.configuration"> | | | |
93 | <title>Configuration</title> | | | |
94 | | | | |
95 | <!-- begin old --> | | | |
96 | <sect3 id="binary.bulk.build.conf"> | | | |
97 | <title><filename>build.conf</filename></title> | | | |
98 | | | | |
99 | <para>The <filename>build.conf</filename> file is the main | | | |
100 | configuration file for bulk builds. You can configure how your | | | |
101 | copy of pkgsrc is kept up to date, how the distfiles are | | | |
102 | downloaded, how the packages are built and how the report is | | | |
103 | generated. You can find an annotated example file in | | | |
104 | <filename>pkgsrc/mk/bulk/build.conf-example</filename>. To use | | | |
105 | it, copy <filename>build.conf-example</filename> to | | | |
106 | <filename>build.conf</filename> and edit it, following the | | | |
107 | comments in that file.</para> | | | |
108 | </sect3> | | | |
109 | | | | |
110 | <sect3 id="binary.mk.conf"> | | | |
111 | <title>&mk.conf;</title> | | | |
112 | | | | |
113 | <para>You may want to set variables in &mk.conf;. | | | |
114 | Look at <filename>pkgsrc/mk/defaults/mk.conf</filename> for | | | |
115 | details of the default settings. You will want to ensure that | | | |
116 | <varname>ACCEPTABLE_LICENSES</varname> meet your local policy. | | | |
117 | As used in this example, <varname>SKIP_LICENSE_CHECK=yes</varname> | | | |
118 | completely bypasses the license check.</para> | | | |
119 | | | | |
120 | <programlisting> | | | |
121 | PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH} | | | |
122 | WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc | | | |
123 | BSDSRCDIR= /usr/src | | | |
124 | BSDXSRCDIR= /usr/xsrc # for x11/xservers | | | |
125 | OBJHOSTNAME?= yes # use work.`hostname` | | | |
126 | FAILOVER_FETCH= yes # insist on the correct checksum | | | |
127 | PKG_DEVELOPER?= yes | | | |
128 | SKIP_LICENSE_CHECK= yes | | | |
129 | </programlisting> | | | |
130 | | | | |
131 | <para>Some options that are especially useful for bulk builds | | | |
132 | can be found at the top lines of the file | | | |
133 | <filename>mk/bulk/bsd.bulk-pkg.mk</filename>. The most useful | | | |
134 | options of these are briefly described here.</para> | | | |
135 | | | | |
136 | <itemizedlist> | | | |
137 | | | | |
138 | <listitem><para>If you are on a slow machine, you may want to | | | |
139 | set <varname>USE_BULK_BROKEN_CHECK</varname> to | | | |
140 | <quote>no</quote>.</para></listitem> | | | |
141 | | | | |
142 | <listitem><para>If you are doing bulk builds from a read-only | | | |
143 | copy of pkgsrc, you have to set <varname>BULKFILESDIR</varname> | | | |
144 | to the directory where all log files are created. Otherwise the | | | |
145 | log files are created in the pkgsrc directory.</para></listitem> | | | |
146 | | | | |
147 | <listitem><para>Another important variable is | | | |
148 | <varname>BULK_PREREQ</varname>, which is a list of packages that | | | |
149 | should be always available while building other | | | |
150 | packages.</para></listitem> | | | |
151 | | | | |
152 | </itemizedlist> | | | |
153 | | | | |
154 | <para>Some other options are scattered in the pkgsrc | | | |
155 | infrastructure:</para> | | | |
156 | | | | |
157 | <itemizedlist> | | | |
158 | | | | |
159 | <listitem><para><varname>ALLOW_VULNERABLE_PACKAGES</varname> | | | |
160 | should be set to <literal>yes</literal>. The purpose of the | | | |
161 | bulk builds is creating binary packages, no matter if they | | | |
162 | are vulnerable or not. Leaving this variable unset would | | | |
163 | prevent the bulk build system from even trying to build | | | |
164 | them, so possible building errors would not show | | | |
165 | up.</para></listitem> | | | |
166 | | | | |
167 | <listitem><para><varname>CHECK_FILES</varname> | | | |
168 | (<filename>pkgsrc/mk/check/check-files.mk</filename>) can be set to | | | |
169 | <quote>yes</quote> to check that the installed set of files | | | |
170 | matches the <filename>PLIST</filename>.</para></listitem> | | | |
171 | | | | |
172 | <listitem><para><varname>CHECK_INTERPRETER</varname> | | | |
173 | (<filename>pkgsrc/mk/check/check-interpreter.mk</filename>) can be set to | | | |
174 | <quote>yes</quote> to check that the installed | | | |
175 | <quote>#!</quote>-scripts will find their | | | |
176 | interpreter.</para></listitem> | | | |
177 | | | | |
178 | <listitem><para><varname>PKGSRC_RUN_TEST</varname> can be | | | |
179 | set to <quote><literal>yes</literal></quote> to run each | | | |
180 | package's self-test before installing it. Note that some | | | |
181 | packages make heavy use of <quote>good</quote> random | | | |
182 | numbers, so you need to assure that the machine on which you | | | |
183 | are doing the bulk builds is not completely idle. Otherwise | | | |
184 | some test programs will seem to hang, while they are just | | | |
185 | waiting for new random data to be | | | |
186 | available.</para></listitem> | | | |
187 | | | | |
188 | </itemizedlist> | | | |
189 | | | | |
190 | </sect3> | | | |
191 | | | | |
192 | <sect3 id="pre-build.local"> | | | |
193 | <title><filename>pre-build.local</filename></title> | | | |
194 | | | | |
195 | <para>It is possible to configure the bulk build to perform | | | |
196 | certain site-specific tasks at the end of the pre-build | | | |
197 | stage. If the file | | | |
198 | <filename>pre-build.local</filename> exists in | | | |
199 | <filename>/usr/pkgsrc/mk/bulk</filename>, it will be executed | | | |
200 | (as a &man.sh.1; script) at the end of the usual pre-build | | | |
201 | stage. An example use of | | | |
202 | <filename>pre-build.local</filename> is to have the line:</para> | | | |
203 | | | | |
204 | <screen>echo "I do not have enough disk space to build this pig." \ | | | |
205 | > misc/openoffice/$BROKENF</screen> | | | |
206 | | | | |
207 | <para>to prevent the system from trying to build a particular package | | | |
208 | which requires nearly 3 GB of disk space.</para> | | | |
209 | </sect3> | | | |
210 | </sect2> | | | |
211 | | | | |
212 | <sect2 id="other-environmental-considerations"> | | | |
213 | <title>Other environmental considerations</title> | | | |
214 | | | | |
215 | <para>As <filename>/usr/pkg</filename> will be completely | | | |
216 | deleted at the start of bulk builds, make sure your login | | | |
217 | shell is placed somewhere else. Either drop it into | | | |
218 | <filename>/usr/local/bin</filename> (and adjust your login | | | |
219 | shell in the passwd file), or (re-)install it via | | | |
220 | &man.pkg.add.1; from <filename>/etc/rc.local</filename>, so | | | |
221 | you can login after a reboot (remember that your current | | | |
222 | process won't die if the package is removed, you just can't | | | |
223 | start any new instances of the shell any more). Also, if you | | | |
224 | use &os; earlier than 1.5, or you still want to use the pkgsrc | | | |
225 | version of ssh for some reason, be sure to install ssh before | | | |
226 | starting it from <filename>rc.local</filename>:</para> | | | |
227 | | | | |
228 | <programlisting> | | | |
229 | (cd /usr/pkgsrc/security/ssh && make bulk-install) | | | |
230 | if [ -f /usr/pkg/etc/rc.d/sshd ]; then | | | |
231 | /usr/pkg/etc/rc.d/sshd | | | |
232 | fi | | | |
233 | </programlisting> | | | |
234 | | | | |
235 | <para>Not doing so will result in you being not able to log in | | | |
236 | via ssh after the bulk build is finished or if the machine | | | |
237 | gets rebooted or crashes. You have been warned! :)</para> | | | |
238 | </sect2> | | | |
239 | | | | |
240 | <sect2 id="operation"> | | | |
241 | <title>Operation</title> | | | |
242 | | | | |
243 | <para>Make sure you don't need any of the packages still | | | |
244 | installed.</para> | | | |
245 | | | | |
246 | <warning> | | | |
247 | <para>During the bulk build, <emphasis>all packages, their | | | |
248 | configuration files and some more files from | | | |
249 | <filename>/var</filename>, <filename>/home</filename> and | | | |
250 | possibly other locations will be removed! So don't run a bulk | | | |
251 | build with privileges that might harm your | | | |
252 | system.</emphasis></para> | | | |
253 | </warning> | | | |
254 | | | | |
255 | <para>Be sure to remove all other things that might | | | |
256 | interfere with builds, like some libs installed in | | | |
257 | <filename>/usr/local</filename>, etc. then become root and type:</para> | | | |
258 | | | | |
259 | <screen> | | | |
260 | &rprompt; <userinput>cd /usr/pkgsrc</userinput> | | | |
261 | &rprompt; <userinput>sh mk/bulk/build</userinput> | | | |
262 | </screen> | | | |
263 | | | | |
264 | <para>If for some reason your last build didn't complete (power | | | |
265 | failure, system panic, ...), you can continue it by | | | |
266 | running:</para> | | | |
267 | | | | |
268 | <screen>&rprompt; <userinput>sh mk/bulk/build restart</userinput></screen> | | | |
269 | | | | |
270 | <para>At the end of the bulk build, you will get a summary via mail, | | | |
271 | and find build logs in the directory specified by | | | |
272 | <varname>FTP</varname> in the <filename>build.conf</filename> | | | |
273 | file.</para> | | | |
274 | </sect2> | | | |
275 | | | | |
276 | <sect2 id="what-it-does"> | | | |
277 | <title>What it does</title> | | | |
278 | | | | |
279 | <para>The bulk builds consist of three steps:</para> | | | |
280 | | | | |
281 | <variablelist> | | | |
282 | <varlistentry> | | | |
283 | <term>1. pre-build</term> | | | |
284 | | | | |
285 | <listitem> | | | |
286 | <para>The script updates your pkgsrc tree via (anon)cvs, then | | | |
287 | cleans out any broken distfiles, and removes all | | | |
288 | packages installed.</para> | | | |
289 | </listitem> | | | |
290 | </varlistentry> | | | |
291 | | | | |
292 | <varlistentry> | | | |
293 | <term>2. the bulk build</term> | | | |
294 | | | | |
295 | <listitem> | | | |
296 | <para>This is basically <quote>make bulk-package</quote> with | | | |
297 | an optimised order in which packages will be | | | |
298 | built. Packages that don't require other packages will | | | |
299 | be built first, and packages with many dependencies will | | | |
300 | be built later.</para> | | | |
301 | </listitem> | | | |
302 | </varlistentry> | | | |
303 | | | | |
304 | <varlistentry> | | | |
305 | <term>3. post-build</term> | | | |
306 | | | | |
307 | <listitem> | | | |
308 | <para>Generates a report that's placed in the directory | | | |
309 | specified in the <filename>build.conf</filename> file | | | |
310 | named <filename>broken.html</filename>, a short version | | | |
311 | of that report will also be mailed to the build's | | | |
312 | admin.</para> | | | |
313 | </listitem> | | | |
314 | </varlistentry> | | | |
315 | </variablelist> | | | |
316 | | | | |
317 | <para>During the build, a list of broken packages will be compiled | | | |
318 | in <filename>/usr/pkgsrc/.broken</filename> (or | | | |
319 | <filename>.../.broken.${MACHINE}</filename> if | | | |
320 | <varname>OBJMACHINE</varname> is set), individual build logs | | | |
321 | of broken builds can be found in the package's | | | |
322 | directory. These files are used by the bulk-targets to mark | | | |
323 | broken builds to not waste time trying to rebuild them, and | | | |
324 | they can be used to debug these broken package builds | | | |
325 | later.</para> | | | |
326 | </sect2> | | | |
327 | | | | |
328 | <sect2 id="disk-space-requirements"> | | | |
329 | <title>Disk space requirements</title> | | | |
330 | | | | |
331 | <para>Currently, roughly the following requirements are valid for | | | |
332 | NetBSD 6.99/amd64:</para> | | | |
333 | | | | |
334 | <itemizedlist> | | | |
335 | <listitem> | | | |
336 | <para>40 GB - distfiles (NFS ok)</para> | | | |
337 | </listitem> | | | |
338 | | | | |
339 | <listitem> | | | |
340 | <para>30 GB - full set of all binaries (NFS ok)</para> | | | |
341 | </listitem> | | | |
342 | | | | |
343 | <listitem> | | | |
344 | <para>5 GB - temp space for compiling (local disk recommended)</para> | | | |
345 | </listitem> | | | |
346 | </itemizedlist> | | | |
347 | | | | |
348 | <para>Note that all pkgs will be de-installed as soon as they are | | | |
349 | turned into a binary package, and that sources are removed, | | | |
350 | so there is no excessively huge demand to disk | | | |
351 | space. Afterwards, if the package is needed again, it will | | | |
352 | be installed via &man.pkg.add.1; instead of building again, so | | | |
353 | there are no cycles wasted by recompiling.</para> | | | |
354 | </sect2> | | | |
355 | | | | |
356 | <sect2 id="setting-up-a-sandbox"> | | | |
357 | <title>Setting up a sandbox for chrooted builds</title> | | | |
358 | | | | |
359 | <para>If you don't want all the packages nuked from a machine | | | |
360 | (rendering it useless for anything but pkg compiling), there | | | |
361 | is the possibility of doing the package bulk build inside a | | | |
362 | chroot environment.</para> | | | |
363 | | | | |
364 | <para>The first step is to set up a chroot sandbox, | | | |
365 | e.g. <filename>/usr/sandbox</filename>. This can be done by | | | |
366 | using null mounts, or manually.</para> | | | |
367 | | | | |
368 | <para>There is a shell script called | | | |
369 | <filename>mksandbox</filename> installed by the <filename | | | |
370 | role="pkg">pkgtools/mksandbox</filename> package, which will set | | | |
371 | up the sandbox environment using null mounts. It will also | | | |
372 | create a script called <filename>sandbox</filename> in the | | | |
373 | root of the sandbox environment, which will allow the null | | | |
374 | mounts to be activated using the <command>sandbox | | | |
375 | mount</command> command and deactivated using the | | | |
376 | <command>sandbox umount</command> command.</para> | | | |
377 | | | | |
378 | <para>To set up a sandbox environment by hand, after extracting all | | | |
379 | the sets from a &os; installation or doing a <command>make | | | |
380 | distribution DESTDIR=/usr/sandbox</command> in | | | |
381 | <filename>/usr/src/etc</filename>, be sure the following items | | | |
382 | are present and properly configured:</para> | | | |
383 | | | | |
384 | <procedure> | | | |
385 | <step> | | | |
386 | <para>Kernel</para> | | | |
387 | | | | |
388 | <screen>&rprompt; <userinput>cp /netbsd /usr/sandbox</userinput></screen> | | | |
389 | </step> | | | |
390 | | | | |
391 | <step> | | | |
392 | <para><filename>/dev/*</filename></para> | | | |
393 | | | | |
394 | <screen>&rprompt; <userinput>cd /usr/sandbox/dev ; sh MAKEDEV all</userinput></screen> | | | |
395 | </step> | | | |
396 | | | | |
397 | <step> | | | |
398 | <para><filename>/etc/resolv.conf</filename> (for <filename | | | |
399 | role="pkg">security/smtpd</filename> and mail):</para> | | | |
400 | | | | |
401 | <screen>&rprompt; <userinput>cp /etc/resolv.conf /usr/sandbox/etc</userinput></screen> | | | |
402 | </step> | | | |
403 | | | | |
404 | <step> | | | |
405 | <para>Working(!) mail config (hostname, sendmail.cf):</para> | | | |
406 | | | | |
407 | <screen>&rprompt; <userinput>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</userinput></screen> | | | |
408 | </step> | | | |
409 | | | | |
410 | <step> | | | |
411 | <para><filename>/etc/localtime</filename> (for <filename | | | |
412 | role="pkg">security/smtpd</filename>):</para> | | | |
413 | | | | |
414 | <screen>&rprompt; <userinput>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</userinput></screen> | | | |
415 | </step> | | | |
416 | | | | |
417 | <step> | | | |
418 | | | | |
419 | <para><filename>/usr/src</filename> (system sources, | | | |
420 | rarely used by packages if at all:</para> | | | |
421 | | | | |
422 | <screen>&rprompt; <userinput>ln -s ../disk1/cvs .</userinput> | | | |
423 | &rprompt; <userinput>ln -s cvs/src-2.0 src</userinput></screen> | | | |
424 | </step> | | | |
425 | | | | |
426 | <step> | | | |
427 | <para>Create <filename>/var/db/pkg</filename> (not part of default install):</para> | | | |
428 | | | | |
429 | <screen>&rprompt; <userinput>mkdir /usr/sandbox/var/db/pkg</userinput></screen> | | | |
430 | </step> | | | |
431 | | | | |
432 | <step> | | | |
433 | <para>Create <filename>/usr/pkg</filename> (not part of default install):</para> | | | |
434 | | | | |
435 | <screen>&rprompt; <userinput>mkdir /usr/sandbox/usr/pkg</userinput></screen> | | | |
436 | </step> | | | |
437 | | | | |
438 | <step> | | | |
439 | <para>Checkout pkgsrc via cvs into | | | |
440 | <filename>/usr/sandbox/usr/pkgsrc</filename>:</para> | | | |
441 | | | | |
442 | <screen> | | | |
443 | &rprompt; <userinput>cd /usr/sandbox/usr</userinput> | | | |
444 | &rprompt; <userinput>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</userinput> | | | |
445 | </screen> | | | |
446 | | | | |
447 | <para>Do not mount/link this to the copy of your pkgsrc tree | | | |
448 | you do development in, as this will likely cause problems!</para> | | | |
449 | </step> | | | |
450 | | | | |
451 | <step> | | | |
452 | <para>Make | | | |
453 | <filename>/usr/sandbox/usr/pkgsrc/packages</filename> and | | | |
454 | <filename>.../distfiles</filename> point somewhere | | | |
455 | appropriate. NFS- and/or nullfs-mounts may come in handy!</para> | | | |
456 | </step> | | | |
457 | | | | |
458 | <step> | | | |
459 | <para>Edit &mk.conf;, see <xref linkend="binary.mk.conf"/>.</para> | | | |
460 | </step> | | | |
461 | | | | |
462 | <step> | | | |
463 | <para>Adjust <filename>mk/bulk/build.conf</filename> to suit your needs.</para> | | | |
464 | </step> | | | |
465 | </procedure> | | | |
466 | | | | |
467 | <para>When the chroot sandbox is set up, you can start | | | |
468 | the build with the following steps:</para> | | | |
469 | | | | |
470 | <screen> | | | |
471 | &rprompt; <userinput>cd /usr/sandbox/usr/pkgsrc</userinput> | | | |
472 | &rprompt; <userinput>sh mk/bulk/do-sandbox-build</userinput> | | | |
473 | </screen> | | | |
474 | | | | |
475 | <para>This will just jump inside the sandbox and start building. At | | | |
476 | the end of the build, mail will be sent with the results of | | | |
477 | the build. Created binary pkgs will be in | | | |
478 | <filename>/usr/sandbox/usr/pkgsrc/packages</filename> | | | |
479 | (wherever that points/mounts to/from).</para> | | | |
480 | </sect2> | | | |
481 | | | | |
482 | <sect2 id="building-a-partial-set"> | | | |
483 | <title>Building a partial set of packages</title> | | | |
484 | | | | |
485 | <para>In addition to building a complete set of all packages in | | | |
486 | pkgsrc, the <filename>pkgsrc/mk/bulk/build</filename> script | | | |
487 | may be used to build a subset of the packages contained in | | | |
488 | pkgsrc. By setting <varname>SPECIFIC_PKGS</varname> | | | |
489 | in &mk.conf;, the variables</para> | | | |
490 | | | | |
491 | <itemizedlist> | | | |
492 | <listitem><para>SITE_SPECIFIC_PKGS</para></listitem> | | | |
493 | <listitem><para>HOST_SPECIFIC_PKGS</para></listitem> | | | |
494 | <listitem><para>GROUP_SPECIFIC_PKGS</para></listitem> | | | |
495 | <listitem><para>USER_SPECIFIC_PKGS</para></listitem> | | | |
496 | </itemizedlist> | | | |
497 | | | | |
498 | <para>will define the set of packages which should be built. | | | |
499 | The bulk build code will also include any packages which are | | | |
500 | needed as dependencies for the explicitly listed packages.</para> | | | |
501 | | | | |
502 | <para>One use of this is to do a bulk build with | | | |
503 | <varname>SPECIFIC_PKGS</varname> in a chroot sandbox | | | |
504 | periodically to have a complete set of the binary packages | | | |
505 | needed for your site available without the overhead of | | | |
506 | building extra packages that are not needed.</para> | | | |
507 | | | | |
508 | </sect2> | | | |
509 | | | | |
510 | <sect2 id="bulk-upload"> | | | |
511 | <title>Uploading results of a bulk build</title> | | | |
512 | | | | |
513 | <para>This section describes how pkgsrc developers can upload binary | | | |
514 | pkgs built by bulk builds to ftp.NetBSD.org.</para> | | | |
515 | | | | |
516 | <para>If you would like to automatically create checksum files for the | | | |
517 | binary packages you intend to upload, remember to set | | | |
518 | <varname>MKSUMS=yes</varname> in your | | | |
519 | <filename>mk/bulk/build.conf</filename>.</para> | | | |
520 | | | | |
521 | <para>If you would like to PGP sign the checksum files (highly | | | |
522 | recommended!), remember to set | | | |
523 | <varname>SIGN_AS=username@NetBSD.org</varname> in your | | | |
524 | <filename>mk/bulk/build.conf</filename>. This will prompt you for | | | |
525 | your GPG password to sign the files before uploading everything.</para> | | | |
526 | | | | |
527 | <para>Then, make sure that you have <varname>RSYNC_DST</varname> | | | |
528 | set properly in your <filename>mk/bulk/build.conf</filename> | | | |
529 | file, i.e. adjust it to something like one of the following:</para> | | | |
530 | | | | |
531 | <screen>RSYNC_DST=ftp.NetBSD.org:/pub/pkgsrc/packages/NetBSD/arch/a.b.c-20xxQy/upload</screen> | | | |
532 | | | | |
533 | <para>Please use appropriate values for "20xxQy" (the branch), | | | |
534 | "a.b.c" (the OS version) and "arch" here. If your login on ftp.NetBSD.org | | | |
535 | is different from your local login, write your login directly | | | |
536 | into the variable, e.g. my local account is "feyrer", but for my | | | |
537 | login "hubertf", I use:</para> | | | |
538 | | | | |
539 | <screen>RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/pkgsrc/packages/NetBSD/arch/a.b.c-20xxQy/upload</screen> | | | |
540 | | | | |
541 | <para>A separate <filename>upload</filename> directory is used | | | |
542 | here to allow "closing" the directory during upload. To do | | | |
543 | so, run the following command on ftp.NetBSD.org next:</para> | | | |
544 | | | | |
545 | <screen>nbftp% <userinput>mkdir -p -m 750 /pub/pkgsrc/packages/NetBSD/arch/a.b.c-20xxQy/upload</userinput></screen> | | | |
546 | | | | |
547 | <para>Before uploading the binary pkgs, ssh authentication needs | | | |
548 | to be set up. This example shows how to set up temporary keys | | | |
549 | for the root account <emphasis>inside the sandbox</emphasis> | | | |
550 | (assuming that no keys should be present there usually):</para> | | | |
551 | | | | |
552 | <screen> | | | |
553 | &rprompt; <userinput>chroot /usr/sandbox</userinput> | | | |
554 | chroot-&rprompt; <userinput>rm $HOME/.ssh/id-dsa*</userinput> | | | |
555 | chroot-&rprompt; <userinput>ssh-keygen -t rsa</userinput> | | | |
556 | chroot-&rprompt; <userinput>cat $HOME/.ssh/id-rsa.pub</userinput> | | | |
557 | </screen> | | | |
558 | | | | |
559 | <para>Now take the output of <filename>id-rsa.pub</filename> and | | | |
560 | append it to your <filename>~/.ssh/authorized_keys</filename> | | | |
561 | file on ftp.NetBSD.org. You should remove the key after the | | | |
562 | upload is done!</para> | | | |
563 | | | | |
564 | <para>Next, test if your ssh connection really works:</para> | | | |
565 | | | | |
566 | <screen>chroot-&rprompt; <userinput>ssh ftp.NetBSD.org date</userinput> </screen> | | | |
567 | | | | |
568 | <para>Use "-l yourNetBSDlogin" here as appropriate!</para> | | | |
569 | | | | |
570 | <para>Now after all this works, you can exit the sandbox and start | | | |
571 | the upload:</para> | | | |
572 | | | | |
573 | <screen> | | | |
574 | chroot-&rprompt; <userinput>exit</userinput> | | | |
575 | &rprompt; <userinput>cd /usr/sandbox/usr/pkgsrc</userinput> | | | |
576 | &rprompt; <userinput>sh mk/bulk/do-sandbox-upload</userinput> | | | |
577 | </screen> | | | |
578 | | | | |
579 | <para>The upload process may take quite some time. Use &man.ls.1; or | | | |
580 | &man.du.1; on the FTP server to monitor progress of the | | | |
581 | upload. The upload script will take care of not uploading | | | |
582 | restricted packages.</para> | | | |
583 | | | | |
584 | <para>After the upload has ended, first thing is to revoke ssh access:</para> | | | |
585 | | | | |
586 | <screen>nbftp% <userinput>vi ~/.ssh/authorized_keys</userinput> | | | |
587 | Gdd:x! </screen> | | | |
588 | | | | |
589 | <para>Use whatever is needed to remove the key you've entered | | | |
590 | before! Last, move the uploaded packages out of the | | | |
591 | <filename>upload</filename> directory to have them accessible | | | |
592 | to everyone:</para> | | | |
593 | | | | |
594 | <screen> | | | |
595 | nbftp% <userinput>cd /pub/pkgsrc/packages/NetBSD/arch/a.b.c-20xxQy</userinput> | | | |
596 | nbftp% <userinput>mv upload/* .</userinput> | | | |
597 | nbftp% <userinput>rmdir upload</userinput> | | | |
598 | nbftp% <userinput>chgrp -R netbsd .</userinput> | | | |
599 | nbftp% <userinput>find . -type d | xargs chmod 775</userinput> | | | |
600 | </screen> | | | |
601 | | | | |
602 | <!-- end old --> | | | |
603 | </sect2> | | | |
604 | | | | |
605 | </sect1> | | | |
606 | | | | |
607 | <sect1 id="bulk.pbulk"> | | 85 | <sect1 id="bulk.pbulk"> |
608 | <title>Running a pbulk-style bulk build</title> | | 86 | <title>Running a pbulk-style bulk build</title> |
609 | | | 87 | |
610 | <para>Running a pbulk-style bulk build works roughly as follows:</para> | | 88 | <para>Running a pbulk-style bulk build works roughly as follows:</para> |
611 | | | 89 | |
612 | <itemizedlist> | | 90 | <itemizedlist> |
613 | <listitem><para>First, build the pbulk infrastructure in a fresh pkgsrc location.</para></listitem> | | 91 | <listitem><para>First, build the pbulk infrastructure in a fresh pkgsrc location.</para></listitem> |
614 | <listitem><para>Then, build each of the packages from a clean installation directory using the infrastructure.</para></listitem> | | 92 | <listitem><para>Then, build each of the packages from a clean installation directory using the infrastructure.</para></listitem> |
615 | </itemizedlist> | | 93 | </itemizedlist> |
616 | | | 94 | |
617 | <sect2 id="bulk.pbulk.prepare"> | | 95 | <sect2 id="bulk.pbulk.prepare"> |
618 | <title>Preparation</title> | | 96 | <title>Preparation</title> |
619 | | | 97 | |