Exigências: build-essential, automake, gnupg, lintian, fakeroot, patchutils, debhelper e pbuilder.
Ubuntu is based on the Debian Linux distribution and uses the same package management system (APT). At the beginning of each Ubuntu development cycle, the packages in Ubuntu are updated to those in the Debian unstable branch. However, because Ubuntu is not the same as Debian, some of the packages need to be modified to work in Ubuntu. There might also be bug fixes that Ubuntu developers have introduced into the packages. You can determine whether this has taken place by noting the package version. If the package version includes ubuntu in it (an example would be gimp-2.2.9-3ubuntu2), then the Ubuntu developers have made changes, and it is no longer the same as the Debian package. There are more than 1000 such modified packages in the Universe repository.
At the start of each Ubuntu development cycle, a decision is made regarding these Ubuntu versioned packages. Of course if the Debian version hasn't changed since the last Ubuntu release, then nothing needs to be changed. However, if there is a newer version of the package in Debian, then one of two things should happen. If all of the reasons for Ubuntu modifications (bug fixes, dependencies, etc.) are fixed in the new Debian package, then we can just take the Debian package directly. This decision is called a sync. However, if the new Debian version has the same issues that caused the Ubuntu version to be made, then those changes need to be applied to the new Debian version, too. This decision is called merging.
O processo de mesclagem envolve observar as mudanças entre os pacotes fontes no Debian e no Ubuntu e deteminando o que mudaram e quais mudanças são especificas do Ubuntu. Deixe-nos agora observar um exemplo, um popular programa de gravação de CD chamado xcdroast.
Para iniciar, crie uma pasta para manter nosso projeto, então navegue lá:
mkdir ~/xcdroast cd ~/xcdroast
Agora baixe todos os pacotes fontes envolvidos dentro deste diretório:
Um xcdroast fonte tarball que é usado para todas as versões:
Os arquivos do pacote fonte do Ubuntu Breezy:
Os arquivos do pacote fonte do Debian dos quais os pacotes do Breezy são derivados:
Os novos pacotes fontes do Debian dos quais os pacotes do Dapper packages serão derivados:
Estes passos também podem ser feitos procurando por pacotes Debian no packages.debian.org e os pacotes do Ubuntu no packages.ubuntu.com.
A very useful package to have installed when doing merges (or any Ubuntu packaging) is devscripts. If you do not have that already installed, install it before proceeding.
By looking at the Ubuntu changelog you should be able to see which differences to expect between the Ubuntu package and the Debian package from which it was derived. For xcdroast, the Ubuntu changelog can be found at changelogs.ubuntu.com. It says that a .desktop file was fixed and properly installed to close a bug reported in Malone.
Agora inspecione as atuais mudanças nos pacotes fontes:
debdiff xcdroast_0.98+0alpha15-1.1.dsc xcdroast_0.98+0alpha15-1.1ubuntu1.dsc | ubuntu.debdiff | less ubuntu.debdiff
As linhas que inciam com - foram removidas do pacote Debian, e aqueles que iniciam com + foram adcionados ao pacote Ubuntu.
A seguir é o que nós vemos:
In debian/rules install is being used instead of cp to install the xcdroast icon. Also, there is a new line installing the .desktop file.
No debian/changelog as mudanças feitas são adcionadas numa entrada no changelog.
In debian/dirs usr/share/applications has been added for the install lines above to work properly.
xcdroast.desktop é adicionado
Agora nós sabemos como a fonte do Ubuntu foi alterada. Agora nós precisamos ver o que foi alterando nas fontes do Debian.
debdiff xcdroast_0.98+0alpha15-1.1.dsc xcdroast_0.98+0alpha15-3.dsc > debian.debdiff less debian.debdiff
There is a lot more in this debdiff than in the last one. One way we can get a better idea of what has changed is to see what files were changed in the debdiff:
grep diff debian.debdiff
This indicates that debian/postinst, debian/rules, debian/changelog, debian/doc-base.manual, debian/control, and debian/menu were changed in the new Debian version.
Thus we can see that we need to check debian/rules to see if the Ubuntu changes were made. We can also see that debian/dirs was not changed from the old Debian version. Let us now look at the files. We can unpack the source package by using dpkg-source:
dpkg-source -x xcdroast_0.98+0alpha15-3.dsc
This will decompress the xcdroast_0.98+0alpha15.orig.tar.gz file, create a xcdroast-0.98+0alpha15 directory, and apply the changes found in xcdroast_0.98+0alpha15-3.diff.gz.
Agora iremos ao diretório do debian:
cd xcdroast-0.98+0alpha15/debian
One can see in rules
that changes made by Ubuntu were not applied to the new Debian version.
This means that:
cp debian/xcdroast.xpm `pwd`/debian/$(PACKAGE)/usr/share/pixmaps
...pode ser alterado para:
#cp debian/xcdroast.xpm `pwd`/debian/$(PACKAGE)/usr/share/pixmaps #install desktop and icon install -D -m 644 $(CURDIR)/debian/xcdroast.desktop \ $(CURDIR)/debian/xcdroast/usr/share/applications/xcdroast.desktop install -D -m 644 $(CURDIR)/debian/xcdroast.xpm \ $(CURDIR)/debian/xcdroast/usr/share/pixmaps/xcdroast.xpm
Now in dirs
, the following line needs to be added for the .desktop file to be installed:
usr/share/applications
Now we need the actual .desktop file (saved as debian/xcdroast.desktop). From the ubuntu.debdiff (or the Ubuntu source package), we see that it is:
[Desktop Entry] Encoding=UTF-8 Name=X-CD-Roast Comment=Criar um CD Exec=xcdroast Icon=xcdroast.xpm Type=Application Categories=Application;AudioVideo;
The last change that needs to be made is in changelog
.
Not only do we need to add what we have just done (merge with Debian), but we
should also add in the previous Ubuntu changelog entries. To do this, run
dch -i -D dapper and put something to the effect of:
xcdroast (0.98+0alpha15-3ubuntu1) dapper; urgency=low
* Resynchronise with Debian.
Make sure to change the version number to the correct Ubuntu version. Also add:
xcdroast (0.98+0alpha15-1.1ubuntu1) breezy; urgency=low * Fix and install existing .desktop file. (Closes Malone #2698) -- Captain Packager <packager@coolness.com> Sat, 1 Oct 2005 19:39:04 -0400
between the 0.98+0alpha15-1.1 and 0.98+0alpha15-2 log entries.
Now you can build and test the new source packages. There are different ways to do this, but one example is:
cd .. debuild -S cd .. sudo pbuilder build xcdroast_0.98+0alpha15-3ubuntu1.dsc
This will recreate the source package, sign it with your default GPG key, and build the package in a pbuilder environment to make sure it builds correctly. Make sure to always test your packages before submitting patches. The last step is to make a debdiff that can be attached to an existing bug report or given to the MOTUs in the #ubuntu-motu IRC channel. To do this, we get the difference between the Debian unstable source package and the new Ubuntu version:
debdiff xcdroast_0.98+0alpha15-3.dsc xcdroast_0.98+0alpha15-3ubuntu1.dsc > \ xcdroast_0.98+0alpha15-3ubuntu1.debdiff