summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Chvatal <scarabeus@gentoo.org>2010-01-11 16:57:46 +0000
committerTomas Chvatal <scarabeus@gentoo.org>2010-01-11 16:57:46 +0000
commit35f87d10b84b0243fbf03a56b8a3e96d76fab3f4 (patch)
tree258efc1953b870be6d1e16326b87f8b8738cab66 /eclass/base.eclass
parentDon't call python_need_rebuild() (bug #300587). (diff)
downloadgentoo-2-35f87d10b84b0243fbf03a56b8a3e96d76fab3f4.tar.gz
gentoo-2-35f87d10b84b0243fbf03a56b8a3e96d76fab3f4.tar.bz2
gentoo-2-35f87d10b84b0243fbf03a56b8a3e96d76fab3f4.zip
Update maintainership to be qa@g.o
Features information: PATCHES now accept also folders as their argument. New arrays DOCS and HTML_DOCS, also bash arrays as patches. src_install calls emake and not make. switched from "function argument" layout to separate functions. Review request submited: http://archives.gentoo.org/gentoo-dev/msg_254665435d58a97bcc5a952e5e005cd1.xml
Diffstat (limited to 'eclass/base.eclass')
-rw-r--r--eclass/base.eclass272
1 files changed, 109 insertions, 163 deletions
diff --git a/eclass/base.eclass b/eclass/base.eclass
index 29a9ab974018..855a0a25d87b 100644
--- a/eclass/base.eclass
+++ b/eclass/base.eclass
@@ -1,227 +1,173 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.40 2010/01/03 21:07:32 mr_bones_ Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.41 2010/01/11 16:57:46 scarabeus Exp $
# @ECLASS: base.eclass
# @MAINTAINER:
-# Peter Alfredsen <loki_val@gentoo.org>
+# QA Team <qa@gentoo.org>
#
# Original author Dan Armak <danarmak@gentoo.org>
# @BLURB: The base eclass defines some default functions and variables.
# @DESCRIPTION:
# The base eclass defines some default functions and variables. Nearly
# everything else inherits from here.
-#
-# NOTE: You must define EAPI before inheriting from base, or the wrong functions
-# may be exported.
-
inherit eutils
+BASE_EXPF="src_unpack src_compile src_install"
case "${EAPI:-0}" in
- 2)
- EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install
- ;;
- *)
- EXPORT_FUNCTIONS src_unpack src_compile src_install
- ;;
+ 2|3|4) BASE_EXPF="src_prepare src_configure" ;;
+ *) ;;
esac
-DESCRIPTION="Based on the $ECLASS eclass"
+EXPORT_FUNCTIONS ${BASE_EXPF}
-# @FUNCTION: base_src_unpack
-# @USAGE: [ unpack ] [ patch ] [ autopatch ] [ all ]
+# @ECLASS-VARIABLE: DOCS
+# @USAGE: DOCS=( "${S}/doc/document.txt" "${S}/doc/doc_folder/" )
# @DESCRIPTION:
-# The base src_unpack function, which is exported. If no argument is given,
-# "all" is assumed if EAPI!=2, "unpack" if EAPI=2.
-base_src_unpack() {
+# Array containing documents passed to dodoc command.
- debug-print-function $FUNCNAME "$@"
-
- if [ -z "$1" ] ; then
- case "${EAPI:-0}" in
- 2)
- base_src_util unpack
- ;;
- *)
- base_src_util all
- ;;
- esac
- else
- base_src_util $@
- fi
-}
-
-# @FUNCTION: base_src_prepare
+# @ECLASS-VARIABLE: HTML_DOCS
+# @USAGE: HTML_DOCS=( "${S}/doc/document.html" "${S}/doc/html_folder/" )
# @DESCRIPTION:
-# The base src_prepare function, which is exported when EAPI=2. Performs
-# "base_src_util autopatch".
-base_src_prepare() {
+# Array containing documents passed to dohtml command.
- debug-print-function $FUNCNAME "$@"
+# @ECLASS-VARIABLE: PATCHES
+# @USAGE: PATCHES=( "${FILESDIR}/mypatch.patch" "${FILESDIR}/patches_folder/" )
+# @DESCRIPTION:
+# PATCHES array variable containing all various patches to be applied.
+# This variable is expected to be defined in global scope of ebuild.
+# Make sure to specify the full path. This variable is utilised in
+# src_unpack/src_prepare phase based on EAPI.
+# NOTE: if using patches folders with special file suffixes you have to
+# define one additional variable EPATCH_SUFFIX="something"
- base_src_util autopatch
-}
-# @FUNCTION: base_src_util
-# @USAGE: [ unpack ] [ patch ] [ autopatch ] [ all ]
+# @FUNCTION: base_src_unpack
# @DESCRIPTION:
-# The base_src_util function is the grunt function for base src_unpack
-# and base src_prepare.
-base_src_util() {
- local x
-
+# The base src_unpack function, which is exported.
+# Calls also src_prepare with eapi older than 2.
+base_src_unpack() {
debug-print-function $FUNCNAME "$@"
- cd "${WORKDIR}"
+ pushd "${WORKDIR}" > /dev/null
- while [ "$1" ]; do
+ [[ -n "${A}" ]] && unpack ${A}
+ has src_prepare ${BASE_EXPF} || base_src_prepare
- case $1 in
- unpack)
- debug-print-section unpack
- if [ ! -z "$A" ] ; then
- unpack ${A}
- fi
- ;;
- patch)
- debug-print-section patch
- cd "${S}"
- epatch "${FILESDIR}/${P}-gentoo.diff"
- ;;
- autopatch)
- debug-print-section autopatch
- debug-print "$FUNCNAME: autopatch: PATCHES=$PATCHES, PATCHES1=$PATCHES1"
- cd "${S}"
- if [[ ${#PATCHES[@]} -gt 1 ]] ; then
- for x in "${PATCHES[@]}"; do
- debug-print "$FUNCNAME: autopatch: patching from ${x}"
- epatch "${x}"
- done
- else
- for x in ${PATCHES} ${PATCHES1}; do
- debug-print "$FUNCNAME: autopatch: patching from ${x}"
- epatch "${x}"
- done
+ popd > /dev/null
+}
+
+# @FUNCTION: base_src_prepare
+# @DESCRIPTION:
+# The base src_prepare function, which is exported
+# EAPI is greater or equal to 2.
+base_src_prepare() {
+ debug-print-function $FUNCNAME "$@"
+ debug-print "$FUNCNAME: PATCHES=$PATCHES"
+
+ pushd "${S}" > /dev/null
+ if [[ "$(declare -p PATCHES 2>/dev/null 2>&1)" == "declare -a"* ]]; then
+ for x in "${PATCHES[@]}"; do
+ debug-print "$FUNCNAME: applying patch from ${x}"
+ [[ -f "${x}" ]] && epatch "${x}"
+ if [[ -d "${x}" ]]; then
+ # Use standardized names and locations with bulk patching
+ # Patch directory is ${WORKDIR}/patch
+ # See epatch() in eutils.eclass for more documentation
+ EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch}
+
+ # in order to preserve normal EPATCH_SOURCE value that can
+ # be used other way than with base eclass store in local
+ # variable and restore later
+ oldval=${EPATCH_SOURCE}
+ EPATCH_SOURCE=${x}
+ epatch
+ EPATCH_SOURCE=${oldval}
fi
- ;;
- all)
- debug-print-section all
- base_src_util unpack autopatch
- ;;
- esac
+ done
+ else
+ for x in ${PATCHES}; do
+ debug-print "$FUNCNAME: patching from ${x}"
+ epatch "${x}"
+ done
+ fi
- shift
- done
+ # Apply user patches
+ debug-print "$FUNCNAME: applying user patches"
+ epatch_user
+ popd > /dev/null
}
# @FUNCTION: base_src_configure
# @DESCRIPTION:
-# The base src_prepare function, which is exported when EAPI=2. Performs
-# "base_src_work configure".
+# The base src_configure function, which is exported when
+# EAPI is greater or equal to 2. Runs basic econf.
base_src_configure() {
-
debug-print-function $FUNCNAME "$@"
- base_src_work configure
+ # there is no pushd ${S} so we can override its place where to run
+ [[ -x ${ECONF_SOURCE:-.}/configure ]] && econf
}
# @FUNCTION: base_src_compile
-# @USAGE: [ configure ] [ make ] [ all ]
# @DESCRIPTION:
-# The base src_compile function, which is exported. If no argument is given,
-# "all" is assumed if EAPI!=2, "make" if EAPI=2.
+# The base src_compile function, calls src_configure with
+# EAPI older than 2.
base_src_compile() {
-
debug-print-function $FUNCNAME "$@"
- if [ -z "$1" ]
- then
- case "${EAPI:-0}" in
- 2)
- base_src_work make
- ;;
- *)
- base_src_work all
- ;;
- esac
- else
- base_src_work $@
- fi
+ has src_configure ${BASE_EXPF} || base_src_configure
+ base_src_make $@
}
-# placeholder for future api so eclasses can be migrated now.
+# @FUNCTION: base_src_make
+# @DESCRIPTION:
+# Actual function that runs emake command.
base_src_make() {
debug-print-function $FUNCNAME "$@"
- base_src_work make
+
+ if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
+ emake $@ || die "died running emake, $FUNCNAME:make"
+ fi
}
-# @FUNCTION: base_src_work
-# @USAGE: [ configure ] [ make ] [ all ]
+# @FUNCTION: base_src_install
# @DESCRIPTION:
-# The base_src_work function is the grunt function for base src_configure
-# and base src_compile.
-base_src_work() {
-
+# The base src_install function. Runs make install and
+# installs documents and html documents from DOCS and HTML_DOCS
+# arrays.
+base_src_install() {
debug-print-function $FUNCNAME "$@"
- cd "${S}"
-
- while [ "$1" ]; do
-
- case $1 in
- configure)
- debug-print-section configure
- if [[ -x ${ECONF_SOURCE:-.}/configure ]]
- then
- econf || die "died running econf, $FUNCNAME:configure"
- fi
- ;;
- make)
- debug-print-section make
- if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]
- then
- emake || die "died running emake, $FUNCNAME:make"
- fi
- ;;
- all)
- debug-print-section all
- base_src_work configure make
- ;;
- esac
-
- shift
- done
-
+ emake DESTDIR="${D}" $@ install || die "died running make install, $FUNCNAME:make"
+ base_src_install_docs
}
-# @FUNCTION: base_src_install
-# @USAGE: [ make ] [ all ]
+# @FUNCTION: base_src_install_docs
# @DESCRIPTION:
-# The base src_install function, which is exported. If no argument is given,
-# "all" is assumed.
-base_src_install() {
-
+# Actual function that install documentation from
+# DOCS and HTML_DOCS arrays.
+base_src_install_docs() {
debug-print-function $FUNCNAME "$@"
- [ -z "$1" ] && base_src_install all
-
- cd "${S}"
- while [ "$1" ]; do
+ local x
- case $1 in
- make)
- debug-print-section make
- make DESTDIR="${D}" install || die "died running make install, $FUNCNAME:make"
- ;;
- all)
- debug-print-section all
- base_src_install make
- ;;
- esac
+ pushd "${S}" > /dev/null
- shift
- done
+ if [[ "$(declare -p DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then
+ for x in "${DOCS[@]}"; do
+ debug-print "$FUNCNAME: docs: creating document from ${x}"
+ dodoc -r "${x}" || die "dodoc failed"
+ done
+ fi
+ if [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then
+ for x in "${HTML_DOCS[@]}"; do
+ debug-print "$FUNCNAME: docs: creating html document from ${x}"
+ dohtml -r "${x}" || die "dohtml failed"
+ done
+ fi
+ popd > /dev/null
}