diff options
author | 2006-05-03 07:49:27 +0000 | |
---|---|---|
committer | 2006-05-03 07:49:27 +0000 | |
commit | 006ddcb8d861002c0268af14b9eea2313a803bd0 (patch) | |
tree | ff836ddc40309fd120aeac904f8f18a3735eb1d3 /eclass/debian.eclass | |
parent | sort KEYWORDS (diff) | |
download | gentoo-2-006ddcb8d861002c0268af14b9eea2313a803bd0.tar.gz gentoo-2-006ddcb8d861002c0268af14b9eea2313a803bd0.tar.bz2 gentoo-2-006ddcb8d861002c0268af14b9eea2313a803bd0.zip |
Added eclass for unpacking debian packages
Diffstat (limited to 'eclass/debian.eclass')
-rw-r--r-- | eclass/debian.eclass | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/eclass/debian.eclass b/eclass/debian.eclass new file mode 100644 index 000000000000..197c7e85699f --- /dev/null +++ b/eclass/debian.eclass @@ -0,0 +1,81 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/debian.eclass,v 1.1 2006/05/03 07:49:27 stuart Exp $ + +# Author : Jonathan Scruggs <j.scruggs@gmail.com> (09 April 2006) +# Based on rpm.eclass by : Alastair Tse <liquidx@gentoo.org> (21 Jun 2003) +# +# Convienence class for extracting DEBs +# +# Basically, deb_src_unpack does: +# +# 1. uses debian_unpack to unpack a deb file using ar from binutils. +# 2. deletes all the unpacked tarballs and zip files from ${WORKDIR} +# NOTE: deb2targz requiers perl, and that is not a package installed +# by default. ar comes with binutils, so everyone should have +# this already, and no need for a dependency of a really large +# package like perl. Some users may never need perl. +# +# This ebuild now re-defines a utility function called deb_unpack which +# basically extracts the files out of the deb. It does not gzip the +# output tar again but directly extracts to ${WORKDIR} +# +# I don't know if this will handle RPMs in the list, but it will with +# other regular files that the unpack command can handle. :) + + +# extracts the contents of the DEP in ${WORKDIR} +debian_unpack() { + local debfile targzfile return_value + debfile=$1 + + if [ -z "${debfile}" ]; then + return_value=1 + else + ar x ${debfile} + # remove unneeded files. + rm -f control.tar.gz debian-binary + + # Make this multi-file friendly. + # Rename this for nice output during emerge, so + # Users know what file is being extracted, rahter + # than seeing data.tar.gz all the time. + targzfile=${debfile##*\/} + targzfile=${targzfile//.deb/.tar.gz} + mv data.tar.gz ${targzfile} + + return_value=0 + fi + + return ${return_value} +} + +debian_src_unpack() { + local x targzfile ext myfail OLD_DISTDIR + + for x in ${A}; do + myfail="failure unpacking ${x}" + ext=${x##*.} + case "$ext" in + deb) + echo ">>> Unpacking ${x}" + cd ${WORKDIR} + debian_unpack ${DISTDIR}/${x} || die "${myfail}" + + # Needed to unpack data.tar.gz + OLD_DISTDIR=${DISTDIR} + DISTDIR=${WORKDIR} + targzfile=${x##*\/} + targzfile=${targzfile//.deb/.tar.gz} + unpack ${targzfile} + rm -f ${targzfile} + DISTDIR=${OLD_DISTDIR} + ;; + *) + unpack ${x} + ;; + esac + done +} + +EXPORT_FUNCTIONS src_unpack |