Merge lp:~barry/ubuntu-packaging-guide/udd into lp:ubuntu-packaging-guide

Proposed by Barry Warsaw
Status: Merged
Merged at revision: 22
Proposed branch: lp:~barry/ubuntu-packaging-guide/udd
Merge into: lp:ubuntu-packaging-guide
Diff against target: 1884 lines (+1395/-279)
13 files modified
fixing-a-bug.rst (+67/-121)
getting-set-up.rst (+179/-157)
index.rst (+10/-1)
introduction-to-ubuntu-development.rst (+1/-0)
testing.rst (+67/-0)
udd-intro.rst (+225/-0)
udd-latest.rst (+46/-0)
udd-merging.rst (+111/-0)
udd-newpackage.rst (+170/-0)
udd-patchsys.rst (+190/-0)
udd-sponsorship.rst (+99/-0)
udd-uploading.rst (+120/-0)
udd-working.rst (+110/-0)
To merge this branch: bzr merge lp:~barry/ubuntu-packaging-guide/udd
Reviewer Review Type Date Requested Status
Daniel Holbach (community) Approve
Ubuntu Packaging Guide Team Pending
Review via email: mp+48685@code.launchpad.net

Description of the change

First cut at integrating UDD docs from the wiki page. Also, much cleaning and consistency of style, typos, etc.

To post a comment you must log in.
Revision history for this message
Daniel Holbach (dholbach) wrote :

EXCELLENT WORK!

A few quick comments:
 - Is ":rfc:5322" a macro that should do anything? It looks a bit weird in the generated HTML.
 - In "fixing a bug" can we link to how "branching the code" and "proposing a merge" works?

I most confess I'm a bit unsure about the structure of the guide and where we're going with it. The way I understood our discussions at UDS we essentially wanted to be task-based and provide articles that help folks to solve a specific problem (fix a bug, update a package to new upstream version, etc.) It's clear that by moving from the Wiki docs to the packaging guide you mostly followed the old structure. One way I can imagine this working out is by writing articles that explain how to attack a task "in general" and add a link to some other article if it doesn't pan out because it's one of those >10% weird cases. (Quick howto that links to in-depth articles if you really need to understand all of it.) Or maybe split the whole guide up into "knowledge base articles" vs. "howto guides"? Can you share your thoughts on it?

This is an excellent start, even if we should decide to juggle the sections around a little bit.

lp:~barry/ubuntu-packaging-guide/udd updated
28. By Barry Warsaw

Fix RFC markup.

29. By Barry Warsaw

Add some cross-references.

Revision history for this message
Barry Warsaw (barry) wrote :

On Feb 07, 2011, at 11:36 AM, Daniel Holbach wrote:

>EXCELLENT WORK!
>
>A few quick comments: - Is ":rfc:5322" a macro that should do anything? It
>looks a bit weird in the generated HTML.

It should be a link to the IETF page for the RFC, but I messed up the markup.
Fixed now.

> - In "fixing a bug" can we link to how "branching the code" and "proposing a
> - merge" works?

Good idea, done!

>I most confess I'm a bit unsure about the structure of the guide and where
>we're going with it. The way I understood our discussions at UDS we
>essentially wanted to be task-based and provide articles that help folks to
>solve a specific problem (fix a bug, update a package to new upstream
>version, etc.) It's clear that by moving from the Wiki docs to the packaging
>guide you mostly followed the old structure. One way I can imagine this
>working out is by writing articles that explain how to attack a task "in
>general" and add a link to some other article if it doesn't pan out because
>it's one of those >10% weird cases. (Quick howto that links to in-depth
>articles if you really need to understand all of it.) Or maybe split the
>whole guide up into "knowledge base articles" vs. "howto guides"? Can you
>share your thoughts on it?
>
>This is an excellent start, even if we should decide to juggle the sections
>around a little bit.

I totally agree this is just a start. I wanted to make sure the wiki
information was faithfully incorporated into the packaging guide docs. I
still need to make a pass through /usr/share/doc/bzr-builddeb/user_manual.
Once this lands and is available via (even a temporary) web page, I plan to
remove/disable the wiki pages and point them at this documentation.

But I fully agree that the guide should be reorganized at some point. I like
the idea of quick howto-guides and more in-depth kb articles. It's in the
latter that we could (possibly) introduce alternative ways of doing things.
For example, using sbuild instead of pbuilder.

Revision history for this message
Daniel Holbach (dholbach) wrote :

> I totally agree this is just a start. I wanted to make sure the wiki
> information was faithfully incorporated into the packaging guide docs. I
> still need to make a pass through /usr/share/doc/bzr-builddeb/user_manual.
> Once this lands and is available via (even a temporary) web page, I plan to
> remove/disable the wiki pages and point them at this documentation.
>
> But I fully agree that the guide should be reorganized at some point. I like
> the idea of quick howto-guides and more in-depth kb articles. It's in the
> latter that we could (possibly) introduce alternative ways of doing things.
> For example, using sbuild instead of pbuilder.

That sounds good to me. Maybe we can reorganise the TOC in that way.

What do you think about moving this to ~ubuntu-packaging-guide-team/ubuntu-packaging-guide/udd or something, so we can all work on making this happen?

Are there other opinions on this?

review: Needs Information
Revision history for this message
Barry Warsaw (barry) wrote :

I tend to think it would be better to keep everything together, even if it's currently a little disorganized. Better to be discoverable and fixable. :)

Revision history for this message
Daniel Holbach (dholbach) wrote :

> I tend to think it would be better to keep everything together, even if it's
> currently a little disorganized. Better to be discoverable and fixable. :)

I agree. In the interest of making sure we have all the old content, let's merge this.

Only one thing: can we revert the breaking up of the "fixing a bug" article? I'm happy for us to have separate dedicated "recipes" and "knowledge base articles" later on. What do you think?

lp:~barry/ubuntu-packaging-guide/udd updated
30. By Barry Warsaw

Merge typo fix.

Revision history for this message
Barry Warsaw (barry) wrote :

Hi Daniel, sorry for the delayed response.

As for fixing-a-bug.rst, here are my thoughts:

I added Figuring out what to fix, which I think is useful information at that point. In the old version it says "If you know which source package contains the code..." but what if you don't know? That's what I covered in the new section.

I guess you're suggesting that the 'bzr branch' commands in the old Get the code section should be restored, instead of moved to the branching.rst file? What do you think about adding back a section in the new version that shows a "quick teaser" for how to get the branch? The main article can still be in branching.rst, but I can add back most of the text from the old Get the code section.

The Work on a fix section is largely the same in both versions.

Testing the fix, Documenting the fix, and Committing the fix still do feel better split out, otherwise fixing-a-bug.rst will get to be too long I think. Or do you still feel strongly that those should be added back to fixing-a-bug.rst?

Tomorrow, I can push an updated branch based on your response.

Cheers!

Revision history for this message
Morten Kjeldgaard (mok0) wrote :

