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/mozextension.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/mozextension.eclass')
-rw-r--r-- | eclass/mozextension.eclass | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/eclass/mozextension.eclass b/eclass/mozextension.eclass new file mode 100644 index 000000000000..40a8ac00c588 --- /dev/null +++ b/eclass/mozextension.eclass @@ -0,0 +1,88 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ +# +# @ECLASS: mozextension.eclass +# @MAINTAINER: +# Mozilla team <mozilla@gentoo.org> +# @BLURB: Install extensions for use in mozilla products. +# +if [[ ! ${_MOZEXTENSION} ]]; then + +# @ECLASS-VARIABLE: MOZEXTENSION_TARGET +# @DESCRIPTION: +# This variable allows the installation path for xpi_install +# to be overridden from the default app-global extensions path. +# Default is empty, which installs to predetermined hard-coded +# paths specified in the eclass. +: ${MOZEXTENSION_TARGET:=""} + +inherit eutils + +DEPEND="app-arch/unzip" + +mozversion_extension_location() { + case ${PN} in + firefox|firefox-bin) + if [[ $(get_version_component_range 1) -ge 21 ]] ; then + return 0 + fi + ;; + esac + + return 1 +} + +xpi_unpack() { + local xpi xpiname srcdir + + # Not gonna use ${A} as we are looking for a specific option being passed to function + # You must specify which xpi to use + [[ -z "$*" ]] && die "Nothing passed to the $FUNCNAME command. please pass which xpi to unpack" + + for xpi in "$@"; do + einfo "Unpacking ${xpi} to ${PWD}" + xpiname=$(basename ${xpi%.*}) + + if [[ "${xpi:0:2}" != "./" ]] && [[ "${xpi:0:1}" != "/" ]] ; then + srcdir="${DISTDIR}/" + fi + + [[ -s "${srcdir}${xpi}" ]] || die "${xpi} does not exist" + + case "${xpi##*.}" in + ZIP|zip|jar|xpi) + mkdir "${WORKDIR}/${xpiname}" && \ + unzip -qo "${srcdir}${xpi}" -d "${WORKDIR}/${xpiname}" || die "failed to unpack ${xpi}" + ;; + *) + einfo "unpack ${xpi}: file format not recognized. Ignoring." + ;; + esac + done +} + + +xpi_install() { + local emid + + # You must tell xpi_install which xpi to use + [[ ${#} -ne 1 ]] && die "$FUNCNAME takes exactly one argument, please specify an xpi to unpack" + + x="${1}" + cd ${x} + # determine id for extension + emid="$(sed -n -e '/install-manifest/,$ { /em:id/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' "${x}"/install.rdf)" \ + || die "failed to determine extension id" + if [[ -n ${MOZEXTENSION_TARGET} ]]; then + insinto "${MOZILLA_FIVE_HOME}"/${MOZEXTENSION_TARGET%/}/${emid} + elif $(mozversion_extension_location) ; then + insinto "${MOZILLA_FIVE_HOME}"/browser/extensions/${emid} + else + insinto "${MOZILLA_FIVE_HOME}"/extensions/${emid} + fi + doins -r "${x}"/* || die "failed to copy extension" +} + +_MOZEXTENSION=1 +fi |