/[gentoo-x86]/eclass/rpm.eclass
Gentoo

Diff of /eclass/rpm.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.20 Revision 1.21
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2009 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/rpm.eclass,v 1.20 2010/07/18 21:57:20 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/rpm.eclass,v 1.21 2011/12/10 08:50:47 vapier Exp $
4 4
5# @ECLASS: rpm.eclass 5# @ECLASS: rpm.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org 7# base-system@gentoo.org
8# @BLURB: convenience class for extracting RPMs 8# @BLURB: convenience class for extracting RPMs
80# @DESCRIPTION: 80# @DESCRIPTION:
81# Read the specified spec (defaults to ${PN}.spec) and attempt to apply 81# Read the specified spec (defaults to ${PN}.spec) and attempt to apply
82# all the patches listed in it. If the spec does funky things like moving 82# all the patches listed in it. If the spec does funky things like moving
83# files around, well this won't handle that. 83# files around, well this won't handle that.
84rpm_spec_epatch() { 84rpm_spec_epatch() {
85 local p spec=${1:-${PN}.spec} 85 local p spec=$1
86 local dir
87
88 if [[ -z ${spec} ]] ; then
89 # search likely places for the spec file
90 for spec in "${PWD}" "${S}" "${WORKDIR}" ; do
91 spec+="/${PN}.spec"
92 [[ -e ${spec} ]] && break
93 done
94 fi
95 [[ ${spec} == */* ]] \
86 local dir=${spec%/*} 96 && dir=${spec%/*} \
97 || dir=
98
99 ebegin "Applying patches from ${spec}"
100
87 grep '^%patch' "${spec}" | \ 101 grep '^%patch' "${spec}" | \
88 while read line ; do 102 while read line ; do
103 # expand the %patch line
89 set -- ${line} 104 set -- ${line}
90 p=$1 105 p=$1
91 shift 106 shift
107
108 # process the %patch arguments
109 local arg
92 EPATCH_OPTS="$*" 110 EPATCH_OPTS=
111 for arg in "$@" ; do
112 case ${arg} in
113 -b) EPATCH_OPTS+=" --suffix" ;;
114 *) EPATCH_OPTS+=" ${arg}" ;;
115 esac
116 done
117
118 # extract the patch name from the Patch# line
93 set -- $(grep "^P${p#%p}: " "${spec}") 119 set -- $(grep "^P${p#%p}: " "${spec}")
94 shift 120 shift
95 epatch "${dir:+${dir}/}$*" 121 epatch "${dir:+${dir}/}$*"
96 done 122 done
123
124 eend
97} 125}
98 126
99EXPORT_FUNCTIONS src_unpack 127EXPORT_FUNCTIONS src_unpack

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.20