You are not logged in.

#1 2017-08-21 21:10:00

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,563

[SOLVED] How to apply a patch during installation of package in AUR

I installed jamin-cvs using yaourt but when I ran it, I got segmentation fault and this problem has been encountered by others as well described on the repository page. However one of the users has written a patch and diff file which make it work. My question is how do you apply this patch during installation? How do you edit the PKGBUILD with the patch? And what is the role of the diff file?

Last edited by d_fajardo (2017-08-25 16:19:00)

Offline

#2 2017-08-21 21:11:46

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,787
Website

Re: [SOLVED] How to apply a patch during installation of package in AUR


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2017-08-22 22:24:41

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,563

Re: [SOLVED] How to apply a patch during installation of package in AUR

Hi WorMzy. Thanks for the lead. I tried following the wiki and this is what I got.

First of all this is the PKGBUILD:

pkgname=jamin-cvs
pkgver=0.98.3
pkgrel=6
pkgdesc="A JACK Audio Connection Kit Audio Mastering interface"
arch=('i686' 'x86_64')
url="http://jamin.sourceforge.net/"
license=('GPL')
depends=('jack' 'libxml2' 'gtk2' 'swh-plugins' 'fftw' 'liblo')
makedepends=('perl-xml-parser' 'ladspa' 'cvs' 'intltool')
conflicts=('jamin')
provides=('jamin')
options=('!libtool')
install=${pkgname}.install
source=()
md5sums=()

build() {
	LDFLAGS="-ldl"
	cd "$srcdir"
	msg ""
	msg ""
	msg "Connecting to svs server ..."
	msg ""
	msg "Press ENTER when asked for password"
	cvs -d:pserver:anonymous@jamin.cvs.sourceforge.net:/cvsroot/jamin login
	cvs -z3 -d:pserver:anonymous@jamin.cvs.sourceforge.net:/cvsroot/jamin co -P jamin


	cd ${srcdir}/jamin
	./autogen.sh --prefix=/usr --libdir=/usr/lib
	make
}

package() {
	cd ${srcdir}/jamin
	make DESTDIR=${pkgdir} install
}

And this is how I edited it base on my understanding:

pkgname=jamin-cvs
pkgver=0.98.3
pkgrel=6
pkgdesc="A JACK Audio Connection Kit Audio Mastering interface"
arch=('i686' 'x86_64')
url="http://jamin.sourceforge.net/"
license=('GPL')
depends=('jack' 'libxml2' 'gtk2' 'swh-plugins' 'fftw' 'liblo')
makedepends=('perl-xml-parser' 'ladspa' 'cvs' 'intltool')
conflicts=('jamin')
provides=('jamin')
options=('!libtool')
install=${pkgname}.install
source=('typefix.patch')
md5sums=('a0a18224447f431503471b3dfe1b715c')

prepare() {
    cd "$srcdir"
    patch -Np1 -i "${srcdir}/typefix.patch"
}

build() {
	LDFLAGS="-ldl"
	cd "$srcdir"
	msg ""
	msg ""
	msg "Connecting to svs server ..."
	msg ""
	msg "Press ENTER when asked for password"
	cvs -d:pserver:anonymous@jamin.cvs.sourceforge.net:/cvsroot/jamin login
	cvs -z3 -d:pserver:anonymous@jamin.cvs.sourceforge.net:/cvsroot/jamin co -P jamin


	cd ${srcdir}/jamin
	./autogen.sh --prefix=/usr --libdir=/usr/lib
	make
}

package() {
	cd ${srcdir}/jamin
	make DESTDIR=${pkgdir} install
}

Then the installation continues but I get this from the terminal:

can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/gtkmeter.c b/src/gtkmeter.c
|index dda8dc9..c1aa9a6 100644
|--- a/src/gtkmeter.c
|+++ b/src/gtkmeter.c
--------------------------
File to patch: 

It is obvious I'm not doing it right. What is the right way of doing it?

Offline

#4 2017-08-22 22:36:18

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] How to apply a patch during installation of package in AUR

It's not your fault, that's a very odd PKGBUILD that you're working with. It's downloading the source files in the build() function instead of following the PKGBUILD standards.

You're trying to patch the source before it's been downloaded, you need to run the patch command after the cvs commands but before autogen.sh.

That original PKGBUILD really needs fixing though, if there really is no way of correctly specifying the download in the source array then this should at least be done in prepara() instead of build(). It's also missing a pkgver() function.

Last edited by Slithery (2017-08-22 22:40:02)


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#5 2017-08-23 01:16:08

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] How to apply a patch during installation of package in AUR

From PKGBUILD(5):

Currently makepkg supports the Bazaar, Git, Subversion, and Mercurial version control systems. For other
version control systems, manual cloning of upstream repositories must be done in the prepare() function.

CVS is pretty old sad but at the very least the download should be performed in the prepare() function as slithery said.

EDIT: Is the maintainer still active? If this patch is so necessary, why hasn't it been added to the package already?

Last edited by eschwartz (2017-08-23 01:22:25)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#6 2017-08-23 06:06:50

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,563

Re: [SOLVED] How to apply a patch during installation of package in AUR

I don't know if this is still actively manahged. According to the repo page jamin-cvs, the last update was 2016-04-23 and I guess you are right. If this is actively managed, the patch should already be incorporated.
My alternative is to compile from source which I can get from jamin.
From your comments, the question now is can I download the source, write my own PKGBUILD for it and install it from my computer? I can try installing it directly without PKGBUILD but I'd like pacman to be able to account for the packages I install. Besides that really is the Arch way.

Offline

#7 2017-08-23 06:29:03

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] How to apply a patch during installation of package in AUR

Well, sure you can write your own PKGBUILD. But you might as well use the existing one, and just fix it.

