Gentoo Archives: gentoo-commits

From: "Ulrich Mueller (ulm)" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] eselect r756 - in trunk: . libs modules
Date: Sat, 30 Jan 2010 14:22:34
Message-Id: E1NbEDT-0001ts-Nl@stork.gentoo.org
1 Author: ulm
2 Date: 2010-01-30 14:22:27 +0000 (Sat, 30 Jan 2010)
3 New Revision: 756
4
5 Modified:
6 trunk/ChangeLog
7 trunk/NEWS
8 trunk/configure.ac
9 trunk/libs/Makefile.am
10 trunk/libs/package-manager.bash.in
11 trunk/modules/env.eselect
12 Log:
13 The env module calls the package manager's env-update, if available.
14
15 Modified: trunk/ChangeLog
16 ===================================================================
17 --- trunk/ChangeLog 2010-01-30 11:11:57 UTC (rev 755)
18 +++ trunk/ChangeLog 2010-01-30 14:22:27 UTC (rev 756)
19 @@ -1,5 +1,10 @@
20 2010-01-30 Ulrich Mueller <ulm@g.o>
21
22 + * configure.ac: Test for env-update program.
23 + * libs/Makefile.am (dosed): Substitute ENV_UPDATE.
24 + * libs/package-manager.bash.in (env-update): New function.
25 + * modules/env.eselect (do_update): Call env_update, bug 298742.
26 +
27 * configure.ac: Remove --with-pm configure option.
28 * libs/Makefile.am (dosed): Don't substitute PACKAGE_MANAGER.
29 * libs/package-manager.bash.in (package_manager): Don't hardcode
30
31 Modified: trunk/NEWS
32 ===================================================================
33 --- trunk/NEWS 2010-01-30 11:11:57 UTC (rev 755)
34 +++ trunk/NEWS 2010-01-30 14:22:27 UTC (rev 756)
35 @@ -1,6 +1,10 @@
36 This file contains a summary of changes in released versions. Please read the
37 ChangeLog file for a more detailed listing of changes/bug fixes.
38
39 +trunk:
40 + New features:
41 + - The env module calls the package manager's env-update, if available.
42 +
43 1.2.9:
44 Bug fixes:
45 - Fixed bug #298742: The env module was not whitespace safe.
46
47 Modified: trunk/configure.ac
48 ===================================================================
49 --- trunk/configure.ac 2010-01-30 11:11:57 UTC (rev 755)
50 +++ trunk/configure.ac 2010-01-30 14:22:27 UTC (rev 756)
51 @@ -23,6 +23,7 @@
52 fi
53
54 AC_PATH_PROG(PORTAGEQ, portageq, /usr/bin/portageq)
55 +AC_PATH_PROG(ENV_UPDATE, env-update, /usr/sbin/env-update, [$PATH:/usr/sbin])
56
57 AC_PATH_PROG(READLINK, greadlink)
58 if test x$READLINK = "x" ; then
59
60 Modified: trunk/libs/Makefile.am
61 ===================================================================
62 --- trunk/libs/Makefile.am 2010-01-30 11:11:57 UTC (rev 755)
63 +++ trunk/libs/Makefile.am 2010-01-30 14:22:27 UTC (rev 756)
64 @@ -29,6 +29,7 @@
65 dosed = @SED@ \
66 -e 's,\@SED\@,@SED@,g' \
67 -e 's,\@PORTAGEQ\@,@PORTAGEQ@,g' \
68 + -e 's,\@ENV_UPDATE\@,@ENV_UPDATE@,g' \
69 -e 's,\@CANONICALISE\@,@CANONICALISE@,g'
70
71 %.bash : %.bash.in
72
73 Modified: trunk/libs/package-manager.bash.in
74 ===================================================================
75 --- trunk/libs/package-manager.bash.in 2010-01-30 11:11:57 UTC (rev 755)
76 +++ trunk/libs/package-manager.bash.in 2010-01-30 14:22:27 UTC (rev 756)
77 @@ -143,3 +143,17 @@
78 paludis) run_paludis --configuration-variable ${repo} newsdir ;;
79 esac
80 }
81 +
82 +# env_update
83 +# Run env-update command, if available with the package manager
84 +# If $1 is non-zero: also run ldconfig to update /etc/ld.so.cache
85 +env_update() {
86 + local args
87 + case $(package_manager) in
88 + portage)
89 + [[ $1 -eq 0 ]] && args="--no-ldconfig"
90 + "@ENV_UPDATE@" ${args}
91 + ;;
92 + paludis) return 127 ;;
93 + esac
94 +}
95
96 Modified: trunk/modules/env.eselect
97 ===================================================================
98 --- trunk/modules/env.eselect 2010-01-30 11:11:57 UTC (rev 755)
99 +++ trunk/modules/env.eselect 2010-01-30 14:22:27 UTC (rev 756)
100 @@ -3,7 +3,7 @@
101 # Distributed under the terms of the GNU General Public License v2
102 # $Id$
103
104 -inherit config multilib
105 +inherit config multilib package-manager
106
107 DESCRIPTION="Manage environment variables set in /etc/env.d/"
108 MAINTAINER="eselect@g.o"
109 @@ -251,7 +251,8 @@
110 }
111
112 do_update() {
113 - local ldconfig=1
114 + local ldconfig=1 status
115 +
116 while [[ $# -gt 0 ]]; do
117 case ${1##--} in
118 makelinks)
119 @@ -267,12 +268,19 @@
120 shift
121 done
122
123 + # Test for sufficient permissions
124 if [[ -e ${ENVPROFILE} ]]; then
125 [[ -w ${ENVPROFILE} ]] || die -q "You need to be root!"
126 else
127 touch "${ENVPROFILE}" || die -q "You need to be root!"
128 fi
129
130 + # Use the package manager's env-update command if available,
131 + # otherwise (if 127 was returned) fall back to shell implementation
132 + env_update
133 + status=$?
134 + [[ ${status} -ne 127 ]] && return ${status}
135 +
136 # Create configuration files
137 create_profile_env
138 if [[ ${ldconfig} -ne 0 ]]; then