![]() |
|
Requirements: build-essential, automake, gnupg, lintian, fakeroot, patchutils, debhelper and 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.
The merging process involves looking at the changes to both the Debian and Ubuntu source packages and determining what has changed and which changes are Ubuntu-specific. Let us now look at an example, a popular CD creation program called xcdroast.
To start, make a folder to hold our project, then navigate there:
mkdir ~/xcdroast cd ~/xcdroast
Now download all of the source packages involved into this directory:
The xcdroast source tarball that is used by all versions:
The Ubuntu Breezy source package files:
The Debian source package files that the Breezy packages are derived from:
The new Debian source package files that the Dapper packages will be derived from:
![]() |
|
These steps can also be done by searching for the Debian packages at packages.debian.org and the Ubuntu packages at 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.
Now inspect the actual changes in the source packages:
debdiff xcdroast_0.98+0alpha15-1.1.dsc xcdroast_0.98+0alpha15-1.1ubuntu1.dsc | \ ubuntu.debdiff | less ubuntu.debdiff
The lines that start with - have been removed from the Debian package, and those that start with + have been added to the Ubuntu package.
The following is what we see:
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.
In debian/changelog the changes made are added to the changelog entry.
In debian/dirs usr/share/applications has been added for the install lines above to work properly.
xcdroast.desktop is added
Now we know how the Ubuntu source was changed. Now we need to see what has changed in the Debian sources.
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.
Now navigate to the debian directory:
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
...should be changed to:
#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=Create a 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 <[email protected]> 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