public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in eclass: unpacker.eclass
@ 2012-02-05  4:48 Mike Frysinger (vapier)
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger (vapier) @ 2012-02-05  4:48 UTC (permalink / raw
  To: gentoo-commits

vapier      12/02/05 04:48:42

  Added:                unpacker.eclass
  Log:
  initial unpacker eclass

Revision  Changes    Path
1.1                  eclass/unpacker.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.1&content-type=text/plain

Index: unpacker.eclass
===================================================================
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.1 2012/02/05 04:48:42 vapier Exp $

# @ECLASS: unpacker.eclass
# @MAINTAINER:
# base-system@gentoo.org
# @BLURB: helpers for extraneous file formats and consistent behavior across EAPIs
# @DESCRIPTION:
# Some extraneous file formats are not part of PMS, or are only in certain
# EAPIs.  Rather than worrying about that, support the crazy cruft here
# and for all EAPI versions.

# Possible todos:
#  - merge rpm unpacking
#  - support partial unpacks?

if [[ ${___ECLASS_ONCE_UNPACKER} != "recur -_+^+_- spank" ]] ; then
___ECLASS_ONCE_UNPACKER="recur -_+^+_- spank"

# @ECLASS-VARIABLE: UNPACKER_BZ2
# @DEFAULT_UNSET
# @DESCRIPTION:
# Utility to use to decompress bzip2 files.  Will dynamically pick between
# `pbzip2` and `bzip2`.  Make sure your choice accepts the "-c" option.
# Note: this is meant for users to set, not ebuilds.

# for internal use only (unpack_pdv and unpack_makeself)
find_unpackable_file() {
	local src=$1
	if [[ -z ${src} ]] ; then
		src=${DISTDIR}/${A}
	else
		if [[ ${src} == ./* ]] ; then
			: # already what we want
		elif [[ -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}"
}

unpack_banner() {
	echo ">>> Unpacking ${1##*/} to ${PWD}"
}

# @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 :("

	unpack_banner "${src}"

	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}'"

	unpack_banner "${src}"

	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 ${src##*/} 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 ${src##*/} ('${ver}' +${skip})"
}

# @FUNCTION: unpack_deb
# @USAGE: <one deb to unpack>
# @DESCRIPTION:
# Unpack a Debian .deb archive in style.
unpack_deb() {
	[[ $# -eq 1 ]] || die "Usage: ${FUNCNAME} <file>"

	local deb=$(find_unpackable_file "$1")

	unpack_banner "${deb}"

	ar x "${deb}"
	unpack ./data.tar*
}

# @FUNCTION: _unpacker
# @USAGE: <one archive to unpack>
# @INTERNAL
# @DESCRIPTION:
# Unpack the specified archive.  We only operate on one archive here
# to keep down on the looping logic (that is handled by `unpacker`).
_unpacker() {
	[[ $# -eq 1 ]] || die "Usage: ${FUNCNAME} <file>"

	local a=$1
	local m=$(echo "${a}" | tr '[:upper:]' '[:lower:]')
	a=$(find_unpackable_file "${a}")

	# first figure out the decompression method
	case ${m} in
	*.bz2|*.tbz|*.tbz2)
		local bzcmd=${PORTAGE_BZIP2_COMMAND:-$(type -P pbzip2 || bzip2)}
		local bzuncmd=${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}
		: ${UNPACKER_BZ2:=${bzuncmd}}
		comp="${UNPACKER_BZ2} -c"
		;;
	*.z|*.gz|*.tgz)
		comp="gzip -dc" ;;
	*.lzma|*.xz|*.txz)
		comp="xz -dc" ;;
	*)	comp="" ;;
	esac

	# then figure out if there are any archiving aspects
	case ${m} in
	*.tgz|*.tbz|*.tbz2|*.txz|*.tar.*|*.tar)
		arch="tar --no-same-owner -xof" ;;
	*.deb)
		arch="unpack_deb" ;;
	*.run)
		arch="unpack_makeself" ;;
	*) arch="" ;;
	esac

	# finally do the unpack
	if [[ -z ${arch}${comp} ]] ; then
		unpack "${a}"
		return $?
	fi

	[[ ${arch} != unpack_* ]] && unpack_banner "${a}"

	if [[ -z ${arch} ]] ; then
		${comp} "${a}" > "${a%.*}"
	elif [[ -z ${comp} ]] ; then
		${arch} "${a}"
	else
		${comp} "${a}" | ${arch} -
	fi

	assert "unpacking ${a} failed (comp=${comp} arch=${arch})"
}