If you cannot reach the maintainer, you can file an orphan request and take over maintenance.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#8 2017-08-23 06:46:45

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,563

Re: [SOLVED] How to apply a patch during installation of package in AUR

Eschwartz wrote:

But you might as well use the existing one, and just fix it.

How do you fix it?
I don't have enough experience to be a maintainer.

Offline

#9 2017-08-23 14:27:03

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] How to apply a patch during installation of package in AUR

Just move the cvs checkout block to the beginning of prepare() before it runs `patch`:

prepare() {
	cd "$srcdir"
	msg ""
	msg ""
	msg "Connecting to svs server ..."
	msg ""
	msg "Press ENTER when asked for password"
	cvs -d:pserver:anonymous@jamin.cvs.sourceforge.net:/cvsroot/jamin login
	cvs -z3 -d:pserver:anonymous@jamin.cvs.sourceforge.net:/cvsroot/jamin co -P jamin
	cd jamin
	patch -Np1 -i "${srcdir}/typefix.patch"
}

EDIT: Sorry! It would really help to cd into the cvs clone before using `patch`. yikes

Last edited by eschwartz (2017-08-23 20:33:14)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#10 2017-08-23 19:51:27

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,563

Re: [SOLVED] How to apply a patch during installation of package in AUR

Thanks Eschwartz. I can see what you're getting at. I tried it but with no luck. The problem is once the actual source files are downloaded, then the actually installation directory changes. Instead of $srcdir, the actual source files to patch are located in $srcdir/jamin/src and I tried to point typefix.patch but not working. Terminal complains cannot find the files to patch. Any update?

Offline

#11 2017-08-23 20:03:41

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] How to apply a patch during installation of package in AUR

d_fajardo wrote:

Instead of $srcdir, the actual source files to patch are located in $srcdir/jamin/src and I tried to point typefix.patch but not working. Terminal complains cannot find the files to patch. Any update?

Just cd into the correct directory before applying the patch.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#12 2017-08-23 20:45:06

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,391

Re: [SOLVED] How to apply a patch during installation of package in AUR

The upstream developers also have a git repo on their sourceforge page. It is hidden behind the gtk3 link.

Offline

#13 2017-08-25 05:41:48

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,563

Re: [SOLVED] How to apply a patch during installation of package in AUR

Sorry. I can't get it to work. Just reflects my inexperience in all of this. I practically  copied the typefix.patch within the different levels of the source directory but I'm still getting this:

ogging in to :pserver:anonymous@jamin.cvs.sourceforge.net:2401/cvsroot/jamin
CVS password: 
? jamin/typefix.patch
? jamin/src/typefix.patch
cvs checkout: Updating jamin
cvs checkout: Updating jamin/controller
cvs checkout: Updating jamin/data
cvs checkout: Updating jamin/examples
cvs checkout: Updating jamin/pixmaps
cvs checkout: Updating jamin/po
cvs checkout: Updating jamin/src
cvs checkout: Updating jamin/test
cvs checkout: Updating jamin/test/files
cvs checkout: Updating jamin/www
cvs checkout: Updating jamin/www/lib
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/gtkmeter.c b/src/gtkmeter.c
|index dda8dc9..c1aa9a6 100644
|--- a/src/gtkmeter.c
|+++ b/src/gtkmeter.c
--------------------------
File to patch: 

And here is my updated PKGBUILD:

pkgname=jamin-cvs
pkgver=0.98.3
pkgrel=6
pkgdesc="A JACK Audio Connection Kit Audio Mastering interface"
arch=('i686' 'x86_64')
url="http://jamin.sourceforge.net/"
license=('GPL')
depends=('jack' 'libxml2' 'gtk2' 'swh-plugins' 'fftw' 'liblo')
makedepends=('perl-xml-parser' 'ladspa' 'cvs' 'intltool')
conflicts=('jamin')
provides=('jamin')
options=('!libtool')
install=${pkgname}.install
source=('typefix.patch')
md5sums=('a0a18224447f431503471b3dfe1b715c')

prepare() {
    LDFLAGS="-ldl"
	cd "$srcdir/jamin"
	msg ""
	msg ""
	msg "Connecting to svs server ..."
	msg ""
	msg "Press ENTER when asked for password"
	cvs -d:pserver:anonymous@jamin.cvs.sourceforge.net:/cvsroot/jamin login
	cvs -z3 -d:pserver:anonymous@jamin.cvs.sourceforge.net:/cvsroot/jamin co -P jamin
	patch -Np1 -i "${srcdir}/jamin/src/typefix.patch"
}

build() {
	cd ${srcdir}/jamin
	./autogen.sh --prefix=/usr --libdir=/usr/lib
	make
}

package() {
	cd ${srcdir}/jamin
	make DESTDIR=${pkgdir} install
}

I can see from the tmp directory that the files needing to be patched are in /src/jamin/src directory. I have copied the patch there but still getting the flags.

Offline

#14 2017-08-25 06:19:02

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] How to apply a patch during installation of package in AUR

Because that's not what we said. You changed directories to $srcdir/jamin before cloning the cvs repo, then didn't change directories into the clone  before running patch.

I did update my example BTW. smile


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#15 2017-08-25 16:18:40

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,563

Re: [SOLVED] How to apply a patch during installation of package in AUR

Thanks Eschwartz. It worked with one small adjustment. I still needed to copy the patch to the src directory but after that it was fine and no segmentation fault when I run the program.
Cheers!

Offline

#16 2017-08-25 17:54:36

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] How to apply a patch during installation of package in AUR

Uh, the src directory should already contain it, because makepkg itself will symlink all files in the source=() array into "$srcdir".

And of course a proper patch is listed in the source array in order to work on other peoples' computers. wink


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB