diff options
author | Martin Väth <martin@mvath.de> | 2015-10-11 11:26:48 +0200 |
---|---|---|
committer | Martin Väth <martin@mvath.de> | 2015-10-11 11:32:18 +0200 |
commit | 109d6b4f673a249aea4deeb0cdb5b54a21592410 (patch) | |
tree | ec3589a50dac5be54ef6248d1e0ff3a9fd3b41b4 /eclass | |
download | mv-109d6b4f673a249aea4deeb0cdb5b54a21592410.tar.gz mv-109d6b4f673a249aea4deeb0cdb5b54a21592410.tar.bz2 mv-109d6b4f673a249aea4deeb0cdb5b54a21592410.zip |
Clear history for egencache --repo=mv --update-changelogs
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ChangeLog | 33 | ||||
-rw-r--r-- | eclass/monotone.eclass | 197 | ||||
-rw-r--r-- | eclass/mv_mozextension.eclass | 154 |
3 files changed, 384 insertions, 0 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog new file mode 100644 index 00000000..ba3d84b4 --- /dev/null +++ b/eclass/ChangeLog @@ -0,0 +1,33 @@ +# ChangeLog for eclass directory +# Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2 +# $Header: $ + + 25 Jan 2015; Martin Väth <martin@mvath.de>: + avoid use_if_iuse in mv_mozextenstion.eclass to be fully pms compatible + + 24 Jan 2015; Martin Väth <martin@mvath.de>: + Remove auteps from mv_mozextension.eclass + + 14 Aug 2013; Martin Väth <martin@mvath.de>: + Simplify EPREFIX + + 22 Sep 2012; Martin Väth <martin@mvath.de>: + Use AUTHOR tag. Use $ECLASS for message + + 21 Sep 2012; Martin Väth <martin@mvath.de>: + mv_mozextension: Use slot dependencies; requires at least EAPI=5 + monotone: Remove useless DESCRIPTION + + 26 Aug 2012; Martin Väth <martin@mvath.de>: + Rename IUSE={copy,symlink}_extensions to {copy,symlink}-extensions to avoid + possible collision with USE_EXPAND + + 10 Jun 2012; Martin Väth <martin@mvath.de>: + Remove support for icecat. Fix headers to make repoman happy. + + 12 May 2012; Martin Väth <martin@mvath.de>: + base->eutils + + 12 May 2012; Martin Väth <martin@mvath.de>: + Created ChangeLog + diff --git a/eclass/monotone.eclass b/eclass/monotone.eclass new file mode 100644 index 00000000..a8d6ec46 --- /dev/null +++ b/eclass/monotone.eclass @@ -0,0 +1,197 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# @ECLASS: monotone.eclass +# @MAINTAINER: +# Martin Väth <martin@mvath.de> +# @AUTHOR: +# Martin Väth <martin@mvath.de> +# @BLURB: The monotone eclass is written to fetch software sources from monotone repositories +# @DESCRIPTION: +# The monotone eclass provides functions to fetch software sources from +# monotone repositories. + +# @ECLASS-VARIABLE: EMTN_STORE_DIR +# @DESCRIPTION: +# monotone sources store directory. Users may override this in /etc/make.conf +: ${EMTN_STORE_DIR:=${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/mtn-src} + +# @ECLASS-VARIABLE: EMTN_OFFLINE +# @DESCRIPTION: +# Set this variable to a non-empty value to disable the automatic updating of +# an monotone source tree. This is intended to be set by users. +: ${EMTN_OFFLINE:=${EVCS_OFFLINE}} + +# @ECLASS-VARIABLE: EMTN_CMD +# @DESCRIPTION: +# monotone command with argument for database which must be '$db' +: ${EMTN_CMD:=mtn -d \"\$db\"} + +# @ECLASS-VARIABLE: EMTN_PULL_CMD +# @DESCRIPTION: +# monotone pull command +: ${EMTN_PULL_CMD:=${EMTN_CMD} pull} + +# @ECLASS-VARIABLE: EMTN_INIT_CMD +# @DESCRIPTION: +# monotone init command +: ${EMTN_INIT_CMD:=${EMTN_CMD} db init} + +# @ECLASS-VARIABLE: EMTN_CO_CMD +# @DESCRIPTION: +# monotone checkout command +: ${EMTN_CO_CMD:=${EMTN_CMD} co} + +# @ECLASS-VARIABLE: EMTN_PRINT_HEADS_CMD +# @DESCRIPTION: +# monotone command to print the revision of the heads +: ${EMTN_PRINT_HEADS_CMD:=${EMTN_CMD} automate heads} + +# @ECLASS-VARIABLE: EMTN_DB +# @DESCRIPTION: +# Name of the database file where the local monotone repository is stored. +: ${EMTN_DB:=${PN}.db} + +# @ECLASS-VARIABLE: EMTN_REPO_URI +# @DESCRIPTION: +# Name of the external monotone repository, e.g. foo.bar.org +: ${EMTN_REPO_URI:=} + +# @ECLASS-VARIABLE: EMTN_GLOB +# @DESCRIPTION: +# Name of the glob for the external repository. Typically '*' +: ${EMTN_GLOB:=*} + +# @ECLASS-VARIABLE: EMTN_MODULEPATH +# @DESCRIPTION: +# Name of the module to checkout +: ${EMTN_MODULEPATH:=${PN}} + +# @ECLASS-VARIABLE: EMTN_MODULEDIR +# @DESCRIPTION: +# Name where the module should come. Empty means: basename of modulepath. +: ${EMTN_MODULEDIR:=} + +# @ECLASS-VARIABLE: EMTN_REVISIONARGS +# @DESCRIPTION: +# Args for revision to checkout, e.g. "-r something" +# The special value "head" means to use the first head. +: ${EMTN_REVISIONARGS=head} + +# @ECLASS-VARIABLE: EMTN_DISABLE_DEPENDENCIES +# @DESCRIPTION: +# Set this variable to a non-empty value to disable the automatic inclusion of +# monotone in dependencies. +: ${EMTN_DISABLE_DEPENDENCIES:=} + +# @FUNCTION: monotone_fetch +# @USAGE: [repo_uri] [glob] [db] +# @DESCRIPTION: +# Fetch/update ${EMTN_STORE_DIR}/database from external uri (using glob) +# and copy it into ${S}. +# After this function, current working directory is ${S}. +# +# Can take three optional parameters: +# repo_uri - a repository URI. If empty defaults to EMTN_REPO_URI. +# glob - The glob for URI. If empty defaults to EMTN_GLOB. +# db - the database filename. If empty defaults to EMTN_DB. +monotone_fetch() { + local repo_uri glob db db_full + repo_uri=${1:-${EMTN_REPO_URI}} + glob=${2:-${EMTN_GLOB}} + db=${3:-${EMTN_DB}} + test -d "${EMTN_STORE_DIR}" || ( + addwrite / + mkdir -p -- "/${EMTN_STORE_DIR}" + ) + cd -P -- "${EMTN_STORE_DIR}" >/dev/null \ + || die "cannot cd to ${EMTN_STORE_DIR}" + + if ! test -e "${db}" + then ( + addwrite "${PWD}" + einfo "Initializing new ${db}" && \ + eval "${EMTN_INIT_CMD}" && \ + einfo "Fetching ${db} from remote ${repo_uri}" && \ + eval "${EMTN_PULL_CMD} \"\${repo_uri}\" \"\${glob}\"" + ) + elif [ -z "${EMTN_OFFLINE}" ] + then ( + addwrite "${PWD}" + einfo "Updating ${db} from remote ${repo_uri}" + eval "${EMTN_PULL_CMD}" + ) + fi || die "Could not fetch/update ${db}" + db_full="${EMTN_STORE_DIR}/${db}" + einfo "Copying database ${db_full} ..." + test -d "${S}" || mkdir -p -- "${S}" || die "mkdir ${S} failed" + cd -- "${S}" >/dev/null + cp -p -- "${db_full}" "${db}" || die "cp ${db_full} ${db} failed" +} + +# @FUNCTION: monotone_co +# @USAGE: [db] [modulepath] [moduledir] [revisionargs] +# @DESCRIPTION: +# Unpack monotone sources from the local database. +# +# All parameters are optional: +# db - the database filename. If empty defaults to EMTN_DB. +# modulepath - the name of the module to checkout. +# If empty defaults to EMTN_MODULEPATH +# moduledir - the name of the directory in which the module should come. +# If empty defaults to EMTN_MODULEDIR +# If that is also empty defaults to basename of EMTN_MODULEPATH. +# revisionargs - Args for the revision to checkout. If empty defaults to +# EMTN_REVISIONARGS. +# The special value "head" means to use the first head. +monotone_co() { + local db modulepath moduledir r + db=${1:-${EMTN_DB}} + modulepath=${2:-${EMTN_MODULEPATH}} + moduledir=${3:-${EMTN_MODULEDIR}} + [ -z "${moduledir}" ] && moduledir=${modulepath##*/} + if [ ${#} -gt 3 ] + then shift 3 + else eval "set -- ${EMTN_REVISIONARGS}" + fi + if [ "${1}" = 'head' ] + then if r=`eval "${EMTN_PRINT_HEADS_CMD} \"\${modulepath}\"" \ + | tail -n1` && [ -n "${r}" ] + then set -- -r "${r}" + else set -- + fi + fi + if [ -n "${modulepath}" ] + then einfo "Checking out module ${modulepath}" + eval "${EMTN_CO_CMD} -b \"\${modulepath}\" \"\${@}\" \"\${moduledir}\"" \ + || die "checkout of ${modulepath} failed" + else einfo "Checking out module ${module}" + eval "${EMTN_CO_CMD} \"\${@}\" \"\${moduledir}\"" \ + || die "checkout of ${module} failed" + fi +} + +# @FUNCTION: monotone_finish +# @USAGE: [db] +# @DESCRIPTION: +# Call this when all modules are checked out: Removes the local database. +# The optional argument db defaults to EMTN_DB. +monotone_finish() { + local db + db=${1:-${EMTN_DB}} + rm -- "${S}/${db}" || die "cannot remove ${S}/${db}" +} + +# @FUNCTION: monotone_src_unpack +# @DESCRIPTION: +# Default src_unpack. Call monotone_fetch, monotone_co, monotone_finish +monotone_src_unpack() { + monotone_fetch + monotone_co + monotone_finish +} + +[ -n "${EMTN_DISABLE_DEPENDENCIES}" ] || DEPEND='dev-vcs/monotone' + +EXPORT_FUNCTIONS src_unpack diff --git a/eclass/mv_mozextension.eclass b/eclass/mv_mozextension.eclass new file mode 100644 index 00000000..7d3ab08d --- /dev/null +++ b/eclass/mv_mozextension.eclass @@ -0,0 +1,154 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# @ECLASS: mv_mozextension.eclass +# @MAINTAINER: +# Martin Väth <martin@mvath.de> +# @BLURB: This eclass provides functions to install mozilla extensions +# @DESCRIPTION: +# The eclass is based on mozextension.eclass with many extensions. +# 1. It has some compatibility fixes in xpi_install/xpi_unpack. +# 2. A default src_unpack function is defined; set FILENAME to the archive name. +# If FILENAME is unset or empty, the last part of the last SRC_URI is used. +# 3. Default functions for installation for all mozilla type browsers. + +# @ECLASS-VARIABLE: MV_MOZ_MOZILLAS +# @DESCRIPTION: +# If this variables is set to the empty value, no default install functions +# are defined. Otherwise, the value of this variable should be +# "firefox seamonkey" (default) +# or a subset of these. +# The eclass will then install the extension for all these mozillas, +# set corresponding dependencies and print corresponding messages. +: ${MV_MOZ_MOZILLAS=firefox seamonkey} + +inherit eutils multilib + +case ${EAPI:-0} in +[01234]) + die "EAPI ${EAPI} no longer supported by ${ECLASS}";; +esac + +MV_MOZ_IUSE= +RDEPEND='|| (' +case ${MV_MOZ_MOZILLAS} in +*fire*) + MV_MOZ_IUSE="${MV_MOZ_IUSE}${MV_MOZ_IUSE:+ }firefox firefox-bin" + RDEPEND="${RDEPEND} + firefox? ( >=www-client/firefox-21 ) + firefox-bin? ( >=www-client/firefox-bin-21 )" +esac +case ${MV_MOZ_MOZILLAS} in +*sea*) + MV_MOZ_IUSE="${MV_MOZ_IUSE}${MV_MOZ_IUSE:+ }seamonkey seamonkey-bin" + RDEPEND="${RDEPEND} + seamonkey? ( www-client/seamonkey ) + seamonkey-bin? ( www-client/seamonkey-bin )" +esac +RDEPEND="${RDEPEND} )" +IUSE=${MV_MOZ_IUSE} +REQUIRED_USE="|| ( ${MV_MOZ_IUSE} )" + +DEPEND='app-arch/unzip' + +mv_mozextension_src_unpack() { + local i + if [ -z "${FILENAME}" ] + then for i in ${SRC_URI} + do FILENAME=${i##*/} + done + fi + xpi_unpack "${FILENAME}" +} + +mv_mozextension_src_prepare() { + epatch_user +} + +EXPORT_FUNCTIONS src_unpack src_prepare + +mv_mozextension_src_install() { + local b e + b="${EPREFIX}/usr/$(get_libdir)" + e="${EPREFIX}/opt" + mv_mozextension_install firefox "${b}/firefox/browser/extensions" + mv_mozextension_install firefox-bin "${e}/firefox/browser/extensions" + mv_mozextension_install seamonkey "${b}/seamonkey/extensions" + mv_mozextension_install seamonkey-bin "${e}/seamonkey/extensions" +} + +[ -z "${MV_MOZ_MOZILLAS}" ] || EXPORT_FUNCTIONS src_install + +xpi_unpack() { + local xpi srcdir u + + # Not gonna use ${A} as we are looking for a specific option being passed to function + # You must specify which xpi to use + [ ${#} -eq 0 ] && die \ + "Nothing passed to the ${FUNCNAME} command. Please pass which xpi to unpack" + + test -d "${S}" || mkdir "${S}" || die + for xpi + do einfo "Unpacking ${xpi} to ${S}" + xpiname=${xpi%.*} + xpiname=${xpiname##*/} + + case ${xpi} in + ./*|/*) + srcdir=;; + *) + srcdir="${DISTDIR}/";; + esac + + test -s "${srcdir}${xpi}" || die "${xpi} does not exist" + + case ${xpi##*.} in + ZIP|zip|jar|xpi) + mkdir -- "${S}/${xpiname}" && \ + cd -- "${S}/${xpiname}" && \ + unzip -qo -- "${srcdir}${xpi}" \ + || die "failed to unpack ${xpi}" + chmod -R a+rX,u+w,go-w -- "${S}/${xpiname}";; + *) + einfo "unpack ${xpi}: file format not recognized. Ignoring.";; + esac + done +} + +xpi_install() { + local d x + + # You must tell xpi_install which dir to use + [ ${#} -eq 1 ] || die "${FUNCNAME} takes exactly one argument. Please specify the directory" + + x=${1} + # determine id for extension + d='{ /\<\(em:\)*id\>/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' + d=$(sed -n -e '/install-manifest/,$ '"${d}" "${x}"/install.rdf) \ + && [ -n "${d}" ] || die 'failed to determine extension id' + : ${MOZILLA_EXTENSIONS_DIRECTORY:="${MOZILLA_FIVE_HOME}/extensions"} + d="${MOZILLA_EXTENSIONS_DIRECTORY}/${d}" + test -d "${D}${d}" || dodir "${d}" || die "failed to create ${d}" + cp -RPl -- "${x}"/* "${D}${d}" || { + ewarn 'Failed to hardlink extension. Falling back to USE=copy-extensions' + insinto "${d}" && doins -r "${x}"/* + } || die 'failed to copy extension' +} + +# This function is called by mv_mozextension_src_install +# and should be overridden if the paths do not match: +# It just should call xpi_install with the correct argument(s) +xpi_install_dirs() { + local d + for d in "${S}"/* + do [ -n "${d}" ] && test -d "${d}" && xpi_install "${d}" + done +} + +mv_mozextension_install() { + local MOZILLA_EXTENSIONS_DIRECTORY + has "${1}" ${MV_MOZ_IUSE} && use "${1}" || return 0 + MOZILLA_EXTENSIONS_DIRECTORY=${2} + xpi_install_dirs +} |