[gentoo-commits] proj/postgresql/eselect:stateless commit in: /

2017-04-18 Thread Aaron Swenson
commit: a49cc145883fdb24113096e3c73a1c6f76eb46de
Author: Aaron W. Swenson  gentoo  org>
AuthorDate: Tue Apr 18 19:43:07 2017 +
Commit: Aaron Swenson  gentoo  org>
CommitDate: Tue Apr 18 19:43:07 2017 +
URL:
https://gitweb.gentoo.org/proj/postgresql/eselect.git/commit/?id=a49cc145

Change to the proper directory level for tar

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 22dec4a..f2937fe 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ V := $(shell grep V $(D)/postgresql.eselect | grep -Po 
'[0-9.]+')
 all:
mkdir -p $(D)/eselect-postgresql-$(V)
cp $(D)/postgresql.eselect $(D)/eselect-postgresql-$(V)/
-   tar cjf $(D)/eselect-postgresql-$(V).tbz2 $(D)/eselect-postgresql-$(V)
+   cd ${D} && tar cjf eselect-postgresql-$(V).tbz2 eselect-postgresql-$(V)
 
 clean:
rm $(D)/eselect-postgresql-$(V)/postgresql.eselect



[gentoo-commits] proj/postgresql/eselect:stateless commit in: /

2017-04-12 Thread Aaron Swenson
commit: 5d82111e0fe1b9002f07855a523186da5fdbeb78
Author: Aaron W. Swenson  gentoo  org>
AuthorDate: Wed Apr 12 12:54:18 2017 +
Commit: Aaron Swenson  gentoo  org>
CommitDate: Wed Apr 12 12:54:18 2017 +
URL:
https://gitweb.gentoo.org/proj/postgresql/eselect.git/commit/?id=5d82111e

Add gitignore and makefile

 .gitignore |  1 +
 Makefile   | 12 
 2 files changed, 13 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000..77482bd
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+eselect-postgresql*

diff --git a/Makefile b/Makefile
new file mode 100644
index 000..22dec4a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,12 @@
+D := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST
+V := $(shell grep V $(D)/postgresql.eselect | grep -Po '[0-9.]+')
+
+all:
+   mkdir -p $(D)/eselect-postgresql-$(V)
+   cp $(D)/postgresql.eselect $(D)/eselect-postgresql-$(V)/
+   tar cjf $(D)/eselect-postgresql-$(V).tbz2 $(D)/eselect-postgresql-$(V)
+
+clean:
+   rm $(D)/eselect-postgresql-$(V)/postgresql.eselect
+   rmdir $(D)/eselect-postgresql-$(V)
+   rm $(D)/eselect-postgresql-$(V).tbz2



[gentoo-commits] proj/postgresql/eselect:stateless commit in: /

2017-02-06 Thread Aaron Swenson
commit: fec9c553ad737a3fe6b5fae6f07b02d84ce6f7bc
Author: Aaron W. Swenson  gentoo  org>
AuthorDate: Mon Feb  6 11:49:53 2017 +
Commit: Aaron Swenson  gentoo  org>
CommitDate: Mon Feb  6 11:49:53 2017 +
URL:
https://gitweb.gentoo.org/proj/postgresql/eselect.git/commit/?id=fec9c553

Remove useless reset action

The reset action is usless as do_set calls do_unset if active_slot is
something other than (none).

 postgresql.eselect | 16 ++--
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/postgresql.eselect b/postgresql.eselect
index 67f7b74..83db02f 100644
--- a/postgresql.eselect
+++ b/postgresql.eselect
@@ -328,18 +328,6 @@ do_unset() {
done
 }
 
