Merge lp:~jr/ubuntu-packaging-guide/03-packaging-from-scratch into lp:ubuntu-packaging-guide
- 03-packaging-from-scratch
- Merge into trunk
Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~jr/ubuntu-packaging-guide/03-packaging-from-scratch | ||||
Merge into: | lp:ubuntu-packaging-guide | ||||
Prerequisite: | lp:~jr/ubuntu-packaging-guide/02-udd-introduction | ||||
Diff against target: |
783 lines (+523/-192) 5 files modified
index.rst (+12/-3) packaging-from-scratch.rst (+199/-0) traditional-packaging.rst (+5/-0) udd-getting-the-source.rst (+190/-0) udd-intro.rst (+117/-189) |
||||
To merge this branch: | bzr merge lp:~jr/ubuntu-packaging-guide/03-packaging-from-scratch | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Barry Warsaw (community) | Needs Fixing | ||
Review via email: mp+68099@code.launchpad.net |
This proposal has been superseded by a proposal from 2011-07-22.
Commit message
Description of the change
Add a packaging from scratch guide
Barry Warsaw (barry) wrote : | # |
Barry Warsaw (barry) wrote : | # |
s/check it compiles/check that it compiles/
Line 74 "A running programme..." doesn't make sense to me (seems out of place or incomplete).
I personally would like to promote pkgme over `bzr dh-make` as I think the former is a better overall framework for helping people get the packaging basics added. It's also much simpler, and doesn't ask the user to answer difficult questions. Can you check to see if pkgme does the right thing for your example, and if so, switch to that?
(The downside is that pkgme itself isn't in the archives, but it can be installed from a PPA. It's also less mature than dh-make, but that doesn't seem to be too big a negative for UDD, so we might as well be opinionated here too ;).
line 102 doesn't parse for me: +``compat`` tell the ``debhelper`` scripts which build the package what version
103 +to run as. Ensure it says ``7``.
meta data, or metadata?
How about instead of "Even if it builds the .deb binary package, your packaging will not yet be a work
158 +of perfection, nothing is first time."
"Even if the .deb binary package was built correctly, your package may still have bugs."
Should you also recommend uploading the package to a PPA? There are a few things that happen on the LP buildds that normally don't happen on a local build, so the PPA is as close to "reality" as you can get without actually uploading to the archive.
- 69. By Jonathan Riddell
-
merge in trunk
- 70. By Jonathan Riddell
-
improve compat description
- 71. By Jonathan Riddell
-
be consistent about 'metadata'
- 72. By Jonathan Riddell
-
nicer wording
Jonathan Riddell (jr) wrote : | # |
All done except pkgme. I haven't found any information on how to use pkgme and it just complains about no backend when I run it for this package.
- 73. By Jonathan Riddell
-
upload to PPA
Barry Warsaw (barry) wrote : | # |
Currently, you have to run pkgme from its PPA.
Barry Warsaw (barry) wrote : | # |
1. The section on fixing a security bug breaks out of the UDD track to use apt-get source. If possible though I think you can use an ubuntu:
2. Also, s/may will/may/ in packaging-
Still setting to Needs Fixing to get your feedback on issue #1.
Jonathan Riddell (jr) wrote : | # |
1. There's nothing about security bugs in this merge proposal, there was a chapter added on that recently by others.
2. done
- 74. By Jonathan Riddell
-
grammer fix
- 75. By Jonathan Riddell
-
merge in trunk
Unmerged revisions
Preview Diff
1 | === added file 'images/kdetoys-udd-branch.png' |
2 | Binary files images/kdetoys-udd-branch.png 1970-01-01 00:00:00 +0000 and images/kdetoys-udd-branch.png 2011-07-20 11:01:36 +0000 differ |
3 | === added file 'images/kdetoys-udd-diff.png' |
4 | Binary files images/kdetoys-udd-diff.png 1970-01-01 00:00:00 +0000 and images/kdetoys-udd-diff.png 2011-07-20 11:01:36 +0000 differ |
5 | === modified file 'index.rst' |
6 | --- index.rst 2011-07-19 13:13:58 +0000 |
7 | +++ index.rst 2011-07-20 11:01:36 +0000 |
8 | @@ -9,8 +9,14 @@ |
9 | The guide is split up into two sections: |
10 | |
11 | * A list of articles based on tasks, things you want to get done. |
12 | -* A set of articles that dig deeper into specific bits of our tools |
13 | - and workflows. |
14 | +* A set of knowledge-base articles that dig deeper |
15 | + into specific bits of our tools and workflows. |
16 | + |
17 | +This guide focuses on the Ubuntu Distributed Development packaging method. |
18 | +This is a new way of packaging which uses Distributed Revision Control |
19 | +branches. It currently has some limitations which mean many teams in Ubuntu |
20 | +use :doc:`traditional packaging</traditional-packaging>` methods. See the |
21 | +:doc:`UDD Introduction</udd-intro>` page for an introduction to the differences. |
22 | |
23 | Articles |
24 | -------- |
25 | @@ -20,6 +26,8 @@ |
26 | |
27 | introduction-to-ubuntu-development |
28 | getting-set-up |
29 | + udd-intro |
30 | + packaging-from-scratch |
31 | fixing-a-bug |
32 | fixing-a-bug-security |
33 | |
34 | @@ -31,7 +39,7 @@ |
35 | |
36 | debian-dir-overview |
37 | testing |
38 | - udd-intro |
39 | + udd-getting-the-source |
40 | udd-working |
41 | udd-sponsorship |
42 | udd-uploading |
43 | @@ -39,6 +47,7 @@ |
44 | udd-merging |
45 | udd-patchsys |
46 | udd-newpackage |
47 | + traditional-packaging |
48 | |
49 | |
50 | Indices and tables |
51 | |
52 | === added file 'packaging-from-scratch.rst' |
53 | --- packaging-from-scratch.rst 1970-01-01 00:00:00 +0000 |
54 | +++ packaging-from-scratch.rst 2011-07-20 11:01:36 +0000 |
55 | @@ -0,0 +1,199 @@ |
56 | +====================== |
57 | +Packaging From Scratch |
58 | +====================== |
59 | + |
60 | +You have found an exciting new piece of software, it needs exposure to the |
61 | +wider world by getting it into Ubuntu or a PPA, so you have decided to package |
62 | +it. |
63 | + |
64 | +Checking the Programme |
65 | +---------------------- |
66 | + |
67 | +The first stage in packaging is to get the released tar from upstream (we call |
68 | +the authors of applications "upstream") and check that it compiles and runs. |
69 | + |
70 | +This guide will take you through packaging a simple application called KQRCode |
71 | +which has been `posted on KDE-apps.org`_. Download `version 0.4 from |
72 | +Sourceforge`_ and put it in a new directory. |
73 | + |
74 | +Now uncompress it:: |
75 | + |
76 | + $ tar xf kqrcode-0.4.tar.gz |
77 | + $ cd kqrcode-0.4 |
78 | + |
79 | +This application uses the CMake build system so we want to run cmake to prepare |
80 | +for compilation:: |
81 | + |
82 | + $ mkdir build |
83 | + $ cd build |
84 | + $ cmake .. |
85 | + |
86 | +CMake will check for the required dependencies, in this case it tells us we |
87 | +need Qt and KDE libraries. We also need GCC, packagers can install |
88 | +``build-essential`` which brings this in and is assumed to be installed for all |
89 | +packages. If you do not have the development files for these libraries installed |
90 | +it will fail, you can install them and run CMake again:: |
91 | + |
92 | + $ sudo apt-get install build-essential libqt4-dev kdelibs5-dev |
93 | + $ cmake .. |
94 | + |
95 | +Now you can compile the source:: |
96 | + |
97 | + $ make |
98 | + |
99 | +Running this gives some errors about missing headers. This means there are |
100 | +other libraries missing which were not checked by CMake. Make a note to inform |
101 | +upstream of this problem. `packages.ubuntu.com`_ can be used to find which |
102 | +packages these headers come from, install these packages and continue the |
103 | +compile:: |
104 | + |
105 | + $ sudo apt-get install libqrencode-dev libzbar-dev libzbarqt-dev |
106 | + $ make |
107 | + |
108 | +If the compile completes successfully you can install and run the programme:: |
109 | + |
110 | + $ sudo make install |
111 | + $ kqrcode |
112 | + |
113 | +Starting a Package |
114 | +------------------ |
115 | + |
116 | +``bzr-builddeb`` includes a plugin to create a new package from a template, |
117 | +the plugin is a wrapper around the ``dh_make`` command:: |
118 | + |
119 | + $ sudo apt-get install dh-make |
120 | + $ bzr dh-make kqrcode 0.4 kqrcode-0.4.tar.gz |
121 | + |
122 | +When it asks what type of package type ``s`` for single binary. |
123 | + |
124 | +This will import the code into a branch and add the ``debian/`` packaging |
125 | +directory. Have a look at the contents. Most of the files it adds are only |
126 | +needed for specialist packages (such as Emacs modules) so you can start by |
127 | +removing the optional example files:: |
128 | + |
129 | + $ cd kqrcode/debian |
130 | + $ rm *ex *EX |
131 | + |
132 | +You should now customise each of the files. |
133 | + |
134 | +In ``debian/changelog`` change the |
135 | +version number to an Ubuntu version: ``0.4-0ubuntu1`` (upstream version 0.4, |
136 | +Debian version 0, Ubuntu version 1). Also change ``unstable`` to the current |
137 | +development Ubuntu release such as ``oneiric``. |
138 | + |
139 | +Much of the package building work is done by a series of scripts |
140 | +called ``debhelper``. The exact behaviour of ``debhelper`` changes |
141 | +with new major versions, the compat file instructs ``debhelper`` which |
142 | +version to act as. You will generally want to set this to the most |
143 | +recent version which is ``8``. |
144 | + |
145 | +``control`` contains all the metadata of the package. The first paragraph |
146 | +describes the source package. The second and and following paragraphs describe |
147 | +the binary packages to be built. We will need to add the packages needed to |
148 | +compile the application to ``Build-Depends:`` so set that to:: |
149 | + |
150 | + Build-Depends: debhelper (>= 7.0.50~), cmake, libqt4-dev, kdelibs5-dev, |
151 | + libqrencode-dev, libzbar-dev, libzbarqt-dev |
152 | + |
153 | +You will also need to fill in a description of the programme in the |
154 | +``Description:`` field. |
155 | + |
156 | +``copyright`` needs to be filled in to follow the licence of the upstream |
157 | +source. According to the kqrcode/COPYING file this is GNU GPL 3 or later. |
158 | + |
159 | +``docs`` contains any upstream documentation files you think should be included |
160 | +in the final package. |
161 | + |
162 | +``README.source`` and ``README.Debian`` are only needed if your package has any |
163 | +non-standard features, we don't so you can delete them. |
164 | + |
165 | +``source/format`` can be left as is, this describes the version format of the |
166 | +source package and should be ``3.0 (quilt)``. |
167 | + |
168 | +``rules`` is the most complex file. This is a Makefile which compiles the |
169 | +code and turns it into a binary package. Fortunately most of the work is |
170 | +automatically done these days by ``debhelper 7`` so the universal ``%`` |
171 | +Makefile target just runs the ``dh`` script which will run everything needed. |
172 | + |
173 | +Finally commit the code to your packaging branch:: |
174 | + |
175 | + $ bzr commit |
176 | + |
177 | +Building the package |
178 | +-------------------- |
179 | + |
180 | +Now we need to check that our packaging successfully compiles the package and |
181 | +builds the .deb binary package:: |
182 | + |
183 | + $ bzr builddeb |
184 | + |
185 | +This should compile the package and place the result in ``../build-area``. You |
186 | +can view the contents of the package with:: |
187 | + |
188 | + $ lesspipe kqrcode_0.4-0ubuntu1_amd64.deb |
189 | + |
190 | +Install the package and check it works:: |
191 | + |
192 | + $ sudo dpkg --install kqrcode_0.4-0ubuntu1_amd64.deb |
193 | + |
194 | +Next Steps |
195 | +---------- |
196 | + |
197 | +Even if it builds the .deb binary package, your packaging may have |
198 | +bugs. Many errors can be automatically detected by our tool |
199 | +``lintian`` which can be run on both the source .dsc metadata file and |
200 | +the .deb binary package:: |
201 | + |
202 | + $ lintian kqrcode_0.4-0ubuntu1.dsc |
203 | + $ lintian kqrcode_0.4-0ubuntu1_amd64.deb |
204 | + |
205 | +A description of each of the problems it reports can be found on the |
206 | +`lintian website`_. |
207 | + |
208 | +After making a fix to the packaging you can rebuild without having to build |
209 | +from scratch using:: |
210 | + |
211 | + $ debuild -nc |
212 | + |
213 | +FIXME is there a UDD equivalent? |
214 | + |
215 | +Having checked that the package builds locally you should ensure it builds on a |
216 | +clean system using ``pbuilder``:: |
217 | + |
218 | + $ bzr builddeb -S |
219 | + $ cd ../build-area |
220 | + $ pbuilder-dist oneiric build kqrcode_0.4-0ubuntu1.dsc |
221 | + |
222 | +When you are happy with your package you will want others to review it. You |
223 | +can upload the branch to Launchpad for review:: |
224 | + |
225 | + $ bzr push lp:~<lp-username>/+junk/kqrcode-package |
226 | + |
227 | +You could also upload the source package to REVU for review:: |
228 | + |
229 | + $ bzr builddeb -S |
230 | + $ cd .. |
231 | + $ dput revu kqrcode_0.4-0ubuntu1.dsc |
232 | + |
233 | +You will need to log in to REVU before you can upload to it. The package |
234 | +must also be correctly signed by the GPG key you have in Launchpad. See the |
235 | +`REVU wiki page` for full details. |
236 | + |
237 | +Uploading it to a PPA (Personal Package Archive) will ensure it builds |
238 | +and give an easy way for you and others to test the binary packages. |
239 | +You will need to set up a PPA in Launchad then upload with ``dput``:: |
240 | + |
241 | + $ dput ppa:<lp-username> kqrcode_0.4-0ubuntu1.dsc |
242 | + |
243 | +See :doc:`uploading</udd-uploading>` for more information. |
244 | + |
245 | +You can ask for reviews in ``#ubuntu-motu`` IRC channel, or on the |
246 | +`MOTU mailing list`_. There might also be a more specific team you |
247 | +could ask such as the Kubuntu team for KDE packages. |
248 | + |
249 | +.. _`posted on KDE-apps.org`: http://kde-apps.org/content/show.php/KQRCode?content=143544 |
250 | +.. _`version 0.4 from Sourceforge`: http://sourceforge.net/projects/kqrcode/files/kqrcode-0.4.tar.gz/download |
251 | +.. _`packages.ubuntu.com`: http://packages.ubuntu.com/ |
252 | +.. _`lintian website`: http://lintian.debian.org/tags.html |
253 | +.. _`REVU wiki page`: https://wiki.kubuntu.org/MOTU/Packages/REVU |
254 | +.. _`MOTU mailing list`: https://lists.ubuntu.com/mailman/listinfo/ubuntu-motu |
255 | |
256 | === added file 'traditional-packaging.rst' |
257 | --- traditional-packaging.rst 1970-01-01 00:00:00 +0000 |
258 | +++ traditional-packaging.rst 2011-07-20 11:01:36 +0000 |
259 | @@ -0,0 +1,5 @@ |
260 | +===================== |
261 | +Traditional Packaging |
262 | +===================== |
263 | + |
264 | +FIXME describe traditional packaging here |
265 | |
266 | === added file 'udd-getting-the-source.rst' |
267 | --- udd-getting-the-source.rst 1970-01-01 00:00:00 +0000 |
268 | +++ udd-getting-the-source.rst 2011-07-20 11:01:36 +0000 |
269 | @@ -0,0 +1,190 @@ |
270 | +================== |
271 | +Getting the Source |
272 | +================== |
273 | + |
274 | +Source package URLs |
275 | +=================== |
276 | + |
277 | +Bazaar provides some very nice shortcuts for accessing Launchpad's source |
278 | +branches of packages in both Ubuntu and Debian. |
279 | + |
280 | +To refer to source branches use:: |
281 | + |
282 | + ubuntu:package |
283 | + |
284 | +where *package* refers to the package name you're interested in. This URL |
285 | +refers to the package in the current development version of Ubuntu. To |
286 | +refer to the branch of Tomboy in the development version, you would use:: |
287 | + |
288 | + ubuntu:tomboy |
289 | + |
290 | +To refer to the version of a source package in an older release of Ubuntu, |
291 | +just prefix the package name with the release's code name. E.g. to refer to |
292 | +Tomboy's source package in Maverick_ use:: |
293 | + |
294 | + ubuntu:maverick/tomboy |
295 | + |
296 | +Since they are unique, you can also abbreviate the distro-series name:: |
297 | + |
298 | + ubuntu:m/tomboy |
299 | + |
300 | +You can use a similar scheme to access the source branches in Debian, although |
301 | +there are no shortcuts for the Debian distro-series names. To access the |
302 | +Tomboy branch in the current development series for Debian use: |
303 | + |
304 | + debianlp:tomboy |
305 | + |
306 | +and to access Tomboy in Debian Lenny_ use:: |
307 | + |
308 | + debianlp:lenny/tomboy |
309 | + |
310 | + |
311 | +.. _`Bazaar`: http://bazaar.canonical.com/en/ |
312 | +.. _`Intrepid`: https://wiki.ubuntu.com/IntrepidIbex |
313 | +.. _Maverick: https://wiki.ubuntu.com/MaverickMeerkat |
314 | +.. _Lenny: http://debian.org/releases/stable/ |
315 | + |
316 | + |
317 | +Getting the source |
318 | +================== |
319 | + |
320 | +Every source package in Ubuntu has an associated source branch on Launchpad. |
321 | +These source branches are updated automatically by Launchpad, although the |
322 | +process is not currently foolproof. |
323 | + |
324 | +There are a couple of things that we do first in order to make the workflow |
325 | +more efficient later. Once you are used to the process you will learn when it |
326 | +makes sense to skip these steps. |
327 | + |
328 | + |
329 | +.. _up-to-date: |
330 | + |
331 | +Ensure the source branch is up-to-date |
332 | +-------------------------------------- |
333 | + |
334 | +Once you've determined which source package to work on, you should ensure that |
335 | +the source branch for that package on Launchpad is up-to-date. Some package |
336 | +imports fail for various reasons, and the `status of the package importer`_ is |
337 | +always available online. If the source branch for a package you want to work |
338 | +on is out of sync, you'll have to use ``apt-get source`` until the import of |
339 | +that package is fixed. |
340 | + |
341 | +Let's say you want to fix a problem in Tomboy in Natty. First, find out the |
342 | +latest binary package versions that are available:: |
343 | + |
344 | + $ rmadison tomboy | grep natty |
345 | + tomboy | 1.5.2-1ubuntu4 | natty | source, amd64, i386 |
346 | + |
347 | +You've already seen how to :ref:`determine the source package corresponding to |
348 | +this binary package <what-to-fix>`. For Tomboy, the binary and source |
349 | +packages are both named ``tomboy``. |
350 | + |
351 | +Whenever the package importer processes a new source package version, it adds |
352 | +a Bazaar tag corresponding to that new version. You can use this tag to |
353 | +ensure that the import is up-to-date. To find the tag of the last revision |
354 | +committed by the package importer, do:: |
355 | + |
356 | + $ bzr log ubuntu:tomboy | grep ^tags | head -n 1 |
357 | + tags: 1.5.2-1ubuntu4 |
358 | + |
359 | +By comparing the version number returned by ``rmadison`` and the tag added by |
360 | +the package importer, we can see that the ``tomboy`` source package for Natty |
361 | +is up-to-date. |
362 | + |
363 | +Here's an example of a package that is out-of-date. Let's say you want to fix |
364 | +a problem in the ``initscripts`` binary package. First find out the |
365 | +latest binary package versions that are available:: |
366 | + |
367 | + $ rmadison initscripts | tail -n 1 |
368 | + initscripts | 2.87dsf-4ubuntu25 | oneiric | amd64, i386 |
369 | + |
370 | +Then determine the source package corresponding to this binary package:: |
371 | + |
372 | + $ apt-cache showsrc initscripts | grep ^Package: |
373 | + Package: sysvinit |
374 | + |
375 | +Find the latest tag added by the package importer:: |
376 | + |
377 | + $ bzr log ubuntu:sysvinit | grep ^tags | head -n 1 |
378 | + tags: 2.86.ds1-61ubuntu13 |
379 | + |
380 | +Here we can see that ``2.86.ds1-61ubuntu13`` is older than |
381 | +``2.87dsf-4ubuntu19`` so the source package is out of date, and in fact we can |
382 | +verify that by looking at the status package for the package at |
383 | +http://package-import.ubuntu.com/status/sysvinit.html. |
384 | + |
385 | +When you find such out-of-date packages, be sure to `file a bug on the UDD |
386 | +project`_ to get the issue resolved. |
387 | + |
388 | +A feature in progress is for a warning to be automatically printed when |
389 | +branching an out of date import, this will make the above obsolete. |
390 | + |
391 | +.. _branching: |
392 | + |
393 | +Creating a shared repository |
394 | +---------------------------- |
395 | + |
396 | +Okay, you want to work on the Tomboy package in Natty, and you've verified |
397 | +that the source package is up-to-date. Before actually branching the code for |
398 | +Tomboy, create a shared repository to hold the branches for this package. |
399 | +The shared repository will make future work much more efficient. |
400 | + |
401 | +Do this using the `bzr init-repo` command, passing it the directory name we |
402 | +would like to use:: |
403 | + |
404 | + $ bzr init-repo tomboy |
405 | + |
406 | +You will see that a `tomboy` directory is created in your current working |
407 | +area. Change to this new directory for the rest of your work:: |
408 | + |
409 | + $ cd tomboy |
410 | + |
411 | + |
412 | +Getting the trunk branch |
413 | +------------------------ |
414 | + |
415 | +We use the `bzr branch` command to create a local branch of the package. |
416 | +We'll name the target directory `tomboy.dev` just to keep things easy to |
417 | +remember:: |
418 | + |
419 | + $ bzr branch ubuntu:tomboy tomboy.dev |
420 | + |
421 | +The tomboy.dev directory represents the version of Tomboy in the development |
422 | +version of Ubuntu, and you can always ``cd`` into this directory and do a `bzr |
423 | +pull` to get any future updates. |
424 | + |
425 | + |
426 | +Getting a branch for a particular release |
427 | +----------------------------------------- |
428 | + |
429 | +When you want to do something like a `stable release update`_ (SRU), or you |
430 | +just want to examine the code in an old release, you'll want to grab the |
431 | +branch corresponding to a particular Ubuntu release. For example, to get the |
432 | +Tomboy package for Maverick do:: |
433 | + |
434 | + $ bzr branch ubuntu:m/tomboy maverick |
435 | + |
436 | + |
437 | +Importing a Debian source package |
438 | +--------------------------------- |
439 | + |
440 | +If the package you want to work on is available in Debian but not Ubuntu, it's |
441 | +still easy to import the code to a local bzr branch for development. Let's |
442 | +say you want to import the `newpackage` source package. We'll start by |
443 | +creating a shared repository as normal, but we also have to create a working |
444 | +tree to which the source package will be imported (remember to cd out of the |
445 | +`tomboy` directory created above):: |
446 | + |
447 | + $ bzr init-repo newpackage |
448 | + $ cd newpackage |
449 | + $ bzr init debian |
450 | + $ cd debian |
451 | + $ bzr import-dsc http://ftp.de.debian.org/debian/pool/main/n/newpackage/newpackage_1.0-1.dsc |
452 | + |
453 | +As you can see, we just need to provide the remote location of the dsc file, |
454 | +and Bazaar will do the rest. You've now got a Bazaar source branch. |
455 | + |
456 | + |
457 | +.. _`status of the package importer`: http://package-import.ubuntu.com/status |
458 | +.. _`file a bug on the UDD project`: https://bugs.launchpad.net/udd |
459 | +.. _`stable release update`: https://wiki.ubuntu.com/StableReleaseUpdates |
460 | |
461 | === modified file 'udd-intro.rst' |
462 | --- udd-intro.rst 2011-07-13 11:27:47 +0000 |
463 | +++ udd-intro.rst 2011-07-20 11:01:36 +0000 |
464 | @@ -1,202 +1,130 @@ |
465 | =================================================== |
466 | -Ubuntu Distributed Development - Getting the Source |
467 | +Ubuntu Distributed Development - Introduction |
468 | =================================================== |
469 | |
470 | -*Ubuntu Distributed Development* (UDD) is a technique for developing Ubuntu |
471 | +This guide focuses on packaging using the *Ubuntu Distributed Development* (UDD) |
472 | +method. |
473 | + |
474 | +*Ubuntu Distributed Development* (UDD) is a new technique for developing Ubuntu |
475 | packages that uses tools, processes, and workflows similar to generic |
476 | distributed version control system (DVCS) based software development. The |
477 | DVCS used for UDD is Bazaar_. |
478 | |
479 | -You should already be familiar with basic Bazaar usage and workflow. For an |
480 | -introduction to Bazaar see the `Bazaar Five Minute Tutorial |
481 | +Traditional Packaging Limitations |
482 | +--------------------------------- |
483 | + |
484 | +Traditionally Ubuntu packages have been kept in tar archive files. A |
485 | +traditional source package is made up of the upstream source tar, a "debian" tar |
486 | +(or compressed diff file for older packages) containing the packaging and a |
487 | +.dsc meta-data file. To see a traditional package run:: |
488 | + |
489 | + $ apt-get source kdetoys |
490 | + |
491 | +This will download the upstream source ``kdetoys_4.6.5.orig.tar.bz2``, the |
492 | +packaging ``kdetoys_4.6.5-0ubuntu1.debian.tar.gz`` and the meta-data |
493 | +``kdetoys_4.6.5-0ubuntu1~ppa1.dsc``. Assuming you have dpkg-dev installed it |
494 | +will extract these and give you the source package. |
495 | + |
496 | +Traditional packaging would edit these files and upload. However this gives |
497 | +limited opportunity to collaborate with other developers, changes have to be |
498 | +passed around as diff files with no central way to track them and two developers |
499 | +can not make changes at the same time. So most teams have moved to putting |
500 | +their packaging in a revision control system. This makes it easier for several |
501 | +developers to work on a package together. However there is no direct |
502 | +connection between the revision control system and the archive packages so the |
503 | +two must be manually kept in sync. Since each team works in its own revision |
504 | +control system a prospective developer must first work out where that is and |
505 | +how to get the packaging before they can work on the package. |
506 | + |
507 | +Ubuntu Distributed Development |
508 | +------------------------------ |
509 | + |
510 | +With Ubuntu Distributed Development all packages in the Ubuntu (and Debian) |
511 | +archive are automatically imported into Bazaar branches on our code hosting |
512 | +site Launchpad. Changes can be made directly to these branches in |
513 | +incremental steps and by anyone with commit access. Changes can also be made |
514 | +in forked branched and merged back in with Merge Proposals when they are large |
515 | +enough to need review or if they are by someone without direct commit access. |
516 | + |
517 | +UDD branches are all in a standard location so doing a checkout is easy:: |
518 | + |
519 | + $ bzr branch ubuntu:kdetoys |
520 | + |
521 | +The merge history includes two separate branches, one for the upstream source |
522 | +and one which adds the ``debian/`` packaging directory:: |
523 | + |
524 | + $ cd kdetoys |
525 | + $ bzr qlog |
526 | + |
527 | +(This command uses *qbzr* for a GUI, run ``log`` instead of ``qlog`` for |
528 | +console output.) |
529 | + |
530 | +.. image:: images/kdetoys-udd-branch.png |
531 | + |
532 | +This UDD branch of *kdetoys* shows the full packaging for each version |
533 | +uploaded to Ubuntu with grey circles and the upstream source versions with |
534 | +green circles. Versions are tagged with either the version in Ubuntu such as |
535 | +``4:4.2.29-0ubuntu1`` or for the upstream branch with the upstream version |
536 | +``upstream-4.2.96``. |
537 | + |
538 | +Many Ubuntu packages are based on the packages in Debian, UDD also imports the |
539 | +Debian package into our branches. In the *kdetoys* branch above the Debian |
540 | +versions from *unstable* are from the merge with blue circles while those from |
541 | +*Debian experimental* are from the merge with yellow circles. Debian |
542 | +released are tagged with their version number e.g. ``4:4.2.2-1``. |
543 | + |
544 | +So from a UDD branch you can see the complete history of changes to the package |
545 | +and compare any two versions. For example, to see the changes between version |
546 | +4.2.2 in Debian and the 4.2.2 in Ubuntu use:: |
547 | + |
548 | + $ bzr qdiff -r tag:4:4.2.2-1..tag:4:4.2.2-1ubuntu1 |
549 | + |
550 | +(This command uses *qbzr* for a GUI, run ``diff`` instead of ``qdiff`` for |
551 | +console output.) |
552 | + |
553 | +.. image:: images/kdetoys-udd-diff.png |
554 | + |
555 | +From this we can clearly see what has changed in Ubuntu compared to Debian, |
556 | +very handy. |
557 | + |
558 | +Bazaar |
559 | +------ |
560 | + |
561 | +UDD branches use Bazaar, a distributed revision control system intended to be |
562 | +easy to use for those familiar with popular systems such as Subversion while |
563 | +offering the power of Git. |
564 | + |
565 | +To do packaging with UDD you will need to know the basics of how to use |
566 | +Bazaar to manage files. For an introduction to Bazaar see the `Bazaar Five |
567 | +Minute Tutorial |
568 | <http://doc.bazaar.canonical.com/bzr.dev/en/mini-tutorial/index.html>`_ and the |
569 | `Bazaar Users Guide |
570 | <http://doc.bazaar.canonical.com/bzr.dev/en/user-guide/index.html>`_. |
571 | |
572 | - |
573 | -Source package URLs |
574 | -=================== |
575 | - |
576 | -Bazaar provides some very nice shortcuts for accessing Launchpad's source |
577 | -branches of packages in both Ubuntu and Debian. |
578 | - |
579 | -To refer to source branches use:: |
580 | - |
581 | - ubuntu:package |
582 | - |
583 | -where *package* refers to the package name you're interested in. This URL |
584 | -refers to the package in the current development version of Ubuntu. To |
585 | -refer to the branch of Tomboy in the development version, you would use:: |
586 | - |
587 | - ubuntu:tomboy |
588 | - |
589 | -To refer to the version of a source package in an older release of Ubuntu, |
590 | -just prefix the package name with the release's code name. E.g. to refer to |
591 | -Tomboy's source package in Maverick_ use:: |
592 | - |
593 | - ubuntu:maverick/tomboy |
594 | - |
595 | -Since they are unique, you can also abbreviate the distro-series name:: |
596 | - |
597 | - ubuntu:m/tomboy |
598 | - |
599 | -You can use a similar scheme to access the source branches in Debian, although |
600 | -there are no shortcuts for the Debian distro-series names. To access the |
601 | -Tomboy branch in the current development series for Debian use: |
602 | - |
603 | - debianlp:tomboy |
604 | - |
605 | -and to access Tomboy in Debian Lenny_ use:: |
606 | - |
607 | - debianlp:lenny/tomboy |
608 | - |
609 | - |
610 | -.. _`Bazaar`: http://bazaar.canonical.com/en/ |
611 | -.. _`Intrepid`: https://wiki.ubuntu.com/IntrepidIbex |
612 | -.. _Maverick: https://wiki.ubuntu.com/MaverickMeerkat |
613 | -.. _Lenny: http://debian.org/releases/stable/ |
614 | - |
615 | - |
616 | -Getting the source |
617 | -================== |
618 | - |
619 | -Every source package in Ubuntu has an associated source branch on Launchpad. |
620 | -These source branches are updated automatically by Launchpad, although the |
621 | -process is not currently foolproof. |
622 | - |
623 | -There are a couple of things that we do first in order to make the workflow |
624 | -more efficient later. Once you are used to the process you will learn when it |
625 | -makes sense to skip these steps. |
626 | - |
627 | - |
628 | -.. _up-to-date: |
629 | - |
630 | -Ensure the source branch is up-to-date |
631 | --------------------------------------- |
632 | - |
633 | -Once you've determined which source package to work on, you should ensure that |
634 | -the source branch for that package on Launchpad is up-to-date. Some package |
635 | -imports fail for various reasons, and the `status of the package importer`_ is |
636 | -always available online. If the source branch for a package you want to work |
637 | -on is out of sync, you'll have to use ``apt-get source`` until the import of |
638 | -that package is fixed. |
639 | - |
640 | -Let's say you want to fix a problem in Tomboy in Natty. First, find out the |
641 | -latest binary package versions that are available:: |
642 | - |
643 | - $ rmadison tomboy | grep natty |
644 | - tomboy | 1.5.2-1ubuntu4 | natty | source, amd64, i386 |
645 | - |
646 | -You've already seen how to :ref:`determine the source package corresponding to |
647 | -this binary package <what-to-fix>`. For Tomboy, the binary and source |
648 | -packages are both named ``tomboy``. |
649 | - |
650 | -Whenever the package importer processes a new source package version, it adds |
651 | -a Bazaar tag corresponding to that new version. You can use this tag to |
652 | -ensure that the import is up-to-date. To find the tag of the last revision |
653 | -committed by the package importer, do:: |
654 | - |
655 | - $ bzr log ubuntu:tomboy | grep ^tags | head -n 1 |
656 | - tags: 1.5.2-1ubuntu4 |
657 | - |
658 | -By comparing the version number returned by ``rmadison`` and the tag added by |
659 | -the package importer, we can see that the ``tomboy`` source package for Natty |
660 | -is up-to-date. |
661 | - |
662 | -Here's an example of a package that is out-of-date. Let's say you want to fix |
663 | -a problem in the ``initscripts`` binary package. First find out the |
664 | -latest binary package versions that are available:: |
665 | - |
666 | - $ rmadison initscripts | tail -n 1 |
667 | - initscripts | 2.87dsf-4ubuntu25 | oneiric | amd64, i386 |
668 | - |
669 | -Then determine the source package corresponding to this binary package:: |
670 | - |
671 | - $ apt-cache showsrc initscripts | grep ^Package: |
672 | - Package: sysvinit |
673 | - |
674 | -Find the latest tag added by the package importer:: |
675 | - |
676 | - $ bzr log ubuntu:sysvinit | grep ^tags | head -n 1 |
677 | - tags: 2.86.ds1-61ubuntu13 |
678 | - |
679 | -Here we can see that ``2.86.ds1-61ubuntu13`` is older than |
680 | -``2.87dsf-4ubuntu19`` so the source package is out of date, and in fact we can |
681 | -verify that by looking at the status package for the package at |
682 | -http://package-import.ubuntu.com/status/sysvinit.html. |
683 | - |
684 | -When you find such out-of-date packages, be sure to `file a bug on the UDD |
685 | -project`_ to get the issue resolved. |
686 | - |
687 | -A feature in progress is for a warning to be automatically printed when |
688 | -branching an out of date import, this will make the above obsolete. |
689 | - |
690 | -.. _branching: |
691 | - |
692 | -Creating a shared repository |
693 | ----------------------------- |
694 | - |
695 | -Okay, you want to work on the Tomboy package in Natty, and you've verified |
696 | -that the source package is up-to-date. Before actually branching the code for |
697 | -Tomboy, create a shared repository to hold the branches for this package. |
698 | -The shared repository will make future work much more efficient. |
699 | - |
700 | -Do this using the `bzr init-repo` command, passing it the directory name we |
701 | -would like to use:: |
702 | - |
703 | - $ bzr init-repo tomboy |
704 | - |
705 | -You will see that a `tomboy` directory is created in your current working |
706 | -area. Change to this new directory for the rest of your work:: |
707 | - |
708 | - $ cd tomboy |
709 | - |
710 | - |
711 | -Getting the trunk branch |
712 | ------------------------- |
713 | - |
714 | -We use the `bzr branch` command to create a local branch of the package. |
715 | -We'll name the target directory `tomboy.dev` just to keep things easy to |
716 | -remember:: |
717 | - |
718 | - $ bzr branch ubuntu:tomboy tomboy.dev |
719 | - |
720 | -The tomboy.dev directory represents the version of Tomboy in the development |
721 | -version of Ubuntu, and you can always ``cd`` into this directory and do a `bzr |
722 | -pull` to get any future updates. |
723 | - |
724 | - |
725 | -Getting a branch for a particular release |
726 | ------------------------------------------ |
727 | - |
728 | -When you want to do something like a `stable release update`_ (SRU), or you |
729 | -just want to examine the code in an old release, you'll want to grab the |
730 | -branch corresponding to a particular Ubuntu release. For example, to get the |
731 | -Tomboy package for Maverick do:: |
732 | - |
733 | - $ bzr branch ubuntu:m/tomboy maverick |
734 | - |
735 | - |
736 | -Importing a Debian source package |
737 | ---------------------------------- |
738 | - |
739 | -If the package you want to work on is available in Debian but not Ubuntu, it's |
740 | -still easy to import the code to a local bzr branch for development. Let's |
741 | -say you want to import the `newpackage` source package. We'll start by |
742 | -creating a shared repository as normal, but we also have to create a working |
743 | -tree to which the source package will be imported (remember to cd out of the |
744 | -`tomboy` directory created above):: |
745 | - |
746 | - $ bzr init-repo newpackage |
747 | - $ cd newpackage |
748 | - $ bzr init debian |
749 | - $ cd debian |
750 | - $ bzr import-dsc http://ftp.de.debian.org/debian/pool/main/n/newpackage/newpackage_1.0-1.dsc |
751 | - |
752 | -As you can see, we just need to provide the remote location of the dsc file, |
753 | -and Bazaar will do the rest. You've now got a Bazaar source branch. |
754 | - |
755 | +Limitations of UDD |
756 | +------------------ |
757 | + |
758 | +Ubuntu Distributed Development is a new method for working with Ubuntu |
759 | +packages. It currently has some notable limitations: |
760 | + |
761 | +* Doing a full branch with history can take a lot of time and network |
762 | + resources. You may find it quicker to do a lightweight checkout ``bzr |
763 | + checkout --lightweight ubuntu:kdetoys`` but this will need a network access |
764 | + for any further bzr operations. |
765 | + |
766 | +* Working with patches is fiddly. Patches can be seen as a branched revision |
767 | + control system, so we end up with RCS on top of RCS. |
768 | + |
769 | +* There is no way to build directly from branches. You need to create a source |
770 | + package and upload that. |
771 | + |
772 | +* Some packages have not been successfully imported into UDD branches. You |
773 | + should check the `status of the package importer`_ before working on a branch. |
774 | + |
775 | +All of the above are being worked on and UDD is expected to become the main way |
776 | +to work on Ubuntu packages soon. However currently most teams within Ubuntu do |
777 | +not yet work with UDD branches for their development. However because UDD |
778 | +branches are the same as the packages in the archive any team should be able to |
779 | +accept merges against them. |
780 | |
781 | .. _`status of the package importer`: http://package-import.ubuntu.com/status |
782 | -.. _`file a bug on the UDD project`: https://bugs.launchpad.net/udd |
783 | -.. _`stable release update`: https://wiki.ubuntu.com/StableReleaseUpdates |
Question for Daniel: British English or American English?