diff options
author | Mike Frysinger <vapier@gentoo.org> | 2012-02-14 16:01:21 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2012-02-14 16:01:21 +0000 |
commit | c51b0ccc15fdc112dfa45465678a4041c9b7c7e1 (patch) | |
tree | 24742c0e1d0f6bf24e3a301f684d5f70c119833d /eclass | |
parent | Version bump that contains fix for implicit cgdb_malloc. Fixes bug 390895 by ... (diff) | |
download | historical-c51b0ccc15fdc112dfa45465678a4041c9b7c7e1.tar.gz historical-c51b0ccc15fdc112dfa45465678a4041c9b7c7e1.tar.bz2 historical-c51b0ccc15fdc112dfa45465678a4041c9b7c7e1.zip |
drop unpack_{makeself,pdv} since they are in unpacker.eclass now
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/eutils.eclass | 213 |
1 files changed, 1 insertions, 212 deletions
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass index 0d4363364db5..0e04c2e84b4d 100644 --- a/eclass/eutils.eclass +++ b/eclass/eutils.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.380 2012/01/31 06:55:37 ulm Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.381 2012/02/14 16:01:21 vapier Exp $ # @ECLASS: eutils.eclass # @MAINTAINER: @@ -944,217 +944,6 @@ newicon() { ) } -# for internal use only (unpack_pdv and unpack_makeself) -find_unpackable_file() { - local src=$1 - if [[ -z ${src} ]] ; then - src=${DISTDIR}/${A} - else - if [[ -e ${DISTDIR}/${src} ]] ; then - src=${DISTDIR}/${src} - elif [[ -e ${PWD}/${src} ]] ; then - src=${PWD}/${src} - elif [[ -e ${src} ]] ; then - src=${src} - fi - fi - [[ ! -e ${src} ]] && return 1 - echo "${src}" -} - -# @FUNCTION: unpack_pdv -# @USAGE: <file to unpack> <size of off_t> -# @DESCRIPTION: -# Unpack those pesky pdv generated files ... -# They're self-unpacking programs with the binary package stuffed in -# the middle of the archive. Valve seems to use it a lot ... too bad -# it seems to like to segfault a lot :(. So lets take it apart ourselves. -# -# You have to specify the off_t size ... I have no idea how to extract that -# information out of the binary executable myself. Basically you pass in -# the size of the off_t type (in bytes) on the machine that built the pdv -# archive. -# -# One way to determine this is by running the following commands: -# -# @CODE -# strings <pdv archive> | grep lseek -# strace -elseek <pdv archive> -# @CODE -# -# Basically look for the first lseek command (we do the strings/grep because -# sometimes the function call is _llseek or something) and steal the 2nd -# parameter. Here is an example: -# -# @CODE -# vapier@vapier 0 pdv_unpack # strings hldsupdatetool.bin | grep lseek -# lseek -# vapier@vapier 0 pdv_unpack # strace -elseek ./hldsupdatetool.bin -# lseek(3, -4, SEEK_END) = 2981250 -# @CODE -# -# Thus we would pass in the value of '4' as the second parameter. -unpack_pdv() { - local src=$(find_unpackable_file "$1") - local sizeoff_t=$2 - - [[ -z ${src} ]] && die "Could not locate source for '$1'" - [[ -z ${sizeoff_t} ]] && die "No idea what off_t size was used for this pdv :(" - - local shrtsrc=$(basename "${src}") - echo ">>> Unpacking ${shrtsrc} to ${PWD}" - local metaskip=$(tail -c ${sizeoff_t} "${src}" | hexdump -e \"%i\") - local tailskip=$(tail -c $((${sizeoff_t}*2)) "${src}" | head -c ${sizeoff_t} | hexdump -e \"%i\") - - # grab metadata for debug reasons - local metafile=$(emktemp) - tail -c +$((${metaskip}+1)) "${src}" > "${metafile}" - - # rip out the final file name from the metadata - local datafile=$(tail -c +$((${metaskip}+1)) "${src}" | strings | head -n 1) - datafile=$(basename "${datafile}") - - # now lets uncompress/untar the file if need be - local tmpfile=$(emktemp) - tail -c +$((${tailskip}+1)) ${src} 2>/dev/null | head -c 512 > ${tmpfile} - - local iscompressed=$(file -b "${tmpfile}") - if [[ ${iscompressed:0:8} == "compress" ]] ; then - iscompressed=1 - mv ${tmpfile}{,.Z} - gunzip ${tmpfile} - else - iscompressed=0 - fi - local istar=$(file -b "${tmpfile}") - if [[ ${istar:0:9} == "POSIX tar" ]] ; then - istar=1 - else - istar=0 - fi - - #for some reason gzip dies with this ... dd cant provide buffer fast enough ? - #dd if=${src} ibs=${metaskip} count=1 \ - # | dd ibs=${tailskip} skip=1 \ - # | gzip -dc \ - # > ${datafile} - if [ ${iscompressed} -eq 1 ] ; then - if [ ${istar} -eq 1 ] ; then - tail -c +$((${tailskip}+1)) ${src} 2>/dev/null \ - | head -c $((${metaskip}-${tailskip})) \ - | tar -xzf - - else - tail -c +$((${tailskip}+1)) ${src} 2>/dev/null \ - | head -c $((${metaskip}-${tailskip})) \ - | gzip -dc \ - > ${datafile} - fi - else - if [ ${istar} -eq 1 ] ; then - tail -c +$((${tailskip}+1)) ${src} 2>/dev/null \ - | head -c $((${metaskip}-${tailskip})) \ - | tar --no-same-owner -xf - - else - tail -c +$((${tailskip}+1)) ${src} 2>/dev/null \ - | head -c $((${metaskip}-${tailskip})) \ - > ${datafile} - fi - fi - true - #[ -s "${datafile}" ] || die "failure unpacking pdv ('${metaskip}' '${tailskip}' '${datafile}')" - #assert "failure unpacking pdv ('${metaskip}' '${tailskip}' '${datafile}')" -} - -# @FUNCTION: unpack_makeself -# @USAGE: [file to unpack] [offset] [tail|dd] -# @DESCRIPTION: -# Unpack those pesky makeself generated files ... -# They're shell scripts with the binary package tagged onto -# the end of the archive. Loki utilized the format as does -# many other game companies. -# -# If the file is not specified, then ${A} is used. If the -# offset is not specified then we will attempt to extract -# the proper offset from the script itself. -unpack_makeself() { - local src_input=${1:-${A}} - local src=$(find_unpackable_file "${src_input}") - local skip=$2 - local exe=$3 - - [[ -z ${src} ]] && die "Could not locate source for '${src_input}'" - - local shrtsrc=$(basename "${src}") - echo ">>> Unpacking ${shrtsrc} to ${PWD}" - if [[ -z ${skip} ]] ; then - local ver=$(grep -m1 -a '#.*Makeself' "${src}" | awk '{print $NF}') - local skip=0 - exe=tail - case ${ver} in - 1.5.*|1.6.0-nv) # tested 1.5.{3,4,5} ... guessing 1.5.x series is same - skip=$(grep -a ^skip= "${src}" | cut -d= -f2) - ;; - 2.0|2.0.1) - skip=$(grep -a ^$'\t'tail "${src}" | awk '{print $2}' | cut -b2-) - ;; - 2.1.1) - skip=$(grep -a ^offset= "${src}" | awk '{print $2}' | cut -b2-) - (( skip++ )) - ;; - 2.1.2) - skip=$(grep -a ^offset= "${src}" | awk '{print $3}' | head -n 1) - (( skip++ )) - ;; - 2.1.3) - skip=`grep -a ^offset= "${src}" | awk '{print $3}'` - (( skip++ )) - ;; - 2.1.4|2.1.5) - skip=$(grep -a offset=.*head.*wc "${src}" | awk '{print $3}' | head -n 1) - skip=$(head -n ${skip} "${src}" | wc -c) - exe="dd" - ;; - *) - eerror "I'm sorry, but I was unable to support the Makeself file." - eerror "The version I detected was '${ver}'." - eerror "Please file a bug about the file ${shrtsrc} at" - eerror "http://bugs.gentoo.org/ so that support can be added." - die "makeself version '${ver}' not supported" - ;; - esac - debug-print "Detected Makeself version ${ver} ... using ${skip} as offset" - fi - case ${exe} in - tail) exe="tail -n +${skip} '${src}'";; - dd) exe="dd ibs=${skip} skip=1 if='${src}'";; - *) die "makeself cant handle exe '${exe}'" - esac - - # lets grab the first few bytes of the file to figure out what kind of archive it is - local filetype tmpfile=$(emktemp) - eval ${exe} 2>/dev/null | head -c 512 > "${tmpfile}" - filetype=$(file -b "${tmpfile}") || die - case ${filetype} in - *tar\ archive*) - eval ${exe} | tar --no-same-owner -xf - - ;; - bzip2*) - eval ${exe} | bzip2 -dc | tar --no-same-owner -xf - - ;; - gzip*) - eval ${exe} | tar --no-same-owner -xzf - - ;; - compress*) - eval ${exe} | gunzip | tar --no-same-owner -xf - - ;; - *) - eerror "Unknown filetype \"${filetype}\" ?" - false - ;; - esac - assert "failure unpacking (${filetype}) makeself ${shrtsrc} ('${ver}' +${skip})" -} - # @FUNCTION: cdrom_get_cds # @USAGE: <file on cd1> [file on cd2] [file on cd3] [...] # @DESCRIPTION: |