summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorGeorge Shapovalov <george@gentoo.org>2007-09-26 20:41:33 +0000
committerGeorge Shapovalov <george@gentoo.org>2007-09-26 20:41:33 +0000
commitd4b20a7f89a9a9fc1243297808872491ad9157a6 (patch)
treeadef2125235db200a36eafb934b94e222cbf8a0b /eclass
parentInitial ebuild. Bug 189125, also thanks to Tobias Roeser (bug 124466). (diff)
downloadhistorical-d4b20a7f89a9a9fc1243297808872491ad9157a6.tar.gz
historical-d4b20a7f89a9a9fc1243297808872491ad9157a6.tar.bz2
historical-d4b20a7f89a9a9fc1243297808872491ad9157a6.zip
added get_active_profile helper function
Diffstat (limited to 'eclass')
-rw-r--r--eclass/gnat.eclass30
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