diff options
author | George Shapovalov <george@gentoo.org> | 2007-09-26 20:41:33 +0000 |
---|---|---|
committer | George Shapovalov <george@gentoo.org> | 2007-09-26 20:41:33 +0000 |
commit | 3ba2b476cf6cffe840ff3d17a2f506a331353a18 (patch) | |
tree | 46e9aef3bb8b8acfb82cc02a999e074c515971d0 /eclass/gnat.eclass | |
parent | Initial ebuild. Bug 189125, also thanks to Tobias Roeser (bug 124466). (diff) | |
download | gentoo-2-3ba2b476cf6cffe840ff3d17a2f506a331353a18.tar.gz gentoo-2-3ba2b476cf6cffe840ff3d17a2f506a331353a18.tar.bz2 gentoo-2-3ba2b476cf6cffe840ff3d17a2f506a331353a18.zip |
added get_active_profile helper function
Diffstat (limited to 'eclass/gnat.eclass')
-rw-r--r-- | eclass/gnat.eclass | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/eclass/gnat.eclass b/eclass/gnat.eclass index e35cb2d2dfcb..619da0983b19 100644 --- a/eclass/gnat.eclass +++ b/eclass/gnat.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/gnat.eclass,v 1.27 2007/09/26 20:09:03 george Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/gnat.eclass,v 1.28 2007/09/26 20:41:33 george Exp $ # # Author: George Shapovalov <george@gentoo.org> # Belongs to: ada herd <ada@gentoo.org> @@ -125,6 +125,34 @@ get_gnat_value() { } +# Returns a name of active gnat profile. Peroroms some validity checks. No input +# parameters, analyzes the system setup directly. +get_active_profile() { + # get common code and settings + . ${GnatCommon} || die "failed to source gnat-common lib" + + local profiles=( $(get_env_list) ) + + if [[ ${profiles[@]} == "${MARKER}*" ]]; then + exit + # returning empty string + fi + + if (( 1 == ${#profiles[@]} )); then + local active=${profiles[0]#${MARKER}} + else + die "${ENVDIR} contains multiple gnat profiles, please cleanup!" + fi + + if [[ -f ${SPECSDIR}/${active} ]]; then + echo ${active} + else + die "The profile active in ${ENVDIR} does not correspond to any installed gnat!" + fi +} + + + # ------------------------------------ # Functions |