Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Change Portage's Patch Command
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
rabcor
Apprentice
Apprentice


Joined: 05 Apr 2012
Posts: 200

PostPosted: Fri May 30, 2014 3:13 pm    Post subject: Change Portage's Patch Command Reply with quote

I'm getting an error while patching the kernel, someone suggested to try patching it with -p1, but portage's default patch command is -p0.

Quote:
PATCH COMMAND: patch -p0 -g0 -E --no-backup-if-mismatch < '/etc/portage/patches/sys-kernel/gentoo-sources/ACS_Override.patch'

==============================
can't find file to patch at input line 9
Perhaps you used the wrong -p or --strip option?


How can I change that command? And if that solves my problem, is there a way I can inform portage to use -p1 instead of -p0 for that patch in future updates?

If this cannot be done, then at least how can I manually apply these patches with a different method (not through /etc/portage/patches)?

Edit: I looked up the manual of patch, seems that changing this command does indeed not solve my problem in that particular case, but it would still be nice to know how to change this line.
_________________
This picture was my biggest reason for ever trying Gentoo <3
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54237
Location: 56N 3W

PostPosted: Fri May 30, 2014 5:15 pm    Post subject: Reply with quote

rabcor,

epatch tries -p0 ... -p6 before it gives up
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
rabcor
Apprentice
Apprentice


Joined: 05 Apr 2012
Posts: 200

PostPosted: Sat May 31, 2014 6:17 am    Post subject: Reply with quote

My bad! Thanks for clarifying :)
_________________
This picture was my biggest reason for ever trying Gentoo <3
Back to top
View user's profile Send private message
piotr5
Tux's lil' helper
Tux's lil' helper


Joined: 14 Dec 2012
Posts: 117

PostPosted: Sun Jun 01, 2014 10:23 am    Post subject: Reply with quote

sorry for abducting this thread, but I still have to ask: how do you actually change the patch commands for user-patches? what file is that command contained in?

my problem is sometimes patches I provide in /etc/portage/patches/... fail because the directory in which the patch is being applied isn't the directory with the sourcecode. i.e. manually applying the patch works, also if I include the patch into the ebuild file it works, but emerge doesn't manage to do it automatically as a user-patch. obviously a bug. how do I hunt this bug? where to start?

not saying this bug actually exists, maybe new versions of portage have fixed it. just curious...
Back to top
View user's profile Send private message
EmaRsk
Apprentice
Apprentice


Joined: 07 Sep 2004
Posts: 158
Location: Italy

PostPosted: Sun Jun 01, 2014 12:43 pm    Post subject: Reply with quote

Is this of any help?: https://wiki.gentoo.org/wiki//etc/portage/patches
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21633

PostPosted: Sun Jun 01, 2014 3:07 pm    Post subject: Reply with quote

You should not change the patch command. You should change the patch file so that it works with the default patch command. The failed patch commands should be shown in one of the logs generated when epatch_user fails. Best practice is that the patch file should specify a relative path rooted at $S. Many patches have a single leading directory, often in the git convention of a/ for old and b/ for new.
Back to top
View user's profile Send private message
piotr5
Tux's lil' helper
Tux's lil' helper


Joined: 14 Dec 2012
Posts: 117

PostPosted: Mon Jun 02, 2014 1:36 pm    Post subject: Reply with quote

EmaRsk wrote:
Is this of any help?: https://wiki.gentoo.org/wiki//etc/portage/patches

thanks for this link, I'll investigate from here. seems there is no change directory happening there though...

@Hu: guess you didn't read my posting carefully enough, I said it's a bug in portage and not in the patch, which I'm trying to fix! for example whenever I'm upgrading gentoo I recently had to do so with cmake excluded. angry at that inconvenience I searched for a solution and discovered a patch at https://bugs.gentoo.org/show_bug.cgi?id=468622. but this patch doesn't get applied. contents of /var/tmp/portage/dev-util/cmake-2.8.12.2/temp/cmake-2.8.12.1-FindCurses.patch.out:
Code:
***** cmake-2.8.12.1-FindCurses.patch *****
PWD: /usr/lib64/portage/pym

===========================================

PATCH COMMAND:  patch -p0 -g0 -E --no-backup-if-mismatch  < '/etc/portage/patches//dev-util/cmake-2.8.12.2/cmake-2.8.12.1-FindCurses.patch'

