diff options
Diffstat (limited to 'eclass/0install.eclass')
-rw-r--r-- | eclass/0install.eclass | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/eclass/0install.eclass b/eclass/0install.eclass deleted file mode 100644 index e1bdd1f..0000000 --- a/eclass/0install.eclass +++ /dev/null @@ -1,136 +0,0 @@ -# Copyright 1999-2007 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ - -# -# Original Author: Jim Ramsay <lack@gentoo.org> -# Purpose: Utility functions for 0install compatibility -# - -# TODO: Install this all the time? -RDEPEND="rox-base/zeroinstall-injector" - -# Environment: -NATIVE_FEED_DIR="/usr/share/0install.net/native_feeds" -ZEROINSTALL_STRIP_REQUIRES="" - -# Escapes a http-style URI into a 0install-compatible filename -# -# 0install_escape_uri <uri> -# uri - The URI to escape -0install_escape_uri() { - local uri=${1} - uri=${uri//\//#} - echo $uri -} - -# Parses an implementation, returning the interface URI -# -# 0install_parse_uri <src> -# src - The XML document to parse -0install_parse_uri() { - local src="${1}" - - [ -f "${src}" ] || die "Source file not found" - local feed_for=$(grep '<feed-for.*interface=' "${src}") - [ -n "${feed_for}" ] || die "No 'feed-for' element" - feed_for=${feed_for##*interface=[\"\']} - feed_for=${feed_for%[\'\"]*>} - echo $feed_for -} - -# Edits a feed, replacing stability and id -# -# 0install_edit_feed <input> <stability> -# input - The file to edit -# output - The final install location (relative to ${D}) -0install_edit_feed() { - local input="${1}"; shift - local output="${1}"; shift - - [ -f "${input}" ] || die "No input file" - - # Basic editing: - # - Remove stability="*" - # - Remove uri="*" - # - Replace id="*" with id=".", add in stability="packaged" - # - Force main="AppRun" - sed -e 's/stability="[^"]*"//' \ - -e "s/stability='[^']*'//" \ - -e 's/uri="[^"]*"//' \ - -e "s/uri='[^']*'//" \ - -e 's/id="[^"]*"/id="." stability="packaged"/' \ - -e "s/id='[^']*'/id=\".\" stability=\"packaged\"/" \ - -e 's/main="[^"]*"/main="AppRun"/' \ - -e "s/main='[^']*'/main=\"AppRun\"/" \ - ${input} > tmp.native_feed - - if [[ -n "${ZEROINSTALL_STRIP_REQUIRES}" ]]; then - # Strip out all 'requires' sections - sed -i -e '/<requires.*\/>/d' \ - -e '/<requires.*\>/,/<\/requires>/d' tmp.native_feed - fi - - ( - insinto $(dirname ${output}) - newins tmp.native_feed $(basename ${output}) - ) -} - -# Installs an ebuild-provided feed -# -# 0install_install_feed <src> <destpath> -# src - The XML file we will install and point at -# path - The path where the implementation will be installed -# IE, the final xml will be at <path>/<basename of src> -0install_install_feed() { - local src="${1}"; shift - local path="${1}"; shift - local feedfile=$(basename "${src}") - local dest="${path}/$feedfile" - - # Step 1: Find the URI - local uri=$(0install_parse_uri "${src}") - - # Step 2: Install the feed in the proper location - ( - insinto $(dirname "${dest}") - newins "${src}" $(basename "${dest}") - ) - - # Step 3: Install the symlink so 0install can find it - local feedname=$(0install_escape_uri ${uri}) - dosym "${dest}" "${NATIVE_FEED_DIR}/${feedname}" -} - -# Does all the local feed magic you could want: -# - Parses the input file to get the interface URI -# - Edits the input file and installs it to the final location -# - Installs a local feed pointer -# -# Environment variables: -# ZEROINSTALL_STRIP_REQUIRES - If set, strips all 'requires' sections from the XML -# on editing. Default: Not set -# -# 0install_native_feed <src> <destpath> -# src - The XML file we will edit, install, and point at -# path - The path where the implementation will be installed -# IE, the final edited xml will be at <path>/<basename of src> -0install_native_feed() { - local src="${1}"; shift - local path="${1}"; shift - local feedfile=$(basename "${src}") - local dest="${path}/$feedfile" - - # Step 1: Find the URI - local uri=$(0install_parse_uri "${src}") - - # Step 2: Edit the input and install it in the proper location - 0install_edit_feed "${src}" "${dest}" - - # Step 3: Install the symlink so 0install can find it - local feedname=$(0install_escape_uri ${uri}) - dosym "${dest}" "${NATIVE_FEED_DIR}/${feedname}" -} - - |