diff options
author | Martin Väth <martin@mvath.de> | 2010-06-26 20:42:30 +0200 |
---|---|---|
committer | Martin Väth <martin@mvath.de> | 2015-10-11 10:45:36 +0200 |
commit | 80a82fd6501865bbedb216c49a50b58eb002959d (patch) | |
tree | 2a88a3e5f712d4227555f98838380326e06feaa8 /eclass | |
parent | Bump ccache (diff) | |
download | mv-80a82fd6501865bbedb216c49a50b58eb002959d.tar.gz mv-80a82fd6501865bbedb216c49a50b58eb002959d.tar.bz2 mv-80a82fd6501865bbedb216c49a50b58eb002959d.zip |
Add monotone.eclass for magus. Improve mv_mozextension.eclass messages
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/monotone.eclass | 217 | ||||
-rw-r--r-- | eclass/mv_mozextension.eclass | 4 |
2 files changed, 219 insertions, 2 deletions
diff --git a/eclass/monotone.eclass b/eclass/monotone.eclass new file mode 100644 index 00000000..341749da --- /dev/null +++ b/eclass/monotone.eclass @@ -0,0 +1,217 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header $ + +# @ECLASS: monotone.eclass +# @MAINTAINER: +# Martin Väth <martin@mvath.de> +# +# Original 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. + +DESCRIPTION="Based on the ${ECLASS} eclass" + +# @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:="${ESCM_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 two 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 db db_full + if [ ${#} -ge 1 ] + then repo_uri=${1:-"${EMTN_REPO_URI}"} + shift + else repo_uri="${EMTN_REPO_URI}" + fi + if [ ${#} -ge 1 ] + then db=${1:-"${EMTN_DB}"} + shift + else db=${1:-"${EMTN_DB}"} + fi + 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 [ -n "${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 + if [ ${#} -ge 1 ] + then db=${1:-"${EMTN_DB}"} + shift + else db="${EMTN_DB}" + fi + if [ ${#} -ge 1 ] + then modulepath=${1:-"${EMTN_MODULEPATH}"} + shift + else modulepath="${EMTN_MODULEPATH}" + fi + if [ ${#} -ge 1 ] + then moduledir=${1:-"${EMTN_MODULEDIR}"} + shift + else moduledir="${EMTN_MODULEDIR}" + fi + [ -z "${moduledir}" ] && moduledir="${modulepath##*/}" + if [ ${#} -eq 0 ] && [ -n "${EMTN_REVISIONARGS}" ] + then eval "set -- ${EMTN_REVISIONARGS}" + fi + if [ "${1}" = "head" ] + then if r=`eval "${EMTN_PRINT_HEADS_CMD}" | 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 argument db defaults to EMTN_DB. +monotone_finish () { + if [ ${#} -ge 1 ] + then db=${1:-"${EMTN_DB}"} + shift + else db="${EMTN_DB}" + fi + 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 index 49e5b773..3cffd33f 100644 --- a/eclass/mv_mozextension.eclass +++ b/eclass/mv_mozextension.eclass @@ -113,8 +113,8 @@ mv_mozextension_pkg_postinst () { do elog " ${i}" done elog - elog "After installing other mozilla ebuilds, if you want to use it with them," - elog "reemerge ${CATEGORY}/${PN}" + elog "When you install or upgrade some of: ${MOZILLAS}" + elog "you might need to reemerge ${CATEGORY}/${PN}" } EXPORT_FUNCTIONS src_install pkg_postinst |