1 |
commit: 2ab66cffbfd5ff7111244eca0e4f7e06dcf7cae7 |
2 |
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Aug 8 22:39:19 2016 +0000 |
4 |
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Aug 8 22:39:19 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/postgresql/eselect.git/commit/?id=2ab66cff |
7 |
|
8 |
Rename global variables to something sensible |
9 |
|
10 |
Decoding those 1 character prefixes is exhausting! |
11 |
|
12 |
postgresql.eselect | 102 ++++++++++++++++++++++++++--------------------------- |
13 |
1 file changed, 51 insertions(+), 51 deletions(-) |
14 |
|
15 |
diff --git a/postgresql.eselect b/postgresql.eselect |
16 |
index 8463344..93dc723 100644 |
17 |
--- a/postgresql.eselect |
18 |
+++ b/postgresql.eselect |
19 |
@@ -9,8 +9,8 @@ MAINTAINER="pgsql-bugs@g.o" |
20 |
VERSION="1.3" |
21 |
|
22 |
# Global Data |
23 |
-B_PATH="${EROOT%/}/usr" |
24 |
-E_PATH="${EROOT%/}/etc/eselect/postgresql" |
25 |
+USR_PATH="${EROOT%/}/usr" |
26 |
+ETC_PATH="${EROOT%/}/etc/eselect/postgresql" |
27 |
ENV_FILE="${EROOT%/}/etc/env.d/50postgresql" |
28 |
|
29 |
# This list of files/directories are the symbolic link targets that need to be |
30 |
@@ -19,19 +19,19 @@ ENV_FILE="${EROOT%/}/etc/env.d/50postgresql" |
31 |
# If you change this list, remember to change include_sources in do_set. And, |
32 |
# they must be listed in the same order. |
33 |
INCLUDE_TARGETS=( |
34 |
- "${B_PATH}"/include/postgresql |
35 |
- "${B_PATH}"/include/libpq-fe.h |
36 |
- "${B_PATH}"/include/pg_config_ext.h |
37 |
- "${B_PATH}"/include/pg_config_manual.h |
38 |
- "${B_PATH}"/include/libpq |
39 |
- "${B_PATH}"/include/postgres_ext.h |
40 |
+ "${USR_PATH}"/include/postgresql |
41 |
+ "${USR_PATH}"/include/libpq-fe.h |
42 |
+ "${USR_PATH}"/include/pg_config_ext.h |
43 |
+ "${USR_PATH}"/include/pg_config_manual.h |
44 |
+ "${USR_PATH}"/include/libpq |
45 |
+ "${USR_PATH}"/include/postgres_ext.h |
46 |
) |
47 |
|
48 |
active_slot() { |
49 |
- # ${B_PATH}/share/postgresql is a symlink. See if it's there, then |
50 |
+ # ${USR_PATH}/share/postgresql is a symlink. See if it's there, then |
51 |
# find out where it links to |
52 |
- if [[ -h "${B_PATH}/share/postgresql" ]] ; then |
53 |
- canonicalise "${B_PATH}/share/postgresql" | \ |
54 |
+ if [[ -h "${USR_PATH}/share/postgresql" ]] ; then |
55 |
+ canonicalise "${USR_PATH}/share/postgresql" | \ |
56 |
sed 's|.*postgresql-\([1-9][0-9.]*\)|\1|' |
57 |
else |
58 |
echo "(none)" |
59 |
@@ -41,13 +41,13 @@ active_slot() { |
60 |
lib_dir() { |
61 |
local lib_list=$(list_libdirs) |
62 |
if [[ ${lib_list} =~ .*lib64.* && \ |
63 |
- -n $(ls -d ${B_PATH}/lib64/postgresql-*/lib64 2> /dev/null) ]] ; then |
64 |
+ -n $(ls -d ${USR_PATH}/lib64/postgresql-*/lib64 2> /dev/null) ]] ; then |
65 |
echo "lib64" |
66 |
elif [[ ${lib_list} =~ .*lib32.* && \ |
67 |
- -n $(ls -d ${B_PATH}/lib32/postgresql-*/lib32 2> /dev/null) ]] ; then |
68 |
+ -n $(ls -d ${USR_PATH}/lib32/postgresql-*/lib32 2> /dev/null) ]] ; then |
69 |
echo "lib32" |
70 |
elif [[ ${lib_list} =~ .*libx32.* && \ |
71 |
- -n $(ls -d ${B_PATH}/libx32/postgresql-*/libx32 2> /dev/null) ]] ; then |
72 |
+ -n $(ls -d ${USR_PATH}/libx32/postgresql-*/libx32 2> /dev/null) ]] ; then |
73 |
echo "libx32" |
74 |
else |
75 |
echo "lib" |
76 |
@@ -124,13 +124,13 @@ get_slots() { |
77 |
local slot |
78 |
local found_slots |
79 |
|
80 |
- for slot in $(find "${B_PATH}/$(lib_dir)/" -maxdepth 1 -type d \ |
81 |
+ for slot in $(find "${USR_PATH}/$(lib_dir)/" -maxdepth 1 -type d \ |
82 |
-regex '.*postgresql-[0-9][0-9]*\.[0-9][0-9]*' | \ |
83 |
sed -re 's#.*([0-9]+\.[0-9]+)$#\1#' | sort -n) |
84 |
do |
85 |
# Check that pg_config exists for this slot, otherwise we have |
86 |
# a false positive. |
87 |
- [[ -x "${B_PATH}/$(lib_dir)/postgresql-${slot}/bin/pg_config" ]] && \ |
88 |
+ [[ -x "${USR_PATH}/$(lib_dir)/postgresql-${slot}/bin/pg_config" ]] && \ |
89 |
found_slots+=( ${slot} ) |
90 |
done |
91 |
|
92 |
@@ -152,7 +152,7 @@ do_list() { |
93 |
local slot |
94 |
local bindir |
95 |
for slot in $(get_slots) ; do |
96 |
- bindir="${B_PATH}/$(lib_dir)/postgresql-${slot}/bin" |
97 |
+ bindir="${USR_PATH}/$(lib_dir)/postgresql-${slot}/bin" |
98 |
|
99 |
# The output of `pg_config --version` also includes "PostgreSQL" in |
100 |
# the string, which is a bit redundant. |
101 |
@@ -203,7 +203,7 @@ describe_set() { |
102 |
do_set() { |
103 |
local SLOT=$1 |
104 |
|
105 |
- if [[ ! -d ${B_PATH}/$(lib_dir)/postgresql-${SLOT} ]] ; then |
106 |
+ if [[ ! -d ${USR_PATH}/$(lib_dir)/postgresql-${SLOT} ]] ; then |
107 |
die -q "Not a valid slot." |
108 |
fi |
109 |
|
110 |
@@ -227,12 +227,12 @@ do_set() { |
111 |
# If you change this list, you must change the INCLUDE_TARGETS list, |
112 |
# too. And, they must be listed in the same order. |
113 |
local include_sources=( |
114 |
- "${B_PATH}"/include/postgresql-${SLOT} |
115 |
- "${B_PATH}"/include/postgresql-${SLOT}/libpq-fe.h |
116 |
- "${B_PATH}"/include/postgresql-${SLOT}/pg_config_ext.h |
117 |
- "${B_PATH}"/include/postgresql-${SLOT}/pg_config_manual.h |
118 |
- "${B_PATH}"/include/postgresql-${SLOT}/libpq |
119 |
- "${B_PATH}"/include/postgresql-${SLOT}/postgres_ext.h |
120 |
+ "${USR_PATH}"/include/postgresql-${SLOT} |
121 |
+ "${USR_PATH}"/include/postgresql-${SLOT}/libpq-fe.h |
122 |
+ "${USR_PATH}"/include/postgresql-${SLOT}/pg_config_ext.h |
123 |
+ "${USR_PATH}"/include/postgresql-${SLOT}/pg_config_manual.h |
124 |
+ "${USR_PATH}"/include/postgresql-${SLOT}/libpq |
125 |
+ "${USR_PATH}"/include/postgresql-${SLOT}/postgres_ext.h |
126 |
) |
127 |
|
128 |
# The linker function cannot accomadate this special purpose. |
129 |
@@ -253,24 +253,24 @@ do_set() { |
130 |
# Link modules to /usr/lib{,32,64}/ |
131 |
local x |
132 |
for x in $(list_libdirs) ; do |
133 |
- if [[ -d ${B_PATH}/${x}/postgresql-${SLOT}/${x} ]] ; then |
134 |
+ if [[ -d ${USR_PATH}/${x}/postgresql-${SLOT}/${x} ]] ; then |
135 |
# 'linker' function doesn't work for linking directories. |
136 |
# Default lib path - create a relative link |
137 |
- ln -s "postgresql-${SLOT}/${x}" "${B_PATH}/${x}/postgresql" |
138 |
+ ln -s "postgresql-${SLOT}/${x}" "${USR_PATH}/${x}/postgresql" |
139 |
|
140 |
# Linker works for files |
141 |
- linker "${B_PATH}/${x}/postgresql-${SLOT}/${x}/" \ |
142 |
- "-name lib*" "${B_PATH}/${x}" |
143 |
+ linker "${USR_PATH}/${x}/postgresql-${SLOT}/${x}/" \ |
144 |
+ "-name lib*" "${USR_PATH}/${x}" |
145 |
fi |
146 |
done |
147 |
|
148 |
# Link binaries to /usr/bin/ |
149 |
- linker "${B_PATH}/$(lib_dir)/postgresql-${SLOT}/bin/" \ |
150 |
- "-type f" "${B_PATH}/bin" |
151 |
+ linker "${USR_PATH}/$(lib_dir)/postgresql-${SLOT}/bin/" \ |
152 |
+ "-type f" "${USR_PATH}/bin" |
153 |
|
154 |
# Default share path - use a relative link here by just specifying the |
155 |
# base name |
156 |
- ln -s "postgresql-${SLOT}" "${B_PATH}/share/postgresql" |
157 |
+ ln -s "postgresql-${SLOT}" "${USR_PATH}/share/postgresql" |
158 |
|
159 |
echo "done." |
160 |
echo "Setting ${SLOT} as default was successful!" |
161 |
@@ -295,7 +295,7 @@ do_unset() { |
162 |
fi |
163 |
|
164 |
local l |
165 |
- for l in ${INCLUDE_TARGETS[@]} "${B_PATH}/share/postgresql" ; do |
166 |
+ for l in ${INCLUDE_TARGETS[@]} "${USR_PATH}/share/postgresql" ; do |
167 |
# Remove target before creating the symlink |
168 |
[[ -h ${l} ]] && rm -f "${l}" |
169 |
|
170 |
@@ -305,15 +305,15 @@ do_unset() { |
171 |
done |
172 |
|
173 |
for x in $(list_libdirs) ; do |
174 |
- if [[ -d ${B_PATH}/${x}/postgresql-${SLOT}/${x} ]] ; then |
175 |
- if [[ -h "${B_PATH}/${x}/postgresql" ]] ; then |
176 |
- rm -f "${B_PATH}/${x}/postgresql" |
177 |
- [[ -e "${B_PATH}/${x}/postgresql" ]] && \ |
178 |
- die -q "Unable to remove '${B_PATH}/${x}/postgresql'" |
179 |
+ if [[ -d ${USR_PATH}/${x}/postgresql-${SLOT}/${x} ]] ; then |
180 |
+ if [[ -h "${USR_PATH}/${x}/postgresql" ]] ; then |
181 |
+ rm -f "${USR_PATH}/${x}/postgresql" |
182 |
+ [[ -e "${USR_PATH}/${x}/postgresql" ]] && \ |
183 |
+ die -q "Unable to remove '${USR_PATH}/${x}/postgresql'" |
184 |
fi |
185 |
|
186 |
- unlinker "${B_PATH}/${x}/postgresql-${SLOT}/${x}/" \ |
187 |
- "-name lib*" "${B_PATH}/${x}" |
188 |
+ unlinker "${USR_PATH}/${x}/postgresql-${SLOT}/${x}/" \ |
189 |
+ "-name lib*" "${USR_PATH}/${x}" |
190 |
fi |
191 |
done |
192 |
} |
193 |
@@ -345,17 +345,17 @@ do_update() { |
194 |
# Remove environment files that have been generated by the ebuilds |
195 |
rm -f "${ENV_FILE}"-* |
196 |
|
197 |
- if [[ -d ${E_PATH} ]] ; then |
198 |
+ if [[ -d ${ETC_PATH} ]] ; then |
199 |
# Remove some files outright as they're entirely useless now. |
200 |
- # ${E_PATH}/active: Contents was the active slot (e.g., 9.5) |
201 |
- # ${E_PATH}/service: Told the initscript which slot to start |
202 |
+ # ${ETC_PATH}/active: Contents was the active slot (e.g., 9.5) |
203 |
+ # ${ETC_PATH}/service: Told the initscript which slot to start |
204 |
local f |
205 |
- for f in "${E_PATH}/active" "${E_PATH}/service" ; do |
206 |
+ for f in "${ETC_PATH}/active" "${ETC_PATH}/service" ; do |
207 |
[[ -e "${f}" ]] && rm -f "${f}" |
208 |
done |
209 |
|
210 |
local active_link_file |
211 |
- for active_link_file in "${E_PATH}"/active.links* ; do |
212 |
+ for active_link_file in "${ETC_PATH}"/active.links* ; do |
213 |
local active_links=($(<"${active_link_file}")) |
214 |
for (( i=0; $i < ${#active_links[@]}; i++ )) ; do |
215 |
[[ -h "${ROOT%/}/${active_links[$i]}" ]] && \ |
216 |
@@ -369,14 +369,14 @@ do_update() { |
217 |
done |
218 |
|
219 |
local unused_files |
220 |
- unused_file=$(find "${E_PATH}" -type f -not -name '.keep*') |
221 |
+ unused_file=$(find "${ETC_PATH}" -type f -not -name '.keep*') |
222 |
if [[ -n "${unused_file[@]}" ]] ; then |
223 |
write_warning_msg "You have unused files that should be removed:" |
224 |
for f in ${unused_file[@]} ; do |
225 |
write_warning_msg $f |
226 |
done |
227 |
else |
228 |
- echo "It's should be safe for you to remove '${E_PATH}'" |
229 |
+ echo "It's should be safe for you to remove '${ETC_PATH}'" |
230 |
fi |
231 |
fi |
232 |
|
233 |
@@ -405,18 +405,18 @@ do_update() { |
234 |
local ldpath |
235 |
local x |
236 |
for x in $(list_libdirs) ; do |
237 |
- [[ -h ${B_PATH}/${x}/postgresql ]] && \ |
238 |
- ldpath+="${B_PATH}/${x}/postgresql:" |
239 |
+ [[ -h ${USR_PATH}/${x}/postgresql ]] && \ |
240 |
+ ldpath+="${USR_PATH}/${x}/postgresql:" |
241 |
done |
242 |
ldpath="${ldpath%:}" |
243 |
- local manpath="${B_PATH}/share/postgresql/man/" |
244 |
+ local manpath="${USR_PATH}/share/postgresql/man/" |
245 |
while [[ $[--index] -gt -1 ]] ; do |
246 |
local curslot="${slots[$index]}" |
247 |
for x in $(list_libdirs) ; do |
248 |
- local lib_path="${B_PATH}/${x}/postgresql-${curslot}/${x}/" |
249 |
+ local lib_path="${USR_PATH}/${x}/postgresql-${curslot}/${x}/" |
250 |
[[ -d ${lib_path} ]] && ldpath+=":${lib_path}" |
251 |
done |
252 |
- local tmp_manpath="${B_PATH}/share/postgresql-${curslot}/man/" |
253 |
+ local tmp_manpath="${USR_PATH}/share/postgresql-${curslot}/man/" |
254 |
[[ -d ${tmp_manpath} ]] && manpath+=":${tmp_manpath}" |
255 |
echo "done." |
256 |
done |