1 |
On Thursday 12 March 2009 14:44:21 Donnie Berkholz wrote: |
2 |
> On 04:29 Thu 12 Mar , Mike Frysinger (vapier) wrote: |
3 |
> > Modified: rpm.eclass |
4 |
> > Log: |
5 |
> > add a func to automatically process patches in rpm specs |
6 |
> > |
7 |
> > +# @FUNCTION: rpm_spec_epatch |
8 |
> > +# @USAGE: [spec] |
9 |
> > +# @DESCRIPTION: |
10 |
> > +# Read the specified spec (defaults to ${PN}.spec) and attempt to apply |
11 |
> > +# all the patches listed in it. If the spec does funky things like |
12 |
> > moving +# files around, well this won't handle that. |
13 |
> > +rpm_spec_epatch() { |
14 |
> > + local p spec=${1:-${PN}.spec} |
15 |
> > + local dir=${spec%/*} |
16 |
> > + grep '^%patch' "${spec}" | \ |
17 |
> > + while read line ; do |
18 |
> > + set -- ${line} |
19 |
> > + p=$1 |
20 |
> > + shift |
21 |
> > + EPATCH_OPTS="$*" |
22 |
> > + set -- $(grep "^P${p#%p}: " "${spec}") |
23 |
> > + shift |
24 |
> > + epatch "${dir:+${dir}/}$*" |
25 |
> > + done |
26 |
> > +} |
27 |
> > + |
28 |
> |
29 |
> Very cool! How about adding this to a default src_prepare() for EAPI=2? |
30 |
|
31 |
many specs do weird things like changing dirs/files/whatever, so i dont think |
32 |
making it a default is viable. especially when people only want rpm.elcass |
33 |
for rpm_unpack, not for rpm_src_unpack. |
34 |
-mike |