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

Diff of /eclass/eutils.eclass

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

Revision 1.45 Revision 1.51
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.45 2003/07/18 20:43:00 wolf31o2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.51 2003/09/08 02:10:46 azarah 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.
10# NB: If you add anything, please comment it! 10# NB: If you add anything, please comment it!
11 11
12ECLASS=eutils 12ECLASS=eutils
13INHERITED="$INHERITED $ECLASS" 13INHERITED="$INHERITED $ECLASS"
14 14
15DEPEND="$DEPEND !bootstrap? ( sys-devel/patch )" 15newdepend "!bootstrap? ( sys-devel/patch )"
16 16
17DESCRIPTION="Based on the ${ECLASS} eclass" 17DESCRIPTION="Based on the ${ECLASS} eclass"
18 18
19# This function generate linker scripts in /usr/lib for dynamic 19# This function generate linker scripts in /usr/lib for dynamic
20# libs in /lib. This is to fix linking problems when you have 20# libs in /lib. This is to fix linking problems when you have
838# the proper offset from the script itself. 838# the proper offset from the script itself.
839unpack_makeself() { 839unpack_makeself() {
840 local src=$1 840 local src=$1
841 local skip=$2 841 local skip=$2
842 842
843 [ -z "${src}" ] && src=${A} 843 if [ -z "${src}" ] ; then
844 [ -e ./${src} ] \ 844 src="${DISTDIR}/${A}"
845 && src=${PWD}/${src} \ 845 else
846 if [ -e "${DISTDIR}/${src}" ] ; then
846 || src=${DISTDIR}/${src} 847 src="${DISTDIR}/${src}"
848 elif [ -e "${PWD}/${src}" ] ; then
849 src="${PWD}/${src}"
850 elif [ -e "${src}" ] ; then
851 src="${src}"
852 fi
853 fi
854 [ ! -e "${src}" ] && die "Could not find requested makeself archive ${src}"
855
847 local shrtsrc=`basename ${src}` 856 local shrtsrc=`basename ${src}`
848 echo ">>> Unpacking ${shrtsrc} to ${PWD}" 857 echo ">>> Unpacking ${shrtsrc} to ${PWD}"
849 if [ -z "${skip}" ] ; then 858 if [ -z "${skip}" ] ; then
850 local ver="`grep -a '#.*Makeself' ${src} | awk '{print $NF}'`" 859 local ver="`grep -a '#.*Makeself' ${src} | awk '{print $NF}'`"
851 local skip=0 860 local skip=0
858 ;; 867 ;;
859 2.1.1) 868 2.1.1)
860 skip=`grep -a ^offset= ${src} | awk '{print $2}' | cut -b2-` 869 skip=`grep -a ^offset= ${src} | awk '{print $2}' | cut -b2-`
861 let skip="skip + 1" 870 let skip="skip + 1"
862 ;; 871 ;;
872 2.1.2)
873 skip=`grep -a ^offset= ${src} | awk '{print $3}' | head -n 1`
874 let skip="skip + 1"
875 ;;
876 2.1.3)
877 skip=`grep -a ^offset= ${src} | awk '{print $3}'`
878 let skip="skip + 1"
879 ;;
863 *) 880 *)
864 eerror "I'm sorry, but I was unable to support the Makeself file." 881 eerror "I'm sorry, but I was unable to support the Makeself file."
865 eerror "The version I detected was '${ver}'." 882 eerror "The version I detected was '${ver}'."
866 eerror "Please file a bug about the file ${shrtsrc} at" 883 eerror "Please file a bug about the file ${shrtsrc} at"
867 eerror "http://bugs.gentoo.org/ so that support can be added." 884 eerror "http://bugs.gentoo.org/ so that support can be added."
871 debug-print "Detected Makeself version ${ver} ... using ${skip} as offset" 888 debug-print "Detected Makeself version ${ver} ... using ${skip} as offset"
872 fi 889 fi
873 890
874 # we do this because otherwise a failure in gzip will cause 0 bytes to be sent 891 # we do this because otherwise a failure in gzip will cause 0 bytes to be sent
875 # to tar which will make tar not extract anything and exit with 0 892 # to tar which will make tar not extract anything and exit with 0
876 local out="`tail +${skip} ${src} | gzip -cd | tar -x --no-same-owner -v -f -`" 893 tail -n +${skip} ${src} | gzip -cd | tar -x --no-same-owner -f - 2>/dev/null
894 local pipestatus="${PIPESTATUS[*]}"
895 pipestatus="${pipestatus// }"
896 if [ "${pipestatus//0}" != "" ] ; then
897 # maybe it isnt gzipped ... they usually are, but not always ...
898 tail -n +${skip} ${src} | tar -x --no-same-owner -f - \
877 [ -z "${out}" ] && die "failure unpacking makeself ${shrtsrc} ('${ver}' +${skip})" 899 || die "failure unpacking makeself ${shrtsrc} ('${ver}' +${skip})"
900 fi
878} 901}

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.51

  ViewVC Help
Powered by ViewVC 1.1.20