1 |
commit: bf55487f97abc7370d1ac4acefa521ef6baeecb8 |
2 |
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Oct 30 18:27:49 2016 +0000 |
4 |
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Oct 30 18:27:49 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/postgresql/eselect.git/commit/?id=bf55487f |
7 |
|
8 |
Add pkg-config support |
9 |
|
10 |
Among some other cleanups, add pkg-config support. |
11 |
|
12 |
postgresql.eselect | 59 +++++++++++++++++++++++------------------------------- |
13 |
1 file changed, 25 insertions(+), 34 deletions(-) |
14 |
|
15 |
diff --git a/postgresql.eselect b/postgresql.eselect |
16 |
index 9bb009a..7ff9b83 100644 |
17 |
--- a/postgresql.eselect |
18 |
+++ b/postgresql.eselect |
19 |
@@ -103,19 +103,6 @@ linker() { |
20 |
done |
21 |
} |
22 |
|
23 |
-### TODO: Refactor so that it searches source directories for removal targets, |
24 |
-### and move the old stuff into do_update |
25 |
- |
26 |
-### Unlinker Function ### |
27 |
-# Takes one argument: |
28 |
-# - Full path to active links file (e.g. /etc/eselect/postgresql/active.links) |
29 |
-unlinker() { |
30 |
- local dir |
31 |
- local pattern |
32 |
- local findings |
33 |
- |
34 |
-} |
35 |
- |
36 |
### Get Slots Function ### |
37 |
# Find all available slots in the preferred lib_dir() and return them. |
38 |
get_slots() { |
39 |
@@ -123,8 +110,8 @@ get_slots() { |
40 |
local found_slots |
41 |
|
42 |
for slot in $(find "${USR_PATH}/$(lib_dir)/" -maxdepth 1 -type d \ |
43 |
- -regex '.*postgresql-[0-9][0-9]*\.[0-9][0-9]*' | \ |
44 |
- sed -re 's#.*([0-9]+\.[0-9]+)$#\1#' | sort -n) |
45 |
+ -regex '.*/postgresql-[1-9][0-9]*\.*[0-9]*' | \ |
46 |
+ sed -re 's#.*([1-9][0-9]*\.*[0-9]*)$#\1#' | sort -n) |
47 |
do |
48 |
# Check that pg_config exists for this slot, otherwise we have |
49 |
# a false positive. |
50 |
@@ -282,19 +269,13 @@ describe_unset() { |
51 |
# Undo everything done by do_set(). |
52 |
do_unset() { |
53 |
local SLOT=$1 |
54 |
- if [[ ${SLOT} = $(active_slot) ]] ; then |
55 |
- echo -n "Unsetting ${SLOT} as the default installation..." |
56 |
- |
57 |
- echo "done." |
58 |
- echo "Setting a new slot as the default." |
59 |
- do_update |
60 |
- else |
61 |
- echo "Inactive slot selected. No work to do." |
62 |
+ if [[ ${SLOT} != $(active_slot) ]] ; then |
63 |
+ echo "Slot already inactive; no work to do." |
64 |
+ return 0 |
65 |
fi |
66 |
|
67 |
local l |
68 |
for l in ${INCLUDE_TARGETS[@]} "${USR_PATH}/share/postgresql" ; do |
69 |
- # Remove target before creating the symlink |
70 |
[[ -h ${l} ]] && rm -f "${l}" |
71 |
|
72 |
# Check if include target still exists |
73 |
@@ -302,16 +283,19 @@ do_unset() { |
74 |
die -q "The target '${l}' exists and could not be removed!" |
75 |
done |
76 |
|
77 |
+ for l in $(find "${USR_PATH}/bin" -type l) ; do |
78 |
+ if [[ $(realpath ${l} | grep -c postgresql) -ge 1 ]] ; then |
79 |
+ rm "${l}" |
80 |
+ fi |
81 |
+ done |
82 |
+ |
83 |
for x in $(list_libdirs) ; do |
84 |
- if [[ -d ${USR_PATH}/${x}/postgresql-${SLOT}/${x} ]] ; then |
85 |
- if [[ -h "${USR_PATH}/${x}/postgresql" ]] ; then |
86 |
- rm -f "${USR_PATH}/${x}/postgresql" |
87 |
- [[ -e "${USR_PATH}/${x}/postgresql" ]] && \ |
88 |
- die -q "Unable to remove '${USR_PATH}/${x}/postgresql'" |
89 |
- fi |
90 |
- |
91 |
- unlinker "${USR_PATH}/${x}/postgresql-${SLOT}/${x}/" \ |
92 |
- "-name lib*" "${USR_PATH}/${x}" |
93 |
+ if [[ -h "${USR_PATH}/${x}/postgresql" ]] ; then |
94 |
+ for l in $(find "${USR_PATH}/${x}" -type l) ; do |
95 |
+ if [[ $(realpath ${l} | grep -c postgresql) -ge 1 ]] ; then |
96 |
+ rm "${l}" |
97 |
+ fi |
98 |
+ done |
99 |
fi |
100 |
done |
101 |
} |
102 |
@@ -401,18 +385,24 @@ do_update() { |
103 |
|
104 |
# Update paths to libs and man pages |
105 |
local ldpath |
106 |
+ local pcpath |
107 |
local x |
108 |
for x in $(list_libdirs) ; do |
109 |
- [[ -h ${USR_PATH}/${x}/postgresql ]] && \ |
110 |
+ if [[ -h ${USR_PATH}/${x}/postgresql ]] ; then |
111 |
ldpath+="${USR_PATH}/${x}/postgresql:" |
112 |
+ pcpath+="${USR_PATH}/${x}/postgresql/pkgconfig:" |
113 |
+ fi |
114 |
done |
115 |
ldpath="${ldpath%:}" |
116 |
+ pcdpath="${pcpath%:}" |
117 |
local manpath="${USR_PATH}/share/postgresql/man/" |
118 |
while [[ $[--index] -gt -1 ]] ; do |
119 |
local curslot="${slots[$index]}" |
120 |
for x in $(list_libdirs) ; do |
121 |
local lib_path="${USR_PATH}/${x}/postgresql-${curslot}/${x}/" |
122 |
+ local pkg_path="${lib_path}/pkgconfig" |
123 |
[[ -d ${lib_path} ]] && ldpath+=":${lib_path}" |
124 |
+ [[ -d ${pkg_path} ]] && pcpath+=":${pcpath}" |
125 |
done |
126 |
local tmp_manpath="${USR_PATH}/share/postgresql-${curslot}/man/" |
127 |
[[ -d ${tmp_manpath} ]] && manpath+=":${tmp_manpath}" |
128 |
@@ -421,5 +411,6 @@ do_update() { |
129 |
|
130 |
store_config "${ENV_FILE}" LDPATH "${ldpath}" |
131 |
store_config "${ENV_FILE}" MANPATH "${manpath}" |
132 |
+ store_config "${ENV_FILE}" PKG_CONFIG_PATH "${pcpath}" |
133 |
do_action env update &> /dev/null |
134 |
} |