aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-01-08 10:45:07 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-01-08 10:45:07 +0000
commit86b9e9ba407f1f0f1530e4fde6056785fed68869 (patch)
tree3544423b7d8bbc3535b2dcd1fa22858a26e83ef8 /paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash
parentcc2065217d1acd31ffa4c10530eae72b2321e169 (diff)
downloadpaludis-86b9e9ba407f1f0f1530e4fde6056785fed68869.tar.gz
paludis-86b9e9ba407f1f0f1530e4fde6056785fed68869.tar.xz
Split up exheres and pms-derived EAPIs. Start suing 'default' for exheres. Use different coloured >>>/=== for different EAPIs.
Diffstat (limited to 'paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash')
-rw-r--r--paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash83
1 files changed, 83 insertions, 0 deletions
diff --git a/paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash b/paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash
new file mode 100644
index 0000000..38e1f2a
--- /dev/null
+++ b/paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash
@@ -0,0 +1,83 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+# Copyright (c) 2007, 2008 Ciaran McCreesh
+#
+# This file is part of the Paludis package manager. Paludis is free software;
+# you can redistribute it and/or modify it under the terms of the GNU General
+# Public License, version 2, as published by the Free Software Foundation.
+#
+# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+export_exlib_phases()
+{
+ [[ -z "${CURRENT_EXLIB}" ]] && die "export_exlib_phases called but CURRENT_EXLIB undefined"
+
+ local e
+ for e in "$@" ; do
+ case "$e" in
+ pkg_nofetch|pkg_setup|pkg_prerm|pkg_postrm|pkg_preinst|pkg_postinst|pkg_config|pkg_pretend)
+ eval "${e}() { ${CURRENT_EXLIB}_${e} \"\$@\" ; }"
+ ;;
+
+ src_unpack|src_compile|src_install|src_test)
+ eval "${e}() { ${CURRENT_EXLIB}_${e} \"\$@\" ; }"
+ ;;
+
+ *)
+ eval "${e}() { ${CURRENT_EXLIB}_${e} \"\$@\" ; }"
+ ebuild_notice "qa" "$e should not be in export_exlib_phases for ${CURRENT_EXLIB}"
+ ;;
+ esac
+ done
+}
+
+require()
+{
+ ebuild_notice "debug" "Command 'require ${@}', using EXLIBSDIRS '${EXLIBSDIRS}'"
+ local e ee location= v
+ for e in "$@" ; do
+ for ee in ${EXLIBSDIRS} ; do
+ [[ -f "${ee}/${e}.exlib" ]] && location="${ee}/${e}.exlib"
+ done
+ local old_CURRENT_EXLIB="${CURRENT_EXLIB}"
+ export CURRENT_EXLIB="${e}"
+
+ for v in ${PALUDIS_SOURCE_MERGED_VARIABLES} ; do
+ local c_v="current_${v}" u_v="unset_${v}"
+ local ${c_v}="${!v}"
+ local ${u_v}="${!v-unset}"
+ unset ${v}
+ done
+
+ [[ -z "${location}" ]] && die "Error finding exlib ${e} in ${EXLIBSDIRS}"
+ source "${location}" || die "Error sourcing exlib ${e}"
+ hasq "${CURRENT_EXLIB}" ${INHERITED} || export INHERITED="${INHERITED} ${CURRENT_EXLIB}"
+
+ for v in ${PALUDIS_SOURCE_MERGED_VARIABLES} ; do
+ local e_v="E_${v}"
+ export ${e_v}="${!e_v} ${!v}"
+ done
+
+ for v in ${PALUDIS_SOURCE_MERGED_VARIABLES} ; do
+ local c_v="current_${v}" u_v="unset_${v}"
+ [[ "unset" == ${!u_v} ]] && unset ${v} || export ${v}="${!c_v}"
+ done
+
+ export CURRENT_EXLIB="${old_CURRENT_EXLIB}"
+ done
+}
+
+default()
+{
+ [[ $(type -t "default_${FUNCNAME[1]}" ) == "function" ]] || die "default_${FUNCNAME[1]} not a function"
+ default_${FUNCNAME[1]} "$@"
+}
+