# @FUNCTION: unpacker
# @USAGE: [archives to unpack]
# @DESCRIPTION:
# This works in the same way that `unpack` does.  If you don't specify
# any files, it will default to ${A}.
unpacker() {
	local a
	[[ $# -eq 0 ]] && set -- ${A}
	for a ; do _unpacker "${a}" ; done
}

# @FUNCTION: unpacker_src_unpack
# @DESCRIPTION:
# Run `unpacker` to unpack all our stuff.
unpacker_src_unpack() {
	unpacker
}

# @FUNCTION: unpacker_src_uri_depends
# @USAGE: [archives that we will unpack]
# @RETURN: Dependencies needed to unpack all the archives
# @DESCRIPTION:
# Walk all the specified files (defaults to $SRC_URI) and figure out the
# dependencies that are needed to unpack things.
#
# Note: USE flags are not yet handled.
unpacker_src_uri_depends() {
	local uri deps d

	[[ $# -eq 0 ]] && set -- ${SRC_URI}

	for uri in "$@" ; do
		case ${uri} in
		*.rar|*.RAR)
			d="app-arch/unrar" ;;
		*.7z)
			d="app-arch/p7zip" ;;
		*.xz)
			d="app-arch/xz-utils" ;;
		esac
		deps+=" ${d}"
	done

	echo "${deps}"
}

EXPORT_FUNCTIONS src_unpack

fi






^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: unpacker.eclass
@ 2012-02-05  5:48 Mike Frysinger (vapier)
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger (vapier) @ 2012-02-05  5:48 UTC (permalink / raw
  To: gentoo-commits

vapier      12/02/05 05:48:00

  Modified:             unpacker.eclass
  Log:
  avoid emktemp since that needs eutils.eclass, and add quoting to all src/tmpfile usage

Revision  Changes    Path
1.2                  eclass/unpacker.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.2&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.2&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?r1=1.1&r2=1.2

Index: unpacker.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- unpacker.eclass	5 Feb 2012 04:48:42 -0000	1.1
+++ unpacker.eclass	5 Feb 2012 05:48:00 -0000	1.2
@@ -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/unpacker.eclass,v 1.1 2012/02/05 04:48:42 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.2 2012/02/05 05:48:00 vapier Exp $
 
 # @ECLASS: unpacker.eclass
 # @MAINTAINER:
@@ -94,7 +94,7 @@
 	local tailskip=$(tail -c $((${sizeoff_t}*2)) "${src}" | head -c ${sizeoff_t} | hexdump -e \"%i\")
 
 	# grab metadata for debug reasons
-	local metafile=$(emktemp)
+	local metafile="${T}/${FUNCNAME}.meta"
 	tail -c +$((${metaskip}+1)) "${src}" > "${metafile}"
 
 	# rip out the final file name from the metadata
@@ -102,14 +102,14 @@
 	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 tmpfile="${T}/${FUNCNAME}"
+	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}
+		mv "${tmpfile}"{,.Z}
+		gunzip "${tmpfile}"
 	else
 		iscompressed=0
 	fi
@@ -127,22 +127,22 @@
 	#	> ${datafile}
 	if [ ${iscompressed} -eq 1 ] ; then
 		if [ ${istar} -eq 1 ] ; then
-			tail -c +$((${tailskip}+1)) ${src} 2>/dev/null \
+			tail -c +$((${tailskip}+1)) "${src}" 2>/dev/null \
 				| head -c $((${metaskip}-${tailskip})) \
 				| tar -xzf -
 		else
-			tail -c +$((${tailskip}+1)) ${src} 2>/dev/null \
+			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 \
+			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 \
+			tail -c +$((${tailskip}+1)) "${src}" 2>/dev/null \
 				| head -c $((${metaskip}-${tailskip})) \
 				> ${datafile}
 		fi
@@ -218,7 +218,7 @@
 	esac
 
 	# lets grab the first few bytes of the file to figure out what kind of archive it is
-	local filetype tmpfile=$(emktemp)
+	local filetype tmpfile="${T}/${FUNCNAME}"
 	eval ${exe} 2>/dev/null | head -c 512 > "${tmpfile}"
 	filetype=$(file -b "${tmpfile}") || die
 	case ${filetype} in






^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: unpacker.eclass
@ 2012-02-05  5:57 Mike Frysinger (vapier)
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger (vapier) @ 2012-02-05  5:57 UTC (permalink / raw
  To: gentoo-commits

vapier      12/02/05 05:57:19

  Modified:             unpacker.eclass
  Log:
  pass original argument to portage `unpack` since our local $a is the full path (including DISTDIR) which portage does not want

Revision  Changes    Path
1.3                  eclass/unpacker.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.3&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.3&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?r1=1.2&r2=1.3

Index: unpacker.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- unpacker.eclass	5 Feb 2012 05:48:00 -0000	1.2
+++ unpacker.eclass	5 Feb 2012 05:57:19 -0000	1.3
@@ -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/unpacker.eclass,v 1.2 2012/02/05 05:48:00 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.3 2012/02/05 05:57:19 vapier Exp $
 
 # @ECLASS: unpacker.eclass
 # @MAINTAINER:
@@ -298,7 +298,7 @@
 
 	# finally do the unpack
 	if [[ -z ${arch}${comp} ]] ; then
-		unpack "${a}"
+		unpack "$1"
 		return $?
 	fi
 






^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: unpacker.eclass
@ 2012-02-05  6:30 Mike Frysinger (vapier)
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger (vapier) @ 2012-02-05  6:30 UTC (permalink / raw
  To: gentoo-commits

vapier      12/02/05 06:30:10

  Modified:             unpacker.eclass
  Log:
  add support for makeself 2.1.6

Revision  Changes    Path
1.4                  eclass/unpacker.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.4&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.4&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?r1=1.3&r2=1.4

Index: unpacker.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- unpacker.eclass	5 Feb 2012 05:57:19 -0000	1.3
+++ unpacker.eclass	5 Feb 2012 06:30:10 -0000	1.4
@@ -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/unpacker.eclass,v 1.3 2012/02/05 05:57:19 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.4 2012/02/05 06:30:10 vapier Exp $
 
 # @ECLASS: unpacker.eclass
 # @MAINTAINER:
@@ -196,7 +196,7 @@
 				skip=`grep -a ^offset= "${src}" | awk '{print $3}'`
 				(( skip++ ))
 				;;
-			2.1.4|2.1.5)
+			2.1.4|2.1.5|2.1.6)
 				skip=$(grep -a offset=.*head.*wc "${src}" | awk '{print $3}' | head -n 1)
 				skip=$(head -n ${skip} "${src}" | wc -c)
 				exe="dd"






^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: unpacker.eclass
@ 2012-02-13 20:53 Mike Frysinger (vapier)
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger (vapier) @ 2012-02-13 20:53 UTC (permalink / raw
  To: gentoo-commits

vapier      12/02/13 20:53:35

  Modified:             unpacker.eclass
  Log:
  add auto-detection of makeself files with *.bin files #403451

Revision  Changes    Path
1.5                  eclass/unpacker.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.5&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.5&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?r1=1.4&r2=1.5

Index: unpacker.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- unpacker.eclass	5 Feb 2012 06:30:10 -0000	1.4
+++ unpacker.eclass	13 Feb 2012 20:53:34 -0000	1.5
@@ -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/unpacker.eclass,v 1.4 2012/02/05 06:30:10 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.5 2012/02/13 20:53:34 vapier Exp $
 
 # @ECLASS: unpacker.eclass
 # @MAINTAINER:
@@ -286,6 +286,7 @@
 	esac
 
 	# then figure out if there are any archiving aspects
+	arch=""
 	case ${m} in
 	*.tgz|*.tbz|*.tbz2|*.txz|*.tar.*|*.tar)
 		arch="tar --no-same-owner -xof" ;;
@@ -293,7 +294,12 @@
 		arch="unpack_deb" ;;
 	*.run)
 		arch="unpack_makeself" ;;
-	*) arch="" ;;
+	*.bin)
+		# Makeself archives can be annoyingly named
+		if head -c 100 "${a}" | grep -qs '#.*Makeself' ; then
+			arch="unpack_makeself"
+		fi
+		;;
 	esac
 
 	# finally do the unpack