These additions to the documentation are very valuable, +1 from me. Wrt. the delete section on branching, it is a good section, and we should not lose it. However, I think it should be specified quite clear(ly that there are two ways of working with sources, one is the "Debian classic" way using source packages (dget/dput) the other is using Bazaar and branching.

A final comment: Anyone wanting to work with source packages and bug fixing really ought to install the ubuntu-dev-tools package, there is so much useful stuff in there that greatly eases your work. Afaik there is no central documentation of these tools anywhere, so perhaps this is the place?

Revision history for this message
Barry Warsaw (barry) wrote :

On Feb 26, 2011, at 06:18 AM, Morten Kjeldgaard wrote:

>These additions to the documentation are very valuable, +1 from me. Wrt. the
>delete section on branching, it is a good section, and we should not lose
>it. However, I think it should be specified quite clear(ly that there are two
>ways of working with sources, one is the "Debian classic" way using source
>packages (dget/dput) the other is using Bazaar and branching.

Note that we're not losing the information on branching, just moving it to a
more detailed section on a different page. We could bring back the 'quick
hint' information though.

Agreed about classic vs. udd, but that's for another branch. :)

>A final comment: Anyone wanting to work with source packages and bug fixing
>really ought to install the ubuntu-dev-tools package, there is so much useful
>stuff in there that greatly eases your work. Afaik there is no central
>documentation of these tools anywhere, so perhaps this is the place?

I've noticed the same thing myself. u-d-t really should get better
documentation, but it probably wouldn't hurt to document at least a summary of
the tools (and why you'd want to use them) here. It would be the one place
where an overview would be available.

Revision history for this message
Daniel Holbach (dholbach) wrote :

Please merge. I'll work on a separate branch
 - introducing a knowledge-base section
 - bringing the "fix a bug" article back together again

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'fixing-a-bug.rst'
2--- fixing-a-bug.rst 2011-01-11 21:23:06 +0000
3+++ fixing-a-bug.rst 2011-02-24 22:00:09 +0000
4@@ -1,8 +1,9 @@
5+======================
6 Fixing a bug in Ubuntu
7 ======================
8
9 Introduction
10-------------
11+============
12
13 If you followed the instructions to :doc:`get set up with Ubuntu
14 Development</getting-set-up>`, you should be all set and ready to go.
15@@ -16,7 +17,7 @@
16
17
18 Finding the problem
19--------------------
20+===================
21
22 There is a lot of different ways to find things to work on. It might be a bug
23 report you are encountering yourself (which gives you a good opportunity to
24@@ -28,25 +29,70 @@
25 it out and find your first bug to work on.
26
27
28-Get the code
29-------------
30-
31-If you know which source package contains the code that shows the problem, it
32-is trivial. Just type in::
33-
34- bzr branch lp:ubuntu/<packagename>
35-
36-where ``<packagename>`` is the name of the source package. This will check out
37-the code of the latest Ubuntu development release. If you need the code of a
38-stable release, let's say ``hardy``, you would type in::
39-
40- bzr branch lp:ubuntu/hardy/<packagename>
41+.. _what-to-fix:
42+
43+Figuring out what to fix
44+========================
45+
46+If you don't know the source package containing the code that has the problem,
47+but you do know the path to the affected program on your system, you can
48+discover the source package that you'll need to work on.
49+
50+Let's say you've found a bug in Tomboy, a note taking desktop application.
51+The Tomboy application can be started by running ``/usr/bin/tomboy`` on the
52+command line. To find the binary package containing this application, use
53+this command::
54+
55+ $ apt-file find /usr/bin/tomboy
56+
57+This would print out::
58+
59+ tomboy: /usr/bin/tomboy
60+
61+Note that the part preceding the colon is the binary package name. It's often
62+the case that the source package and binary package will have different names.
63+This is most common when a single source package is used to build multiple
64+different binary packages. To find the source package for a particular binary
65+package, type::
66+
67+ $ apt-cache show tomboy | grep ^Source:
68+
69+In this case, nothing is printed, meaning that ``tomboy`` is also the name of
70+the binary package. An example where the source and binary package names
71+differ is ``python-vigra``. While that is the binary package name, the source
72+package is actually ``libvigraimpex`` and can be found with this command (and
73+its output)::
74+
75+ $ apt-cache show python-vigra | grep ^Source:
76+ Source: libvigraimpex
77
78 .. XXX: Link to SRU article.
79
80
81-Work on fix
82------------
83+Getting the code
84+================
85+
86+Once you know the source package to work on, you will want to get a copy of
87+the code on your system, so that you can debug it. This is done by
88+:ref:`*branching* the source package <branching>` branch corresponding to the
89+source package. Launchpad maintains source package branches for all the
90+packages in Ubuntu.
91+
92+Once you've got a local branch of the source package, you can investigate the
93+bug, create a fix, and upload your proposed fix to Launchpad, in the form of a
94+Bazaar branch. When you are happy with your fix, you can :ref:`submit a
95+*merge proposal* <merge-proposal>`, which asks other Ubuntu developers to
96+review and approve your change. If they agree with your changes, an Ubuntu
97+developer will upload the new version of the package to Ubuntu so that
98+everyone gets the benefit or your excellent fix - and you get a little bit of
99+credit. You're now on your way to becoming an Ubuntu developer!
100+
101+We'll describe specifics on how to branch the code, push your fix, and request
102+a review in the following sections.
103+
104+
105+Work on a fix
106+=============
107
108 There are entire books written about finding bugs, fixing them, testing them,
109 etc. If you are completely new to programming, try to fix easy bugs such as
110@@ -62,110 +108,10 @@
111
112 .. XXX: Link to 'update to a new version' article.
113
114-
115-If you find a patch to fix the problem, running this command in the source
116-directory should apply the patch::
117-
118- patch -p1 < ../bugfix.patch
119+If you find a patch to fix the problem, say, attached to a bug report, running
120+this command in the source directory should apply the patch::
121+
122+ $ patch -p1 < ../bugfix.patch
123
124 Refer to the ``patch(1)`` manpage for options and arguments such as
125 ``--dry-run``, ``-p<num>``, etc.
126-
127-
128-Testing the fix
129----------------
130-
131-To build a test package with your changes, run these commands::
132-
133- bzr bd -- -S -us -uc
134- pbuilder-dist <release> build ../<package>_<version>.dsc
135-
136-This will create a source package from the branch contents (``-us -uc`` will
137-just omit the step to sign the source package) and pbuilder-dist will build
138-the package from source for whatever ``release`` you choose.
139-
140-Once the build succeeded, install the package from
141-``~/pbuilder/<release>_result/`` (using ``sudo dpkg -i
142-<package>_<version>.deb``). Then test to see if the bug is fixed.
143-
144-
145-
146-Documenting the fix
147--------------------
148-
149-It is very important to document your change sufficiently so developers who
150-look at the code in the future won't have to guess what your reasoning was and
151-what your assumptions were. Every Debian and Ubuntu package source includes
152-``debian/changelog``, where changes of each uploaded package are tracked.
153-
154-The easiest way to do this is to run::
155-
156- dch -i
157-
158-This will add a boilerplate changelog entry for you and launch an editor
159-where you can fill out the blanks. An example of this could be::
160-
161- specialpackage (1.2-3ubuntu4) natty; urgency=low
162-
163- * debian/control: updated description to include frobnicator (LP: #123456)
164-
165- -- Emma Adams <emma.adams@isp.com> Sat, 17 Jul 2010 02:53:39 +0200
166-
167-``dch`` should fill out the first and last line of such a changelog entry for
168-you already. Line 1 consists of the source package name, the version number,
169-which Ubuntu release it is uploaded to, the urgency (which almost always is
170-'low'). The last line always contains the name, email address and timestamp
171-(in RFC 2822 format) of the change.
172-
173-With that out of the way, let's focus on the actual changelog entry itself:
174-it is very important to document:
175-
176- #. where the change was done
177- #. what was changed
178- #. where the discussion of the change happened
179-
180-In our (very sparse) example the last point is covered by "(LP: #123456)"
181-which refers to Launchpad bug 123456. Bug reports or mailing list threads
182-or specifications are usually good information to provide as a rationale for a
183-change. As a bonus, if you use the ``LP: #<number>`` notation for Launchpad
184-bugs, the bug will be automatically closed when the package is uploaded to
185-Ubuntu.
186-
187-
188-Committing the fix
189-------------------
190-
191-With the changelog entry written and saved, you can just run::
192-
193- debcommit
194-
195-and the change will be committed (locally) with your changelog entry as a
196-commit message.
197-
198-To push it to Launchpad, as the remote branch name, you need to stick to the
199-following nomenclature::
200-
201- lp:~<yourlpid>/ubuntu/<release>/<package>/<branchname>
202-
203-This could for example be::
204-
205- lp:~emmaadams/ubuntu/natty/specialpackage/fix-for-123456
206-
207-So if you just run::
208-
209- bzr push lp:~emmaadams/ubuntu/natty/specialpackage/fix-for-123456
210- bzr lp-open
211-
212-you should be all set. The push command should push it to Launchpad and the
213-second command will open the Launchpad page of the remote branch in your
214-browser. There find the "(+) Propose for merging" link, click it to get the
215-change reviewed by somebody and included in Ubuntu.
216-
217-
218-Conclusion
219-----------
220-
221-.. XXX: link to 'forwarding patches' article
222-.. XXX: link to 'debdiff' article (in case of slow internet, package not
223- imported, etc.)
224-
225
226=== modified file 'getting-set-up.rst'
227--- getting-set-up.rst 2011-02-10 13:09:18 +0000
228+++ getting-set-up.rst 2011-02-24 22:00:09 +0000
229@@ -1,118 +1,123 @@
230+==============
231 Getting Set Up
232 ==============
233
234 There are a number of things you need to do in the beginning to enable you to
235 do Ubuntu development. A few of them you have to do locally on your system.
236-In addition to that you also need to inform Launchpad about yourself, so it
237+In addition to that you also need to inform Launchpad_ about yourself, so it
238 accepts changes you want to make.
239
240-When you followed all the steps in this article,
241+When you followed all the steps in this article,
242
243 * you have all the tools to do Ubuntu development installed on your machine,
244 * your local developer tools know about you, which simplifies work a lot,
245 * you can do local builds of packages,
246 * you can interact with other developers and propose your changes on Launchpad
247 to get merged,
248-* you can upload packages to Launchpad, so they are hosted in your Personal
249+* you can upload packages to Launchpad, so they are hosted in your Personal
250 Package Archive (PPA).
251
252
253-Running the development version
254--------------------------------
255-
256-It is advisable to run the current development version of Ubuntu. It will
257-allow you to test changes in a "live environment" where they are actually
258-built and tested in the development release you uploade them to.
259-
260-https://wiki.ubuntu.com/UsingDevelopmentReleases shows a variety of ways to
261+Run the development version
262+===========================
263+
264+It is advisable to run the current development version of Ubuntu. It will
265+allow you to test changes in a "live environment" where they are actually
266+built and tested in the development release you upload them to.
267+
268+https://wiki.ubuntu.com/UsingDevelopmentReleases shows a variety of ways to
269 use the development release in a safe way.
270
271
272-
273-Installing tools locally
274-------------------------
275-
276-Just run::
277-
278- sudo apt-get install gnupg pbuilder ubuntu-dev-tools bzr-builddeb
279-
280-and you should have all the tools you will need in the beginning.
281-
282-* ``gnupg`` you will need to create a GPG key with which you will sign files
283- you want to upload to Launchpad.
284-* ``pbuilder`` is a great tool to do a reproducible build of a package in a
285+Install the tools locally
286+=========================
287+
288+There are a number of tools that will make your life as an Ubuntu developer
289+much easier. You'll encounter these tools later in this guide. To install
290+most of the tools you'll need, run this command::
291+
292+ $ sudo apt-get install gnupg pbuilder ubuntu-dev-tools bzr-builddeb apt-file apt-cache
293+
294+These packages include:
295+
296+* ``gnupg`` -- `GNU Privacy Guard`_ contains tools you will need to create a
297+ cryptographic key with which you will sign files you want to upload to
298+ Launchpad.
299+* ``pbuilder`` -- a tool to do a reproducible builds of a package in a
300 clean and isolated environment.
301-* ``ubuntu-dev-tools`` (and ``devscripts``, a direct dependency) provide you
302- with a collection of tools that make a lot of packaging tasks a lot easier.
303-* ``bzr-builddeb`` (and ``bzr``, a dependency) will get you set up for working
304- in the distributed development environment, that makes it easy for many
305- developers to collaborate and work on the same code while keeping it trivial
306- to merge each others work.
307+* ``ubuntu-dev-tools`` (and ``devscripts``, a direct dependency) -- a
308+ collection of tools that make many packaging tasks easier.
309+* ``bzr-builddeb`` (and ``bzr``, a dependency) -- distributed version control
310+ tools that makes it easy for many developers to collaborate and work on the
311+ same code while keeping it trivial to merge each others work.
312+* ``apt-file`` provides an easy way to find the binary package that contains a
313+ given file.
314+* ``apt-cache`` provides even more information about packages on Ubuntu.
315
316
317 Setting up a GPG key
318---------------------
319+====================
320
321-GPG stands for `GNU Privacy Guard` and implements the OpenPGP standard which
322-allows you to sign and encrypt messages and files. This is useful for a number
323-of purposes. In our case it is important that you can sign files with your
324-key, so they can be identified as something that you worked on. If you upload
325-a source package to Launchpad, it will only accept the package if it can tell
326-who uploaded the package.
327+GPG stands for `GNU Privacy Guard`_ and it implements the OpenPGP standard
328+which allows you to sign and encrypt messages and files. This is useful for a
329+number of purposes. In our case it is important that you can sign files with
330+your key, so they can be identified as something that you worked on. If you
331+upload a source package to Launchpad, it will only accept the package if it
332+can absolutely determine who uploaded the package.
333
334 To generate a new GPG key, run::
335
336- gpg --key-gen
337+ $ gpg --key-gen
338
339-GnuPG will first ask you which kind of key you want to generate. Choosing the
340-default (RSA and DSA) is fine. Next it will ask you about the keysize. The
341-default (currently 2048) is fine, but 4096 is more secure. Afterwards it will
342+GPG will first ask you which kind of key you want to generate. Choosing the
343+default (RSA and DSA) is fine. Next it will ask you about the keysize. The
344+default (currently 2048) is fine, but 4096 is more secure. Afterward, it will
345 ask you if you want it to expire the key at some stage. It is safe to say "0",
346 which means the key will never expire. The last questions will be about your
347 name and email address. Just pick the ones you are going to use for Ubuntu
348-development here, you can add additional email addresses later on. Adding a
349-comment is not necessary. Then you will have to set a passphrase. Choose a
350-safe one. Now GnuPG will create a key for you, which can take a little bit
351-of time, as it needs random bytes, so if you give the system some work to
352-do it will be just fine.
353+development here, you can add additional email addresses later on. Adding a
354+comment is not necessary. Then you will have to set a passphrase. Choose a
355+safe one. Now GPG will create a key for you, which can take a little bit of
356+time; it needs random bytes, so if you give the system some work to do it will
357+be just fine. Move the cursor around!
358
359 Once this is done, you will get a message similar to this one::
360
361- pub 4096R/43CDE61D 2010-12-06
362- Key fingerprint = 5C28 0144 FB08 91C0 2CF3 37AC 6F0B F90F 43CD E61D
363- uid Daniel Holbach <dh@mailempfang.de>
364- sub 4096R/51FBE68C 2010-12-06
365-
366-In this case ``43CDE61D`` is they key ID.
367-
368-To upload (the public part of) of your key to a keyserver, so the world can
369+ pub 4096R/43CDE61D 2010-12-06
370+ Key fingerprint = 5C28 0144 FB08 91C0 2CF3 37AC 6F0B F90F 43CD E61D
371+ uid Daniel Holbach <dh@mailempfang.de>
372+ sub 4096R/51FBE68C 2010-12-06
373+
374+In this case ``43CDE61D`` is the *key ID*.
375+
376+To upload (the public part of) of your key to a keyserver, so the world can
377 identify messages and files as yours, just run::
378
379- gpg --send-keys <KEY ID>
380+ $ gpg --send-keys <KEY ID>
381
382 There is a network of keyservers that will automatically sync the key between
383-them.
384+themselves.
385+
386
387 Setting up an SSH key
388----------------------
389+=====================
390
391-SSH is a network protocol that allows you to exchange data in a secure way
392-over the network. In a lot of cases you will use it to access and open a
393-shell on another machine. It is also very useful to transfer files in a secure
394-way.
395+SSH_ is a network protocol that allows you to exchange data in a secure way
396+over the network. In a lot of cases you will use it to access and open a shell
397+on another machine. It is also very useful to transfer files in a secure way.
398
399 To generate a SSH key, run::
400
401- ssh-keygen -t rsa
402+ $ ssh-keygen -t rsa
403
404-The default filename makes sense, you can just leave it as it is. Also you
405-can choose to use a passphrase or not.
406+The default file name usually makes sense, so you can just leave it as it is.
407+For security purposes, it's highly recommended that you use a passphrase.
408
409 We will use the SSH key to securely push code changes to Launchpad.
410
411
412 Setting up pbuilder
413--------------------
414+===================
415
416 ``pbuilder`` allows you to build packages locally on your machine. It serves
417 a couple of purposes:
418@@ -120,139 +125,156 @@
419 * the build will be done in a minimal and clean environment, where you can
420 see if it succeeds in a reproducible way (with no modifications of the local
421 system
422-* there is no need to install all necessary `build-dependencs` locally
423+* there is no need to install all necessary *build dependencies* locally
424 * you can set up multiple instances for various Ubuntu and Debian releases
425
426-Setting ``pbuilder`` up is very easy. Edit `~/.pbuilderrc` and add the
427+Setting ``pbuilder`` up is very easy. Edit `~/.pbuilderrc` and add the
428 following line to it::
429
430- COMPONENTS="main universe multiverse restricted"
431+ COMPONENTS="main universe multiverse restricted"
432
433-This will ensure that `build-dependends` are satisfied using all components.
434+This will ensure that build dependencies are satisfied using all components.
435
436 Then run::
437
438- pbuilder-dist <release> create
439+ $ pbuilder-dist <release> create
440
441 where <release> is for example `natty`, `maverick`, `lucid` or in the case of
442-Debian maybe `sid`. This will take a while as it will download all the
443+Debian maybe `sid`. This will take a while as it will download all the
444 necessary packages for a "minimal installation". These will be cached though.
445
446
447-Setting up your development environment
448----------------------------------------
449-
450-Teaching Bazaar about you
451-^^^^^^^^^^^^^^^^^^^^^^^^^
452-
453-Bazaar is the tool we use to store code changes in a logical way, to exchange
454-proposed changes and merge them, even if development is done concurrently.
455-
456-To tell Bazaar who you are, simply run::
457-
458- bzr whoami "Frank Chu <fchu@example.com>"
459- bzr launchpad-login fchu
460-
461-`whoami` will tell Bazaar which name and email address it should use for your
462-commit messages. With `launchpad-login` you set your Launchpad ID. This way
463-code that you publish in Launchpad will be associated with you.
464-
465-Note: If you can not remember the ID, go to https://launchpad.net/people/+me
466-and see where it redirects you. The part after the "~" in the URL is your
467-Launchpad ID.)
468-
469-
470-Introducing you to the development tools
471-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
472-Similar to Bazaar, the Debian/Ubuntu packaging tools need to learn about you
473-as well. Simply open your `~/.bashrc` in a text editor and add something like
474-this to the bottom of it::
475-
476- export DEBFULLNAME="Frank Chu"
477- export DEBEMAIL="fchu@example.com"
478-
479-
480-Now save the file and either restart your terminal or run::
481-
482- source ~/.bashrc
483-
484-(If you use a different than the default shell, which is `bash`, please edit
485-the configuration file for that shell accordingly.)
486+Set up your development environment
487+===================================
488+
489+There are a few things you'll need to set up in your development environment
490+before you can start working on packages.
491
492
493 Launchpad
494 ---------
495+
496 Launchpad is the central piece of infrastructure we use in Ubuntu. It stores
497 not only our packages and our code, but also things like translations, bug
498-reports, information about the people who work on Ubuntu and which teams they
499-are part of.
500-
501-You will need to register with Launchpad and give it some information about
502-you so you can get started and it will accept packages, bug reports, code
503-branches, etc. from you.
504-
505-
506-Setting up a profile
507-^^^^^^^^^^^^^^^^^^^^
508-
509-Generally it should be enough to head to https://launchpad.net/+login and
510-enter your email address. It will send back an email to you with a link you
511-need to open in your browser. (If you don not receive it, check in your Spam
512-folder too.)
513-
514-Next you will have to choose a display name. Almost everybody just uses their
515-real name here.
516-
517-https://help.launchpad.net/YourAccount/NewAccount has more information about
518+reports, information about the people who work on Ubuntu and which teams they
519+are part of. You'll also use Launchpad to publish your proposed fixes, and
520+get other Ubuntu developers to review and sponsor them.
521+
522+You will need to register with Launchpad and provide a minimal amount of
523+information, so that you can download and upload code, submit bug reports, and
524+more.
525+
526+
527+Setting up an account
528+---------------------
529+
530+If you don't already have a Launchpad account, you can easily `create one`_.
531+If you have a Launchpad account but cannot remember your Launchpad id, you can
532+find this out by going to https://launchpad.net/people/+me and looking for the
533+part after the `~` in the URL.
534+
535+Launchpad's registration process will ask you to choose a display name. It's
536+encouraged for you to use your real name here. so that your Ubuntu developer
537+colleagues will be able to get to know you better.
538+
539+When you register a new account, Launchpad will send you an email with a link
540+you need to open in your browser, in order to verify your email address. If
541+you don't receive it, check in your spam folder.
542+
543+https://help.launchpad.net/YourAccount/NewAccount has more information about
544 the process and additional settings you can change.
545
546
547 Uploading the GPG key to Launchpad
548-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
549+----------------------------------
550
551 To find about your GPG fingerprint, run::
552
553- gpg --fingerprint <email@address.com>
554+ $ gpg --fingerprint <email@address.com>
555
556 and it will print out something like::
557
558- pub 4096R/43CDE61D 2010-12-06
559- Key fingerprint = 5C28 0144 FB08 91C0 2CF3 37AC 6F0B F90F 43CD E61D
560- uid Daniel Holbach <dh@mailempfang.de>
561- sub 4096R/51FBE68C 2010-12-06
562+ pub 4096R/43CDE61D 2010-12-06
563+ Key fingerprint = 5C28 0144 FB08 91C0 2CF3 37AC 6F0B F90F 43CD E61D
564+ uid Daniel Holbach <dh@mailempfang.de>
565+ sub 4096R/51FBE68C 2010-12-06
566
567
568 Head to https://launchpad.net/people/+me/+editpgpkeys and copy the part about
569-your "Key fingerprint" into the text box. In the case above this would be
570-``5C28 0144 FB08 91C0 2CF3 37AC 6F0B F90F 43CD E61D``. Now click on "Import
571+your "Key fingerprint" into the text box. In the case above this would be
572+``5C28 0144 FB08 91C0 2CF3 37AC 6F0B F90F 43CD E61D``. Now click on "Import
573 Key".
574
575-Launchpad will use the fingerprint to check the Ubuntu key server for your
576-key and, if successful, send you an encrypted email asking you to confirm
577-the key import. Check your email account and read the email that Launchpad
578-sent you. `If your email client supports OpenPGP encryption, it will prompt
579-you for the password you chose for the key when GPG generated it. Enter the
580+Launchpad will use the fingerprint to check the Ubuntu key server for your
581+key and, if successful, send you an encrypted email asking you to confirm
582+the key import. Check your email account and read the email that Launchpad
583+sent you. `If your email client supports OpenPGP encryption, it will prompt
584+you for the password you chose for the key when GPG generated it. Enter the
585 password, then click the link to confirm that the key is yours.`
586
587-Launchpad encrypts the email, using your public key, so that it can be sure
588-that the key is yours. If your email software does not support OpenPGP
589-encryption, copy the encrypted email's contents, type ``gpg`` in your
590-terminal, then paste the email contents into your terminal window.
591-
592-Back on the Launchpad website, use the Confirm button and Launchpad will
593-complete the import of your OpenPGP key.
594-
595-Find more information at
596+Launchpad encrypts the email, using your public key, so that it can be sure
597+that the key is yours. If your email software does not support OpenPGP
598+encryption, copy the encrypted email's contents, type ``gpg`` in your
599+terminal, then paste the email contents into your terminal window.
600+
601+Back on the Launchpad website, use the Confirm button and Launchpad will
602+complete the import of your OpenPGP key.
603+
604+Find more information at
605 https://help.launchpad.net/YourAccount/ImportingYourPGPKey
606
607 Uploading your SSH key
608-^^^^^^^^^^^^^^^^^^^^^^
609+----------------------
610
611 Open https://launchpad.net/people/+me/+editsshkeys in a web browser, also open
612-``~/.ssh/id_rsa.pub`` in a text editor. It is the public part of your SSH key,
613-so it is safe to share it with Launchpad. Copy the contents of the file and
614-paste them into the text box on the web page that says "Add an SSH key". Now
615+``~/.ssh/id_rsa.pub`` in a text editor. It is the public part of your SSH key,
616+so it is safe to share it with Launchpad. Copy the contents of the file and
617+paste them into the text box on the web page that says "Add an SSH key". Now
618 click "Import Public Key".
619
620-More information is available at
621+More information is available at
622 https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair
623+
624+
625+Teaching Bazaar about you
626+-------------------------
627+
628+Bazaar is the tool we use to store code changes in a logical way, to exchange
629+proposed changes and merge them, even if development is done concurrently.
630+
631+To tell Bazaar who you are, simply run::
632+
633+ $ bzr whoami "Bob Dobbs <subgenius@example.com>"
634+ $ bzr launchpad-login subgenius
635+
636+`whoami` will tell Bazaar which name and email address it should use for your
637+commit messages. With `launchpad-login` you set your Launchpad ID. This way
638+code that you publish in Launchpad will be associated with you.
639+
640+Note: If you can not remember the ID, go to https://launchpad.net/people/+me
641+and see where it redirects you. The part after the "~" in the URL is your
642+Launchpad ID.)
643+
644+
645+Introducing you to the development tools
646+----------------------------------------
647+Similar to Bazaar, the Debian/Ubuntu packaging tools need to learn about you
648+as well. Simply open your `~/.bashrc` in a text editor and add something like
649+this to the bottom of it::
650+
651+ $ export DEBFULLNAME="Bob Dobbs"
652+ $ export DEBEMAIL="subgenius@example.com"
653+
654+
655+Now save the file and either restart your terminal or run::
656+
657+ $ source ~/.bashrc
658+
659+(If you use a different than the default shell, which is `bash`, please edit
660+the configuration file for that shell accordingly.)
661+
662+
663+.. _`GNU Privacy Guard`: http://gnupg.org/
664+.. _SSH: http://www.openssh.com/
665+.. _Launchpad: http://launchpad.net
666+.. _`create one`: https://launchpad.net/+login
667
668=== modified file 'index.rst'
669--- index.rst 2010-12-06 16:36:30 +0000
670+++ index.rst 2011-02-24 22:00:09 +0000
671@@ -14,6 +14,16 @@
672 introduction-to-ubuntu-development
673 getting-set-up
674 fixing-a-bug
675+ udd-intro
676+ udd-working
677+ udd-sponsorship
678+ udd-uploading
679+ udd-latest
680+ udd-merging
681+ udd-patchsys
682+ udd-newpackage
683+ testing
684+
685
686 Indices and tables
687 ==================
688@@ -21,4 +31,3 @@
689 * :ref:`genindex`
690 * :ref:`modindex`
691 * :ref:`search`
692-
693
694=== modified file 'introduction-to-ubuntu-development.rst'
695--- introduction-to-ubuntu-development.rst 2010-12-13 15:23:22 +0000
696+++ introduction-to-ubuntu-development.rst 2011-02-24 22:00:09 +0000
697@@ -1,3 +1,4 @@
698+==================================
699 Introduction to Ubuntu Development
700 ==================================
701
702
703=== added file 'testing.rst'
704--- testing.rst 1970-01-01 00:00:00 +0000
705+++ testing.rst 2011-02-24 22:00:09 +0000
706@@ -0,0 +1,67 @@
707+===============
708+Testing the fix
709+===============
710+
711+To build a test package with your changes, run these commands::
712+
713+ $ bzr bd -S -- -us -uc
714+ $ pbuilder-dist <release> build ../<package>_<version>.dsc
715+
716+This will create a source package from the branch contents (``-us -uc`` will
717+just omit the step to sign the source package) and ``pbuilder-dist`` will
718+build the package from source for whatever ``release`` you choose.
719+
720+Once the build succeeded, install the package from
721+``~/pbuilder/<release>_result/`` (using ``sudo dpkg -i
722+<package>_<version>.deb``). Then test to see if the bug is fixed.
723+
724+
725+Documenting the fix
726+===================
727+
728+It is very important to document your change sufficiently so developers who
729+look at the code in the future won't have to guess what your reasoning was and
730+what your assumptions were. Every Debian and Ubuntu package source includes
731+``debian/changelog``, where changes of each uploaded package are tracked.
732+
733+The easiest way to do this is to run::
734+
735+ $ dch -i
736+
737+This will add a boilerplate changelog entry for you and launch an editor
738+where you can fill out the blanks. An example of this could be::
739+
740+ specialpackage (1.2-3ubuntu4) natty; urgency=low
741+
742+ * debian/control: updated description to include frobnicator (LP: #123456)
743+
744+ -- Emma Adams <emma.adams@isp.com> Sat, 17 Jul 2010 02:53:39 +0200
745+
746+``dch`` should fill out the first and last line of such a changelog entry for
747+you already. Line 1 consists of the source package name, the version number,
748+which Ubuntu release it is uploaded to, the urgency (which almost always is
749+'low'). The last line always contains the name, email address and timestamp
750+(in :rfc:`5322` format) of the change.
751+
752+With that out of the way, let's focus on the actual changelog entry itself:
753+it is very important to document:
754+
755+ #. where the change was done
756+ #. what was changed
757+ #. where the discussion of the change happened
758+
759+In our (very sparse) example the last point is covered by ``(LP: #123456)``
760+which refers to Launchpad bug 123456. Bug reports or mailing list threads or
761+specifications are usually good information to provide as a rationale for a
762+change. As a bonus, if you use the ``LP: #<number>`` notation for Launchpad
763+bugs, the bug will be automatically closed when the package is uploaded to
764+Ubuntu.
765+
766+
767+Conclusion
768+==========
769+
770+.. XXX: link to 'forwarding patches' article
771+.. XXX: link to 'debdiff' article (in case of slow internet, package not
772+ imported, etc.)
773+
774
775=== added file 'udd-intro.rst'
776--- udd-intro.rst 1970-01-01 00:00:00 +0000
777+++ udd-intro.rst 2011-02-24 22:00:09 +0000
778@@ -0,0 +1,225 @@
779+==============================
780+Ubuntu Distributed Development
781+==============================
782+
783+*Ubuntu Distributed Development* (UDD) is a technique for developing Ubuntu
784+packages that uses tools, processes, and workflows similar to generic
785+distributed version control (dVCS) system-based software development. The
786+dVCS used for UDD is Bazaar_.
787+
788+You should already be familiar with basic Bazaar usage and workflow. Ubuntu
789+Intrepid_ or later is required for these instructions to work.
790+
791+
792+Source package URLs
793+===================
794+
795+Bazaar provides some very nice shortcuts for accessing the source branches of
796+packages in both Ubuntu and Debian (on Launchpad). These shortcuts are
797+available in Bazaar version 2.3 or newer. You can still access source
798+branches in older versions of Bazaar, using a slightly more verbose syntax.
799+
800+The examples in this guide always use the ``ubuntu:`` prefix.
801+
802+
803+Source branch shortcuts
804+-----------------------
805+
806+To refer to source branches use::
807+
808+ ubuntu:package
809+
810+where *package* refers to the package name you're interested in. This URL
811+refers to the package in the current development version of Ubuntu. As of
812+this writing (2011-02-04) that version is Natty_ which will be released as
813+Ubuntu 11.04. Thus, to refer to the branch of Tomboy in Natty, you would
814+use::
815+
816+ ubuntu:tomboy
817+
818+To refer to the version of a source package in an older release of ubuntu,
819+just prefix the package name with the release's code name. E.g. to refer to
820+Tomboy's source package in Maverick_ use::
821+
822+ ubuntu:maverick/tomboy
823+
824+Since they are unique, you can also abbreviate the distro-series name::
825+
826+ ubuntu:m/tomboy
827+
828+You can use a similar scheme to access the source branches in Debian, although
829+there are no shortcuts for the Debian distro-series names. To access the
830+Tomboy branch in the current development series for Debian use:
831+
832+ debianlp:tomboy
833+
834+and to access Tomboy in Debian Lenny_ use::
835+
836+ debianlp:lenny/tomboy
837+
838+
839+Explicit source branches
840+------------------------
841+
842+If you're using an older version of Bazaar, the ``ubuntu:`` and ``debianlp:``
843+prefixes won't be available to you. Instead use the ``lp:`` prefix to access
844+the source branch. For example, Tomboy in the latest Ubuntu development
845+release is available at::
846+
847+ lp:ubuntu/tomboy
848+
849+while the Maverick version is available at::
850+
851+ lp:ubuntu/maverick/tomboy
852+
853+and the Debian Lenny version is available at::
854+
855+ lp:debian/lenny/tomboy
856+
857+
858+.. _`Bazaar`: http://bazaar.canonical.com/en/
859+.. _`Intrepid`: https://wiki.ubuntu.com/IntrepidIbex
860+.. _Natty: https://wiki.ubuntu.com/NattyNarwhal
861+.. _Maverick: https://wiki.ubuntu.com/MaverickMeerkat
862+.. _Lenny: http://debian.org/releases/stable/
863+
864+
865+Getting the source
866+==================
867+
868+Every source package in Ubuntu has an associated source branch on Launchpad.
869+These source branches are updated automatically by Launchpad, although the
870+process is not currently foolproof.
871+
872+There are a couple of things that we do first in order to make the workflow
873+more efficient later. Once you are used to the process you will learn when it
874+makes sense to skip these steps.
875+
876+
877+.. _up-to-date:
878+
879+Ensure the source branch is up-to-date
880+--------------------------------------
881+
882+Once you've determined which source package to work on, you should ensure that
883+the source branch for that package on Launchpad is up-to-date. Some package
884+imports fail for various reasons, and the `status of the package importer`_ is
885+always available online. If the source branch for a package you want to work
886+on is out of sync, you'll have to use ``apt-get source`` until the import of
887+that package is fixed.
888+
889+Let's say you want to fix a problem in Tomboy in Natty. First, find out the
890+latest binary package versions that are available::
891+
892+ $ rmadison tomboy | grep natty
893+ tomboy | 1.5.2-1ubuntu4 | natty | source, amd64, i386
894+
895+You've already seen how to :ref:`determine the source package corresponding to
896+this binary package <what-to-fix>`. For Tomboy, the binary and source
897+packages are both named ``tomboy``.
898+
899+Whenever the package importer processes a new source package version, it adds
900+a Bazaar tag corresponding to that new version. You can use this tag to
901+ensure that the import is up-to-date. To find the tag of the last revision
902+committed by the package importer, do::
903+
904+ $ bzr log -l 1 ubuntu:tomboy | grep ^tags:
905+ tags: 1.5.2-1ubuntu4
906+
907+By comparing the version number returned by ``rmadison`` and the tag added by
908+the package importer, we can see that the ``tomboy`` source package for Natty
909+is up-to-date.
910+
911+Here's an example of a package that is out-of-date. Let's say you want to fix
912+a problem in the ``initscripts`` binary package on Natty_. First find out the
913+latest binary package versions that are available::
914+
915+ $ rmadison initscripts | grep natty
916+ initscripts | 2.87dsf-4ubuntu19 | natty | amd64, i386
917+
918+Then determine the source package corresponding to this binary package::
919+
920+ $ apt-cache show initscripts | grep ^Source:
921+ Source: sysvinit
922+
923+Find the latest tag added by the package importer::
924+
925+ $ bzr log -l 1 ubuntu:sysvinit | grep ^tags:
926+ tags: 2.86.ds1-61ubuntu13
927+
928+Here we can see that ``2.86.ds1-61ubuntu13`` is older than
929+``2.87dsf-4ubuntu19`` so the source package is out of date, and in fact we can
930+verify that by looking at the status package for the package at
931+http://package-import.ubuntu.com/status/sysvinit.html.
932+
933+When you find such out-of-date packages, be sure to `file a bug on the UDD
934+project`_ to get the issue resolved.
935+
936+.. _branching:
937+
938+Creating a shared repository
939+----------------------------
940+
941+Okay, you want to work on the Tomboy package in Natty, and you've verified
942+that the source package is up-to-date. Before actually branching the code for
943+Tomboy, create a shared repository to hold the branches for this package.
944+The shared repository will make future work much more efficient.
945+
946+Do this using the `bzr init-repo` command, passing it the directory name we
947+would like to use::
948+
949+ $ bzr init-repo tomboy
950+
951+You will see that a `tomboy` directory is created in your current working
952+area. Change to this new directory for the rest of your work::
953+
954+ $ cd foobar
955+
956+
957+Getting the trunk branch
958+------------------------
959+
960+We use the `bzr branch` command to create a local branch of the package.
961+We'll name the target directory `natty` just to keep things easy to remember::
962+
963+ $ bzr branch ubuntu:tomboy natty
964+
965+The `natty` directory represents the version of Tomboy in Natty, and you can
966+always ``cd`` into this directory and do a `bzr pull` to get any future
967+updates.
968+
969+
970+Getting a branch for a particular release
971+-----------------------------------------
972+
973+When you want to do something like a `stable release update`_ (SRU), or you
974+just want to examine the code in an old release, you'll want to grab the
975+branch corresponding to a particular pocket in a particular Ubuntu release.
976+For example, to get the Tomboy package for Maverick do::
977+
978+ $ bzr branch ubuntu:m/tomboy maverick
979+
980+
981+Importing a Debian source package
982+---------------------------------
983+
984+If the package you want to work on is available in Debian but not Ubuntu, it's
985+still easy to import the code to a local bzr branch for development. Let's
986+say you want to import the `newpackage` source package. We'll start by
987+creating a shared repository as normal, but we also have to create a working
988+tree to which the source package will be imported (remember to cd out of the
989+`tomboy` directory created above)::
990+
991+ $ bzr init-repo newpackage
992+ $ cd new-package
993+ $ bzr init debian
994+ $ cd debian
995+ $ bzr import-dsc http://ftp.de.debian.org/debian/pool/main/n/newpackage/newpackage_1.0-1.dsc
996+
997+As you can see, we just need to provide the remote location of the dsc file,
998+and Bazaar will do the rest. You've now got a Bazaar source branch.
999+
1000+
1001+.. _`status of the package importer`: http://package-import.ubuntu.com/status
1002+.. _`file a bug on the UDD project`: https://bugs.launchpad.net/udd
1003+.. _`stable release update`: https://wiki.ubuntu.com/StableReleaseUpdates
1004
1005=== added file 'udd-latest.rst'
1006--- udd-latest.rst 1970-01-01 00:00:00 +0000
1007+++ udd-latest.rst 2011-02-24 22:00:09 +0000
1008@@ -0,0 +1,46 @@
1009+==================
1010+Getting The Latest
1011+==================
1012+
1013+If someone else has landed changes on a package, you will want to pull down
1014+those changes in your own copies of the package branches.
1015+
1016+
1017+Updating your main branch
1018+=========================
1019+
1020+Updating your copy of a branch that corresponds to the package in a particular
1021+release is very simple, simply use `bzr pull` from the appropriate directory::
1022+
1023+ $ cd tomboy/natty
1024+ $ bzr pull
1025+
1026+This works wherever you have a checkout of a branch, so it will work for
1027+things like branches of `maverick`, `hardy-proposed`, etc.
1028+
1029+
1030+Getting the latest in to your working branches
1031+==============================================
1032+
1033+Once you have updated your copy of a distroseries branch, then you may want to
1034+merge this in to your working branches as well, so that they are based on the
1035+latest code.
1036+
1037+You don't have to do this all the time though. You can work on slightly older
1038+code with no problems. The disadvantage would come if you were working on
1039+some code that someone else changed. If you are not working on the latest
1040+version then your changes may not be correct, and may even produce conflicts.
1041+
1042+The merge does have to be done at some point though. The longer it is left,
1043+the harder may be, so doing it regularly should keep each merge simple. Even
1044+if there are many merges the total effort would hopefully be less.
1045+
1046+To merge the changes you just need to use `bzr merge-package`, but you must
1047+have committed your current work first::
1048+
1049+ $ cd tomboy/bug-12345
1050+ $ bzr merge-package ../natty
1051+
1052+Any conflicts will be reported, and you can fix them up. To review the
1053+changes that you just merged use `bzr diff`. To undo the merge use `bzr
1054+revert`. Once you are happy with the changes then use `bzr commit`.
1055
1056=== added file 'udd-merging.rst'
1057--- udd-merging.rst 1970-01-01 00:00:00 +0000
1058+++ udd-merging.rst 2011-02-24 22:00:09 +0000
1059@@ -0,0 +1,111 @@
1060+=======
1061+Merging
1062+=======
1063+
1064+Merging is one of the strengths of Bazaar, and something we do often in Ubuntu
1065+development. Updates can be merged from Debian, from a new upstream release,
1066+and from other Ubuntu developers. Doing it in Bazaar is pretty simple, and
1067+all based around the `bzr merge-package` command.
1068+
1069+The first thing to do is to check that the `package importer`_
1070+:ref:`hasn't failed <up-to-date>` for the package you're going to work on.
1071+
1072+When you are in any branch's working directory then you can merge from
1073+another. First check you have no uncommitted changes::
1074+
1075+ $ bzr status
1076+
1077+If that reports anything then you will either have to commit the changes,
1078+revert them, or shelve them to come back to later.
1079+
1080+
1081+Merging from Debian
1082+===================
1083+
1084+Next run `bzr merge-package` passing the URL of the branch to merge from. For
1085+instance, to merge from the version of the package in Debian Squeeze_ run::
1086+
1087+ $ bzr merge-package lp:debian/squeeze/tomboy
1088+
1089+This will merge the changes since the last merge point and leave you with
1090+changes to review. This may cause some conflicts. You can see everything
1091+that the `merge-package` command did by running::
1092+
1093+ $ bzr status
1094+ $ bzr diff
1095+
1096+If conflicts are reported then you need to edit those files to make them look
1097+how they should, removing the *conflict markers*. Once you have done, run::
1098+
1099+ $ bzr resolve
1100+ $ bzr conflicts
1101+
1102+This will resolve any conflicted files that you fixed, and then tell you what
1103+else you have to deal with.
1104+
1105+Once any conflicts are resolved, and you have made any other changes that you
1106+need, you will add a new changelog entry, and commit::
1107+
1108+ $ dch -i
1109+ $ debcommit
1110+
1111+as described earlier.
1112+
1113+However, before you commit, it is always a good thing to check all the Ubuntu
1114+changes by running::
1115+
1116+ $ bzr diff -r tag:0.6.10-5
1117+
1118+which will show the diff between the new Debian (0.6.10-5) and Ubuntu versions
1119+(0.6.10-5ubuntu1). In similar way you can compare to any other versions. To
1120+see all available versions run::
1121+
1122+ $ bzr tags
1123+
1124+After testing and committing the merge, you will need to seek sponsorship or
1125+upload to the archive in the normal way.
1126+
1127+
1128+Merging a new upstream version
1129+==============================
1130+
1131+When upstream releases a new version (or you want to package a snapshot) then
1132+you have to merge a tarball into your branch.
1133+
1134+This is done using the `bzr merge-upstream` command. From inside the branch
1135+that you want to merge to you run something like::
1136+
1137+ $ bzr merge-upstream --version 1.2 http://example.org/releases/foobar-1.2.tar.gz
1138+
1139+This will download the tarball at the specified URL, and merge it in to your
1140+branch, automatically adding a `debian/changelog` entry for you.
1141+
1142+The `--version` option is used to specify the upstream version that is being
1143+merged in, as the command isn't able to infer that (yet).
1144+
1145+The last parameter is the location of the tarball that you are upgrading to;
1146+this can either be a local filesystem path, or a http, ftp, sftp, etc. URI as
1147+shown. The command will automatically download the tarball for you. If you
1148+point to a `.tar.bz2` or similar tarball then it will recompress it as needed,
1149+or convert it if you pass it a `.zip` or similar. If your package is v3
1150+(quilt) format and so can support `.tar.bz2` upstream tarballs then pass a
1151+`--v3` option to prevent the repacking (this should be `automatically
1152+detected`_).
1153+
1154+The `merge-upstream` command will either tell you that it completed
1155+successfully, or that there were conflicts. Either way you will be able to
1156+review the changes before committing as normal.
1157+
1158+If you are merging an upstream release into an existing Bazaar branch that has
1159+not previously used the UDD layout, `bzr merge-upstream` will fail with an
1160+error that the tag for the previous upstream version is not available; the
1161+merge can't be completed without knowing what base version to merge against.
1162+To work around this, create a tag in your existing existing repo for the last
1163+upstream version present there; e.g., if the last Ubuntu release was
1164+*1.1-0ubuntu3*, create the tag *upstream-1.1* pointing to the bzr revision you
1165+want to use as the tip of the upstream branch.
1166+
1167+
1168+.. _`package importer`: http://package-import.ubuntu.com/status/
1169+.. _Squeeze: http://wiki.debian.org/DebianSqueeze
1170+.. _`automatically detected`: https://bugs.edge.launchpad.net/bzr-builddeb/+bug/627718
1171
1172=== added file 'udd-newpackage.rst'
1173--- udd-newpackage.rst 1970-01-01 00:00:00 +0000
1174+++ udd-newpackage.rst 2011-02-24 22:00:09 +0000
1175@@ -0,0 +1,170 @@
1176+======================
1177+Building a new package
1178+======================
1179+
1180+Let's say I have an upstream project that is not yet available for Ubuntu. I
1181+want to create a package from this project and make it available as a PPA_ so
1182+that other people can more easily use the code. This also makes a good first
1183+step in contributing your package to universe_.
1184+
1185+
1186+Example package
1187+===============
1188+
1189+I started with a Python library called `flufl.enum`_, which is a fairly
1190+typical setuptools-based Python package. Fortunately, it's also maintained in
1191+Launchpad using Bazaar, so that makes bootstrapping much easier. (TBD: add
1192+instructions for using other upstream VCSs.)
1193+
1194+Because we want to package the trunk branch, getting started is pretty
1195+simple::
1196+
1197+ $ bzr init-repo flufl.enum
1198+ $ cd flufl.enum
1199+ $ bzr branch lp:flufl.enum trunk
1200+ $ bzr branch trunk debianize
1201+ $ cd debianize
1202+
1203+
1204+Bootstrapping
1205+=============
1206+
1207+You need to get the initial ``debian`` directory created somehow, along with
1208+all the expected files inside that. There are many ways to bootstrap that,
1209+and hopefully there will eventually be `some convergence`_ in the methods,
1210+especially if you're building standard Python setuptools-based libraries and
1211+applications.
1212+
1213+
1214+The bzr-builddeb way
1215+--------------------
1216+
1217+You could of course just use `dh_make(8)` to get things going, or you could
1218+use `bzr dh-make`. The latter might provide some benefits, and can be run
1219+like so from inside your branch::
1220+
1221+ $ bzr dh-make PKGNAME VERSION DOWNLOADURL
1222+ $ bzr add debian
1223+
1224+If you don't have a URL to download a tarball from, you'll need to create the
1225+tarball locally first. Use ``bzr dh-make --help`` for details on this command.
1226+
1227+After you've created the ``debian`` directory template, be sure to ``bzr rm``
1228+any ``debian`` files you don't need (e.g. the ``*.ex`` files), and edit files
1229+such as ``debian/control``, ``debian/watch``, ``debian/copyright`` and
1230+``debian/changelog``. The following section may give you some hints about
1231+that.
1232+
1233+
1234+The stdeb way
1235+-------------
1236+
1237+Another way I've found useful for initializing the ``debian`` directory for
1238+Python setuptools-based packages, is to use the stdeb_ package. The full
1239+documentation for this package is available on the `upstream home`_, but you
1240+won't need all of the commands. stdeb has a command that is *exactly* what
1241+we're looking for!
1242+
1243+In either case, start by putting this in your ``~/.pydistutils.cfg`` file::
1244+
1245+ [global]
1246+ command.packages:stdeb.command
1247+
1248+
1249+Modern stdeb
1250+~~~~~~~~~~~~
1251+
1252+Here's how easy it is::
1253+
1254+ $ python setup.py debianize
1255+ $ bzr add debian
1256+ $ bzr commit -m'Debianize'
1257+
1258+We also need a ``debian/copyright`` file. Normally, we'd use ``dh_make -c``
1259+for that but again, that doesn't play nicely with UDD. ``dh_make`` expects a
1260+particular file system layout that we don't have. No matter, we'll add the
1261+copyright file manually::
1262+
1263+ $ cp /usr/share/debhelper/dh_make/licenses/lgpl3 debian/copyright
1264+ $ edit debian/copyright
1265+ $ bzr add debian/copyright
1266+ $ bzr commit -m'Added copyright file'
1267+
1268+
1269+stdeb <= 0.5.1
1270+~~~~~~~~~~~~~~
1271+
1272+If you have an older version of stdeb, use this command to create the basic
1273+``debian/`` directory layout::
1274+
1275+ $ python setup.py sdist_dsc
1276+
1277+This command leaves you with a ``deb_dist`` directory containing a
1278+``flufl.enum_3.0.1`` directory. Inside that is your ``debian/`` directory.
1279+Because we're using UDD we don't care about anything else that ``sdist_dsc``
1280+produces, so we can shuffle things around and remove the cruft.
1281+
1282+ $ mv deb_dist/munepy-2.0.1/debian .
1283+ $ rm -rf deb_dist
1284+ $ bzr add debian
1285+ $ bzr commit -m'Add debian directory'
1286+
1287+
1288+pkgme
1289+-----
1290+
1291+pkgme_ is a new tool that makes it easy to Debianize a new package. TBD:
1292+describe how to use it.
1293+
1294+
1295+debian/control file
1296+===================
1297+
1298+You probably want to edit the ``debian/control`` file at this point, adding
1299+any information that's missing, or fixing incorrect default information. For
1300+example, I needed to modify the ``Maintainer`` and ``Description`` fields, and
1301+add ``X-Python-Version`` and ``Homepage`` fields.
1302+
1303+Now we want to build the source package. The easiest way to do that is with
1304+the ``bzr-builddeb`` plugin, however this requires a valid ``debian/watch``
1305+file so that builddeb can find the upstream tarball. This really should match
1306+the version of the checkout you've made.
1307+
1308+
1309+debian/watch file
1310+=================
1311+
1312+Here for example is the ``debian/watch`` file I'm using::
1313+
1314+ version=3
1315+ http://pypi.python.org/packages/source/f/flufl.enum/flufl.enum-(.*).tar.gz
1316+
1317+If your tarballs live on Launchpad, the ``debian/watch`` file is a little more
1318+complicated (see `Question 21146`_ and `Bug 231797`_ for why this is). In
1319+that case, use something like::
1320+
1321+ version=3
1322+ https://launchpad.net/flufl.enum/+download http://launchpad.net/flufl.enum/.*/flufl.enum-(.+).tar.gz
1323+
1324+So, then it's a matter of...::
1325+
1326+ $ bzr add debian/watch
1327+ $ bzr commit -m'added debian/watch file'
1328+
1329+
1330+Building the source package
1331+===========================
1332+
1333+Now we can build the source package and publish the package as we normally
1334+would, with ``bzr bd -S`` and ``dput``.
1335+
1336+
1337+.. _PPA: https://help.launchpad.net/Packaging/PPA
1338+.. _universe: https://wiki.ubuntu.com/MOTU/GettingStarted
1339+.. _`flufl.enum`: http://launchpad.net/flufl.enum
1340+.. _`some convergence`: http://launchpad.net/bugs/545361
1341+.. _stdeb: http://packages.ubuntu.com/lucid/python-stdeb
1342+.. _`upstream home`: http://github.com/astraw/stdeb#the-commands
1343+.. _pkgme: https://launchpad.net/pkgme
1344+.. _`Question 21146`: https://answers.launchpad.net/launchpad/+question/21146
1345+.. _`Bug 231797`: https://launchpad.net/bugs/231797
1346
1347=== added file 'udd-patchsys.rst'
1348--- udd-patchsys.rst 1970-01-01 00:00:00 +0000
1349+++ udd-patchsys.rst 2011-02-24 22:00:09 +0000
1350@@ -0,0 +1,190 @@
1351+===========================
1352+Working with a patch system
1353+===========================
1354+
1355+Many existing packages that have changes from upstream express those changes
1356+using a `patch system`_, of which there are several to choose from. Usually,
1357+when you make an additional change to a package, you'll want to add a patch
1358+file to the patch system being used, rather than editing the source code in
1359+place. Note however that it is considered bad practice to add a patch system
1360+to a package that does not already have one. In that case, either coordinate
1361+with the Debian maintainer, or edit the files in place. You can find out if
1362+your package has a patch system by using the ``what-patch`` command (from the
1363+``ubuntu-dev-tools`` package).
1364+
1365+Although UDD, and in particular `Bazaar looms`_ makes it pretty easy to keep
1366+individual patches separated, if you're submitting changes to be uploaded,
1367+you're currently better off playing along with the package's patch system.
1368+*You will want at least bzr loom version 2.2.1dev, otherwise you'll have
1369+problems pushing and pulling your threads to Launchpad.* Do ``bzr plugins`` to
1370+find the version you're using.
1371+
1372+Here are some guidelines that I've found helpful. Clearly the existing tools
1373+can be improved, but for now this seems to work well enough. This assumes
1374+you're using looms to develop your patch, and that the package itself uses the
1375+quilt_ patch system.
1376+
1377+One important thing to know: all source branches reflect the tree after a
1378+``quilt push -a``. In other words, when you branch a source branch, you get
1379+the tree with all patches applied, ready for you to jump right into hacking.
1380+You do not need to ``quilt push -a`` manually, and in fact, you'll get a tree
1381+with lots of distracting modifications if you push or pop all the changes. Or
1382+to put it another way, once you have a branch, jump right in!
1383+
1384+
1385+Develop your patch
1386+==================
1387+
1388+Start as you normally would with UDD and looms::
1389+
1390+ $ bzr init-repo foobar
1391+ $ cd foobar
1392+ $ bzr branch ubuntu:foobar
1393+ $ bzr branch foobar bug-12345
1394+ $ cd bug-12345
1395+ $ bzr loomify --base trunk
1396+ $ bzr create-thread sourcefix
1397+
1398+Now that you are in the ``sourcefix`` thread, just edit the source code,
1399+making whatever changes you need to fix the bug. Don't worry about the patch
1400+system at this point, at least until you are happy with your changes. If
1401+someone else pushes changes to the package while you're working on it, just
1402+``bzr commit`` your current work, ``bzr down-thread`` to ``trunk``, pull the
1403+updates, and ``bzr up-thread --auto`` back to the ``sourcefix`` thread,
1404+resolving any conflicts along the way. You can periodically commit your
1405+changes, ``bzr record`` and push them to Launchpad as you go, of course
1406+linking your branch to the bug in Launchpad. So far, it's just normal
1407+development with looms.
1408+
1409+Once you're happy with your changes, you need to essentially import your
1410+thread's changes into a quilt patch. This is fairly easy to do. While inside
1411+the ``sourcefix`` thread do::
1412+
1413+ $ bzr create-thread quiltfix
1414+ $ bzr diff -rthread:trunk..thread:sourcefix | quilt import -p0 -P bug-12345 /dev/stdin
1415+ $ bzr add debian/patches/bug-12345
1416+ $ quilt push
1417+ $ quilt pop
1418+ $ bzr commit
1419+
1420+Why the last push/pop before the commit? The push gets the imported changes
1421+into the quilt patch, but also leaves the tree modified, so you'll essentially
1422+have the changes both in the ``debian/`` directory and in the source tree.
1423+The pop undoes the tree changes (which are also available in the ``sourcefix``
1424+thread), but leaves the quilt change available. A ``bzr commit`` at this
1425+point gives you a thread with just the changes to ``debian/``.
1426+
1427+
1428+Problems
1429+========
1430+
1431+The problem comes when you want to modify the patch, e.g.::
1432+
1433+ $ bzr down-thread
1434+ <hack, commit>
1435+
1436+This does *not* work well::
1437+
1438+ $ bzr up-thread
1439+
1440+You'd expect at this point to be able to ``quilt fold`` your new changes to
1441+update your ``bug-12345`` quilt patch, but in fact, this doesn't work. You can
1442+end up with difficult to resolve conflicts, patch failures and rejections. My
1443+recommendation is that when you make changes to your ``sourcefix`` thread,
1444+blow away your ``quiltfix`` thread and regenerate it. Looms make this easy::
1445+
1446+ $ bzr up-thread
1447+ $ bzr revert
1448+ $ bzr combine-thread --force (throws away your quiltfix changes)
1449+ $ bzr create-thread quiltfix
1450+ $ bzr diff -rthread:trunk..thread:sourcefix | quilt import -p0 -P bug-12345 /dev/stdin
1451+ etc...
1452+
1453+So you've thrown away the original ``quiltfix`` thread and recreated it, with
1454+your updated ``sourcefix`` changes.
1455+
1456+
1457+Gotchas
1458+=======
1459+
1460+One thing to keep in mind is that quilt uses a hidden ``.pc`` directory to
1461+record its status. This directory is under version control in all source
1462+branches. *Watch out* for changes to the ``.pc`` directory that are unrelated
1463+(or more accurately, uninteresting) to your patch. This can happen because
1464+the UDD source branch importer `currently includes any existing .pc
1465+directory`_ in the imported branch. This can cause conflicts, or other
1466+unwanted or unknown changes because you've essentially got two conflicting
1467+version control systems competing for the same thing (i.e. bzr and quilt3).
1468+For now, the best recommendation is to revert any changes to the ``.pc``
1469+directory in your branch.
1470+
1471+
1472+Publishing your changes
1473+=======================
1474+
1475+It's actually easier at this point to generate a diff for attaching to the bug
1476+report. While inside the ``quiltfix`` thread, just::
1477+
1478+ $ bzr up-thread --auto
1479+ $ bzr diff -rthread: > bug-12345.diff
1480+
1481+The differences between the ``quiltfix`` thread and the ``sourcefix`` thread
1482+are the interesting bits, and totally appropriate for committing and upload.
1483+Because of the way looms interacts with Launchpad, you can still link your
1484+branch to the bug and request a merge proposal, but understand that the diff
1485+will include all changes between ``quiltfix`` (top) and ``trunk`` (bottom)
1486+threads. So the merge proposal will include the changes in the ``debian/``
1487+directory, *and* the changes in the source tree. As long as you and your
1488+reviewer understands this, you should be okay, but it can be confusing at
1489+first.
1490+
1491+If you need a sponsor to merge and upload your changes, one thing they *do
1492+not* want to do is::
1493+
1494+ $ bzr branch ubuntu:foobar
1495+ $ cd foobar
1496+ $ bzr merge lp:~you/ubuntu/natty/foobar/yourfix
1497+
1498+Much badness (in the form of infinite *maximum recursion depth* exceptions)
1499+ensues. Yes, we need to file a bug on that.
1500+
1501+
1502+edit-patch
1503+==========
1504+
1505+``edit-patch`` is a nice little wrapper script that comes as part of the
1506+``ubuntu-dev-tools`` package. It pretty much hides the nasty details of
1507+dealing with the patch system specifically. For example, while the above
1508+works well if your package is using quilt already, you'll have to adjust the
1509+workflow, perhaps significantly, to work with `a different patch system`_. In
1510+theory ``edit-patch`` should solve this, but there are currently two blockers.
1511+
1512+ * By default, ``bzr diff`` produces a ``-p0`` patch, but ``edit-patch``
1513+ defers to the underlying patch system's default. For quilt, this is
1514+ ``-p1``. ``quilt import`` takes a ``-p`` argument to specify the prefix
1515+ level, but this isn't yet exposed in ``edit-patch``. If you're
1516+ adventurous, try changing the ``bzr diff`` command above to specify the
1517+ proper prefixes using its ``-p`` option.
1518+ * By default, ``edit-patch`` requires a path to an existing patch file, but
1519+ it's more convenient to pipe the output of ``bzr diff`` to the stdin of
1520+ ``edit-patch``, as shown above. The alternative would be to save the diff
1521+ in a temporary file, and then point ``edit-patch`` to this temporary file.
1522+
1523+
1524+Future
1525+======
1526+
1527+Ideally, it would be nice to add a ``bzr edit-patch`` or some such command
1528+which does the whole loom -> patch system import. At least ``edit-patch``
1529+could grow a ``-p`` and ``-P`` option, as well as read from stdin. Stay
1530+tuned, or get involved!
1531+
1532+There's now `a bug` that tracks this.
1533+
1534+
1535+.. _`patch system`: https://wiki.ubuntu.com/DistributedDevelopment/Documentation/PatchSystem/PackagingGuide/PatchSystems
1536+.. _`Bazaar looms`: https://launchpad.net/bzr-loom
1537+.. _quilt: http://www.wzdftpd.net/blog/index.php?2008/02/05/3-quilt-a-patch-management-system-how-to-survive-with-many-patches
1538+.. _`currently includes any existing .pc directory`: https://bugs.launchpad.net/udd/+bug/672740
1539+.. _`a different patch system`: http://wiki.debian.org/debian/patches
1540+.. _`a bug`: https://launchpad.net/bugs/620721
1541
1542=== added file 'udd-sponsorship.rst'
1543--- udd-sponsorship.rst 1970-01-01 00:00:00 +0000
1544+++ udd-sponsorship.rst 2011-02-24 22:00:09 +0000
1545@@ -0,0 +1,99 @@
1546+==============================
1547+Seeking Review and Sponsorship
1548+==============================
1549+
1550+One of the biggest advantages to using the UDD workflow is to improve quality
1551+by seeking review of changes by your peers. This is true whether or not you
1552+have upload rights yourself. Of course, if you don't have upload rights, you
1553+will need to seek sponsorship.
1554+
1555+Once you are happy with your fix, and have a branch ready to go, the following
1556+steps can be used to publish your branch on Launchpad, link it to the bug
1557+issue, and create a *merge proposal* for others to review, and sponsors to
1558+upload.
1559+
1560+
1561+.. _merge-proposal:
1562+
1563+Pushing to Launchpad
1564+====================
1565+
1566+We previously showed you how to :ref:`link your branch to the bug
1567+<link-via-changelog>` using ``dch`` and ``debcommit``. However, the branch
1568+and bug don't actually get linked until you push the branch to Launchpad.
1569+
1570+It is not critical to have a link to a bug for every change you make,
1571+but if you are fixing reported bugs then linking to them will be useful.
1572+
1573+The general form of the URL you should push your branch to is::
1574+
1575+ lp:~<user-id>/ubuntu/<distroseries>/<package>/bug-12345
1576+
1577+For example, to push your fix for bug 12345 in the Tomboy package for Natty,
1578+you'd use::
1579+
1580+ $ bzr push lp:~subgenius/ubuntu/natty/tomboy/bug-12345
1581+
1582+The last component of the path is actually arbitrary; it's up to you to pick
1583+something meaningful.
1584+
1585+However, this usually isn't enough to get Ubuntu developers to review and
1586+sponsor your change. You should next submit a *merge proposal*.
1587+
1588+To do this open the bug page in a browser, e.g.::
1589+
1590+ $ bzr lp-open
1591+
1592+if that fails, then you can use
1593+
1594+ $ xdg-open https://code.launchpad.net/~subgenius/ubuntu/natty/tomboy/bug-12345
1595+
1596+where most of the URL matches what you used for `bzr push`. On this page,
1597+you'll see a link that says *Propose for merging into another branch*. Type
1598+in an explanation of your change in the *Initial Comment* box. Lastly, click
1599+*Propose Merge* to complete the process.
1600+
1601+Merge proposals to package source branches will automatically subscribe the
1602+`~ubuntu-branches` team, which should be enough to reach an Ubuntu developer
1603+who can review and sponsor your package change.
1604+
1605+
1606+Generating a debdiff
1607+====================
1608+
1609+As noted above, some sponsors still prefer reviewing a *debdiff* attached to
1610+bug reports instead of a merge proposal. If you're requested to include a
1611+debdiff, you can generate one like this (from inside your `bug-12345`
1612+branch)::
1613+
1614+ $ bzr diff -rbranch:../natty
1615+
1616+Another way is to is to open the merge proposal and download the diff.
1617+
1618+You should ensure that diff has the changes you expect, no more and no less.
1619+Name the diff appropriately, e.g. foobar-12345.debdiff and attach it to the
1620+bug report.
1621+
1622+
1623+Dealing with feedback from sponsors
1624+===================================
1625+
1626+If a sponsor reviews your branch and asks you to change something, you can do
1627+this fairly easily. Simply go to the branch that you were working in before,
1628+make the changes requested, and then commit::
1629+
1630+ $ bzr commit
1631+
1632+Now when you push your branch to Launchpad, Bazaar will remembered where you
1633+pushed to, and will only update the branch on Launchpad with your latest
1634+commits. All you need to do is::
1635+
1636+ $ bzr push
1637+
1638+You can then reply to the merge proposal review explaining what you changed,
1639+and asking for re-review, or you can reply on the merge proposal page in
1640+Launchpad.
1641+
1642+Note that if you are sponsored via debdiff attached to a bug report you need
1643+to manually update by generating a new diff and attaching that to the bug
1644+report.
1645
1646=== added file 'udd-uploading.rst'
1647--- udd-uploading.rst 1970-01-01 00:00:00 +0000
1648+++ udd-uploading.rst 2011-02-24 22:00:09 +0000
1649@@ -0,0 +1,120 @@
1650+===================
1651+Uploading a package
1652+===================
1653+
1654+Once your merge proposal is reviewed and approved, you will want to upload
1655+your package, either to the archive (if you have permission) or to your
1656+*`Personal Package Archive`_* (PPA). You might also want to do an upload if
1657+you are sponsoring someone else's changes.
1658+
1659+
1660+Uploading a change made by you
1661+==============================
1662+
1663+When you have a branch with a change that you would like to upload you need to
1664+get that change back on to the main source branch, build a source package, and
1665+then upload it.
1666+
1667+First, you need to check that you have the latest version of the package in
1668+your checkout of the development package::
1669+
1670+ $ cd tomboy/natty
1671+ $ bzr pull
1672+
1673+This pulls in any changes that may have been committed while you were working
1674+on your fix. From here, you have several options. If the changes on the
1675+trunk are large, and it will take a while to merge them and test the package,
1676+then you can merge them back into your working branch to do this. If not,
1677+then you can carry on merging your working branch to the main one. You'll
1678+want to use the Bazaar ``merge-package`` command rather than just ``merge``::
1679+
1680+ $ bzr merge-package ../bug-12345
1681+
1682+This will merge the two trees, possibly producing conflicts, which you'll need
1683+to resolve manually.
1684+
1685+Next you should make sure the `debian/changelog` is as you would like, with
1686+the correct distribution, version number, etc.
1687+
1688+Once that is done you should review the change you are about to commit
1689+with `bzr diff`. This should show you the same changes as a debdiff would
1690+before you upload the source package.
1691+
1692+The next step is to build and test the modified source package as you normally
1693+would. Once you are happy with the upload then you should `dput` the
1694+source package. For example, if you want to upload your changes to your PPA,
1695+then you'd do::
1696+
1697+ $ dput ppa:imasponsor/myppa tomboy_1.5.2-1ubuntu5.dsc
1698+
1699+You might want to do one more `bzr commit` to make sure all your changes are
1700+committed in your working tree.
1701+
1702+The last step is to mark the change as being the same as the source package
1703+that was uploaded, so run::
1704+
1705+ $ bzr mark-uploaded
1706+
1707+This also tells the package importer that what is in the Bazaar branch is the
1708+same as in the archive.
1709+
1710+Now you can push the changes back to Launchpad::
1711+
1712+ $ bzr push ubuntu:tomboy
1713+
1714+(Change the destination if you are uploading an SRU or similar.)
1715+
1716+You are now free to delete your feature branch, as it is merged, and can
1717+be re-downloaded from Launchpad if needed.
1718+
1719+
1720+Sponsoring a change
1721+===================
1722+
1723+Sponsoring someone else's change is just like the above procedure, but instead
1724+of merging from a branch you created, you merge from the branch in the merge
1725+proposal::
1726+
1727+ $ bzr merge-package lp:~subgenius/ubuntu/natty/tomboy/bug-12345
1728+
1729+The difference would be that if there are lots of merge conflicts then you
1730+would probably want to ask the contributor to fix them up. To do that see the
1731+next section.
1732+
1733+
1734+Canceling an upload
1735+===================
1736+
1737+At any time before you `dput` the source package you can decide to cancel an
1738+upload and revert the changes::
1739+
1740+ $ bzr revert
1741+
1742+You can do this if you notice something needs more work, or if you would like
1743+to ask the contributor to fix up conflicts when sponsoring something.
1744+
1745+
1746+Sponsoring something and making your own changes
1747+================================================
1748+
1749+If you are going to sponsor someone's work, but you would like to roll it up
1750+with some changes of your own then you can merge their work in to a separate
1751+branch first.
1752+
1753+If you already have a branch where you are working on the package and you
1754+would like to include their changes, then simply run the `bzr merge-package`
1755+from that branch, instead of the checkout of the development package. You can
1756+then make the changes and commit, and then carry on with your changes to the
1757+package.
1758+
1759+If you don't have an existing branch, but you know you would like to make
1760+changes based on what the contributor provides then you should start by
1761+grabbing their branch::
1762+
1763+ $ bzr branch lp:~subgenius/ubuntu/natty/tomboy/bug-12345
1764+
1765+then work in this new branch, and then merge it in to the main one and upload
1766+as if it was your own work. The contributor will still be mentioned in the
1767+changelog, and Bazaar will correctly attribute the changes they made to them.
1768+
1769+.. _`Personal Package Archive`: https://help.launchpad.net/Packaging/PPA
1770
1771=== added file 'udd-working.rst'
1772--- udd-working.rst 1970-01-01 00:00:00 +0000
1773+++ udd-working.rst 2011-02-24 22:00:09 +0000
1774@@ -0,0 +1,110 @@
1775+====================
1776+Working on a Package
1777+====================
1778+
1779+Once you have the source package branch in a shared repository, you'll want to
1780+create additional branches for the fixes or other work you plan to do. You'll
1781+want to base your branch off the package source branch for the distro release
1782+that you plan to upload to. Usually this is the current development release,
1783+but it may be older releases if you're backporting to an SRU for example.
1784+
1785+
1786+Branching for a change
1787+======================
1788+
1789+The first thing to do is to make sure your source package branch is
1790+up-to-date. It will be if you just checked it out, otherwise do this::
1791+
1792+ $ cd natty
1793+ $ bzr pull
1794+
1795+Any updates to the package that have uploaded since your checkout will now be
1796+pulled in. You do not want to make changes to this branch. Instead, create a
1797+branch that will contain just the changes you're going to make. Let's say you
1798+want to fix bug 12345 for the Tomboy project. When you're in the shared
1799+repository you previously created for Tomboy, you can create your bug fix
1800+branch like this::
1801+
1802+ $ bzr branch natty bug-12345
1803+ $ cd bug-12345
1804+
1805+Now you can do all my work in the `bug-12345` directory. You make changes
1806+there as necessary, committing as you go along. This is just like doing any
1807+kind of software development with Bazaar. You can make intermediate commits
1808+as often as you like, and when your changes are finished, you will use the
1809+standard `dch` command (from the `devscripts` package)::
1810+
1811+ $ dch -i
1812+
1813+This will drop you in an editor to add an entry to the `debian/changelog`
1814+file.
1815+
1816+.. _link-via-changelog:
1817+
1818+Here's where things diverge a little from typical Bazaar usage. When you
1819+added your `debian/changelog` entry, you should have included a bug fix tag
1820+that indicated which Launchpad bug issue you're fixing. The format of this
1821+textual tag is pretty strict: ``LP: #12345``. The space between the ``:`` and
1822+the ``#`` is required and of course the number will be replaced by the actual
1823+bug number you're fixing. Your `debian/changelog` entry might look something
1824+like::
1825+
1826+ tomboy (1.5.2-1ubuntu5) natty; urgency=low
1827+
1828+ * Don't fubar the frobnicator. (LP: #12345)
1829+
1830+ -- Bob Dobbs <subgenius@example.com> Mon, 10 Jan 2011 16:10:01 -0500
1831+
1832+Normally, when you want to commit changes to your branch, you just use ``bzr
1833+commit``, but in the case where you've made a change to ``debian/changelog``,
1834+you'll want to use the ``debcommit`` command instead::
1835+
1836+ $ debcommit
1837+
1838+The reason to use ``debcommit`` instead is that it automatically includes your
1839+``debian/changelog`` entry in the commit message, and it also adds the
1840+necessary metadata to link your branch to the bug report when you push your
1841+branch to Launchpad. You can do that manually with ``bzr commit`` (and
1842+eventually, ``bzr commit`` may get smart enough to do it for you), but for now
1843+``debcommit`` is the most convenient way to do it.
1844+
1845+
1846+Building the package
1847+====================
1848+
1849+Along the way, you'll want to build your branch so that you can test it to
1850+make sure it does actually fix the bug.
1851+
1852+In order to build the package you can use the `bzr builddeb` command from
1853+the `bzr-builddeb` package. You can build a source package with::
1854+
1855+ $ bzr bd -S
1856+
1857+(`bd` is an alias for `builddeb`.) You can leave the package unsigned by
1858+appending `-- -uc -us` to the command.
1859+
1860+It is also possible to use your normal tools, as long as they are able to
1861+strip the .bzr directories from the package, e.g.::
1862+
1863+ $ debuild -i -I
1864+
1865+If you ever see an error related to trying to build a native package without a
1866+tarball, check to see if there is a `.bzr-builddeb/default.conf` file
1867+erroneously specifying the package as native. If the changelog version has a
1868+dash in it, then it's not a native package, so remove the configuration file.
1869+Note that while `bzr bd` has a `--native` switch, it does not have a
1870+`--no-native` switch.
1871+
1872+You might also see an error that looks something like this:
1873+
1874+ dpkg-source: error: Version number suggests Ubuntu changes, but
1875+ Maintainer: does not have Ubuntu address
1876+
1877+In a sense, this is a safeguard to ensure that ``update-maintainer`` is run
1878+when necessary. However in this case, you can just temporarily set the
1879+``$DEBEMAIL`` environment variable to a non-@ubuntu.com address::
1880+
1881+ $ DEBEMAIL='me@example.com' bzr bd -S
1882+
1883+Once you've got the source package, you can build it as normal with
1884+``pbuilder`` or ``sbuild``.

Subscribers

People subscribed via source and target branches