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
=== modified file 'fixing-a-bug.rst'
--- fixing-a-bug.rst 2011-01-11 21:23:06 +0000
+++ fixing-a-bug.rst 2011-02-24 22:00:09 +0000
@@ -1,8 +1,9 @@
1======================
1Fixing a bug in Ubuntu2Fixing a bug in Ubuntu
2======================3======================
34
4Introduction5Introduction
5------------6============
67
7If you followed the instructions to :doc:`get set up with Ubuntu 8If you followed the instructions to :doc:`get set up with Ubuntu
8Development</getting-set-up>`, you should be all set and ready to go.9Development</getting-set-up>`, you should be all set and ready to go.
@@ -16,7 +17,7 @@
1617
1718
18Finding the problem19Finding the problem
19-------------------20===================
2021
21There is a lot of different ways to find things to work on. It might be a bug22There is a lot of different ways to find things to work on. It might be a bug
22report you are encountering yourself (which gives you a good opportunity to23report you are encountering yourself (which gives you a good opportunity to
@@ -28,25 +29,70 @@
28it out and find your first bug to work on.29it out and find your first bug to work on.
2930
3031
31Get the code32.. _what-to-fix:
32------------33
3334Figuring out what to fix
34If you know which source package contains the code that shows the problem, it 35========================
35is trivial. Just type in::36
3637If you don't know the source package containing the code that has the problem,
37 bzr branch lp:ubuntu/<packagename>38but you do know the path to the affected program on your system, you can
3839discover the source package that you'll need to work on.
39where ``<packagename>`` is the name of the source package. This will check out40
40the code of the latest Ubuntu development release. If you need the code of a 41Let's say you've found a bug in Tomboy, a note taking desktop application.
41stable release, let's say ``hardy``, you would type in::42The Tomboy application can be started by running ``/usr/bin/tomboy`` on the
4243command line. To find the binary package containing this application, use
43 bzr branch lp:ubuntu/hardy/<packagename>44this command::
45
46 $ apt-file find /usr/bin/tomboy
47
48This would print out::
49
50 tomboy: /usr/bin/tomboy
51
52Note that the part preceding the colon is the binary package name. It's often
53the case that the source package and binary package will have different names.
54This is most common when a single source package is used to build multiple
55different binary packages. To find the source package for a particular binary
56package, type::
57
58 $ apt-cache show tomboy | grep ^Source:
59
60In this case, nothing is printed, meaning that ``tomboy`` is also the name of
61the binary package. An example where the source and binary package names
62differ is ``python-vigra``. While that is the binary package name, the source
63package is actually ``libvigraimpex`` and can be found with this command (and
64its output)::
65
66 $ apt-cache show python-vigra | grep ^Source:
67 Source: libvigraimpex
4468
45.. XXX: Link to SRU article.69.. XXX: Link to SRU article.
4670
4771
48Work on fix72Getting the code
49-----------73================
74
75Once you know the source package to work on, you will want to get a copy of
76the code on your system, so that you can debug it. This is done by
77:ref:`*branching* the source package <branching>` branch corresponding to the
78source package. Launchpad maintains source package branches for all the
79packages in Ubuntu.
80
81Once you've got a local branch of the source package, you can investigate the
82bug, create a fix, and upload your proposed fix to Launchpad, in the form of a
83Bazaar branch. When you are happy with your fix, you can :ref:`submit a
84*merge proposal* <merge-proposal>`, which asks other Ubuntu developers to
85review and approve your change. If they agree with your changes, an Ubuntu
86developer will upload the new version of the package to Ubuntu so that
87everyone gets the benefit or your excellent fix - and you get a little bit of
88credit. You're now on your way to becoming an Ubuntu developer!
89
90We'll describe specifics on how to branch the code, push your fix, and request
91a review in the following sections.
92
93
94Work on a fix
95=============
5096
51There are entire books written about finding bugs, fixing them, testing them, 97There are entire books written about finding bugs, fixing them, testing them,
52etc. If you are completely new to programming, try to fix easy bugs such as98etc. If you are completely new to programming, try to fix easy bugs such as
@@ -62,110 +108,10 @@
62108
63.. XXX: Link to 'update to a new version' article.109.. XXX: Link to 'update to a new version' article.
64110
65111If you find a patch to fix the problem, say, attached to a bug report, running
66If you find a patch to fix the problem, running this command in the source 112this command in the source directory should apply the patch::
67directory should apply the patch::113
68114 $ patch -p1 < ../bugfix.patch
69 patch -p1 < ../bugfix.patch
70115
71Refer to the ``patch(1)`` manpage for options and arguments such as 116Refer to the ``patch(1)`` manpage for options and arguments such as
72``--dry-run``, ``-p<num>``, etc.117``--dry-run``, ``-p<num>``, etc.
73
74
75Testing the fix
76---------------
77
78To build a test package with your changes, run these commands::
79
80 bzr bd -- -S -us -uc
81 pbuilder-dist <release> build ../<package>_<version>.dsc
82
83This will create a source package from the branch contents (``-us -uc`` will
84just omit the step to sign the source package) and pbuilder-dist will build
85the package from source for whatever ``release`` you choose.
86
87Once the build succeeded, install the package from
88``~/pbuilder/<release>_result/`` (using ``sudo dpkg -i
89<package>_<version>.deb``). Then test to see if the bug is fixed.
90
91
92
93Documenting the fix
94-------------------
95
96It is very important to document your change sufficiently so developers who
97look at the code in the future won't have to guess what your reasoning was and
98what your assumptions were. Every Debian and Ubuntu package source includes
99``debian/changelog``, where changes of each uploaded package are tracked.
100
101The easiest way to do this is to run::
102
103 dch -i
104
105This will add a boilerplate changelog entry for you and launch an editor
106where you can fill out the blanks. An example of this could be::
107
108 specialpackage (1.2-3ubuntu4) natty; urgency=low
109
110 * debian/control: updated description to include frobnicator (LP: #123456)
111
112 -- Emma Adams <emma.adams@isp.com> Sat, 17 Jul 2010 02:53:39 +0200
113
114``dch`` should fill out the first and last line of such a changelog entry for
115you already. Line 1 consists of the source package name, the version number,
116which Ubuntu release it is uploaded to, the urgency (which almost always is
117'low'). The last line always contains the name, email address and timestamp
118(in RFC 2822 format) of the change.
119
120With that out of the way, let's focus on the actual changelog entry itself:
121it is very important to document:
122
123 #. where the change was done
124 #. what was changed
125 #. where the discussion of the change happened
126
127In our (very sparse) example the last point is covered by "(LP: #123456)"
128which refers to Launchpad bug 123456. Bug reports or mailing list threads
129or specifications are usually good information to provide as a rationale for a
130change. As a bonus, if you use the ``LP: #<number>`` notation for Launchpad
131bugs, the bug will be automatically closed when the package is uploaded to
132Ubuntu.
133
134
135Committing the fix
136------------------
137
138With the changelog entry written and saved, you can just run::
139
140 debcommit
141
142and the change will be committed (locally) with your changelog entry as a
143commit message.
144
145To push it to Launchpad, as the remote branch name, you need to stick to the
146following nomenclature::
147
148 lp:~<yourlpid>/ubuntu/<release>/<package>/<branchname>
149
150This could for example be::
151
152 lp:~emmaadams/ubuntu/natty/specialpackage/fix-for-123456
153
154So if you just run::
155
156 bzr push lp:~emmaadams/ubuntu/natty/specialpackage/fix-for-123456
157 bzr lp-open
158
159you should be all set. The push command should push it to Launchpad and the
160second command will open the Launchpad page of the remote branch in your
161browser. There find the "(+) Propose for merging" link, click it to get the
162change reviewed by somebody and included in Ubuntu.
163
164
165Conclusion
166----------
167
168.. XXX: link to 'forwarding patches' article
169.. XXX: link to 'debdiff' article (in case of slow internet, package not
170 imported, etc.)
171
172118
=== modified file 'getting-set-up.rst'
--- getting-set-up.rst 2011-02-10 13:09:18 +0000
+++ getting-set-up.rst 2011-02-24 22:00:09 +0000
@@ -1,118 +1,123 @@
1==============
1Getting Set Up2Getting Set Up
2==============3==============
34
4There are a number of things you need to do in the beginning to enable you to5There are a number of things you need to do in the beginning to enable you to
5do Ubuntu development. A few of them you have to do locally on your system.6do Ubuntu development. A few of them you have to do locally on your system.
6In addition to that you also need to inform Launchpad about yourself, so it7In addition to that you also need to inform Launchpad_ about yourself, so it
7accepts changes you want to make.8accepts changes you want to make.
89
9When you followed all the steps in this article, 10When you followed all the steps in this article,
1011
11* you have all the tools to do Ubuntu development installed on your machine,12* you have all the tools to do Ubuntu development installed on your machine,
12* your local developer tools know about you, which simplifies work a lot,13* your local developer tools know about you, which simplifies work a lot,
13* you can do local builds of packages,14* you can do local builds of packages,
14* you can interact with other developers and propose your changes on Launchpad15* you can interact with other developers and propose your changes on Launchpad
15 to get merged,16 to get merged,
16* you can upload packages to Launchpad, so they are hosted in your Personal 17* you can upload packages to Launchpad, so they are hosted in your Personal
17 Package Archive (PPA).18 Package Archive (PPA).
1819
1920
20Running the development version21Run the development version
21-------------------------------22===========================
2223
23It is advisable to run the current development version of Ubuntu. It will 24It is advisable to run the current development version of Ubuntu. It will
24allow you to test changes in a "live environment" where they are actually 25allow you to test changes in a "live environment" where they are actually
25built and tested in the development release you uploade them to.26built and tested in the development release you upload them to.
2627
27https://wiki.ubuntu.com/UsingDevelopmentReleases shows a variety of ways to 28https://wiki.ubuntu.com/UsingDevelopmentReleases shows a variety of ways to
28use the development release in a safe way.29use the development release in a safe way.
2930
3031
3132Install the tools locally
32Installing tools locally33=========================
33------------------------34
3435There are a number of tools that will make your life as an Ubuntu developer
35Just run::36much easier. You'll encounter these tools later in this guide. To install
3637most of the tools you'll need, run this command::
37 sudo apt-get install gnupg pbuilder ubuntu-dev-tools bzr-builddeb38
3839 $ sudo apt-get install gnupg pbuilder ubuntu-dev-tools bzr-builddeb apt-file apt-cache
39and you should have all the tools you will need in the beginning.40
4041These packages include:
41* ``gnupg`` you will need to create a GPG key with which you will sign files42
42 you want to upload to Launchpad.43* ``gnupg`` -- `GNU Privacy Guard`_ contains tools you will need to create a
43* ``pbuilder`` is a great tool to do a reproducible build of a package in a 44 cryptographic key with which you will sign files you want to upload to
45 Launchpad.
46* ``pbuilder`` -- a tool to do a reproducible builds of a package in a
44 clean and isolated environment.47 clean and isolated environment.
45* ``ubuntu-dev-tools`` (and ``devscripts``, a direct dependency) provide you48* ``ubuntu-dev-tools`` (and ``devscripts``, a direct dependency) -- a
46 with a collection of tools that make a lot of packaging tasks a lot easier.49 collection of tools that make many packaging tasks easier.
47* ``bzr-builddeb`` (and ``bzr``, a dependency) will get you set up for working50* ``bzr-builddeb`` (and ``bzr``, a dependency) -- distributed version control
48 in the distributed development environment, that makes it easy for many 51 tools that makes it easy for many developers to collaborate and work on the
49 developers to collaborate and work on the same code while keeping it trivial52 same code while keeping it trivial to merge each others work.
50 to merge each others work.53* ``apt-file`` provides an easy way to find the binary package that contains a
54 given file.
55* ``apt-cache`` provides even more information about packages on Ubuntu.
5156
5257
53Setting up a GPG key58Setting up a GPG key
54--------------------59====================
5560
56GPG stands for `GNU Privacy Guard` and implements the OpenPGP standard which61GPG stands for `GNU Privacy Guard`_ and it implements the OpenPGP standard
57allows you to sign and encrypt messages and files. This is useful for a number62which allows you to sign and encrypt messages and files. This is useful for a
58of purposes. In our case it is important that you can sign files with your 63number of purposes. In our case it is important that you can sign files with
59key, so they can be identified as something that you worked on. If you upload64your key, so they can be identified as something that you worked on. If you
60a source package to Launchpad, it will only accept the package if it can tell65upload a source package to Launchpad, it will only accept the package if it
61who uploaded the package.66can absolutely determine who uploaded the package.
6267
63To generate a new GPG key, run::68To generate a new GPG key, run::
6469
65 gpg --key-gen70 $ gpg --key-gen
6671
67GnuPG will first ask you which kind of key you want to generate. Choosing the 72GPG will first ask you which kind of key you want to generate. Choosing the
68default (RSA and DSA) is fine. Next it will ask you about the keysize. The 73default (RSA and DSA) is fine. Next it will ask you about the keysize. The
69default (currently 2048) is fine, but 4096 is more secure. Afterwards it will74default (currently 2048) is fine, but 4096 is more secure. Afterward, it will
70ask you if you want it to expire the key at some stage. It is safe to say "0",75ask you if you want it to expire the key at some stage. It is safe to say "0",
71which means the key will never expire. The last questions will be about your76which means the key will never expire. The last questions will be about your
72name and email address. Just pick the ones you are going to use for Ubuntu77name and email address. Just pick the ones you are going to use for Ubuntu
73development here, you can add additional email addresses later on. Adding a 78development here, you can add additional email addresses later on. Adding a
74comment is not necessary. Then you will have to set a passphrase. Choose a 79comment is not necessary. Then you will have to set a passphrase. Choose a
75safe one. Now GnuPG will create a key for you, which can take a little bit 80safe one. Now GPG will create a key for you, which can take a little bit of
76of time, as it needs random bytes, so if you give the system some work to81time; it needs random bytes, so if you give the system some work to do it will
77do it will be just fine.82be just fine. Move the cursor around!
7883
79Once this is done, you will get a message similar to this one::84Once this is done, you will get a message similar to this one::
8085
81 pub 4096R/43CDE61D 2010-12-0686 pub 4096R/43CDE61D 2010-12-06
82 Key fingerprint = 5C28 0144 FB08 91C0 2CF3 37AC 6F0B F90F 43CD E61D87 Key fingerprint = 5C28 0144 FB08 91C0 2CF3 37AC 6F0B F90F 43CD E61D
83 uid Daniel Holbach <dh@mailempfang.de>88 uid Daniel Holbach <dh@mailempfang.de>
84 sub 4096R/51FBE68C 2010-12-0689 sub 4096R/51FBE68C 2010-12-06
8590
86In this case ``43CDE61D`` is they key ID. 91In this case ``43CDE61D`` is the *key ID*.
8792
88To upload (the public part of) of your key to a keyserver, so the world can 93To upload (the public part of) of your key to a keyserver, so the world can
89identify messages and files as yours, just run::94identify messages and files as yours, just run::
9095
91 gpg --send-keys <KEY ID>96 $ gpg --send-keys <KEY ID>
9297
93There is a network of keyservers that will automatically sync the key between98There is a network of keyservers that will automatically sync the key between
94them.99themselves.
100
95101
96Setting up an SSH key102Setting up an SSH key
97---------------------103=====================
98104
99SSH is a network protocol that allows you to exchange data in a secure way 105SSH_ is a network protocol that allows you to exchange data in a secure way
100over the network. In a lot of cases you will use it to access and open a 106over the network. In a lot of cases you will use it to access and open a shell
101shell on another machine. It is also very useful to transfer files in a secure107on another machine. It is also very useful to transfer files in a secure way.
102way.
103108
104To generate a SSH key, run::109To generate a SSH key, run::
105110
106 ssh-keygen -t rsa111 $ ssh-keygen -t rsa
107112
108The default filename makes sense, you can just leave it as it is. Also you 113The default file name usually makes sense, so you can just leave it as it is.
109can choose to use a passphrase or not.114For security purposes, it's highly recommended that you use a passphrase.
110115
111We will use the SSH key to securely push code changes to Launchpad.116We will use the SSH key to securely push code changes to Launchpad.
112117
113118
114Setting up pbuilder119Setting up pbuilder
115-------------------120===================
116121
117``pbuilder`` allows you to build packages locally on your machine. It serves122``pbuilder`` allows you to build packages locally on your machine. It serves
118a couple of purposes:123a couple of purposes:
@@ -120,139 +125,156 @@
120* the build will be done in a minimal and clean environment, where you can125* the build will be done in a minimal and clean environment, where you can
121 see if it succeeds in a reproducible way (with no modifications of the local126 see if it succeeds in a reproducible way (with no modifications of the local
122 system127 system
123* there is no need to install all necessary `build-dependencs` locally128* there is no need to install all necessary *build dependencies* locally
124* you can set up multiple instances for various Ubuntu and Debian releases129* you can set up multiple instances for various Ubuntu and Debian releases
125130
126Setting ``pbuilder`` up is very easy. Edit `~/.pbuilderrc` and add the 131Setting ``pbuilder`` up is very easy. Edit `~/.pbuilderrc` and add the
127following line to it::132following line to it::
128133
129 COMPONENTS="main universe multiverse restricted"134 COMPONENTS="main universe multiverse restricted"
130135
131This will ensure that `build-dependends` are satisfied using all components.136This will ensure that build dependencies are satisfied using all components.
132137
133Then run::138Then run::
134139
135 pbuilder-dist <release> create140 $ pbuilder-dist <release> create
136141
137where <release> is for example `natty`, `maverick`, `lucid` or in the case of142where <release> is for example `natty`, `maverick`, `lucid` or in the case of
138Debian maybe `sid`. This will take a while as it will download all the 143Debian maybe `sid`. This will take a while as it will download all the
139necessary packages for a "minimal installation". These will be cached though.144necessary packages for a "minimal installation". These will be cached though.
140145
141146
142Setting up your development environment147Set up your development environment
143---------------------------------------148===================================
144149
145Teaching Bazaar about you150There are a few things you'll need to set up in your development environment
146^^^^^^^^^^^^^^^^^^^^^^^^^151before you can start working on packages.
147
148Bazaar is the tool we use to store code changes in a logical way, to exchange
149proposed changes and merge them, even if development is done concurrently.
150
151To tell Bazaar who you are, simply run::
152
153 bzr whoami "Frank Chu <fchu@example.com>"
154 bzr launchpad-login fchu
155
156`whoami` will tell Bazaar which name and email address it should use for your
157commit messages. With `launchpad-login` you set your Launchpad ID. This way
158code that you publish in Launchpad will be associated with you.
159
160Note: If you can not remember the ID, go to https://launchpad.net/people/+me
161and see where it redirects you. The part after the "~" in the URL is your
162Launchpad ID.)
163
164
165Introducing you to the development tools
166^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
167Similar to Bazaar, the Debian/Ubuntu packaging tools need to learn about you
168as well. Simply open your `~/.bashrc` in a text editor and add something like
169this to the bottom of it::
170
171 export DEBFULLNAME="Frank Chu"
172 export DEBEMAIL="fchu@example.com"
173
174
175Now save the file and either restart your terminal or run::
176
177 source ~/.bashrc
178
179(If you use a different than the default shell, which is `bash`, please edit
180the configuration file for that shell accordingly.)
181152
182153
183Launchpad154Launchpad
184---------155---------
156
185Launchpad is the central piece of infrastructure we use in Ubuntu. It stores157Launchpad is the central piece of infrastructure we use in Ubuntu. It stores
186not only our packages and our code, but also things like translations, bug158not only our packages and our code, but also things like translations, bug
187reports, information about the people who work on Ubuntu and which teams they 159reports, information about the people who work on Ubuntu and which teams they
188are part of.160are part of. You'll also use Launchpad to publish your proposed fixes, and
189161get other Ubuntu developers to review and sponsor them.
190You will need to register with Launchpad and give it some information about 162
191you so you can get started and it will accept packages, bug reports, code163You will need to register with Launchpad and provide a minimal amount of
192branches, etc. from you.164information, so that you can download and upload code, submit bug reports, and
193165more.
194166
195Setting up a profile167
196^^^^^^^^^^^^^^^^^^^^168Setting up an account
197169---------------------
198Generally it should be enough to head to https://launchpad.net/+login and 170
199enter your email address. It will send back an email to you with a link you171If you don't already have a Launchpad account, you can easily `create one`_.
200need to open in your browser. (If you don not receive it, check in your Spam172If you have a Launchpad account but cannot remember your Launchpad id, you can
201folder too.)173find this out by going to https://launchpad.net/people/+me and looking for the
202174part after the `~` in the URL.
203Next you will have to choose a display name. Almost everybody just uses their175
204real name here.176Launchpad's registration process will ask you to choose a display name. It's
205177encouraged for you to use your real name here. so that your Ubuntu developer
206https://help.launchpad.net/YourAccount/NewAccount has more information about 178colleagues will be able to get to know you better.
179
180When you register a new account, Launchpad will send you an email with a link
181you need to open in your browser, in order to verify your email address. If
182you don't receive it, check in your spam folder.
183
184https://help.launchpad.net/YourAccount/NewAccount has more information about
207the process and additional settings you can change.185the process and additional settings you can change.
208186
209187
210Uploading the GPG key to Launchpad188Uploading the GPG key to Launchpad
211^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^189----------------------------------
212190
213To find about your GPG fingerprint, run::191To find about your GPG fingerprint, run::
214192
215 gpg --fingerprint <email@address.com>193 $ gpg --fingerprint <email@address.com>
216194
217and it will print out something like::195and it will print out something like::
218196
219 pub 4096R/43CDE61D 2010-12-06197 pub 4096R/43CDE61D 2010-12-06
220 Key fingerprint = 5C28 0144 FB08 91C0 2CF3 37AC 6F0B F90F 43CD E61D198 Key fingerprint = 5C28 0144 FB08 91C0 2CF3 37AC 6F0B F90F 43CD E61D
221 uid Daniel Holbach <dh@mailempfang.de>199 uid Daniel Holbach <dh@mailempfang.de>
222 sub 4096R/51FBE68C 2010-12-06200 sub 4096R/51FBE68C 2010-12-06
223201
224202
225Head to https://launchpad.net/people/+me/+editpgpkeys and copy the part about203Head to https://launchpad.net/people/+me/+editpgpkeys and copy the part about
226your "Key fingerprint" into the text box. In the case above this would be 204your "Key fingerprint" into the text box. In the case above this would be
227``5C28 0144 FB08 91C0 2CF3 37AC 6F0B F90F 43CD E61D``. Now click on "Import 205``5C28 0144 FB08 91C0 2CF3 37AC 6F0B F90F 43CD E61D``. Now click on "Import
228Key".206Key".
229207
230Launchpad will use the fingerprint to check the Ubuntu key server for your 208Launchpad will use the fingerprint to check the Ubuntu key server for your
231key and, if successful, send you an encrypted email asking you to confirm 209key and, if successful, send you an encrypted email asking you to confirm
232the key import. Check your email account and read the email that Launchpad 210the key import. Check your email account and read the email that Launchpad
233sent you. `If your email client supports OpenPGP encryption, it will prompt 211sent you. `If your email client supports OpenPGP encryption, it will prompt
234you for the password you chose for the key when GPG generated it. Enter the 212you for the password you chose for the key when GPG generated it. Enter the
235password, then click the link to confirm that the key is yours.`213password, then click the link to confirm that the key is yours.`
236214
237Launchpad encrypts the email, using your public key, so that it can be sure 215Launchpad encrypts the email, using your public key, so that it can be sure
238that the key is yours. If your email software does not support OpenPGP 216that the key is yours. If your email software does not support OpenPGP
239encryption, copy the encrypted email's contents, type ``gpg`` in your 217encryption, copy the encrypted email's contents, type ``gpg`` in your
240terminal, then paste the email contents into your terminal window. 218terminal, then paste the email contents into your terminal window.
241219
242Back on the Launchpad website, use the Confirm button and Launchpad will 220Back on the Launchpad website, use the Confirm button and Launchpad will
243complete the import of your OpenPGP key. 221complete the import of your OpenPGP key.
244222
245Find more information at 223Find more information at
246https://help.launchpad.net/YourAccount/ImportingYourPGPKey224https://help.launchpad.net/YourAccount/ImportingYourPGPKey
247225
248Uploading your SSH key226Uploading your SSH key
249^^^^^^^^^^^^^^^^^^^^^^227----------------------
250228
251Open https://launchpad.net/people/+me/+editsshkeys in a web browser, also open229Open https://launchpad.net/people/+me/+editsshkeys in a web browser, also open
252``~/.ssh/id_rsa.pub`` in a text editor. It is the public part of your SSH key, 230``~/.ssh/id_rsa.pub`` in a text editor. It is the public part of your SSH key,
253so it is safe to share it with Launchpad. Copy the contents of the file and 231so it is safe to share it with Launchpad. Copy the contents of the file and
254paste them into the text box on the web page that says "Add an SSH key". Now 232paste them into the text box on the web page that says "Add an SSH key". Now
255click "Import Public Key".233click "Import Public Key".
256234
257More information is available at 235More information is available at
258https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair236https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair
237
238
239Teaching Bazaar about you
240-------------------------
241
242Bazaar is the tool we use to store code changes in a logical way, to exchange
243proposed changes and merge them, even if development is done concurrently.
244
245To tell Bazaar who you are, simply run::
246
247 $ bzr whoami "Bob Dobbs <subgenius@example.com>"
248 $ bzr launchpad-login subgenius
249
250`whoami` will tell Bazaar which name and email address it should use for your
251commit messages. With `launchpad-login` you set your Launchpad ID. This way
252code that you publish in Launchpad will be associated with you.
253
254Note: If you can not remember the ID, go to https://launchpad.net/people/+me
255and see where it redirects you. The part after the "~" in the URL is your
256Launchpad ID.)
257
258
259Introducing you to the development tools
260----------------------------------------
261Similar to Bazaar, the Debian/Ubuntu packaging tools need to learn about you
262as well. Simply open your `~/.bashrc` in a text editor and add something like
263this to the bottom of it::
264
265 $ export DEBFULLNAME="Bob Dobbs"
266 $ export DEBEMAIL="subgenius@example.com"
267
268
269Now save the file and either restart your terminal or run::
270
271 $ source ~/.bashrc
272
273(If you use a different than the default shell, which is `bash`, please edit
274the configuration file for that shell accordingly.)
275
276
277.. _`GNU Privacy Guard`: http://gnupg.org/
278.. _SSH: http://www.openssh.com/
279.. _Launchpad: http://launchpad.net
280.. _`create one`: https://launchpad.net/+login
259281
=== modified file 'index.rst'
--- index.rst 2010-12-06 16:36:30 +0000
+++ index.rst 2011-02-24 22:00:09 +0000
@@ -14,6 +14,16 @@
14 introduction-to-ubuntu-development14 introduction-to-ubuntu-development
15 getting-set-up15 getting-set-up
16 fixing-a-bug16 fixing-a-bug
17 udd-intro
18 udd-working
19 udd-sponsorship
20 udd-uploading
21 udd-latest
22 udd-merging
23 udd-patchsys
24 udd-newpackage
25 testing
26
1727
18Indices and tables28Indices and tables
19==================29==================
@@ -21,4 +31,3 @@
21* :ref:`genindex`31* :ref:`genindex`
22* :ref:`modindex`32* :ref:`modindex`
23* :ref:`search`33* :ref:`search`
24
2534
=== modified file 'introduction-to-ubuntu-development.rst'
--- introduction-to-ubuntu-development.rst 2010-12-13 15:23:22 +0000
+++ introduction-to-ubuntu-development.rst 2011-02-24 22:00:09 +0000
@@ -1,3 +1,4 @@
1==================================
1Introduction to Ubuntu Development2Introduction to Ubuntu Development
2==================================3==================================
34
45
=== added file 'testing.rst'
--- testing.rst 1970-01-01 00:00:00 +0000
+++ testing.rst 2011-02-24 22:00:09 +0000
@@ -0,0 +1,67 @@
1===============
2Testing the fix
3===============
4
5To build a test package with your changes, run these commands::
6
7 $ bzr bd -S -- -us -uc
8 $ pbuilder-dist <release> build ../<package>_<version>.dsc
9
10This will create a source package from the branch contents (``-us -uc`` will
11just omit the step to sign the source package) and ``pbuilder-dist`` will
12build the package from source for whatever ``release`` you choose.
13
14Once the build succeeded, install the package from
15``~/pbuilder/<release>_result/`` (using ``sudo dpkg -i
16<package>_<version>.deb``). Then test to see if the bug is fixed.
17
18
19Documenting the fix
20===================
21
22It is very important to document your change sufficiently so developers who
23look at the code in the future won't have to guess what your reasoning was and
24what your assumptions were. Every Debian and Ubuntu package source includes
25``debian/changelog``, where changes of each uploaded package are tracked.
26
27The easiest way to do this is to run::
28
29 $ dch -i
30
31This will add a boilerplate changelog entry for you and launch an editor
32where you can fill out the blanks. An example of this could be::
33
34 specialpackage (1.2-3ubuntu4) natty; urgency=low
35
36 * debian/control: updated description to include frobnicator (LP: #123456)
37
38 -- Emma Adams <emma.adams@isp.com> Sat, 17 Jul 2010 02:53:39 +0200
39
40``dch`` should fill out the first and last line of such a changelog entry for
41you already. Line 1 consists of the source package name, the version number,
42which Ubuntu release it is uploaded to, the urgency (which almost always is
43'low'). The last line always contains the name, email address and timestamp
44(in :rfc:`5322` format) of the change.
45
46With that out of the way, let's focus on the actual changelog entry itself:
47it is very important to document:
48
49 #. where the change was done
50 #. what was changed
51 #. where the discussion of the change happened
52
53In our (very sparse) example the last point is covered by ``(LP: #123456)``
54which refers to Launchpad bug 123456. Bug reports or mailing list threads or
55specifications are usually good information to provide as a rationale for a
56change. As a bonus, if you use the ``LP: #<number>`` notation for Launchpad
57bugs, the bug will be automatically closed when the package is uploaded to
58Ubuntu.
59
60
61Conclusion
62==========
63
64.. XXX: link to 'forwarding patches' article
65.. XXX: link to 'debdiff' article (in case of slow internet, package not
66 imported, etc.)
67
068
=== added file 'udd-intro.rst'
--- udd-intro.rst 1970-01-01 00:00:00 +0000
+++ udd-intro.rst 2011-02-24 22:00:09 +0000
@@ -0,0 +1,225 @@
1==============================
2Ubuntu Distributed Development
3==============================
4
5*Ubuntu Distributed Development* (UDD) is a technique for developing Ubuntu
6packages that uses tools, processes, and workflows similar to generic
7distributed version control (dVCS) system-based software development. The
8dVCS used for UDD is Bazaar_.
9
10You should already be familiar with basic Bazaar usage and workflow. Ubuntu
11Intrepid_ or later is required for these instructions to work.
12
13
14Source package URLs
15===================
16
17Bazaar provides some very nice shortcuts for accessing the source branches of
18packages in both Ubuntu and Debian (on Launchpad). These shortcuts are
19available in Bazaar version 2.3 or newer. You can still access source
20branches in older versions of Bazaar, using a slightly more verbose syntax.
21
22The examples in this guide always use the ``ubuntu:`` prefix.
23
24
25Source branch shortcuts
26-----------------------
27
28To refer to source branches use::
29
30 ubuntu:package
31
32where *package* refers to the package name you're interested in. This URL
33refers to the package in the current development version of Ubuntu. As of
34this writing (2011-02-04) that version is Natty_ which will be released as
35Ubuntu 11.04. Thus, to refer to the branch of Tomboy in Natty, you would
36use::
37
38 ubuntu:tomboy
39
40To refer to the version of a source package in an older release of ubuntu,
41just prefix the package name with the release's code name. E.g. to refer to
42Tomboy's source package in Maverick_ use::
43
44 ubuntu:maverick/tomboy
45
46Since they are unique, you can also abbreviate the distro-series name::
47
48 ubuntu:m/tomboy
49
50You can use a similar scheme to access the source branches in Debian, although
51there are no shortcuts for the Debian distro-series names. To access the
52Tomboy branch in the current development series for Debian use:
53
54 debianlp:tomboy
55
56and to access Tomboy in Debian Lenny_ use::
57
58 debianlp:lenny/tomboy
59
60
61Explicit source branches
62------------------------
63
64If you're using an older version of Bazaar, the ``ubuntu:`` and ``debianlp:``
65prefixes won't be available to you. Instead use the ``lp:`` prefix to access
66the source branch. For example, Tomboy in the latest Ubuntu development
67release is available at::
68
69 lp:ubuntu/tomboy
70
71while the Maverick version is available at::
72
73 lp:ubuntu/maverick/tomboy
74
75and the Debian Lenny version is available at::
76
77 lp:debian/lenny/tomboy
78
79
80.. _`Bazaar`: http://bazaar.canonical.com/en/
81.. _`Intrepid`: https://wiki.ubuntu.com/IntrepidIbex
82.. _Natty: https://wiki.ubuntu.com/NattyNarwhal
83.. _Maverick: https://wiki.ubuntu.com/MaverickMeerkat
84.. _Lenny: http://debian.org/releases/stable/
85
86
87Getting the source
88==================
89
90Every source package in Ubuntu has an associated source branch on Launchpad.
91These source branches are updated automatically by Launchpad, although the
92process is not currently foolproof.
93
94There are a couple of things that we do first in order to make the workflow
95more efficient later. Once you are used to the process you will learn when it
96makes sense to skip these steps.
97
98
99.. _up-to-date:
100
101Ensure the source branch is up-to-date
102--------------------------------------
103
104Once you've determined which source package to work on, you should ensure that
105the source branch for that package on Launchpad is up-to-date. Some package
106imports fail for various reasons, and the `status of the package importer`_ is
107always available online. If the source branch for a package you want to work
108on is out of sync, you'll have to use ``apt-get source`` until the import of
109that package is fixed.
110
111Let's say you want to fix a problem in Tomboy in Natty. First, find out the
112latest binary package versions that are available::
113
114 $ rmadison tomboy | grep natty
115 tomboy | 1.5.2-1ubuntu4 | natty | source, amd64, i386
116
117You've already seen how to :ref:`determine the source package corresponding to
118this binary package <what-to-fix>`. For Tomboy, the binary and source
119packages are both named ``tomboy``.
120
121Whenever the package importer processes a new source package version, it adds
122a Bazaar tag corresponding to that new version. You can use this tag to
123ensure that the import is up-to-date. To find the tag of the last revision
124committed by the package importer, do::
125
126 $ bzr log -l 1 ubuntu:tomboy | grep ^tags:
127 tags: 1.5.2-1ubuntu4
128
129By comparing the version number returned by ``rmadison`` and the tag added by
130the package importer, we can see that the ``tomboy`` source package for Natty
131is up-to-date.
132
133Here's an example of a package that is out-of-date. Let's say you want to fix
134a problem in the ``initscripts`` binary package on Natty_. First find out the
135latest binary package versions that are available::
136
137 $ rmadison initscripts | grep natty
138 initscripts | 2.87dsf-4ubuntu19 | natty | amd64, i386
139
140Then determine the source package corresponding to this binary package::
141
142 $ apt-cache show initscripts | grep ^Source:
143 Source: sysvinit
144
145Find the latest tag added by the package importer::
146
147 $ bzr log -l 1 ubuntu:sysvinit | grep ^tags:
148 tags: 2.86.ds1-61ubuntu13
149
150Here we can see that ``2.86.ds1-61ubuntu13`` is older than
151``2.87dsf-4ubuntu19`` so the source package is out of date, and in fact we can
152verify that by looking at the status package for the package at
153http://package-import.ubuntu.com/status/sysvinit.html.
154
155When you find such out-of-date packages, be sure to `file a bug on the UDD
156project`_ to get the issue resolved.
157
158.. _branching:
159
160Creating a shared repository
161----------------------------
162
163Okay, you want to work on the Tomboy package in Natty, and you've verified
164that the source package is up-to-date. Before actually branching the code for
165Tomboy, create a shared repository to hold the branches for this package.
166The shared repository will make future work much more efficient.
167
168Do this using the `bzr init-repo` command, passing it the directory name we
169would like to use::
170
171 $ bzr init-repo tomboy
172
173You will see that a `tomboy` directory is created in your current working
174area. Change to this new directory for the rest of your work::
175
176 $ cd foobar
177
178
179Getting the trunk branch
180------------------------
181
182We use the `bzr branch` command to create a local branch of the package.
183We'll name the target directory `natty` just to keep things easy to remember::
184
185 $ bzr branch ubuntu:tomboy natty
186
187The `natty` directory represents the version of Tomboy in Natty, and you can
188always ``cd`` into this directory and do a `bzr pull` to get any future
189updates.
190
191
192Getting a branch for a particular release
193-----------------------------------------
194
195When you want to do something like a `stable release update`_ (SRU), or you
196just want to examine the code in an old release, you'll want to grab the
197branch corresponding to a particular pocket in a particular Ubuntu release.
198For example, to get the Tomboy package for Maverick do::
199
200 $ bzr branch ubuntu:m/tomboy maverick
201
202
203Importing a Debian source package
204---------------------------------
205
206If the package you want to work on is available in Debian but not Ubuntu, it's
207still easy to import the code to a local bzr branch for development. Let's
208say you want to import the `newpackage` source package. We'll start by
209creating a shared repository as normal, but we also have to create a working
210tree to which the source package will be imported (remember to cd out of the
211`tomboy` directory created above)::
212
213 $ bzr init-repo newpackage
214 $ cd new-package
215 $ bzr init debian
216 $ cd debian
217 $ bzr import-dsc http://ftp.de.debian.org/debian/pool/main/n/newpackage/newpackage_1.0-1.dsc
218
219As you can see, we just need to provide the remote location of the dsc file,
220and Bazaar will do the rest. You've now got a Bazaar source branch.
221
222
223.. _`status of the package importer`: http://package-import.ubuntu.com/status
224.. _`file a bug on the UDD project`: https://bugs.launchpad.net/udd
225.. _`stable release update`: https://wiki.ubuntu.com/StableReleaseUpdates
0226
=== added file 'udd-latest.rst'
--- udd-latest.rst 1970-01-01 00:00:00 +0000
+++ udd-latest.rst 2011-02-24 22:00:09 +0000
@@ -0,0 +1,46 @@
1==================
2Getting The Latest
3==================
4
5If someone else has landed changes on a package, you will want to pull down
6those changes in your own copies of the package branches.
7
8
9Updating your main branch
10=========================
11
12Updating your copy of a branch that corresponds to the package in a particular
13release is very simple, simply use `bzr pull` from the appropriate directory::
14
15 $ cd tomboy/natty
16 $ bzr pull
17
18This works wherever you have a checkout of a branch, so it will work for
19things like branches of `maverick`, `hardy-proposed`, etc.
20
21
22Getting the latest in to your working branches
23==============================================
24
25Once you have updated your copy of a distroseries branch, then you may want to
26merge this in to your working branches as well, so that they are based on the
27latest code.
28
29You don't have to do this all the time though. You can work on slightly older
30code with no problems. The disadvantage would come if you were working on
31some code that someone else changed. If you are not working on the latest
32version then your changes may not be correct, and may even produce conflicts.
33
34The merge does have to be done at some point though. The longer it is left,
35the harder may be, so doing it regularly should keep each merge simple. Even
36if there are many merges the total effort would hopefully be less.
37
38To merge the changes you just need to use `bzr merge-package`, but you must
39have committed your current work first::
40
41 $ cd tomboy/bug-12345
42 $ bzr merge-package ../natty
43
44Any conflicts will be reported, and you can fix them up. To review the
45changes that you just merged use `bzr diff`. To undo the merge use `bzr
46revert`. Once you are happy with the changes then use `bzr commit`.
047
=== added file 'udd-merging.rst'
--- udd-merging.rst 1970-01-01 00:00:00 +0000
+++ udd-merging.rst 2011-02-24 22:00:09 +0000
@@ -0,0 +1,111 @@
1=======
2Merging
3=======
4
5Merging is one of the strengths of Bazaar, and something we do often in Ubuntu
6development. Updates can be merged from Debian, from a new upstream release,
7and from other Ubuntu developers. Doing it in Bazaar is pretty simple, and
8all based around the `bzr merge-package` command.
9
10The first thing to do is to check that the `package importer`_
11:ref:`hasn't failed <up-to-date>` for the package you're going to work on.
12
13When you are in any branch's working directory then you can merge from
14another. First check you have no uncommitted changes::
15
16 $ bzr status
17
18If that reports anything then you will either have to commit the changes,
19revert them, or shelve them to come back to later.
20
21
22Merging from Debian
23===================
24
25Next run `bzr merge-package` passing the URL of the branch to merge from. For
26instance, to merge from the version of the package in Debian Squeeze_ run::
27
28 $ bzr merge-package lp:debian/squeeze/tomboy
29
30This will merge the changes since the last merge point and leave you with
31changes to review. This may cause some conflicts. You can see everything
32that the `merge-package` command did by running::
33
34 $ bzr status
35 $ bzr diff
36
37If conflicts are reported then you need to edit those files to make them look
38how they should, removing the *conflict markers*. Once you have done, run::
39
40 $ bzr resolve
41 $ bzr conflicts
42
43This will resolve any conflicted files that you fixed, and then tell you what
44else you have to deal with.
45
46Once any conflicts are resolved, and you have made any other changes that you
47need, you will add a new changelog entry, and commit::
48
49 $ dch -i
50 $ debcommit
51
52as described earlier.
53
54However, before you commit, it is always a good thing to check all the Ubuntu
55changes by running::
56
57 $ bzr diff -r tag:0.6.10-5
58
59which will show the diff between the new Debian (0.6.10-5) and Ubuntu versions
60(0.6.10-5ubuntu1). In similar way you can compare to any other versions. To
61see all available versions run::
62
63 $ bzr tags
64
65After testing and committing the merge, you will need to seek sponsorship or
66upload to the archive in the normal way.
67
68
69Merging a new upstream version
70==============================
71
72When upstream releases a new version (or you want to package a snapshot) then
73you have to merge a tarball into your branch.
74
75This is done using the `bzr merge-upstream` command. From inside the branch
76that you want to merge to you run something like::
77
78 $ bzr merge-upstream --version 1.2 http://example.org/releases/foobar-1.2.tar.gz
79
80This will download the tarball at the specified URL, and merge it in to your
81branch, automatically adding a `debian/changelog` entry for you.
82
83The `--version` option is used to specify the upstream version that is being
84merged in, as the command isn't able to infer that (yet).
85
86The last parameter is the location of the tarball that you are upgrading to;
87this can either be a local filesystem path, or a http, ftp, sftp, etc. URI as
88shown. The command will automatically download the tarball for you. If you
89point to a `.tar.bz2` or similar tarball then it will recompress it as needed,
90or convert it if you pass it a `.zip` or similar. If your package is v3
91(quilt) format and so can support `.tar.bz2` upstream tarballs then pass a
92`--v3` option to prevent the repacking (this should be `automatically
93detected`_).
94
95The `merge-upstream` command will either tell you that it completed
96successfully, or that there were conflicts. Either way you will be able to
97review the changes before committing as normal.
98
99If you are merging an upstream release into an existing Bazaar branch that has
100not previously used the UDD layout, `bzr merge-upstream` will fail with an
101error that the tag for the previous upstream version is not available; the
102merge can't be completed without knowing what base version to merge against.
103To work around this, create a tag in your existing existing repo for the last
104upstream version present there; e.g., if the last Ubuntu release was
105*1.1-0ubuntu3*, create the tag *upstream-1.1* pointing to the bzr revision you
106want to use as the tip of the upstream branch.
107
108
109.. _`package importer`: http://package-import.ubuntu.com/status/
110.. _Squeeze: http://wiki.debian.org/DebianSqueeze
111.. _`automatically detected`: https://bugs.edge.launchpad.net/bzr-builddeb/+bug/627718
0112
=== added file 'udd-newpackage.rst'
--- udd-newpackage.rst 1970-01-01 00:00:00 +0000
+++ udd-newpackage.rst 2011-02-24 22:00:09 +0000
@@ -0,0 +1,170 @@
1======================
2Building a new package
3======================
4
5Let's say I have an upstream project that is not yet available for Ubuntu. I
6want to create a package from this project and make it available as a PPA_ so
7that other people can more easily use the code. This also makes a good first
8step in contributing your package to universe_.
9
10
11Example package
12===============
13
14I started with a Python library called `flufl.enum`_, which is a fairly
15typical setuptools-based Python package. Fortunately, it's also maintained in
16Launchpad using Bazaar, so that makes bootstrapping much easier. (TBD: add
17instructions for using other upstream VCSs.)
18
19Because we want to package the trunk branch, getting started is pretty
20simple::
21
22 $ bzr init-repo flufl.enum
23 $ cd flufl.enum
24 $ bzr branch lp:flufl.enum trunk
25 $ bzr branch trunk debianize
26 $ cd debianize
27
28
29Bootstrapping
30=============
31
32You need to get the initial ``debian`` directory created somehow, along with
33all the expected files inside that. There are many ways to bootstrap that,
34and hopefully there will eventually be `some convergence`_ in the methods,
35especially if you're building standard Python setuptools-based libraries and
36applications.
37
38
39The bzr-builddeb way
40--------------------
41
42You could of course just use `dh_make(8)` to get things going, or you could
43use `bzr dh-make`. The latter might provide some benefits, and can be run
44like so from inside your branch::
45
46 $ bzr dh-make PKGNAME VERSION DOWNLOADURL
47 $ bzr add debian
48
49If you don't have a URL to download a tarball from, you'll need to create the
50tarball locally first. Use ``bzr dh-make --help`` for details on this command.
51
52After you've created the ``debian`` directory template, be sure to ``bzr rm``
53any ``debian`` files you don't need (e.g. the ``*.ex`` files), and edit files
54such as ``debian/control``, ``debian/watch``, ``debian/copyright`` and
55``debian/changelog``. The following section may give you some hints about
56that.
57
58
59The stdeb way
60-------------
61
62Another way I've found useful for initializing the ``debian`` directory for
63Python setuptools-based packages, is to use the stdeb_ package. The full
64documentation for this package is available on the `upstream home`_, but you
65won't need all of the commands. stdeb has a command that is *exactly* what
66we're looking for!
67
68In either case, start by putting this in your ``~/.pydistutils.cfg`` file::
69
70 [global]
71 command.packages:stdeb.command
72
73
74Modern stdeb
75~~~~~~~~~~~~
76
77Here's how easy it is::
78
79 $ python setup.py debianize
80 $ bzr add debian
81 $ bzr commit -m'Debianize'
82
83We also need a ``debian/copyright`` file. Normally, we'd use ``dh_make -c``
84for that but again, that doesn't play nicely with UDD. ``dh_make`` expects a
85particular file system layout that we don't have. No matter, we'll add the
86copyright file manually::
87
88 $ cp /usr/share/debhelper/dh_make/licenses/lgpl3 debian/copyright
89 $ edit debian/copyright
90 $ bzr add debian/copyright
91 $ bzr commit -m'Added copyright file'
92
93
94stdeb <= 0.5.1
95~~~~~~~~~~~~~~
96
97If you have an older version of stdeb, use this command to create the basic
98``debian/`` directory layout::
99
100 $ python setup.py sdist_dsc
101
102This command leaves you with a ``deb_dist`` directory containing a
103``flufl.enum_3.0.1`` directory. Inside that is your ``debian/`` directory.
104Because we're using UDD we don't care about anything else that ``sdist_dsc``
105produces, so we can shuffle things around and remove the cruft.
106
107 $ mv deb_dist/munepy-2.0.1/debian .
108 $ rm -rf deb_dist
109 $ bzr add debian
110 $ bzr commit -m'Add debian directory'
111
112
113pkgme
114-----
115
116pkgme_ is a new tool that makes it easy to Debianize a new package. TBD:
117describe how to use it.
118
119
120debian/control file
121===================
122
123You probably want to edit the ``debian/control`` file at this point, adding
124any information that's missing, or fixing incorrect default information. For
125example, I needed to modify the ``Maintainer`` and ``Description`` fields, and
126add ``X-Python-Version`` and ``Homepage`` fields.
127
128Now we want to build the source package. The easiest way to do that is with
129the ``bzr-builddeb`` plugin, however this requires a valid ``debian/watch``
130file so that builddeb can find the upstream tarball. This really should match
131the version of the checkout you've made.
132
133
134debian/watch file
135=================
136
137Here for example is the ``debian/watch`` file I'm using::
138
139 version=3
140 http://pypi.python.org/packages/source/f/flufl.enum/flufl.enum-(.*).tar.gz
141
142If your tarballs live on Launchpad, the ``debian/watch`` file is a little more
143complicated (see `Question 21146`_ and `Bug 231797`_ for why this is). In
144that case, use something like::
145
146 version=3
147 https://launchpad.net/flufl.enum/+download http://launchpad.net/flufl.enum/.*/flufl.enum-(.+).tar.gz
148
149So, then it's a matter of...::
150
151 $ bzr add debian/watch
152 $ bzr commit -m'added debian/watch file'
153
154
155Building the source package
156===========================
157
158Now we can build the source package and publish the package as we normally
159would, with ``bzr bd -S`` and ``dput``.
160
161
162.. _PPA: https://help.launchpad.net/Packaging/PPA
163.. _universe: https://wiki.ubuntu.com/MOTU/GettingStarted
164.. _`flufl.enum`: http://launchpad.net/flufl.enum
165.. _`some convergence`: http://launchpad.net/bugs/545361
166.. _stdeb: http://packages.ubuntu.com/lucid/python-stdeb
167.. _`upstream home`: http://github.com/astraw/stdeb#the-commands
168.. _pkgme: https://launchpad.net/pkgme
169.. _`Question 21146`: https://answers.launchpad.net/launchpad/+question/21146
170.. _`Bug 231797`: https://launchpad.net/bugs/231797
0171
=== added file 'udd-patchsys.rst'
--- udd-patchsys.rst 1970-01-01 00:00:00 +0000
+++ udd-patchsys.rst 2011-02-24 22:00:09 +0000
@@ -0,0 +1,190 @@
1===========================
2Working with a patch system
3===========================
4
5Many existing packages that have changes from upstream express those changes
6using a `patch system`_, of which there are several to choose from. Usually,
7when you make an additional change to a package, you'll want to add a patch
8file to the patch system being used, rather than editing the source code in
9place. Note however that it is considered bad practice to add a patch system
10to a package that does not already have one. In that case, either coordinate
11with the Debian maintainer, or edit the files in place. You can find out if
12your package has a patch system by using the ``what-patch`` command (from the
13``ubuntu-dev-tools`` package).
14
15Although UDD, and in particular `Bazaar looms`_ makes it pretty easy to keep
16individual patches separated, if you're submitting changes to be uploaded,
17you're currently better off playing along with the package's patch system.
18*You will want at least bzr loom version 2.2.1dev, otherwise you'll have
19problems pushing and pulling your threads to Launchpad.* Do ``bzr plugins`` to
20find the version you're using.
21
22Here are some guidelines that I've found helpful. Clearly the existing tools
23can be improved, but for now this seems to work well enough. This assumes
24you're using looms to develop your patch, and that the package itself uses the
25quilt_ patch system.
26
27One important thing to know: all source branches reflect the tree after a
28``quilt push -a``. In other words, when you branch a source branch, you get
29the tree with all patches applied, ready for you to jump right into hacking.
30You do not need to ``quilt push -a`` manually, and in fact, you'll get a tree
31with lots of distracting modifications if you push or pop all the changes. Or
32to put it another way, once you have a branch, jump right in!
33
34
35Develop your patch
36==================
37
38Start as you normally would with UDD and looms::
39
40 $ bzr init-repo foobar
41 $ cd foobar
42 $ bzr branch ubuntu:foobar
43 $ bzr branch foobar bug-12345
44 $ cd bug-12345
45 $ bzr loomify --base trunk
46 $ bzr create-thread sourcefix
47
48Now that you are in the ``sourcefix`` thread, just edit the source code,
49making whatever changes you need to fix the bug. Don't worry about the patch
50system at this point, at least until you are happy with your changes. If
51someone else pushes changes to the package while you're working on it, just
52``bzr commit`` your current work, ``bzr down-thread`` to ``trunk``, pull the
53updates, and ``bzr up-thread --auto`` back to the ``sourcefix`` thread,
54resolving any conflicts along the way. You can periodically commit your
55changes, ``bzr record`` and push them to Launchpad as you go, of course
56linking your branch to the bug in Launchpad. So far, it's just normal
57development with looms.
58
59Once you're happy with your changes, you need to essentially import your
60thread's changes into a quilt patch. This is fairly easy to do. While inside
61the ``sourcefix`` thread do::
62
63 $ bzr create-thread quiltfix
64 $ bzr diff -rthread:trunk..thread:sourcefix | quilt import -p0 -P bug-12345 /dev/stdin
65 $ bzr add debian/patches/bug-12345
66 $ quilt push
67 $ quilt pop
68 $ bzr commit
69
70Why the last push/pop before the commit? The push gets the imported changes
71into the quilt patch, but also leaves the tree modified, so you'll essentially
72have the changes both in the ``debian/`` directory and in the source tree.
73The pop undoes the tree changes (which are also available in the ``sourcefix``
74thread), but leaves the quilt change available. A ``bzr commit`` at this
75point gives you a thread with just the changes to ``debian/``.
76
77
78Problems
79========
80
81The problem comes when you want to modify the patch, e.g.::
82
83 $ bzr down-thread
84 <hack, commit>
85
86This does *not* work well::
87
88 $ bzr up-thread
89
90You'd expect at this point to be able to ``quilt fold`` your new changes to
91update your ``bug-12345`` quilt patch, but in fact, this doesn't work. You can
92end up with difficult to resolve conflicts, patch failures and rejections. My
93recommendation is that when you make changes to your ``sourcefix`` thread,
94blow away your ``quiltfix`` thread and regenerate it. Looms make this easy::
95
96 $ bzr up-thread
97 $ bzr revert
98 $ bzr combine-thread --force (throws away your quiltfix changes)
99 $ bzr create-thread quiltfix
100 $ bzr diff -rthread:trunk..thread:sourcefix | quilt import -p0 -P bug-12345 /dev/stdin
101 etc...
102
103So you've thrown away the original ``quiltfix`` thread and recreated it, with
104your updated ``sourcefix`` changes.
105
106
107Gotchas
108=======
109
110One thing to keep in mind is that quilt uses a hidden ``.pc`` directory to
111record its status. This directory is under version control in all source
112branches. *Watch out* for changes to the ``.pc`` directory that are unrelated
113(or more accurately, uninteresting) to your patch. This can happen because
114the UDD source branch importer `currently includes any existing .pc
115directory`_ in the imported branch. This can cause conflicts, or other
116unwanted or unknown changes because you've essentially got two conflicting
117version control systems competing for the same thing (i.e. bzr and quilt3).
118For now, the best recommendation is to revert any changes to the ``.pc``
119directory in your branch.
120
121
122Publishing your changes
123=======================
124
125It's actually easier at this point to generate a diff for attaching to the bug
126report. While inside the ``quiltfix`` thread, just::
127
128 $ bzr up-thread --auto
129 $ bzr diff -rthread: > bug-12345.diff
130
131The differences between the ``quiltfix`` thread and the ``sourcefix`` thread
132are the interesting bits, and totally appropriate for committing and upload.
133Because of the way looms interacts with Launchpad, you can still link your
134branch to the bug and request a merge proposal, but understand that the diff
135will include all changes between ``quiltfix`` (top) and ``trunk`` (bottom)
136threads. So the merge proposal will include the changes in the ``debian/``
137directory, *and* the changes in the source tree. As long as you and your
138reviewer understands this, you should be okay, but it can be confusing at
139first.
140
141If you need a sponsor to merge and upload your changes, one thing they *do
142not* want to do is::
143
144 $ bzr branch ubuntu:foobar
145 $ cd foobar
146 $ bzr merge lp:~you/ubuntu/natty/foobar/yourfix
147
148Much badness (in the form of infinite *maximum recursion depth* exceptions)
149ensues. Yes, we need to file a bug on that.
150
151
152edit-patch
153==========
154
155``edit-patch`` is a nice little wrapper script that comes as part of the
156``ubuntu-dev-tools`` package. It pretty much hides the nasty details of
157dealing with the patch system specifically. For example, while the above
158works well if your package is using quilt already, you'll have to adjust the
159workflow, perhaps significantly, to work with `a different patch system`_. In
160theory ``edit-patch`` should solve this, but there are currently two blockers.
161
162 * By default, ``bzr diff`` produces a ``-p0`` patch, but ``edit-patch``
163 defers to the underlying patch system's default. For quilt, this is
164 ``-p1``. ``quilt import`` takes a ``-p`` argument to specify the prefix
165 level, but this isn't yet exposed in ``edit-patch``. If you're
166 adventurous, try changing the ``bzr diff`` command above to specify the
167 proper prefixes using its ``-p`` option.
168 * By default, ``edit-patch`` requires a path to an existing patch file, but
169 it's more convenient to pipe the output of ``bzr diff`` to the stdin of
170 ``edit-patch``, as shown above. The alternative would be to save the diff
171 in a temporary file, and then point ``edit-patch`` to this temporary file.
172
173
174Future
175======
176
177Ideally, it would be nice to add a ``bzr edit-patch`` or some such command
178which does the whole loom -> patch system import. At least ``edit-patch``
179could grow a ``-p`` and ``-P`` option, as well as read from stdin. Stay
180tuned, or get involved!
181
182There's now `a bug` that tracks this.
183
184
185.. _`patch system`: https://wiki.ubuntu.com/DistributedDevelopment/Documentation/PatchSystem/PackagingGuide/PatchSystems
186.. _`Bazaar looms`: https://launchpad.net/bzr-loom
187.. _quilt: http://www.wzdftpd.net/blog/index.php?2008/02/05/3-quilt-a-patch-management-system-how-to-survive-with-many-patches
188.. _`currently includes any existing .pc directory`: https://bugs.launchpad.net/udd/+bug/672740
189.. _`a different patch system`: http://wiki.debian.org/debian/patches
190.. _`a bug`: https://launchpad.net/bugs/620721
0191
=== added file 'udd-sponsorship.rst'
--- udd-sponsorship.rst 1970-01-01 00:00:00 +0000
+++ udd-sponsorship.rst 2011-02-24 22:00:09 +0000
@@ -0,0 +1,99 @@
1==============================
2Seeking Review and Sponsorship
3==============================
4
5One of the biggest advantages to using the UDD workflow is to improve quality
6by seeking review of changes by your peers. This is true whether or not you
7have upload rights yourself. Of course, if you don't have upload rights, you
8will need to seek sponsorship.
9
10Once you are happy with your fix, and have a branch ready to go, the following
11steps can be used to publish your branch on Launchpad, link it to the bug
12issue, and create a *merge proposal* for others to review, and sponsors to
13upload.
14
15
16.. _merge-proposal:
17
18Pushing to Launchpad
19====================
20
21We previously showed you how to :ref:`link your branch to the bug
22<link-via-changelog>` using ``dch`` and ``debcommit``. However, the branch
23and bug don't actually get linked until you push the branch to Launchpad.
24
25It is not critical to have a link to a bug for every change you make,
26but if you are fixing reported bugs then linking to them will be useful.
27
28The general form of the URL you should push your branch to is::
29
30 lp:~<user-id>/ubuntu/<distroseries>/<package>/bug-12345
31
32For example, to push your fix for bug 12345 in the Tomboy package for Natty,
33you'd use::
34
35 $ bzr push lp:~subgenius/ubuntu/natty/tomboy/bug-12345
36
37The last component of the path is actually arbitrary; it's up to you to pick
38something meaningful.
39
40However, this usually isn't enough to get Ubuntu developers to review and
41sponsor your change. You should next submit a *merge proposal*.
42
43To do this open the bug page in a browser, e.g.::
44
45 $ bzr lp-open
46
47if that fails, then you can use
48
49 $ xdg-open https://code.launchpad.net/~subgenius/ubuntu/natty/tomboy/bug-12345
50
51where most of the URL matches what you used for `bzr push`. On this page,
52you'll see a link that says *Propose for merging into another branch*. Type
53in an explanation of your change in the *Initial Comment* box. Lastly, click
54*Propose Merge* to complete the process.
55
56Merge proposals to package source branches will automatically subscribe the
57`~ubuntu-branches` team, which should be enough to reach an Ubuntu developer
58who can review and sponsor your package change.
59
60
61Generating a debdiff
62====================
63
64As noted above, some sponsors still prefer reviewing a *debdiff* attached to
65bug reports instead of a merge proposal. If you're requested to include a
66debdiff, you can generate one like this (from inside your `bug-12345`
67branch)::
68
69 $ bzr diff -rbranch:../natty
70
71Another way is to is to open the merge proposal and download the diff.
72
73You should ensure that diff has the changes you expect, no more and no less.
74Name the diff appropriately, e.g. foobar-12345.debdiff and attach it to the
75bug report.
76
77
78Dealing with feedback from sponsors
79===================================
80
81If a sponsor reviews your branch and asks you to change something, you can do
82this fairly easily. Simply go to the branch that you were working in before,
83make the changes requested, and then commit::
84
85 $ bzr commit
86
87Now when you push your branch to Launchpad, Bazaar will remembered where you
88pushed to, and will only update the branch on Launchpad with your latest
89commits. All you need to do is::
90
91 $ bzr push
92
93You can then reply to the merge proposal review explaining what you changed,
94and asking for re-review, or you can reply on the merge proposal page in
95Launchpad.
96
97Note that if you are sponsored via debdiff attached to a bug report you need
98to manually update by generating a new diff and attaching that to the bug
99report.
0100
=== added file 'udd-uploading.rst'
--- udd-uploading.rst 1970-01-01 00:00:00 +0000
+++ udd-uploading.rst 2011-02-24 22:00:09 +0000
@@ -0,0 +1,120 @@
1===================
2Uploading a package
3===================
4
5Once your merge proposal is reviewed and approved, you will want to upload
6your package, either to the archive (if you have permission) or to your
7*`Personal Package Archive`_* (PPA). You might also want to do an upload if
8you are sponsoring someone else's changes.
9
10
11Uploading a change made by you
12==============================
13
14When you have a branch with a change that you would like to upload you need to
15get that change back on to the main source branch, build a source package, and
16then upload it.
17
18First, you need to check that you have the latest version of the package in
19your checkout of the development package::
20
21 $ cd tomboy/natty
22 $ bzr pull
23
24This pulls in any changes that may have been committed while you were working
25on your fix. From here, you have several options. If the changes on the
26trunk are large, and it will take a while to merge them and test the package,
27then you can merge them back into your working branch to do this. If not,
28then you can carry on merging your working branch to the main one. You'll
29want to use the Bazaar ``merge-package`` command rather than just ``merge``::
30
31 $ bzr merge-package ../bug-12345
32
33This will merge the two trees, possibly producing conflicts, which you'll need
34to resolve manually.
35
36Next you should make sure the `debian/changelog` is as you would like, with
37the correct distribution, version number, etc.
38
39Once that is done you should review the change you are about to commit
40with `bzr diff`. This should show you the same changes as a debdiff would
41before you upload the source package.
42
43The next step is to build and test the modified source package as you normally
44would. Once you are happy with the upload then you should `dput` the
45source package. For example, if you want to upload your changes to your PPA,
46then you'd do::
47
48 $ dput ppa:imasponsor/myppa tomboy_1.5.2-1ubuntu5.dsc
49
50You might want to do one more `bzr commit` to make sure all your changes are
51committed in your working tree.
52
53The last step is to mark the change as being the same as the source package
54that was uploaded, so run::
55
56 $ bzr mark-uploaded
57
58This also tells the package importer that what is in the Bazaar branch is the
59same as in the archive.
60
61Now you can push the changes back to Launchpad::
62
63 $ bzr push ubuntu:tomboy
64
65(Change the destination if you are uploading an SRU or similar.)
66
67You are now free to delete your feature branch, as it is merged, and can
68be re-downloaded from Launchpad if needed.
69
70
71Sponsoring a change
72===================
73
74Sponsoring someone else's change is just like the above procedure, but instead
75of merging from a branch you created, you merge from the branch in the merge
76proposal::
77
78 $ bzr merge-package lp:~subgenius/ubuntu/natty/tomboy/bug-12345
79
80The difference would be that if there are lots of merge conflicts then you
81would probably want to ask the contributor to fix them up. To do that see the
82next section.
83
84
85Canceling an upload
86===================
87
88At any time before you `dput` the source package you can decide to cancel an
89upload and revert the changes::
90
91 $ bzr revert
92
93You can do this if you notice something needs more work, or if you would like
94to ask the contributor to fix up conflicts when sponsoring something.
95
96
97Sponsoring something and making your own changes
98================================================
99
100If you are going to sponsor someone's work, but you would like to roll it up
101with some changes of your own then you can merge their work in to a separate
102branch first.
103
104If you already have a branch where you are working on the package and you
105would like to include their changes, then simply run the `bzr merge-package`
106from that branch, instead of the checkout of the development package. You can
107then make the changes and commit, and then carry on with your changes to the
108package.
109
110If you don't have an existing branch, but you know you would like to make
111changes based on what the contributor provides then you should start by
112grabbing their branch::
113
114 $ bzr branch lp:~subgenius/ubuntu/natty/tomboy/bug-12345
115
116then work in this new branch, and then merge it in to the main one and upload
117as if it was your own work. The contributor will still be mentioned in the
118changelog, and Bazaar will correctly attribute the changes they made to them.
119
120.. _`Personal Package Archive`: https://help.launchpad.net/Packaging/PPA
0121
=== added file 'udd-working.rst'
--- udd-working.rst 1970-01-01 00:00:00 +0000
+++ udd-working.rst 2011-02-24 22:00:09 +0000
@@ -0,0 +1,110 @@
1====================
2Working on a Package
3====================
4
5Once you have the source package branch in a shared repository, you'll want to
6create additional branches for the fixes or other work you plan to do. You'll
7want to base your branch off the package source branch for the distro release
8that you plan to upload to. Usually this is the current development release,
9but it may be older releases if you're backporting to an SRU for example.
10
11
12Branching for a change
13======================
14
15The first thing to do is to make sure your source package branch is
16up-to-date. It will be if you just checked it out, otherwise do this::
17
18 $ cd natty
19 $ bzr pull
20
21Any updates to the package that have uploaded since your checkout will now be
22pulled in. You do not want to make changes to this branch. Instead, create a
23branch that will contain just the changes you're going to make. Let's say you
24want to fix bug 12345 for the Tomboy project. When you're in the shared
25repository you previously created for Tomboy, you can create your bug fix
26branch like this::
27
28 $ bzr branch natty bug-12345
29 $ cd bug-12345
30
31Now you can do all my work in the `bug-12345` directory. You make changes
32there as necessary, committing as you go along. This is just like doing any
33kind of software development with Bazaar. You can make intermediate commits
34as often as you like, and when your changes are finished, you will use the
35standard `dch` command (from the `devscripts` package)::
36
37 $ dch -i
38
39This will drop you in an editor to add an entry to the `debian/changelog`
40file.
41
42.. _link-via-changelog:
43
44Here's where things diverge a little from typical Bazaar usage. When you
45added your `debian/changelog` entry, you should have included a bug fix tag
46that indicated which Launchpad bug issue you're fixing. The format of this
47textual tag is pretty strict: ``LP: #12345``. The space between the ``:`` and
48the ``#`` is required and of course the number will be replaced by the actual
49bug number you're fixing. Your `debian/changelog` entry might look something
50like::
51
52 tomboy (1.5.2-1ubuntu5) natty; urgency=low
53
54 * Don't fubar the frobnicator. (LP: #12345)
55
56 -- Bob Dobbs <subgenius@example.com> Mon, 10 Jan 2011 16:10:01 -0500
57
58Normally, when you want to commit changes to your branch, you just use ``bzr
59commit``, but in the case where you've made a change to ``debian/changelog``,
60you'll want to use the ``debcommit`` command instead::
61
62 $ debcommit
63
64The reason to use ``debcommit`` instead is that it automatically includes your
65``debian/changelog`` entry in the commit message, and it also adds the
66necessary metadata to link your branch to the bug report when you push your
67branch to Launchpad. You can do that manually with ``bzr commit`` (and
68eventually, ``bzr commit`` may get smart enough to do it for you), but for now
69``debcommit`` is the most convenient way to do it.
70
71
72Building the package
73====================
74
75Along the way, you'll want to build your branch so that you can test it to
76make sure it does actually fix the bug.
77
78In order to build the package you can use the `bzr builddeb` command from
79the `bzr-builddeb` package. You can build a source package with::
80
81 $ bzr bd -S
82
83(`bd` is an alias for `builddeb`.) You can leave the package unsigned by
84appending `-- -uc -us` to the command.
85
86It is also possible to use your normal tools, as long as they are able to
87strip the .bzr directories from the package, e.g.::
88
89 $ debuild -i -I
90
91If you ever see an error related to trying to build a native package without a
92tarball, check to see if there is a `.bzr-builddeb/default.conf` file
93erroneously specifying the package as native. If the changelog version has a
94dash in it, then it's not a native package, so remove the configuration file.
95Note that while `bzr bd` has a `--native` switch, it does not have a
96`--no-native` switch.
97
98You might also see an error that looks something like this:
99
100 dpkg-source: error: Version number suggests Ubuntu changes, but
101 Maintainer: does not have Ubuntu address
102
103In a sense, this is a safeguard to ensure that ``update-maintainer`` is run
104when necessary. However in this case, you can just temporarily set the
105``$DEBEMAIL`` environment variable to a non-@ubuntu.com address::
106
107 $ DEBEMAIL='me@example.com' bzr bd -S
108
109Once you've got the source package, you can build it as normal with
110``pbuilder`` or ``sbuild``.

Subscribers

People subscribed via source and target branches