^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: unpacker.eclass
@ 2012-04-05  3:20 Mike Frysinger (vapier)
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger (vapier) @ 2012-04-05  3:20 UTC (permalink / raw
  To: gentoo-commits

vapier      12/04/05 03:20:42

  Modified:             unpacker.eclass
  Log:
  fix by Christoph Junghans to decompress files into $PWD #408801

Revision  Changes    Path
1.6                  eclass/unpacker.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.6&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.6&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?r1=1.5&r2=1.6

Index: unpacker.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- unpacker.eclass	13 Feb 2012 20:53:34 -0000	1.5
+++ unpacker.eclass	5 Apr 2012 03:20:42 -0000	1.6
@@ -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/unpacker.eclass,v 1.5 2012/02/13 20:53:34 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.6 2012/04/05 03:20:42 vapier Exp $
 
 # @ECLASS: unpacker.eclass
 # @MAINTAINER:
@@ -311,7 +311,9 @@
 	[[ ${arch} != unpack_* ]] && unpack_banner "${a}"
 
 	if [[ -z ${arch} ]] ; then
-		${comp} "${a}" > "${a%.*}"
+		# Need to decompress the file into $PWD #408801
+		local _a=${a%.*}
+		${comp} "${a}" > "${_a##*/}"
 	elif [[ -z ${comp} ]] ; then
 		${arch} "${a}"
 	else






^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: unpacker.eclass
@ 2012-04-21  5:45 Mike Frysinger (vapier)
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger (vapier) @ 2012-04-21  5:45 UTC (permalink / raw
  To: gentoo-commits

vapier      12/04/21 05:45:29

  Modified:             unpacker.eclass
  Log:
  fix by Christoph Junghans to make unpack_deb work on AIX (prefix) systems #408801

Revision  Changes    Path
1.7                  eclass/unpacker.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.7&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.7&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?r1=1.6&r2=1.7

Index: unpacker.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- unpacker.eclass	5 Apr 2012 03:20:42 -0000	1.6
+++ unpacker.eclass	21 Apr 2012 05:45:29 -0000	1.7
@@ -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/unpacker.eclass,v 1.6 2012/04/05 03:20:42 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.7 2012/04/21 05:45:29 vapier Exp $
 
 # @ECLASS: unpacker.eclass
 # @MAINTAINER:
@@ -253,8 +253,27 @@
 
 	unpack_banner "${deb}"
 
-	ar x "${deb}"
-	unpack ./data.tar*
+	# on AIX ar doesn't work out as their ar used a different format
+	# from what GNU ar (and thus what .deb files) produce
+	if [[ -n ${EPREFIX} ]] ; then
+		{
+			read # global header
+			[[ ${REPLY} = "!<arch>" ]] || die "${deb} does not seem to be a deb archive"
+			local f timestamp uid gid mode size magic
+			while read f timestamp uid gid mode size magic ; do
+				[[ -n ${f} && -n ${size} ]] || continue # ignore empty lines
+				if [[ ${f} = "data.tar"* ]] ; then
+					head -c "${size}" > "${f}"
+				else
+					head -c "${size}" > /dev/null # trash it
+				fi
+			done
+		} < "${deb}"
+	else
+		ar x "${deb}"
+	fi
+
+	unpacker ./data.tar*
 }
 
 # @FUNCTION: _unpacker






^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: unpacker.eclass
@ 2012-04-29  0:15 Mike Frysinger (vapier)
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger (vapier) @ 2012-04-29  0:15 UTC (permalink / raw
  To: gentoo-commits

vapier      12/04/29 00:15:10

  Modified:             unpacker.eclass
  Log:
  fix by David Leverton for PORTAGE_BZIP2_COMMAND/PORTAGE_BUNZIP2_COMMAND fallbacks #413847

Revision  Changes    Path
1.8                  eclass/unpacker.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.8&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.8&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?r1=1.7&r2=1.8

Index: unpacker.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- unpacker.eclass	21 Apr 2012 05:45:29 -0000	1.7
+++ unpacker.eclass	29 Apr 2012 00:15:10 -0000	1.8
@@ -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/unpacker.eclass,v 1.7 2012/04/21 05:45:29 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.8 2012/04/29 00:15:10 vapier Exp $
 
 # @ECLASS: unpacker.eclass
 # @MAINTAINER:
@@ -292,8 +292,8 @@
 	# first figure out the decompression method
 	case ${m} in
 	*.bz2|*.tbz|*.tbz2)
-		local bzcmd=${PORTAGE_BZIP2_COMMAND:-$(type -P pbzip2 || bzip2)}
-		local bzuncmd=${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}
+		local bzcmd=${PORTAGE_BZIP2_COMMAND:-$(type -P pbzip2 || type -P bzip2)}
+		local bzuncmd=${PORTAGE_BUNZIP2_COMMAND:-${bzcmd} -d}
 		: ${UNPACKER_BZ2:=${bzuncmd}}
 		comp="${UNPACKER_BZ2} -c"
 		;;






^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: unpacker.eclass
@ 2012-05-11  7:46 Mike Frysinger (vapier)
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger (vapier) @ 2012-05-11  7:46 UTC (permalink / raw
  To: gentoo-commits

vapier      12/05/11 07:46:44

  Modified:             unpacker.eclass
  Log:
  probe .sh files to see if they are makeself archives #415013 by Alan Smithee

Revision  Changes    Path
1.9                  eclass/unpacker.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.9&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.9&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?r1=1.8&r2=1.9

Index: unpacker.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- unpacker.eclass	29 Apr 2012 00:15:10 -0000	1.8
+++ unpacker.eclass	11 May 2012 07:46:44 -0000	1.9
@@ -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/unpacker.eclass,v 1.8 2012/04/29 00:15:10 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.9 2012/05/11 07:46:44 vapier Exp $
 
 # @ECLASS: unpacker.eclass
 # @MAINTAINER:
@@ -313,6 +313,12 @@
 		arch="unpack_deb" ;;
 	*.run)
 		arch="unpack_makeself" ;;
+	*.sh)
+		# Not all shell scripts are makeself
+		if head -n 30 "${a}" | grep -qs '#.*Makeself' ; then
+			arch="unpack_makeself"
+		fi
+		;;
 	*.bin)
 		# Makeself archives can be annoyingly named
 		if head -c 100 "${a}" | grep -qs '#.*Makeself' ; then






