linpsk patch

Asked by Hans-Juerg Reinhart

this is probably a rather stupid beginners question...

How do I apply the path to linpsk 1.1-1.1 from Mathias Klose?

best regards,

Hans-Juerg

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu linpsk Edit question
Assignee:
No assignee Edit question
Solved by:
mycae
Solved:
Last query:
Last reply:
Revision history for this message
mycae (mycae) said :
#1

Just so we are clear, do you mean this patch:
http://patch-tracker.debian.org/patch/series/view/linpsk/1.1-1.1/gcc-4.6.patch

?

If so, the patch will be auto-applied at build-time, if you follow this procedure:
http://www.moosechips.com/2008/09/ubuntu-rebuild-a-source-package/

Otherwise, use

patch -p# < path/to/patchfile

where # is a number that depends upon the folder you are in, and the paths listed in the patch. If the patch refers to

src/foo.cpp

and you are in the top dir then # is 0. if you are in the src/ dir # is 1 - the # just builds the relative path appropriately by stripping the paths specified in the patch.

Revision history for this message
Hans-Juerg Reinhart (hans-juerg-reinhart) said :
#2

Thanks for this answer this brings me further along.

I found a whole collection of patches linpsk in 1.1 to linpsk1.1-1.1
linpsk_1.1-1.1.debian.tar.gz

(see e.g. https://launchpad.net/ubuntu/+source/linpsk/1.1-1.1)

The README file tells this set is based on quilt.
However it does not explain how to apply it!

Revision history for this message
mycae (mycae) said :
#3

I'm not clear on what you are trying to do - perhaps with a little more context I can provide a better answer.

When the packages are built by the build-system (buildd), the packages are automatically applied as part of dpkg-buildpackage. There is no need to manually apply the patches if you are building them. The package that you download through the package manager are built with these patches applied. There is no need to rebuild this as an end user.

As part of the instructions on the "moosechips" site I posted earlier, the patches will be automatically integrated as part of the successful build.

The only situation in which you would want to apply the patches by hand is if you are an upstream developer, who is attempting to migrate the patches back into your repository, or if you are porting them to another build-system, like gentoo's portage, or fedora's rpmbuild.

If you are attempting to modify the package itself, and rebuild it for your own purposes, then you should use the quilt program to extend the patch set, and then build the result with dpkg-buildpackage. Don't forget that quilt needs a little configuration in order to work (yeah, its stupid and needless, see "preparation" on the following link).
http://pkg-perl.alioth.debian.org/howto/quilt.html

Revision history for this message
mycae (mycae) said :
#4

typo "the packages are automatically applied " -> "the PATCHES are automatically applied"

Revision history for this message
Hans-Juerg Reinhart (hans-juerg-reinhart) said :
#5

Well I just ried to build linpsk1.1 from the source just to understand the system.
( I admit, it would be easier to just download linpsk directly!)
This is done by using qmake and make according to the instructions in README.
Now g++ stalled with a syntax error.

I then found the above mentioned collection of patches based on quilt which lead to linpsk1.1-1.1. I assume dthis would solve ma problem.
All configuration files appear available.
However I have no clue how to apply these patches to the source.

Thanks anyway for your help. It has been a while since I worked with unix. I apologize for my stupid questions.

HJR

Revision history for this message
Best mycae (mycae) said :
#6

Hi Hans,

No stupid questions - a lot of the debian systems are somewhat "organically" derived.

If it is just a question of getting the idea right, then it is not too hard once you have the hang of the idea behind the "patch" program. The standard "patch" output mode is the "unified" mode, which has additional metadata about patch creation time, filenames, etc.

The key points are that the patch program takes in a human readable file, and adds/removes lines as needed.

Here is a terminal session where I apply the patches by hand.
$ apt-get source linpsk
Reading package lists... Done
Building dependency tree
Reading state information... Done
...
downloads stuff
...
$ls
linpsk-1.1 linpsk_1.1-1.1.dsc
linpsk_1.1-1.1.debian.tar.gz linpsk_1.1.orig.tar.gz
$echo "lets unpack the original tarball to recreate what Hans is doing"
lets unpack the original tarball to recreate what Hans is doing
$ tar -zxf linpsk_1.1.orig.tar.gz
$ ls
linpsk linpsk_1.1-1.1.debian.tar.gz linpsk_1.1.orig.tar.gz
linpsk-1.1 linpsk_1.1-1.1.dsc
$cd linpsk
$ ls
asoundrc ChangeLog COPYING gui images linpsk.pro README src
$echo "lets copy the patches from the debian-ubuntu package source"
lets copy the patches from the debian-ubuntu package source
$ cp ../linpsk-1.1/debian/patches/*patch .
$ls
$ ls
asoundrc COPYING gcc-4.6.patch images qt4.patch src
ChangeLog demowave.patch gui linpsk.pro README typo.patch
$ head -n 4 gcc-4.6.patch
Description: Fix FTBFS with g++-4.6.
Origin: http://launchpadlibrarian.net/80358432/linpsk_1.1-1_1.1-1ubuntu1.diff.gz
Author: Matthias Klose <email address hidden>
Bug-Debian: http://bugs.debian.org/624967
$ echo "lets see which order the debian maintainers used. It might matter, it might not"
lets see which order the debian maintainers used. It might matter, it might not
$cat ../linpsk-1.1/debian/patches/series
demowave.patch
qt4.patch
typo.patch
gcc-4.6.patch
$echo "ok, lets apply the patches by hand"
ok, lets apply the patches by hand
$ head -n 12 gcc-4.6.patch
Description: Fix FTBFS with g++-4.6.
Origin: http://launchpadlibrarian.net/80358432/linpsk_1.1-1_1.1-1ubuntu1.diff.gz
Author: Matthias Klose <email address hidden>
Bug-Debian: http://bugs.debian.org/624967
Bug-Ubuntu: https://bugs.launchpad.net/bugs/770983

--- linpsk-1.1.orig/src/linpsk.cpp
+++ linpsk-1.1/src/linpsk.cpp
@@ -685,12 +685,14 @@ void LinPSK::setRxMode()
     Menu.setParameter ( *Param );
   if ( Menu.exec() != 0 )
   {
$echo "note the +++ line, this says where to apply the patch to"
note the +++ line, this says where to apply the patch to
$ echo "we are in the wrong folder, as the file we want to patch is src/linpsk.cpp, thats OK, because the patch command has a -p switch for this"
we are in the wrong folder, as the file we want to patch is src/linpsk.cpp, thats OK, because the patch command has a -p switch for this
$echo "lets assume all patches are in the same folder and need same -p level"
lets assume all patches are in the same folder and need same -p level
$echo "the level we need is 1, in order to strip off the leading linpsk-1.1 in linpsk1.1/src/linpsk.cpp"
the level we need is 1, in order to strip off the leading linpsk-1.1 in linpsk1.1/src/linpsk.cpp
$ patch -p1 < demowave.patch
patching file src/waveinput.cpp
$ patch -p1 < qt4.patch
patching file linpsk.pro
patching file src/src.pro
patching file gui/gui.pro
$ patch -p1 < typo.patch
patching file src/linpsk.cpp
$ patch -p1 < gcc-4.6.patch
patching file src/linpsk.cpp
$ echo "All done"
All done

Revision history for this message
Hans-Juerg Reinhart (hans-juerg-reinhart) said :
#7

Woww great - thanks very much for your help!

Hans-Jürg

Revision history for this message
Hans-Juerg Reinhart (hans-juerg-reinhart) said :
#8

Thanks mycae, that solved my question.