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

Diff of /eclass/rpm.eclass

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

Revision 1.6 Revision 1.11
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2004 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.6 2003/06/22 16:31:23 liquidx Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/rpm.eclass,v 1.11 2005/06/25 15:58:55 liquidx Exp $
4 4
5# Author : Alastair Tse <liquidx@gentoo.org> (21 Jun 2003) 5# Author : Alastair Tse <liquidx@gentoo.org> (21 Jun 2003)
6# 6#
7# Convienence class for extracting RPMs 7# Convienence class for extracting RPMs
8# 8#
31ECLASS="rpm" 31ECLASS="rpm"
32INHERITED="$INHERITED $ECLASS" 32INHERITED="$INHERITED $ECLASS"
33 33
34USE_RPMOFFSET_ONLY=${USE_RPMOFFSET_ONLY-""} 34USE_RPMOFFSET_ONLY=${USE_RPMOFFSET_ONLY-""}
35 35
36newdepend "app-arch/rpm2targz" 36DEPEND=">=app-arch/rpm2targz-9.0-r1"
37 37
38# extracts the contents of the RPM in ${WORKDIR} 38# extracts the contents of the RPM in ${WORKDIR}
39rpm_unpack() { 39rpm_unpack() {
40 local rpmfile 40 local rpmfile rpmoff decompcmd
41 rpmfile=$1 41 rpmfile=$1
42 if [ -z "${rpmfile}" ]; then 42 if [ -z "${rpmfile}" ]; then
43 return 1 43 return 1
44 fi 44 fi
45
46 cd ${WORKDIR}
47 if [ -x /usr/bin/rpm2cpio -a -z "${USE_RPMOFFSET_ONLY}" ]; then 45 if [ -x /usr/bin/rpm2cpio -a -z "${USE_RPMOFFSET_ONLY}" ]; then
48 rpm2cpio ${rpmfile} | cpio -idmu --no-preserve-owner --quiet || return 1 46 rpm2cpio ${rpmfile} | cpio -idmu --no-preserve-owner --quiet || return 1
49 else 47 else
48 rpmoff=`rpmoffset < ${rpmfile}`
49 [ -z "${rpmoff}" ] && return 1
50
51 decompcmd="gzip -dc"
52 if [ -n "`dd if=${rpmfile} skip=${rpmoff} bs=1 count=3 2>/dev/null | file - | grep bzip2`" ]; then
53 decompcmd="bzip2 -dc"
54 fi
50 dd ibs=`rpmoffset < ${rpmfile}` skip=1 if=${rpmfile} 2> /dev/null \ 55 dd ibs=${rpmoff} skip=1 if=${rpmfile} 2> /dev/null \
51 | gzip -dc \ 56 | ${decompcmd} \
52 | cpio -idmu --no-preserve-owner --quiet || return 1 57 | cpio -idmu --no-preserve-owner --quiet || return 1
53 fi 58 fi
54 59
55 return 0 60 return 0
56} 61}

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.20