^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: unpacker.eclass
@ 2013-03-23 19:35 Mike Frysinger (vapier)
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger (vapier) @ 2013-03-23 19:35 UTC (permalink / raw
  To: gentoo-commits

vapier      13/03/23 19:35:59

  Modified:             unpacker.eclass
  Log:
  unpack_deb: auto rm the unpacked debian internal archives #458658

Revision  Changes    Path
1.11                 eclass/unpacker.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.11&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.11&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?r1=1.10&r2=1.11

Index: unpacker.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- unpacker.eclass	22 Aug 2012 01:41:12 -0000	1.10
+++ unpacker.eclass	23 Mar 2013 19:35:59 -0000	1.11
@@ -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/unpacker.eclass,v 1.10 2012/08/22 01:41:12 ottxor Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.11 2013/03/23 19:35:59 vapier Exp $
 
 # @ECLASS: unpacker.eclass
 # @MAINTAINER:
@@ -274,6 +274,10 @@
 	fi
 
 	unpacker ./data.tar*
+
+	# Clean things up #458658.  No one seems to actually care about
+	# these, so wait until someone requests to do something else ...
+	rm -f debian-binary {control,data}.tar*
 }
 
 # @FUNCTION: unpack_cpio





^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: unpacker.eclass
@ 2014-02-18  6:13 Mike Frysinger (vapier)
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger (vapier) @ 2014-02-18  6:13 UTC (permalink / raw
  To: gentoo-commits

vapier      14/02/18 06:13:50

  Modified:             unpacker.eclass
  Log:
  add makeself 2.2.0 version

Revision  Changes    Path
1.15                 eclass/unpacker.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.15&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?rev=1.15&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/unpacker.eclass?r1=1.14&r2=1.15

Index: unpacker.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- unpacker.eclass	22 Dec 2013 14:44:07 -0000	1.14
+++ unpacker.eclass	18 Feb 2014 06:13:50 -0000	1.15
@@ -1,6 +1,6 @@
 # Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.14 2013/12/22 14:44:07 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.15 2014/02/18 06:13:50 vapier Exp $
 
 # @ECLASS: unpacker.eclass
 # @MAINTAINER:
@@ -196,7 +196,7 @@
 				skip=`grep -a ^offset= "${src}" | awk '{print $3}'`
 				(( skip++ ))
 				;;
-			2.1.4|2.1.5|2.1.6)
+			2.1.4|2.1.5|2.1.6|2.2.0)
 				skip=$(grep -a offset=.*head.*wc "${src}" | awk '{print $3}' | head -n 1)
 				skip=$(head -n ${skip} "${src}" | wc -c)
 				exe="dd"





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-02-18  6:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-11  7:46 [gentoo-commits] gentoo-x86 commit in eclass: unpacker.eclass Mike Frysinger (vapier)
  -- strict thread matches above, loose matches on Subject: below --
2014-02-18  6:13 Mike Frysinger (vapier)
2013-03-23 19:35 Mike Frysinger (vapier)
2012-04-29  0:15 Mike Frysinger (vapier)
2012-04-21  5:45 Mike Frysinger (vapier)
2012-04-05  3:20 Mike Frysinger (vapier)
2012-02-13 20:53 Mike Frysinger (vapier)
2012-02-05  6:30 Mike Frysinger (vapier)
2012-02-05  5:57 Mike Frysinger (vapier)
2012-02-05  5:48 Mike Frysinger (vapier)
2012-02-05  4:48 Mike Frysinger (vapier)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox