My First Patch – Patching alsa-tools with Quilt

Today, i’m gonna show you how i did my first patch to alsa-tools using Quilt. I have to thank crimsum who helped me a lot with this package. Actually, this is not just only a Patch… it is a merge where i had to include a Patch.

So i’m gonna show you how i did the merge first and then how I patched it. First of all I download the package as usual and checked the REPORT to see where were the conflicts.

mkdir alsa-tools
cd alsa-tools
../grab-merge.sh alsa-tools

The conflicts with this package were here in these two files:

C  debian/control
C  debian/patches/series

1. The first thing I did was to check the debian/patches/series file to see where were the conflicts and it showed me this:

<<<<<<< alsa-tools-1.0.15-2ubuntu4 (ubuntu)
hammerfall.patch
firmware_locations.patch
=======
>>>>>>> alsa-tools-1.0.16-1 (debian)

This ment that there were conflicts with two patches that were in Ubuntu but not in Debian so I decided to take a look to the debian/changelog file to see why those patches were there. The first change i’ve noticed was that the hammerfall.patch was already added to the upstream version in Debian (at that moment i knew that i had to remove hammerfall.patch from the debian/patches/series file). The second thing i noticed is that Debian didn’t mention anything about the firmware_locations.patch, but Ubuntu did. The changelog told me that this patch was added only in Ubuntu, so i decided to keep that patch. Next thing i did, is to delete what was not necessary in debian/patches/series and i left it like this:

usx2yloader_udev.patch
as10k1_examples_Makefile.patch
firmware_locations.patch

Next, i verified if the hammerfall.patch was in debian/patches as well as the firmware_locations.patch. Hammerfall.patch was already removed so there was nothing more to do with that conflict.

2. So having resolved the first conflict, I proceeded to resolve the conflict in debian/control, so I openned the file and found this:

<<<<<<< alsa-tools-1.0.15-2ubuntu4 (ubuntu)
Build-Depends: debhelper (>= 5.0.37), quilt (>= 0.40), autotools-dev, libasound2-dev (>= 1.0.13), libfltk1.1-dev, libgtk2.0-dev, libqt3-mt-dev (>= 3:3.3.4-4)
Standards-Version: 3.7.3
=======
Build-Depends: debhelper (>= 6), quilt (>= 0.40), autotools-dev, libasound2-dev (>= 1.0.13), libfltk1.1-dev, libgtk2.0-dev, libqt3-mt-dev (>= 3:3.3.4-4)
Standards-Version: 3.7.3
>>>>>>> alsa-tools-1.0.16-1 (debian)

So i realized quickly that it was a conflict with the dependencies (Build-Depends) and checked the alsa-tools_1.0.15-2ubuntu4.patch (Older Ubuntu and Debian version diff) and alsa-tools_1.0.16-1.patch (Newer Debian and Older Debian diff) files too see what I had to do (This is similar to the process did when merging virt-viewer). So after resolving the conflicts i left my debian/control file Build-depends like this (Which were the same Build-Depends as the Newer Debian Version):

Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>
XSBC-Original-Maintainer: Debian ALSA Maintainers <pkg-alsa-devel@lists.alioth.debian.org>
Uploaders: Jordi Mallach <jordi@debian.org>, Mikael Magnusson <mikma@users.sourceforge.net>, Elimar Riesebieter <riesebie@lxtec.de>
Build-Depends: debhelper (>= 6), quilt (>= 0.40), autotools-dev, libasound2-dev (>= 1.0.13), libfltk1.1-dev, libgtk2.0-dev, libqt3-mt-dev (>= 3:3.3.4-4)
Standards-Version: 3.7.3

3. So, i thought i was done with this merge… but james_w (who was helping me with it) told me to talk to crimsum first. I did, and he told me to apply this patch: http://hg.alsa-project.org/alsa-tools/raw-rev/9d1e48f8dd5 . I didn’t know what to do until he finally told me to do it with quilt. So i started by myself and he ended up helping me. What I did is this:

First i had to export that bash variable specifying the directory where the patches were, and then pushing all the other patches (if any). This patching system works as an stack so that’s why it pushes the other patches.

export QUILT_PATCHES=debian/patches
quilt push -a

Then i had to create the new patch specifying the name of the patch, like this:

quilt new fix_channel_map_adat_speed_1.patch

After doing that, i had to specify the file where i had to apply the patch, so i did this:

quilt add hdspmixer/src/HDSPMixerCard.cxx

After specifying the filename where the patch was to be applied, i had to make the changes… this really means applying the patch, so i did this:

cd ..; wget http://hg.alsa-project.org/alsa-tools/raw-rev/9d1e48f8dd5d; cd –
patch -p1 –dry-run <../9d1e48f8dd5d;echo $?
patch -p1 <../9d1e48f8dd5d

So to finish, i had to refresh the quilt stack and pop all the other patches, and the patch was added successfully, like this:

quilt refresh
quilt pop -a

4. So now, after finishing all the changes i built the source and then built the binary to see if it compiles.. and after check that everything is done right, i created the debdiff (between the newer debian and ubuntu version) and reported the LP Bug (This is done as usual). A quick review:

debuild -S
sudo pbuilder build ../alsa-tools_1.0.16-1ubuntu1.dsc
debdiff alsa-tools_1.0.16-1.dsc alsa-tools_1.0.16-1ubuntu1.dsc > alsa-tools_1.0.16-1ubuntu1.debdiff

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: