Gentoo Archives: gentoo-commits

From: "Peter Volkov (pva)" <pva@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: alternatives.eclass
Date: Wed, 10 Sep 2008 08:10:35
Message-Id: E1KdKmW-0002zH-7m@stork.gentoo.org
1 pva 08/09/10 08:10:32
2
3 Modified: alternatives.eclass
4 Log:
5 Make eclass-manpages ready, bug #210058, thank mren for report.
6
7 Revision Changes Path
8 1.15 eclass/alternatives.eclass
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/alternatives.eclass?rev=1.15&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/alternatives.eclass?rev=1.15&content-type=text/plain
12 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/alternatives.eclass?r1=1.14&r2=1.15
13
14 Index: alternatives.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/alternatives.eclass,v
17 retrieving revision 1.14
18 retrieving revision 1.15
19 diff -u -r1.14 -r1.15
20 --- alternatives.eclass 15 May 2007 15:20:59 -0000 1.14
21 +++ alternatives.eclass 10 Sep 2008 08:10:31 -0000 1.15
22 @@ -1,48 +1,55 @@
23 -# Copyright 1999-2004 Gentoo Foundation
24 +# Copyright 1999-2008 Gentoo Foundation
25 # Distributed under the terms of the GNU General Public License v2
26 -# $Header: /var/cvsroot/gentoo-x86/eclass/alternatives.eclass,v 1.14 2007/05/15 15:20:59 ulm Exp $
27 +# $Header: /var/cvsroot/gentoo-x86/eclass/alternatives.eclass,v 1.15 2008/09/10 08:10:31 pva Exp $
28
29 -# Author : Alastair Tse <liquidx@g.o> (03 Oct 2003)
30 -# Short Desc: Creates symlink to the latest version of multiple slotted
31 -# packages.
32 -#
33 -# Long Desc:
34 -#
35 -# When a package is SLOT'ed, very often we need to have a symlink to the
36 -# latest version. However, depending on the order the user has merged them,
37 -# more often than not, the symlink maybe clobbered by the older versions.
38 -#
39 -# This eclass provides a convenience function that needs to be given a
40 -# list of alternatives (descending order of recent-ness) and the symlink.
41 -# It will choose the latest version it can find installed and create
42 -# the desired symlink.
43 -#
44 -# There are two ways to use this eclass. First is by declaring two variables
45 -# $SOURCE and $ALTERNATIVES where $SOURCE is the symlink to be created and
46 -# $ALTERNATIVES is a list of alternatives. Second way is the use the function
47 -# alternatives_makesym() like the example below.
48 -#
49 -# Example:
50 -#
51 -# pkg_postinst() {
52 -# alternatives_makesym "/usr/bin/python" "/usr/bin/python2.3" "/usr/bin/python2.2"
53 -# }
54 -#
55 -# The above example will create a symlink at /usr/bin/python to either
56 -# /usr/bin/python2.3 or /usr/bin/python2.2. It will choose python2.3 over
57 -# python2.2 if both exist.
58 -#
59 -# Alternatively, you can use this function:
60 -#
61 -# pkg_postinst() {
62 -# alternatives_auto_makesym "/usr/bin/python" "/usr/bin/python[0-9].[0-9]"
63 -# }
64 -#
65 -# This will use bash pathname expansion to fill a list of alternatives it can
66 -# link to. It is probably more robust against version upgrades. You should
67 -# consider using this unless you are want to do something special.
68 +# @ECLASS: alternatives.eclass
69 +# @MAINTAINER:
70 #
71 +# Original author : Alastair Tse <liquidx@g.o> (03 Oct 2003)
72 +# @BLURB: Creates symlink to the latest version of multiple slotted packages.
73 +# @DESCRIPTION:
74 +# When a package is SLOT'ed, very often we need to have a symlink to the
75 +# latest version. However, depending on the order the user has merged them,
76 +# more often than not, the symlink maybe clobbered by the older versions.
77 +#
78 +# This eclass provides a convenience function that needs to be given a
79 +# list of alternatives (descending order of recent-ness) and the symlink.
80 +# It will choose the latest version it can find installed and create
81 +# the desired symlink.
82 +#
83 +# There are two ways to use this eclass. First is by declaring two variables
84 +# $SOURCE and $ALTERNATIVES where $SOURCE is the symlink to be created and
85 +# $ALTERNATIVES is a list of alternatives. Second way is the use the function
86 +# alternatives_makesym() like the example below.
87 +# @EXAMPLE:
88 +# pkg_postinst() {
89 +# alternatives_makesym "/usr/bin/python" "/usr/bin/python2.3" "/usr/bin/python2.2"
90 +# }
91 +#
92 +# The above example will create a symlink at /usr/bin/python to either
93 +# /usr/bin/python2.3 or /usr/bin/python2.2. It will choose python2.3 over
94 +# python2.2 if both exist.
95 +#
96 +# Alternatively, you can use this function:
97 +#
98 +# pkg_postinst() {
99 +# alternatives_auto_makesym "/usr/bin/python" "/usr/bin/python[0-9].[0-9]"
100 +# }
101 +#
102 +# This will use bash pathname expansion to fill a list of alternatives it can
103 +# link to. It is probably more robust against version upgrades. You should
104 +# consider using this unless you are want to do something special.
105 +
106 +# @ECLASS-VARIABLE: SOURCE
107 +# @DESCRIPTION:
108 +# The symlink to be created
109 +
110 +# @ECLASS-VARIABLE: ALTERNATIVES
111 +# @DESCRIPTION:
112 +# The list of alternatives
113
114 +# @FUNCTION: alternatives_auto_makesym
115 +# @DESCRIPTION:
116 # automatic deduction based on a symlink and a regex mask
117 alternatives_auto_makesym() {
118 local SYMLINK REGEX ALT myregex
119 @@ -110,12 +117,18 @@
120 fi
121 }
122
123 +# @FUNCTION: alernatives-pkg_postinst
124 +# @DESCRIPTION:
125 +# The alternatives pkg_postinst, this function will be exported
126 alternatives_pkg_postinst() {
127 if [ -n "${ALTERNATIVES}" -a -n "${SOURCE}" ]; then
128 alternatives_makesym ${SOURCE} ${ALTERNATIVES}
129 fi
130 }
131
132 +# @FUNCTION: alternatives_pkg_postrm
133 +# @DESCRIPTION:
134 +# The alternatives pkg_postrm, this function will be exported
135 alternatives_pkg_postrm() {
136 if [ -n "${ALTERNATIVES}" -a -n "${SOURCE}" ]; then
137 alternatives_makesym ${SOURCE} ${ALTERNATIVES}