diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /eclass/vmware-bundle.eclass | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'eclass/vmware-bundle.eclass')
-rw-r--r-- | eclass/vmware-bundle.eclass | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/eclass/vmware-bundle.eclass b/eclass/vmware-bundle.eclass new file mode 100644 index 000000000000..6a897bb267ca --- /dev/null +++ b/eclass/vmware-bundle.eclass @@ -0,0 +1,83 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# @ECLASS: vmware-bundle.eclass +# @MAINTAINER: +# vmware@gentoo.org +# @AUTHOR: +# Matt Whitlock <matt@whitlock.name> +# @BLURB: Provides extract functionality for vmware products bundles + +DEPEND="dev-libs/libxslt" + +vmware-bundle_extract-bundle-component() { + local bundle=${1:?} component=${2:?} dest=${3:-${2}} + cat > "${T}"/list-bundle-components.xsl <<-EOF + <?xml version="1.0" encoding="ISO-8859-1"?> + <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output omit-xml-declaration="yes"/> + <xsl:template match="text()"/> + <xsl:template match="/bundle/components/component"> + <xsl:value-of select="@offset"/> + <xsl:text> </xsl:text> + <xsl:value-of select="@size"/> + <xsl:text> </xsl:text> + <xsl:value-of select="@name"/> + <xsl:text> </xsl:text> + </xsl:template> + </xsl:stylesheet> + EOF + local -i bundle_size=$(stat -L -c'%s' "${bundle}") + local -i bundle_manifestOffset=$(od -An -j$((bundle_size-36)) -N4 -tu4 "${bundle}") + local -i bundle_manifestSize=$(od -An -j$((bundle_size-40)) -N4 -tu4 "${bundle}") + local -i bundle_dataOffset=$(od -An -j$((bundle_size-44)) -N4 -tu4 "${bundle}") + local -i bundle_dataSize=$(od -An -j$((bundle_size-52)) -N8 -tu8 "${bundle}") + tail -c+$((bundle_manifestOffset+1)) "${bundle}" 2> /dev/null | head -c$((bundle_manifestSize)) | + xsltproc "${T}"/list-bundle-components.xsl - | + while read -r component_offset component_size component_name ; do + if [[ ${component_name} == ${component} ]] ; then + ebegin "Extracting '${component_name}' component from '$(basename "${bundle}")'" + vmware-bundle_extract-component "${bundle}" "${dest}" $((bundle_dataOffset+component_offset)) + eend + fi + done +} + +vmware-bundle_extract-component() { + local component=${1:?} dest=${2:-.} + local -i offset=${3} + cat > "${T}"/list-component-files.xsl <<-EOF + <?xml version="1.0" encoding="ISO-8859-1"?> + <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output omit-xml-declaration="yes"/> + <xsl:template match="text()"/> + <xsl:template match="/component/fileset/file"> + <xsl:value-of select="@offset"/> + <xsl:text> </xsl:text> + <xsl:value-of select="@compressedSize"/> + <xsl:text> </xsl:text> + <xsl:value-of select="@uncompressedSize"/> + <xsl:text> </xsl:text> + <xsl:value-of select="@path"/> + <xsl:text> </xsl:text> + </xsl:template> + </xsl:stylesheet> + EOF + local -i component_manifestOffset=$(od -An -j$((offset+9)) -N4 -tu4 "${component}") + local -i component_manifestSize=$(od -An -j$((offset+13)) -N4 -tu4 "${component}") + local -i component_dataOffset=$(od -An -j$((offset+17)) -N4 -tu4 "${component}") + local -i component_dataSize=$(od -An -j$((offset+21)) -N8 -tu8 "${component}") + tail -c+$((offset+component_manifestOffset+1)) "${component}" 2> /dev/null | + head -c$((component_manifestSize)) | xsltproc "${T}"/list-component-files.xsl - | + while read -r file_offset file_compressedSize file_uncompressedSize file_path ; do + if [[ ${file_path} ]] ; then + echo -n '.' + file_path="${dest}/${file_path}" + mkdir -p "$(dirname "${file_path}")" || die + tail -c+$((offset+component_dataOffset+file_offset+1)) "${component}" 2> /dev/null | + head -c$((file_compressedSize)) | gzip -cd > "${file_path}" || die + fi + done + echo +} |