===========================================
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- cmake-2.8.12.1-orig/Modules/FindCurses.cmake   2013-11-06 06:07:22.000000000 +1100
|+++ cmake-2.8.12.1/Modules/FindCurses.cmake   2014-01-17 21:55:40.630142386 +1100
--------------------------
No file to patch.  Skipping patch.
3 out of 3 hunks ignored

patch program exited with status 1
===========================================

PATCH COMMAND:  patch -p1 -g0 -E --no-backup-if-mismatch  < '/etc/portage/patches//dev-util/cmake-2.8.12.2/cmake-2.8.12.1-FindCurses.patch'

===========================================
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- cmake-2.8.12.1-orig/Modules/FindCurses.cmake   2013-11-06 06:07:22.000000000 +1100
|+++ cmake-2.8.12.1/Modules/FindCurses.cmake   2014-01-17 21:55:40.630142386 +1100
--------------------------
No file to patch.  Skipping patch.
3 out of 3 hunks ignored

patch program exited with status 1
===========================================

PATCH COMMAND:  patch -p2 -g0 -E --no-backup-if-mismatch  < '/etc/portage/patches//dev-util/cmake-2.8.12.2/cmake-2.8.12.1-FindCurses.patch'

===========================================
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- cmake-2.8.12.1-orig/Modules/FindCurses.cmake   2013-11-06 06:07:22.000000000 +1100
|+++ cmake-2.8.12.1/Modules/FindCurses.cmake   2014-01-17 21:55:40.630142386 +1100
--------------------------
No file to patch.  Skipping patch.
3 out of 3 hunks ignored

patch program exited with status 1
===========================================

PATCH COMMAND:  patch -p3 -g0 -E --no-backup-if-mismatch  < '/etc/portage/patches//dev-util/cmake-2.8.12.2/cmake-2.8.12.1-FindCurses.patch'

===========================================
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- cmake-2.8.12.1-orig/Modules/FindCurses.cmake   2013-11-06 06:07:22.000000000 +1100
|+++ cmake-2.8.12.1/Modules/FindCurses.cmake   2014-01-17 21:55:40.630142386 +1100
--------------------------
No file to patch.  Skipping patch.
3 out of 3 hunks ignored

patch program exited with status 1
===========================================

PATCH COMMAND:  patch -p4 -g0 -E --no-backup-if-mismatch  < '/etc/portage/patches//dev-util/cmake-2.8.12.2/cmake-2.8.12.1-FindCurses.patch'

===========================================
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- cmake-2.8.12.1-orig/Modules/FindCurses.cmake   2013-11-06 06:07:22.000000000 +1100
|+++ cmake-2.8.12.1/Modules/FindCurses.cmake   2014-01-17 21:55:40.630142386 +1100
--------------------------
No file to patch.  Skipping patch.
3 out of 3 hunks ignored

patch program exited with status 1
then I switch to root, cd to /var/tmp/portage/dev-util/cmake-2.8.12.2/work/cmake-2.8.12.2/ and execute
Code:
patch -p1 -g0 -E --no-backup-if-mismatch  < '/etc/portage/patches//dev-util/cmake-2.8.12.2/cmake-2.8.12.1-FindCurses.patch'
and it works. any idea how to change the patch for the same result? unfortunately the patch command doesn't accept absolute directories, neither ".." directories seem to manage getting out of /usr/lib64/portage/pym into the working source directory. so obviously I must alter the sourcecode of portage itself...
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21633

PostPosted: Tue Jun 03, 2014 1:19 am    Post subject: Reply with quote

I read it, but it is depressingly common for people to claim that there is a bug in core software when in fact they are simply misusing the software in question. From your initial vague description after the thread hijack, I read it to mean that the patch had been generated with incorrect path information, which is also a very common mistake. Now that you have provided the actual error text, I agree that it seems suspicious that the PWD line references a Portage directory.
Back to top
View user's profile Send private message
piotr5
Tux's lil' helper
Tux's lil' helper


Joined: 14 Dec 2012
Posts: 117

PostPosted: Tue Jun 03, 2014 3:52 pm    Post subject: Reply with quote

no problem.

btw, for people searching for a solution to the problem with compiling cmake in ncurses[tinfo] environment: the patch is already part of gentoo, just unmask it for your arch and upgrade to the 2.8.12.2-r1 version...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum