18.1.47
by James Westby
Add a README |
1 |
bzr-builddeb |
2 |
============
|
|
3 |
||
4 |
Overview
|
|
5 |
--------
|
|
6 |
||
7 |
This is bzr-builddeb, a plugin for `bzr`_ that allows you to build `Debian`_ |
|
8 |
packages from a bzr branch. |
|
9 |
||
10 |
.. _bzr: http://bazaar-vcs.org/ |
|
11 |
.. _Debian: http://www.debian.org/ |
|
12 |
||
149
by James Westby
Add the user manual. |
13 |
Note that there is a user manual available at |
186
by James Westby
* Correct the pointer to the user manual in the README. Thanks to Achim |
14 |
/usr/share/doc/bzr-builddeb/user_manual/index.html that gives more |
149
by James Westby
Add the user manual. |
15 |
information than this file. |
18.1.47
by James Westby
Add a README |
16 |
|
17 |
Installation
|
|
18 |
------------
|
|
19 |
||
266.1.10
by James Westby
Fix the README to mention bzrtools is required. |
20 |
This plugin requires `python-debian`_ (at least version 0.1.11), |
486.2.1
by Karl Goetz
Fix two minor typos in README. |
21 |
and a version of bzr at least 2.1. These are available in Debian |
266.1.10
by James Westby
Fix the README to mention bzrtools is required. |
22 |
(though maybe not at the required versions for a development version |
462
by Karl Goetz
Fix readme rstification from Karl Goetz |
23 |
of builddeb). |
18.1.47
by James Westby
Add a README |
24 |
|
18.1.65
by James Westby
Document the need for deb822 in the README. |
25 |
.. _python-debian: http://bzr.debian.org/pkg-python-debian/trunk/ |
18.1.47
by James Westby
Add a README |
26 |
|
27 |
This plugin can be installed in two ways. As you are probably using a Debian |
|
486.2.1
by Karl Goetz
Fix two minor typos in README. |
28 |
system you can probably just use the Debian packages. The other way is to |
104.1.15
by James Westby
Some fixes to the README |
29 |
branch it in to ``~/.bazaar/plugins/builddeb``, i.e:: |
18.1.47
by James Westby
Add a README |
30 |
|
31 |
bzr branch http://jameswestby.net/bzr/bzr-builddeb/ \ |
|
104.1.15
by James Westby
Some fixes to the README |
32 |
~/.bazaar/plugins/builddeb |
18.1.47
by James Westby
Add a README |
33 |
|
34 |
This will give you a ``bzr builddeb`` command (alias ``bd``). |
|
35 |
||
36 |
Help for this plugin can be found by running ``bzr help builddeb``. |
|
37 |
||
45.1.3
by James Westby
Document the bzr-buildpackage script, and explain that the same arguments will |
38 |
There is also a script named ``bzr-buildpackage`` provided in /usr/bin |
39 |
that provides access to the tool as well. It is just a wrapper script that |
|
40 |
calls ``bzr builddeb`` with the arguments you provide, so the rest of the |
|
41 |
documentation applies equally well to using this script. Probably the only |
|
42 |
difference is that help will be got with ``bzr-buildpackage ---help`` |
|
65.1.1
by Jelmer Vernooij
Fix typos |
43 |
(as ``bzr builddeb --help`` also works and does the same as |
45.1.3
by James Westby
Document the bzr-buildpackage script, and explain that the same arguments will |
44 |
``bzr help builddeb``). The script is provided for two reasons, the first |
45 |
is similarity to the other ``-buildpackage`` systems, and the second is so |
|
46 |
that the Debian package can provide the ``bzr-buildpackage`` package, and |
|
47 |
so make it easier for people to find the package. |
|
48 |
||
18.1.47
by James Westby
Add a README |
49 |
Configuration
|
50 |
-------------
|
|
51 |
||
52 |
There are also configuration files that can be used, these are, in the order |
|
53 |
that values will be used if found:: |
|
54 |
||
159
by James Westby
A reprieve for local.conf. |
55 |
* .bzr-builddeb/local.conf (in the package directory) |
18.1.47
by James Westby
Add a README |
56 |
* ~/.bazaar/builddeb.conf |
57 |
* .bzr-builddeb/default.conf (in the package directory) |
|
58 |
||
104.1.15
by James Westby
Some fixes to the README |
59 |
The last of these should be used for values that will be used by all users of |
60 |
the package, for instance 'merge = True'. The others are for the user to add |
|
61 |
or override settings that are specific to them, either globally or per package. |
|
18.1.47
by James Westby
Add a README |
62 |
|
78
by James Westby
* Document the config changes in the README. |
63 |
There is one complication to this however. As arbitrary commands can be |
64 |
specified for some of the options there is a potential security hole. This |
|
65 |
is closed by only taking these options from the configuration file in your |
|
66 |
home directory, which can't be changed by another committer to the branch. |
|
67 |
I apologise if this breaks your setup, and if you can't work around it please |
|
68 |
talk to me to try to find an approach that satisfies you and does not open |
|
69 |
any security holes. |
|
70 |
||
18.1.47
by James Westby
Add a README |
71 |
These files must start with:: |
72 |
||
73 |
[BUILDDEB] |
|
74 |
||
75 |
Configuration Options |
|
76 |
~~~~~~~~~~~~~~~~~~~~~
|
|
77 |
||
104.1.15
by James Westby
Some fixes to the README |
78 |
The following options are read from the configuration files. Most can also be |
69.1.1
by James Westby
* Document the export-upstream-prepull option. |
79 |
used as command line arguments by prepending ``--`` to the names and not using |
80 |
the ``\=`` symbol. There are a few exceptions to this that are noted in the |
|
81 |
descriptions. |
|
18.1.47
by James Westby
Add a README |
82 |
|
84
by James Westby
* Restructure the config options documentation as it was long. |
83 |
Directories
|
84 |
###########
|
|
85 |
||
86 |
These change the directories that the plugin uses for various things. |
|
87 |
||
18.1.56
by James Westby
Correct option names |
88 |
* ``build-dir = path`` |
18.1.47
by James Westby
Add a README |
89 |
|
90 |
The directory in which the build takes place. (Defaults to |
|
91 |
``../build-area`` relative to the branch). |
|
92 |
||
18.1.56
by James Westby
Correct option names |
93 |
* ``result-dir = path`` |
18.1.47
by James Westby
Add a README |
94 |
|
253
by James Westby
Squash remaining references to ../tarballs. |
95 |
The directory the resulting files will be placed in. (Defaults to ``..``) |
18.1.47
by James Westby
Add a README |
96 |
|
84
by James Westby
* Restructure the config options documentation as it was long. |
97 |
* ``orig-dir = path`` |
98 |
||
99 |
The directory to search for the ``.orig.tar.gz`` when not in native mode. |
|
253
by James Westby
Squash remaining references to ../tarballs. |
100 |
(Defaults to ``..`` relative to the branch). |
84
by James Westby
* Restructure the config options documentation as it was long. |
101 |
|
102 |
Modes
|
|
103 |
#####
|
|
104 |
||
105 |
These change the way in which the plugin operates. They can be set depending |
|
106 |
on the type of package you are building. |
|
107 |
||
18.1.47
by James Westby
Add a README |
108 |
* ``merge = True`` |
109 |
||
110 |
Turns on merge mode. This is where only the ``debian/`` directory is |
|
62
by James Westby
* Add the documentation on using native that I somehow lost before. |
111 |
versioned. It uses and ``orig.tar.gz`` for the upstream and combines the |
112 |
two before building. It works with both the ``debian/`` directory in the |
|
18.1.47
by James Westby
Add a README |
113 |
branch, or the contents of ``debian/`` (e.g. ``rules``, ``control``) |
114 |
directly in the top level directory of the branch. (Defaults to ``False``). |
|
115 |
||
62
by James Westby
* Add the documentation on using native that I somehow lost before. |
116 |
* ``native = True`` |
117 |
||
118 |
If you want to build a native package from a branch then turn on this |
|
119 |
option. It will stop the plugin from looking for an ``orig.tar.gz`` and |
|
120 |
build a native package instead. This has no effect if merge mode is on, |
|
121 |
as I don't think it makes any sense to version the ``debian/`` separately |
|
122 |
for a native package. If you disagree let me know.
|
|
123 |
||
62.1.1
by James Westby
* Document the split option that will create an .orig.tar.gz for you |
124 |
* ``split = True``
|
125 |
||
126 |
This takes a package from a branch that includes both the upstream source
|
|
127 |
and the ``debian/`` dir and creates a non-native package from it by
|
|
128 |
creating an ``orig.tar.gz`` from the code outside of ``debian/``. This
|
|
129 |
is probably most useful if you are bot upstream and Debian maintainer
|
|
130 |
of a non-native package. This has no effect if ``merge`` or ``native``
|
|
131 |
are true, the former is for use when you don't version the full source, |
|
132 |
the second for when you don't need an ``orig.tar.gz`` so they make no sense |
|
133 |
to be used together.
|
|
134 |
||
327.2.9
by James Westby
Re-instate export-upstream for merge mode. |
135 |
* ``export-upstream = path``
|
136 |
||
137 |
This option takes a path (remote or local) to a bzr branch that contains
|
|
138 |
the upstream code. If this is set then the plugin will export the code
|
|
139 |
from that branch to create the ``.orig.tar.gz``. This option only has any
|
|
140 |
effect if ``merge`` is set.
|
|
141 |
||
142 |
* ``export-upstream-revision = revision``
|
|
143 |
||
144 |
This sets the revision that the upstream code will be branched at. It takes
|
|
145 |
the same revision spec as the normal --revision parameter. Use it to
|
|
146 |
associate an upstream version number with a particular revision of the
|
|
147 |
upstream code. This has no effect if ``export-upstream`` is not set.
|
|
148 |
||
84
by James Westby
* Restructure the config options documentation as it was long. |
149 |
Builders
|
150 |
########
|
|
18.1.47
by James Westby
Add a README |
151 |
|
84
by James Westby
* Restructure the config options documentation as it was long. |
152 |
These configure the commands that are used to build the package in different
|
153 |
situations.
|
|
18.1.47
by James Westby
Add a README |
154 |
|
155 |
* ``builder = command``
|
|
156 |
||
306
by James Westby
Switch to debuild instead of dpkg-buildpackage -rfakeroot -uc -us. The most |
157 |
The command to use to build the package. Defaults to ``debuild``).
|
158 |
Will only be read from the file in your home directory.
|
|
18.1.47
by James Westby
Add a README |
159 |
|
18.1.56
by James Westby
Correct option names |
160 |
* ``quick-builder = command``
|
18.1.47
by James Westby
Add a README |
161 |
|
162 |
The command used to build the package if the ``--quick`` option is used.
|
|
78
by James Westby
* Document the config changes in the README. |
163 |
(Defaults to ``fakeroot debian/rules binary``). Will only be read from
|
164 |
the file in your home directory.
|
|
18.1.47
by James Westby
Add a README |
165 |
|
166 |
The idea is that certain options can be set in ``.bzr-builddeb/default.conf``
|
|
167 |
that apply to the package on all systems, or that there is a default that is
|
|
168 |
wanted that differs from the default provided. ``merge = True`` is a perfect
|
|
169 |
example of this.
|
|
170 |
||
171 |
Then the user can override this locally if they want for all of their packages
|
|
172 |
(they prefer ``builder = pdebuild``), so they can set this in
|
|
173 |
``~/.bazaar/builddeb.conf``. They can override it for the package if they want
|
|
174 |
(e.g. they have a different location for upstream tarballs of a package if
|
|
175 |
they are involved with upstream as well, so they set ``orig_dir =
|
|
159
by James Westby
A reprieve for local.conf. |
176 |
/home/.../releases/``), this can be done in ``.bzr-builddeb/local.conf``).
|
18.1.47
by James Westby
Add a README |
177 |
|
178 |
||
179 |
Creating a package
|
|
180 |
------------------
|
|
181 |
||
182 |
Below are instructions for creating a package. These instructions differ
|
|
183 |
depending on whether you want to use merge mode or not.
|
|
184 |
||
185 |
First the common start create a directory to hold your work. This is not
|
|
186 |
absolutely necessary, but as you still get all the power of bzr when using
|
|
187 |
this plugin, so you might want to branch etc. and so this will be useful
|
|
18.1.63
by James Westby
A few README fixes |
188 |
later on::
|
18.1.47
by James Westby
Add a README |
189 |
|
190 |
$ mkdir path/to/project
|
|
191 |
||
192 |
If you are going to be using branches then the following is a good optimisation
|
|
18.1.63
by James Westby
A few README fixes |
193 |
you can use::
|
18.1.47
by James Westby
Add a README |
194 |
|
195 |
$ bzr init-repo --trees path/to/project
|
|
196 |
||
197 |
Now create your global config file if you want to change something like the
|
|
104.1.15
by James Westby
Some fixes to the README |
198 |
builder in use, or have a global result directory or similar::
|
18.1.47
by James Westby
Add a README |
199 |
|
200 |
$ echo "[BUILDDEB]" > ~/.bazaar/builddeb.conf
|
|
201 |
$ $EDITOR ~/.bazaar/builddeb.conf
|
|
202 |
||
203 |
and any options that you want.
|
|
204 |
||
205 |
I will describe creating a new project, but for existing projects you can
|
|
206 |
copy the code over and call ``bzr init`` then continue in the same way.
|
|
207 |
||
208 |
I will also describe the setup that conforms to the default options for
|
|
209 |
directories. If you wish to use a different layout set up the options to
|
|
210 |
your liking and tweak the commands below as necessary.
|
|
211 |
||
212 |
Using merge mode
|
|
213 |
~~~~~~~~~~~~~~~~
|
|
214 |
||
82
by James Westby
* Explain what merge mode actually is. |
215 |
Merge mode is when only the ``debian/`` directory of the package is versioned,
|
216 |
with the upstream version of the code living elsewhere. It allows for clear
|
|
217 |
separation of the Debian specific changes from the upstream code.
|
|
218 |
||
253
by James Westby
Squash remaining references to ../tarballs. |
219 |
First copy the ``.orig.tar.gz`` file for the current version in to the parent
|
132.1.1
by James Westby
Use uscan to retrieve upstream tarballs. |
220 |
directory. If you do not have the upstream tarball for the current version,
|
221 |
but you do have a ``watch`` file detailing where it can be found then the
|
|
222 |
plugin will automatically retrieve the tarballs as they are needed.
|
|
18.1.47
by James Westby
Add a README |
223 |
|
18.1.63
by James Westby
A few README fixes |
224 |
Now create the branch for the ``debian/`` directory::
|
18.1.47
by James Westby
Add a README |
225 |
|
226 |
$ bzr init project
|
|
227 |
||
228 |
Now you can either create a ``project/debian/`` directory for all the files,
|
|
229 |
or add them in the ``project`` directory.
|
|
230 |
|
|
18.1.63
by James Westby
A few README fixes |
231 |
Now tell bzr-builddeb that this is a merge mode project::
|
18.1.47
by James Westby
Add a README |
232 |
|
233 |
$ cd project/
|
|
234 |
$ mkdir .bzr-builddeb/
|
|
235 |
$ echo -e "[BUILDDEB]\nmerge = True" > .bzr-builddeb/default.conf |
|
236 |
||
237 |
Now you are ready to create the project. Create the usual files, and edit them
|
|
238 |
to your satisfaction. When you have the files run::
|
|
239 |
||
240 |
$ bzr add
|
|
241 |
$ bzr ci
|
|
242 |
||
243 |
from the root of the project branch.
|
|
244 |
||
245 |
You are now ready to build the project. See below for instructions on doing
|
|
246 |
this.
|
|
247 |
||
248 |
Non-merge mode
|
|
249 |
~~~~~~~~~~~~~~
|
|
250 |
||
18.1.63
by James Westby
A few README fixes |
251 |
This is a little simpler to set up. Create the branch for the project::
|
18.1.47
by James Westby
Add a README |
252 |
|
253 |
$ cd path/to/project
|
|
254 |
$ bzr init project
|
|
255 |
||
18.1.63
by James Westby
A few README fixes |
256 |
Now add all the project files to the branch, and add the to bzr::
|
18.1.55
by James Westby
Typo |
257 |
|
18.1.47
by James Westby
Add a README |
258 |
$ cd project
|
259 |
$ bzr add
|
|
260 |
$ bzr ci
|
|
261 |
||
62
by James Westby
* Add the documentation on using native that I somehow lost before. |
262 |
There are two options when you want to build a Debian package, whether
|
462
by Karl Goetz
Fix readme rstification from Karl Goetz |
263 |
it is a native package or not. Most packages are non-native so I will describe
|
62
by James Westby
* Add the documentation on using native that I somehow lost before. |
264 |
that first.
|
265 |
||
266 |
To create a non-native package you need an upstream tarball to build against.
|
|
267 |
Set the ``orig-dir`` variable to the directory containing the tarball that
|
|
268 |
you want to use and the plugin will pick it up and you will have a non-native
|
|
132.1.1
by James Westby
Use uscan to retrieve upstream tarballs. |
269 |
package. If you do not have the upstream tarball corresponding to the version
|
270 |
of the package you are trying to build, but you have a ``watch`` file
|
|
271 |
detailing where it can be found then it will be automatically retrieved when
|
|
272 |
needed.
|
|
62
by James Westby
* Add the documentation on using native that I somehow lost before. |
273 |
|
62.1.1
by James Westby
* Document the split option that will create an .orig.tar.gz for you |
274 |
However sometimes you might be upstream of a package as well as Debian
|
275 |
maintainer, but it is not a native package. In that case you may version
|
|
276 |
the whole source including ``debian/``, but not want to have to manually
|
|
277 |
make a tarball without the ``debian/`` directory. In that case see the
|
|
278 |
``split`` variable. If you set that then the plugin will create you an
|
|
279 |
appropriately named orig.tar.gz of everything outside of ``debian/``.
|
|
280 |
||
62
by James Westby
* Add the documentation on using native that I somehow lost before. |
281 |
If you want to have a native package you don't need to worry about |
104.1.15
by James Westby
Some fixes to the README |
282 |
``orig-dir``, but instead set ``native = True`` in the |
283 |
``.bzr-builddeb/default.conf`` file (make sure it starts with ``[BUILDDEB]`` |
|
284 |
if you create it). |
|
62
by James Westby
* Add the documentation on using native that I somehow lost before. |
285 |
|
18.1.47
by James Westby
Add a README |
286 |
Now you are ready to build using the plugin. |
287 |
||
288 |
||
289 |
Building a Package |
|
290 |
------------------
|
|
291 |
||
18.1.63
by James Westby
A few README fixes |
292 |
Once your package is set up then building it is easy. Run the following |
18.1.47
by James Westby
Add a README |
293 |
command from the top-level of the project branch, after checking in all |
294 |
changes:: |
|
295 |
||
296 |
$ bzr bd |
|
297 |
||
298 |
If you used the default options this should build the package and leave the |
|
299 |
resulting files in ``../build-area``. |
|
300 |
||
104.1.15
by James Westby
Some fixes to the README |
301 |
Note that most of the options can be used as parameters to this command as well |
68
by James Westby
* Add a note that the configuration options can also be passed on the |
302 |
by prefixing their name with ``--``. So you can do for example:: |
303 |
||
304 |
$ bzr bd --builder pdebuild |
|
305 |
||
306 |
to change from what is in the configuration files. Note that there is currently |
|
307 |
no way to set the binary options to false if they are set to true in the |
|
308 |
configuration files. It would be possible to allow this, but it would bloat |
|
309 |
the code and the help listings quite a lot, so I will only it if asked to. |
|
310 |
||
18.1.47
by James Westby
Add a README |
311 |
Tips
|
312 |
----
|
|
313 |
||
178.1.1
by James Westby
Build the working tree by default. |
314 |
If you have a slow builder defined in your configuration (for instance |
18.1.47
by James Westby
Add a README |
315 |
``pdebuild``, you can bypass this by using the ``--quick`` option. This uses |
316 |
whatever the ``quick_builder`` option is (defaults to ``fakeroot debian/rules |
|
317 |
binary``). |
|
318 |
||
319 |
If you are running in merge mode, and you have a large upstream tarball, and |
|
320 |
you do not want to unpack it at every build you can speed things up even more. |
|
321 |
This involves reusing the tarball each build, so saving the need to unpack it. |
|
18.1.63
by James Westby
A few README fixes |
322 |
To do this run:: |
18.1.47
by James Westby
Add a README |
323 |
|
148
by James Westby
Fix up some copyright notices. |
324 |
$ bzr bd --export-only |
18.1.47
by James Westby
Add a README |
325 |
|
326 |
once to create a build-dir to use. (``-e`` is the short option for this). Then |
|
327 |
on the next builds you can use the ``--reuse`` and ``--dont-purge`` options to |
|
328 |
keep using this build directory. **N.B. This may cause build problems, |
|
65.1.1
by Jelmer Vernooij
Fix typos |
329 |
especially if files are removed**, it is advisable to run a build without |
148
by James Westby
Fix up some copyright notices. |
330 |
``--reuse`` after removing any files. |
18.1.47
by James Westby
Add a README |
331 |
|
332 |
||
333 |
Workflow
|
|
334 |
--------
|
|
335 |
||
336 |
bzr-builddeb is designed to fit in with the workflow that bzr encourages. It |
|
337 |
is designed as a plugin, so that it just becomes one more ``bzr`` command that |
|
338 |
you run while working on the package. |
|
339 |
||
340 |
It also works fine with the frequent branching approach of bzr, so that you |
|
341 |
can branch to test something new for the package, or for a bug fix, and then |
|
342 |
merge it back in to your main branch when it is done. |
|
343 |
||
18.1.53
by James Westby
Add copyright and license info to README |
344 |
Copyright
|
345 |
---------
|
|
346 |
||
347 |
This README is Copyright (C) 2006 James Westby <jw+debian@jameswestby.net> and |
|
148
by James Westby
Fix up some copyright notices. |
348 |
is distributed under the following terms:: |
18.1.53
by James Westby
Add copyright and license info to README |
349 |
|
350 |
This file is part of bzr-builddeb. |
|
351 |
||
352 |
bzr-builldeb is free software; you can redistribute it and/or modify |
|
353 |
it under the terms of the GNU General Public License as published by |
|
354 |
the Free Software Foundation; either version 2 of the License, or |
|
355 |
(at your option) any later version. |
|
356 |
||
357 |
bzr-builddeb is distributed in the hope that it will be useful, |
|
358 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
359 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
360 |
GNU General Public License for more details. |
|
361 |
||
362 |
You should have received a copy of the GNU General Public License |
|
363 |
along with bzr-builddeb; if not, write to the Free Software |
|
364 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
365 |
||
18.1.56
by James Westby
Correct option names |
366 |
.. vim: set ft=rst : |