1 |
george 07/09/26 20:41:34 |
2 |
|
3 |
Modified: gnat.eclass |
4 |
Log: |
5 |
added get_active_profile helper function |
6 |
|
7 |
Revision Changes Path |
8 |
1.28 eclass/gnat.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gnat.eclass?rev=1.28&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gnat.eclass?rev=1.28&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gnat.eclass?r1=1.27&r2=1.28 |
13 |
|
14 |
Index: gnat.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/gnat.eclass,v |
17 |
retrieving revision 1.27 |
18 |
retrieving revision 1.28 |
19 |
diff -u -r1.27 -r1.28 |
20 |
--- gnat.eclass 26 Sep 2007 20:09:03 -0000 1.27 |
21 |
+++ gnat.eclass 26 Sep 2007 20:41:33 -0000 1.28 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2004 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/gnat.eclass,v 1.27 2007/09/26 20:09:03 george Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/gnat.eclass,v 1.28 2007/09/26 20:41:33 george Exp $ |
27 |
# |
28 |
# Author: George Shapovalov <george@g.o> |
29 |
# Belongs to: ada herd <ada@g.o> |
30 |
@@ -125,6 +125,34 @@ |
31 |
} |
32 |
|
33 |
|
34 |
+# Returns a name of active gnat profile. Peroroms some validity checks. No input |
35 |
+# parameters, analyzes the system setup directly. |
36 |
+get_active_profile() { |
37 |
+ # get common code and settings |
38 |
+ . ${GnatCommon} || die "failed to source gnat-common lib" |
39 |
+ |
40 |
+ local profiles=( $(get_env_list) ) |
41 |
+ |
42 |
+ if [[ ${profiles[@]} == "${MARKER}*" ]]; then |
43 |
+ exit |
44 |
+ # returning empty string |
45 |
+ fi |
46 |
+ |
47 |
+ if (( 1 == ${#profiles[@]} )); then |
48 |
+ local active=${profiles[0]#${MARKER}} |
49 |
+ else |
50 |
+ die "${ENVDIR} contains multiple gnat profiles, please cleanup!" |
51 |
+ fi |
52 |
+ |
53 |
+ if [[ -f ${SPECSDIR}/${active} ]]; then |
54 |
+ echo ${active} |
55 |
+ else |
56 |
+ die "The profile active in ${ENVDIR} does not correspond to any installed gnat!" |
57 |
+ fi |
58 |
+} |
59 |
+ |
60 |
+ |
61 |
+ |
62 |
# ------------------------------------ |
63 |
# Functions |
64 |
|
65 |
|
66 |
|
67 |
|
68 |
-- |
69 |
gentoo-commits@g.o mailing list |