9. Mesclando — Atualizando do Debian e do upstream¶
Merging is one of the strengths of Bazaar, and something we do often in Ubuntu development. Updates can be merged from Debian, from a new upstream release, and from other Ubuntu developers. Doing it in Bazaar is pretty simple, and all based around the bzr merge command .
While you are in any branch’s working directory, you can merge in a branch from a different location. First check that you have no uncommitted changes:
$ bzr status
If that reports anything then you will either have to commit the changes, revert them, or shelve them to come back to later.
9.1. Mesclando do Debian¶
Next run bzr merge passing the URL of the branch to merge from. For example, to merge from the version of the package in Debian Unstable run :
$ bzr merge lp:debian/tomboy
This will merge the changes since the last merge point and leave you with changes to review. This may cause some conflicts. You can see everything that the merge command did by running:
$ bzr status $ bzr diff
If conflicts are reported then you need to edit those files to make them look how they should, removing the conflict markers. Once you have done this, run:
$ bzr resolve $ bzr conflicts
This will resolve any conflicted files that you fixed, and then tell you what else you have to deal with.
Once any conflicts are resolved, and you have made any other changes that you need, you will add a new changelog entry, and commit:
$ dch -i $ bzr commit
conforme descrito anteriormente.
However, before you commit, it is always a good thing to check all the Ubuntu changes by running:
$ bzr diff -r tag:0.6.10-5
which will show the differences between the Debian (0.6.10-5) and Ubuntu versions (0.6.10-5ubuntu1). In similar way you can compare to any other versions. To see all available versions run:
$ bzr tags
Depois de testar e submeter para mescla, você deverá buscar orientação ou enviar o arquivo da maneira normal.
If you are going to build the source package from this merged branch, you would use the -S option to the bd command. One other thing you’ll want to consider is also using the --package-merge option. This will add the appropriate -v and -sa options to the source package so that all the changelog entries since the last Ubuntu change will be included in your _source.changes file. For example:
$ bzr builddeb -S --package-merge
9.2. Mesclando uma nova versão do upstream¶
When upstream releases a new version (or you want to package a snapshot), you have to merge a tarball into your branch.
This is done using the bzr merge-upstream command. If your package has a valid debian/watch file, from inside the branch that you want to merge to, just type this:
$ bzr merge-upstream
This will download the tarball and merge it into your branch, automatically adding a debian/changelog entry for you. bzr-builddeb looks at the debian/watch file for the upstream tarball location.
Se você não tiver uma arquivo “debian/watch”, você terá que especificar a localização do tarball no upstream, e a versão manualmente:
$ bzr merge-upstream --version 1.2 http://example.org/releases/foo-1.2.tar.gz
A opção “–version” é usada para especificar a versão do upstream que está sendo mesclada, eis que o comando não consegue inferir isto (ainda) .
O último parâmetro é a localização do tarball para o qual você está atualizando; pode ser tanto um caminho do seu sistema de arquivos local, ou um URI http, ftp, sftp, etc, como mostrado. O comando irá baixar automaticamente o tarball para você. O tarball será renomeado apropriadamente e, se necessário, convertido para ”.gz”.
O comando “merge-usptream” irá lhe dizer que terminou com sucesso, ou que houve conflitos. De uma forma ou de outra, você poderá revisar as alterações antes de subemter, como de costume.
If you are merging an upstream release into an existing Bazaar branch that has not previously used the UDD layout, bzr merge-upstream will fail with an error that the tag for the previous upstream version is not available; the merge can’t be completed without knowing what base version to merge against. To work around this, create a tag in your existing repository for the last upstream version present there; e.g., if the last Ubuntu release was 1.1-0ubuntu3, create the tag upstream-1.1 pointing to the bzr revision you want to use as the tip of the upstream branch.
|||You will need newer versions of bzr and the bzr-builddeb for the merge command to work. Use the versions from Ubuntu 12.04 (Precise) or the development versions from the bzr PPA. Specifically, you need bzr version 2.5 beta 5 or newer, and bzr-builddeb version 2.8.1 or newer. For older versions, use the bzr merge-package command instead.|
|||To check other available branches of a package in Debian, see package code page. E.g. https://code.launchpad.net/debian/+source/tomboy|