How to help fixing problems in openSUSE

Posted by – 14. Januar 2010

If you found a problem in your openSUSE system, and know how to fix it, it is very easy now to contribute the fix back to the project.

For example a user had a problem with a boot script erroneously overwriting a file at each system boot. As he already found out how to fix it, I can demonstrate how easy it is to contribute this fix back to the project, so that every openSUSE user can benefit from it.

At first I had to find out which package to fix. This can be done by asking the package management system which package owns the buggy file:

> rpm -qf /etc/init.d/boot.clock

aaa_base-11.2-43.45.1.i586

Now we create a branch of the package in the openSUSE buildservice:

> osc branch openSUSE:Factory aaa_base

Note: Please login to build.opensuse.org first to create your home project. The osc tool can be installed for openSUSE 11.2, 11.1.

The server created a copy of the package in your home project now.
You need to check it out to your local machine to do the changes:

osc co home:digitaltomm:branches:Base:System/aaa_base

You now have a directory ‚home:digitaltomm:branches:Base:System/aaa_base‘ containing the package source files.

You can now either directly change the sources of the package or create a patch file that gets included from the .spec file. Creating a patch file is preferred for source changes, so that the patch can easily be removed when the upstream project has included the fix. Changes to the .spec file can be done directly.

Let’s create a patch. This can be done manually with the patch command, or with the help of the quilt program.

I have to extract the source tarball, create a copy where I fix the code, and create the patch file by using diff to compare the original and the patched sources:

> cd home\:digitaltomm\:branches\:Base\:System/aaa_base
> tar -xf aaa_base.tar.bz2
> cp -r aaa_base aaa_base.orig
> vim aaa_base/etc/init.d/boot.clock
> diff -uNr aaa_base.orig aaa_base > adjtime.patch

Now the patch file needs to be referenced from the .spec file. This is done by adding a reference like this:

Source: aaa_base.tar.bz2
Patch0: adjtime.patch
...
%prep
%setup -n aaa_base
%patch0 -p1

To make sure the patch is applied correctly, and the package builds on openSUSE Factory, I start a local build:

> osc build --no-verify

When everything went fine, I can commit the changes to my branch, add a changelog entry and afterwards submit a request to get the changes included in the openSUSE Factory project:

> osc commit -m "Added adjtime fix from bnc#570245."
> osc vc
> osc submitreq -m 'Added adjtime fix from bnc#570245'
created request id 29474

The request is now pending and waiting to get reviewed by the project maintainers of openSUSE Factory. It’s state can be viewed with:

> osc request show 29474

or in the webinterface.

In my case the request got declined because Rudi was faster in fixing it, and I forgot to add a correct changelog entry first.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.