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

Diff of /eclass/eutils.eclass

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

Revision 1.195 Revision 1.196
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 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/eutils.eclass,v 1.195 2005/09/01 05:56:35 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.196 2005/09/06 01:59:22 vapier Exp $
4# 4#
5# Author: Martin Schlemmer <azarah@gentoo.org> 5# Author: Martin Schlemmer <azarah@gentoo.org>
6# 6#
7# This eclass is for general purpose functions that most ebuilds 7# This eclass is for general purpose functions that most ebuilds
8# have to implement themselves. 8# have to implement themselves.
931############################################################## 931##############################################################
932 932
933 933
934# for internal use only (unpack_pdv and unpack_makeself) 934# for internal use only (unpack_pdv and unpack_makeself)
935find_unpackable_file() { 935find_unpackable_file() {
936 local src="$1" 936 local src=$1
937 if [ -z "${src}" ] 937 if [[ -z ${src} ]] ; then
938 then
939 src="${DISTDIR}/${A}" 938 src=${DISTDIR}/${A}
940 else 939 else
941 if [ -e "${DISTDIR}/${src}" ] 940 if [[ -e ${DISTDIR}/${src} ]] ; then
942 then
943 src="${DISTDIR}/${src}" 941 src=${DISTDIR}/${src}
944 elif [ -e "${PWD}/${src}" ] 942 elif [[ -e ${PWD}/${src} ]] ; then
945 then
946 src="${PWD}/${src}" 943 src=${PWD}/${src}
947 elif [ -e "${src}" ] 944 elif [[ -e ${src} ]] ; then
948 then
949 src="${src}" 945 src=${src}
950 fi
951 fi 946 fi
952 [ ! -e "${src}" ] && die "Could not find requested archive ${src}" 947 fi
948 [[ ! -e ${src} ]] && return 1
953 echo "${src}" 949 echo "${src}"
954} 950}
955 951
956# Unpack those pesky pdv generated files ... 952# Unpack those pesky pdv generated files ...
957# They're self-unpacking programs with the binary package stuffed in 953# They're self-unpacking programs with the binary package stuffed in
972# lseek 968# lseek
973# root@vapier 0 pdv_unpack # strace -elseek ./hldsupdatetool.bin 969# root@vapier 0 pdv_unpack # strace -elseek ./hldsupdatetool.bin
974# lseek(3, -4, SEEK_END) = 2981250 970# lseek(3, -4, SEEK_END) = 2981250
975# thus we would pass in the value of '4' as the second parameter. 971# thus we would pass in the value of '4' as the second parameter.
976unpack_pdv() { 972unpack_pdv() {
977 local src="`find_unpackable_file $1`" 973 local src=$(find_unpackable_file $1)
978 local sizeoff_t="$2" 974 local sizeoff_t=$2
979 975
976 [[ -z ${src} ]] && die "Could not locate source for '$1'"
980 [ -z "${sizeoff_t}" ] && die "No idea what off_t size was used for this pdv :(" 977 [[ -z ${sizeoff_t} ]] && die "No idea what off_t size was used for this pdv :("
981 978
982 local shrtsrc="`basename ${src}`" 979 local shrtsrc="`basename ${src}`"
983 echo ">>> Unpacking ${shrtsrc} to ${PWD}" 980 echo ">>> Unpacking ${shrtsrc} to ${PWD}"
984 local metaskip=`tail -c ${sizeoff_t} ${src} | hexdump -e \"%i\"` 981 local metaskip=`tail -c ${sizeoff_t} ${src} | hexdump -e \"%i\"`
985 local tailskip=`tail -c $((${sizeoff_t}*2)) ${src} | head -c ${sizeoff_t} | hexdump -e \"%i\"` 982 local tailskip=`tail -c $((${sizeoff_t}*2)) ${src} | head -c ${sizeoff_t} | hexdump -e \"%i\"`
1051# Usage: unpack_makeself [file to unpack] [offset] [tail|dd] 1048# Usage: unpack_makeself [file to unpack] [offset] [tail|dd]
1052# - If the file is not specified then unpack will utilize ${A}. 1049# - If the file is not specified then unpack will utilize ${A}.
1053# - If the offset is not specified then we will attempt to extract 1050# - If the offset is not specified then we will attempt to extract
1054# the proper offset from the script itself. 1051# the proper offset from the script itself.
1055unpack_makeself() { 1052unpack_makeself() {
1056 local src="$(find_unpackable_file "$1")" 1053 local src=$(find_unpackable_file "$1")
1057 local skip="$2" 1054 local skip=$2
1058 local exe="$3" 1055 local exe=$3
1059 1056
1057 [[ -z ${src} ]] && die "Could not locate source for '$1'"
1058
1060 local shrtsrc="$(basename "${src}")" 1059 local shrtsrc=$(basename "${src}")
1061 echo ">>> Unpacking ${shrtsrc} to ${PWD}" 1060 echo ">>> Unpacking ${shrtsrc} to ${PWD}"
1062 if [ -z "${skip}" ] 1061 if [ -z "${skip}" ]
1063 then 1062 then
1064 local ver="`grep -a '#.*Makeself' ${src} | awk '{print $NF}'`" 1063 local ver="`grep -a '#.*Makeself' ${src} | awk '{print $NF}'`"
1065 local skip=0 1064 local skip=0

Legend:
Removed from v.1.195  
changed lines
  Added in v.1.196

  ViewVC Help
Powered by ViewVC 1.1.20