Gentoo Archives: gentoo-user

From: "Bo Ørsted Andresen" <bo.andresen@××××.dk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Howto patch ebuilds?
Date: Fri, 30 Jun 2006 09:22:15
Message-Id: 200606301117.24080.bo.andresen@zlin.dk
In Reply to: Re: [gentoo-user] Howto patch ebuilds? by Rumen Yotov
1 On Friday 30 June 2006 10:06, Rumen Yotov wrote:
2 > Hope i didn't screwed something so check it again (some things might be
3 > made shorter though).
4
5 I have a neat little script for this:
6
7 ######################################################
8 #!/bin/bash
9
10 # collect vars
11 ebuild=`equery which $1`
12 patch=$2
13 category=`echo ${ebuild} | awk -F/ '{cat=NF-2;print $cat}'`
14 package=`echo ${ebuild} | awk -F/ '{pkg=NF-1;print $pkg}'`
15 portagepath=`dirname ${ebuild}`
16 overlaypath=/usr/local/portage/${category}/${package}
17
18 # copy to overlay
19 mkdir -pv ${overlaypath}/local-files
20 cp -v ${ebuild} ${overlaypath}/
21 ln -sv ${portagepath}/files ${overlaypath}/files
22 cp -v ${patch} ${overlaypath}/local-files/
23
24 # print instructions - wait for acknowledgement - edit file
25 echo -e 'Insert:\n\tepatch ${FILESDIR/files/local-files}/'${patch}'\nin
26 src_unpack{ }'
27 read
28 ${EDITOR} ${overlaypath}/${ebuild##*/}
29
30 # digest ebuild
31 ebuild ${overlaypath}/${ebuild##*/} digest
32 ######################################################
33
34 This only copies the newest ebuild and makes a symlink to the filesdir
35 in /usr/portage so that patches in portage do not have to be copied... The
36 first argument must be the name of the package in a format that `equery
37 which` understands and the second argument must be the path to the patch that
38 needs to be applied.
39
40 --
41 Bo Andresen