# 4. Den Quelltext bekommen

## 4.1. Quellpaket-URLs

Bazaar bietet einige nette Abkürzungen, um Zugang zu Launchpads Quellverzeichnispaketen zu bekommen, sowohl in Ubuntu als auch in Debian.

Um Dich auf Quellzweige zu beziehen benutze:

    ubuntu:package

wobei Paket sich auf den Paketnamen bezieht, an dem du interessiert bist. Diese URL gehört zu dem Paket der aktuellen Entwicklerversion von Ubuntu. Um auf das Tomboy-Verzeichnis der Entwicklerversion zuzugreifen, würdest du benutzen:

    ubuntu:tomboy

To refer to the version of a source package in an older release of Ubuntu, just prefix the package name with the release’s code name. E.g. to refer to Tomboy’s source package in Saucy use:

    ubuntu:saucy/tomboy

Weil sie eindeutig sind, kannst Du die Distro-Serien-Namen auch abkürzen:

    ubuntu:s/tomboy

You can use a similar scheme to access the source branches in Debian, although there are no shortcuts for the Debian distro-series names. To access the Tomboy branch in the current development series for Debian use:

    debianlp:tomboy

and to access Tomboy in Debian Wheezy use:

    debianlp:wheezy/tomboy

## 4.2. Den Quelltext herunterladen

Every source package in Ubuntu has an associated source branch on Launchpad. These source branches are updated automatically by Launchpad, although the process is not currently foolproof.

There are a couple of things that we do first in order to make the workflow more efficient later. Once you are used to the process you will learn when it makes sense to skip these steps.

### 4.2.1. Einen verteilten Aufbewahrungsort (Repository) erstellen

Sagen wir du willst an dem Paket Tomboy arbeiten, und du hast überprüft, dass das Quellpaket `tomboy` benannt ist. Bevor der Code von Tomboy bezogen wird, erstelle eine gemeinsam genutzte Ablage für die Zweige des Pakets. Die gemeinsame Ablage macht zukünftige Arbeiten um einiges effizienter.

Verwende dazu den Befehl bzr init-repo, gib als Argument einfach den Verzeichnisnamen an, den Du verwenden möchtest:

    $ bzr init-repo tomboy

You will see that a tomboy directory is created in your current working area. Change to this new directory for the rest of your work:

    $ cd tomboy

### 4.2.2. Den trunk-Zweig bekommen

We use the bzr branch command to create a local branch of the package. We’ll name the target directory tomboy.dev just to keep things easy to remember:

    $ bzr branch ubuntu:tomboy tomboy.dev

The tomboy.dev directory represents the version of Tomboy in the development version of Ubuntu, and you can always `cd` into this directory and do a bzr pull to get any future updates.

### 4.2.3. Sicherstellen, dass die Version aktuell ist

When you do your `bzr branch` you will get a message telling you if the packaging branch is up to date. For example:

    $ bzr branch ubuntu:tomboy
    Most recent Ubuntu version: 1.8.0-1ubuntu1.2
    Packaging branch status: CURRENT
    Branched 86 revisions.

Occasionally the importer fails and packaging branches do not match what is in the archive. A message saying:

    Packaging branch status: OUT-OF-DATE

means the importer has failed. You can find out why on http://package-import.ubuntu.com/status/ and file a bug on the UDD project to get the issue resolved.

### 4.2.4. Upstream-Tar-Datei

Du kannst die Upstream-Tar-Datei bekommen in dem Du folgenden Befehl ausführst:

    bzr get-orig-source

This will try a number of methods to get the upstream tar, firstly by recreating it from the `upstream-x.y` tag in the bzr archive, then by downloading from the Ubuntu archive, lastly by running `debian/rules get-orig-source`. The upstream tar will also be recreated when using bzr to build the package:

    bzr builddeb

The builddeb plugin has several configuration options.

### 4.2.5. Einen Zweig fuer ein bestimmtes Release bekommen

When you want to do something like a stable release update (SRU), or you just want to examine the code in an old release, you’ll want to grab the branch corresponding to a particular Ubuntu release. For example, to get the Tomboy package for Quantal do:

    $ bzr branch ubuntu:m/tomboy quantal

### 4.2.6. Ein Debian Quellpaket importieren

If the package you want to work on is available in Debian but not Ubuntu, it’s still easy to import the code to a local bzr branch for development. Let’s say you want to import the newpackage source package. We’ll start by creating a shared repository as normal, but we also have to create a working tree to which the source package will be imported (remember to cd out of the tomboy directory created above):

    $ bzr init-repo newpackage
    $ cd newpackage
    $ bzr init debian
    $ cd debian
    $ bzr import-dsc http://ftp.de.debian.org/debian/pool/main/n/newpackage/newpackage_1.0-1.dsc

As you can see, we just need to provide the remote location of the dsc file, and Bazaar will do the rest. You’ve now got a Bazaar source branch.