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

Diff of /eclass/eutils.eclass

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

Revision 1.70 Revision 1.71
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2003 Gentoo Technologies, Inc.
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.70 2003/11/30 11:22:32 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.71 2003/11/30 11:42:09 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.
957 957
958 # rip out the final file name from the metadata 958 # rip out the final file name from the metadata
959 local datafile="`tail -c +$((${metaskip}+1)) ${src} | strings | head -n 1`" 959 local datafile="`tail -c +$((${metaskip}+1)) ${src} | strings | head -n 1`"
960 datafile="`basename ${datafile}`" 960 datafile="`basename ${datafile}`"
961 961
962 # now lets uncompress the file if need be 962 # now lets uncompress/untar the file if need be
963 local tmpfile="`mymktemp ${T}`" 963 local tmpfile="`mymktemp ${T}`"
964 tail -c +$((${tailskip}+1)) ${src} 2>/dev/null | head -c 512 > ${tmpfile} 964 tail -c +$((${tailskip}+1)) ${src} 2>/dev/null | head -c 512 > ${tmpfile}
965
966 local iscompressed="`file -b ${tmpfile}`"
967 if [ "${iscompressed:0:8}" == "compress" ] ; then
968 iscompressed=1
969 mv ${tmpfile}{,.Z}
970 gunzip ${tmpfile}
971 else
972 iscompressed=0
973 fi
965 local filetype="`file -b ${tmpfile}`" 974 local istar="`file -b ${tmpfile}`"
966 case ${filetype} in 975 if [ "${istar:0:9}" == "POSIX tar" ] ; then
967 compress*) 976 istar=1
977 else
978 istar=0
979 fi
980
968 #for some reason gzip dies with this ... dd cant provide buffer fast enough ? 981 #for some reason gzip dies with this ... dd cant provide buffer fast enough ?
969 #dd if=${src} ibs=${metaskip} count=1 \ 982 #dd if=${src} ibs=${metaskip} count=1 \
970 # | dd ibs=${tailskip} skip=1 \ 983 # | dd ibs=${tailskip} skip=1 \
971 # | gzip -dc \ 984 # | gzip -dc \
972 # > ${datafile} 985 # > ${datafile}
986 if [ ${iscompressed} -eq 1 ] ; then
987 if [ ${istar} -eq 1 ] ; then
988 tail -c +$((${tailskip}+1)) ${src} 2>/dev/null \
989 | head -c $((${metaskip}-${tailskip})) \
990 | tar -xzf -
991 else
973 tail -c +$((${tailskip}+1)) ${src} 2>/dev/null \ 992 tail -c +$((${tailskip}+1)) ${src} 2>/dev/null \
974 | head -c $((${metaskip}-${tailskip})) \ 993 | head -c $((${metaskip}-${tailskip})) \
975 | gzip -dc \ 994 | gzip -dc \
976 > ${datafile} 995 > ${datafile}
977 ;; 996 fi
978 *) 997 else
998 if [ ${istar} -eq 1 ] ; then
999 tail -c +$((${tailskip}+1)) ${src} 2>/dev/null \
1000 | head -c $((${metaskip}-${tailskip})) \
1001 | tar -xf -
1002 else
979 tail -c +$((${tailskip}+1)) ${src} 2>/dev/null \ 1003 tail -c +$((${tailskip}+1)) ${src} 2>/dev/null \
980 | head -c $((${metaskip}-${tailskip})) \ 1004 | head -c $((${metaskip}-${tailskip})) \
981 > ${datafile} 1005 > ${datafile}
982 #dd if=${src} ibs=${metaskip} count=1 \ 1006 fi
983 # | dd ibs=${tailskip} skip=1 of=${datafile} 1007 fi
984 ;; 1008 true
985 esac
986 [ -s "${datafile}" ] || die "failure unpacking pdv ('${metaskip}' '${tailskip}' '${datafile}')" 1009 #[ -s "${datafile}" ] || die "failure unpacking pdv ('${metaskip}' '${tailskip}' '${datafile}')"
987 #assert "failure unpacking pdv ('${metaskip}' '${tailskip}' '${datafile}')" 1010 #assert "failure unpacking pdv ('${metaskip}' '${tailskip}' '${datafile}')"
988} 1011}
989 1012
990# Unpack those pesky makeself generated files ... 1013# Unpack those pesky makeself generated files ...
991# They're shell scripts with the binary package tagged onto 1014# They're shell scripts with the binary package tagged onto

Legend:
Removed from v.1.70  
changed lines
  Added in v.1.71

  ViewVC Help
Powered by ViewVC 1.1.20