-### Reset Action ###
-describe_reset() {
-   echo "Recreate symbolic links for currently active slot."
-}
-
-do_reset() {
-   local slot=$(active_slot)
-   [[ ${slot} == "(none)" ]] && die -q "No active slot to reset."
-   do_unset ${slot}
-   do_set ${slot}
-}
-
 ### Update Action ###
 describe_update() {
echo "Refreshes all symbolic links managed by this module"
@@ -390,9 +378,9 @@ do_update() {
local slots=($(get_slots))
 
if [[ ${slots[@]} =~ ${active_slot} ]] ; then
-   # If active_slot is in the slots list, do a reset as the 
installation
+   # If active_slot is in the slots list, set it again as the 
installation
# may have changed.
-   do_reset
+   do_set ${active_slot}
elif [[ ${#slots[@]} -ne 0 ]] ; then
# If $slots is not empty but ${active_slot} is set, the 
active_slot
# must have been unmerged and its links need to be cleaned 
before...



[gentoo-commits] proj/postgresql/eselect:stateless commit in: /

2017-02-06 Thread Aaron Swenson
commit: 4a6f0ad3208a0e27a24377c4a2aa3d3cb78517c4
Author: Aaron W. Swenson  gentoo  org>
AuthorDate: Mon Feb  6 11:53:49 2017 +
Commit: Aaron Swenson  gentoo  org>
CommitDate: Mon Feb  6 11:53:49 2017 +
URL:
https://gitweb.gentoo.org/proj/postgresql/eselect.git/commit/?id=4a6f0ad3

Remove redundant do_unset() call

do_set() calls do_unset(). No need to call it before do_set().

 postgresql.eselect | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/postgresql.eselect b/postgresql.eselect
index 83db02f..d7229e5 100644
--- a/postgresql.eselect
+++ b/postgresql.eselect
@@ -382,11 +382,8 @@ do_update() {
# may have changed.
do_set ${active_slot}
elif [[ ${#slots[@]} -ne 0 ]] ; then
-   # If $slots is not empty but ${active_slot} is set, the 
active_slot
-   # must have been unmerged and its links need to be cleaned 
before...
-   [[ ${active_slot} != "(none)" ]] && do_unset ${active_slot}
-
-   # Setting the highest slot available.
+   # If $slots is not empty and active_slot is not in the list, 
set the
+   # highest slot available.
do_set ${slots[-1]}
elif [[ ${active_slot} != "(none)" ]] ; then
# If slots is empty, but active_slot still has a value, an 
unset must



[gentoo-commits] proj/postgresql/eselect:stateless commit in: /

2017-02-06 Thread Aaron Swenson
commit: 2901113fc0cf9f574729af30aef33cea26becbc9
Author: Aaron W. Swenson  gentoo  org>
AuthorDate: Mon Feb  6 11:43:41 2017 +
Commit: Aaron Swenson  gentoo  org>
CommitDate: Mon Feb  6 11:43:41 2017 +
URL:
https://gitweb.gentoo.org/proj/postgresql/eselect.git/commit/?id=2901113f

Eliminate some noise

Removed unnecessary echo about generating new links.

 postgresql.eselect | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/postgresql.eselect b/postgresql.eselect
index b8ecbe1..67f7b74 100644
--- a/postgresql.eselect
+++ b/postgresql.eselect
@@ -199,9 +199,8 @@ do_set() {
echo "done."
fi
 
-   echo "Setting ${slot} as the default..."
+   echo -ne "Setting ${slot} as the default..."
 
-   echo -ne "\tGenerating new links..."
# Sources for header files
# Targets are listed in the global variable INCLUDE_TARGETS.
#
@@ -264,8 +263,7 @@ do_set() {
# base name
ln -s "postgresql-${slot}" "${USR_PATH}/share/postgresql"
 
-   echo "done."
-   echo "Setting ${slot} as default was successful!"
+   echo "success!"
 }
 
 ### Unset Action ###



[gentoo-commits] proj/postgresql/eselect:stateless commit in: /

2017-02-04 Thread Aaron Swenson
commit: c92b58550953bdb5d82b1068bfb99225efd65e29
Author: Aaron W. Swenson  gmail  com>
AuthorDate: Sat Feb  4 21:10:28 2017 +
Commit: Aaron Swenson  gentoo  org>
CommitDate: Sat Feb  4 21:10:28 2017 +
URL:
https://gitweb.gentoo.org/proj/postgresql/eselect.git/commit/?id=c92b5855

Huge Changes

No longer use an environment file. All links are in locations that are
searched by default by man and pkgconfig.

Remove several files outright in /etc/eselect/postgresql as they’re
unnecessary.

Added linking for man pages and pkgconfig files.

Rename ${SLOT} to ${slot} as it isn’t a global variable.

Now compatible with the upcoming slot scheme where there is no
dot. (Release 10.0 is just 10.)

 postgresql.eselect | 262 ++---
 1 file changed, 129 insertions(+), 133 deletions(-)

diff --git a/postgresql.eselect b/postgresql.eselect
index 7ff9b83..b8ecbe1 100644
--- a/postgresql.eselect
+++ b/postgresql.eselect
@@ -1,4 +1,4 @@
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id: $
 
@@ -6,12 +6,11 @@ inherit config multilib
 
 DESCRIPTION="Manage active PostgreSQL client applications and libraries"
 MAINTAINER="pgsql-b...@gentoo.org"
-VERSION="1.3"
+VERSION="2.0"
 
-# Global Data
+# We do a lot of things in /usr and it's a bit of a pain to write this
+# constantly.
 USR_PATH="${EROOT%/}/usr"
-ETC_PATH="${EROOT%/}/etc/eselect/postgresql"
-ENV_FILE="${EROOT%/}/etc/env.d/50postgresql"
 
 # This list of files/directories are the symbolic link targets that need to be
 # created when a slot is set.
@@ -28,11 +27,11 @@ INCLUDE_TARGETS=(
 )
 
 active_slot() {
-# ${USR_PATH}/share/postgresql is a symlink. See if it's there, then
-# find out where it links to
+# ${USR_PATH}/share/postgresql is a symlink to the active
+# slot. See if it's there, then find out where it links to.
if [[ -h "${USR_PATH}/share/postgresql" ]] ; then
canonicalise "${USR_PATH}/share/postgresql" | \
-sed 's|.*postgresql-\([1-9][0-9.]*\)|\1|'
+   sed -re 's#.*([1-9][0-9.]+)$#\1#'
else
echo "(none)"
fi
@@ -86,7 +85,7 @@ linker() {
local findings
local rel_source
 
-   findings=$(finder "${source_dir}" ${pattern})
+   findings=$(finder "${source_dir}" "${pattern}")
 
for link_source in ${findings} ; do
local link_target="${target_dir%/}/$(basename 
${link_source})${suffix}"
@@ -109,9 +108,9 @@ get_slots() {
local slot
local found_slots
 
-   for slot in $(find "${USR_PATH}/$(lib_dir)/" -maxdepth 1 -type d \
-   -regex '.*/postgresql-[1-9][0-9]*\.*[0-9]*' | \
-   sed -re 's#.*([1-9][0-9]*\.*[0-9]*)$#\1#' | sort -n)
+   for slot in $(find "${USR_PATH}/$(lib_dir)/" \
+  -mindepth 1 -maxdepth 1 -type d 
-name 'postgresql-*' | \
+sed -re 
's#.*([1-9][0-9.]+)$#\1#' | sort -n)
do
# Check that pg_config exists for this slot, otherwise we have
# a false positive.
@@ -186,24 +185,21 @@ describe_set() {
 }
 
 do_set() {
-   local SLOT=$1
+   local slot=$1
 
-   if [[ ! -d ${USR_PATH}/$(lib_dir)/postgresql-${SLOT} ]] ; then
+   if [[ ! -d ${USR_PATH}/$(lib_dir)/postgresql-${slot} ]] ; then
die -q "Not a valid slot."
fi
 
# If there's an active slot, unset that one first
-   if [[  "$(active_slot)" == "${SLOT}" ]] ; then
-   echo $(highlight "No work to do.")
-   echo "If you think the links need to be reset, use the reset 
action."
-   return 0
-   elif [[ "$(active_slot)" != "(none)" ]] ; then
-   echo -ne "\tRemoving old links..."
-   do_unset $(active_slot)
+   local active_slot=$(active_slot)
+   if [[ "${active_slot}" != "(none)" ]] ; then
+   echo -ne "Unsetting ${active_slot} as default..."
+   do_unset ${active_slot}
echo "done."
fi
 
-   echo "Setting ${SLOT} as the default installation..."
+   echo "Setting ${slot} as the default..."
 
echo -ne "\tGenerating new links..."
# Sources for header files
@@ -212,12 +208,12 @@ do_set() {
# If you change this list, you must change the INCLUDE_TARGETS list,
# too. And, they must be listed in the same order.
local include_sources=(
-   "${USR_PATH}"/include/postgresql-${SLOT}
-   "${USR_PATH}"/include/postgresql-${SLOT}/libpq-fe.h
-   "${USR_PATH}"/include/postgresql-${SLOT}/pg_config_ext.h
-   "${USR_PATH}"/include/postgresql-${SLOT}/pg_config_manual.h
-   "${USR_PATH}"/include/postgresql-${SLOT}/libpq
-