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

Diff of /eclass/rpm.eclass

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

Revision 1.19 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.19 2009/10/05 06:14:36 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
45 rpm_unpack "$@" 45 rpm_unpack "$@"
46 46
47 # no .src.rpm files, then nothing to do 47 # no .src.rpm files, then nothing to do
48 [[ "$* " != *".src.rpm " ]] && return 0 48 [[ "$* " != *".src.rpm " ]] && return 0
49 49
50 local old_shopts=$(shopt -p nullglob)
51 shopt -s nullglob 50 eshopts_push -s nullglob
52 51
53 # unpack everything 52 # unpack everything
54 local a 53 local a
55 for a in *.tar.{gz,bz2} *.t{gz,bz2} *.zip *.ZIP ; do 54 for a in *.tar.{gz,bz2} *.t{gz,bz2} *.zip *.ZIP ; do
56 unpack "./${a}" 55 unpack "./${a}"
57 rm -f "${a}" 56 rm -f "${a}"
58 done 57 done
59 58
60 eval "${old_shopts}" 59 eshopts_pop
61 60
62 return 0 61 return 0
63} 62}
64 63
65# @FUNCTION: rpm_src_unpack 64# @FUNCTION: rpm_src_unpack
81# @DESCRIPTION: 80# @DESCRIPTION:
82# 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
83# 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
84# files around, well this won't handle that. 83# files around, well this won't handle that.
85rpm_spec_epatch() { 84rpm_spec_epatch() {
86 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} == */* ]] \
87 local dir=${spec%/*} 96 && dir=${spec%/*} \
97 || dir=
98
99 ebegin "Applying patches from ${spec}"
100
88 grep '^%patch' "${spec}" | \ 101 grep '^%patch' "${spec}" | \
89 while read line ; do 102 while read line ; do
103 # expand the %patch line
90 set -- ${line} 104 set -- ${line}
91 p=$1 105 p=$1
92 shift 106 shift
107
108 # process the %patch arguments
109 local arg
93 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
94 set -- $(grep "^P${p#%p}: " "${spec}") 119 set -- $(grep "^P${p#%p}: " "${spec}")
95 shift 120 shift
96 epatch "${dir:+${dir}/}$*" 121 epatch "${dir:+${dir}/}$*"
97 done 122 done
123
124 eend
98} 125}
99 126
100EXPORT_FUNCTIONS src_unpack 127EXPORT_FUNCTIONS src_unpack

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

  ViewVC Help
Powered by ViewVC 1.1.20