From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 9D32C139694 for ; Tue, 18 Apr 2017 19:43:49 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5032E21C0A1; Tue, 18 Apr 2017 19:43:41 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1F6B521C0A1 for ; Tue, 18 Apr 2017 19:43:41 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E51EC3416A1 for ; Tue, 18 Apr 2017 19:43:39 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6DD3C743D for ; Tue, 18 Apr 2017 19:43:37 +0000 (UTC) From: "Aaron Swenson" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Aaron Swenson" Message-ID: <1477852069.bf55487f97abc7370d1ac4acefa521ef6baeecb8.titanofold@gentoo> Subject: [gentoo-commits] proj/postgresql/eselect:master commit in: / X-VCS-Repository: proj/postgresql/eselect X-VCS-Files: postgresql.eselect X-VCS-Directories: / X-VCS-Committer: titanofold X-VCS-Committer-Name: Aaron Swenson X-VCS-Revision: bf55487f97abc7370d1ac4acefa521ef6baeecb8 X-VCS-Branch: master Date: Tue, 18 Apr 2017 19:43:37 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 1b473a7e-13a1-46b0-af76-10d6ea616a32 X-Archives-Hash: e787b947efe125cc0bb755b69bb068cf commit: bf55487f97abc7370d1ac4acefa521ef6baeecb8 Author: Aaron W. Swenson gentoo org> AuthorDate: Sun Oct 30 18:27:49 2016 +0000 Commit: Aaron Swenson gentoo org> CommitDate: Sun Oct 30 18:27:49 2016 +0000 URL: https://gitweb.gentoo.org/proj/postgresql/eselect.git/commit/?id=bf55487f Add pkg-config support Among some other cleanups, add pkg-config support. postgresql.eselect | 59 +++++++++++++++++++++++------------------------------- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/postgresql.eselect b/postgresql.eselect index 9bb009a..7ff9b83 100644 --- a/postgresql.eselect +++ b/postgresql.eselect @@ -103,19 +103,6 @@ linker() { done } -### TODO: Refactor so that it searches source directories for removal targets, -### and move the old stuff into do_update - -### Unlinker Function ### -# Takes one argument: -# - Full path to active links file (e.g. /etc/eselect/postgresql/active.links) -unlinker() { - local dir - local pattern - local findings - -} - ### Get Slots Function ### # Find all available slots in the preferred lib_dir() and return them. get_slots() { @@ -123,8 +110,8 @@ get_slots() { local found_slots for slot in $(find "${USR_PATH}/$(lib_dir)/" -maxdepth 1 -type d \ - -regex '.*postgresql-[0-9][0-9]*\.[0-9][0-9]*' | \ - sed -re 's#.*([0-9]+\.[0-9]+)$#\1#' | sort -n) + -regex '.*/postgresql-[1-9][0-9]*\.*[0-9]*' | \ + sed -re 's#.*([1-9][0-9]*\.*[0-9]*)$#\1#' | sort -n) do # Check that pg_config exists for this slot, otherwise we have # a false positive. @@ -282,19 +269,13 @@ describe_unset() { # Undo everything done by do_set(). do_unset() { local SLOT=$1 - if [[ ${SLOT} = $(active_slot) ]] ; then - echo -n "Unsetting ${SLOT} as the default installation..." - - echo "done." - echo "Setting a new slot as the default." - do_update - else - echo "Inactive slot selected. No work to do." + if [[ ${SLOT} != $(active_slot) ]] ; then + echo "Slot already inactive; no work to do." + return 0 fi local l for l in ${INCLUDE_TARGETS[@]} "${USR_PATH}/share/postgresql" ; do - # Remove target before creating the symlink [[ -h ${l} ]] && rm -f "${l}" # Check if include target still exists @@ -302,16 +283,19 @@ do_unset() { die -q "The target '${l}' exists and could not be removed!" done + for l in $(find "${USR_PATH}/bin" -type l) ; do + if [[ $(realpath ${l} | grep -c postgresql) -ge 1 ]] ; then + rm "${l}" + fi + done + for x in $(list_libdirs) ; do - if [[ -d ${USR_PATH}/${x}/postgresql-${SLOT}/${x} ]] ; then - if [[ -h "${USR_PATH}/${x}/postgresql" ]] ; then - rm -f "${USR_PATH}/${x}/postgresql" - [[ -e "${USR_PATH}/${x}/postgresql" ]] && \ - die -q "Unable to remove '${USR_PATH}/${x}/postgresql'" - fi - - unlinker "${USR_PATH}/${x}/postgresql-${SLOT}/${x}/" \ - "-name lib*" "${USR_PATH}/${x}" + if [[ -h "${USR_PATH}/${x}/postgresql" ]] ; then + for l in $(find "${USR_PATH}/${x}" -type l) ; do + if [[ $(realpath ${l} | grep -c postgresql) -ge 1 ]] ; then + rm "${l}" + fi + done fi done } @@ -401,18 +385,24 @@ do_update() { # Update paths to libs and man pages local ldpath + local pcpath local x for x in $(list_libdirs) ; do - [[ -h ${USR_PATH}/${x}/postgresql ]] && \ + if [[ -h ${USR_PATH}/${x}/postgresql ]] ; then ldpath+="${USR_PATH}/${x}/postgresql:" + pcpath+="${USR_PATH}/${x}/postgresql/pkgconfig:" + fi done ldpath="${ldpath%:}" + pcdpath="${pcpath%:}" local manpath="${USR_PATH}/share/postgresql/man/" while [[ $[--index] -gt -1 ]] ; do local curslot="${slots[$index]}" for x in $(list_libdirs) ; do local lib_path="${USR_PATH}/${x}/postgresql-${curslot}/${x}/" + local pkg_path="${lib_path}/pkgconfig" [[ -d ${lib_path} ]] && ldpath+=":${lib_path}" + [[ -d ${pkg_path} ]] && pcpath+=":${pcpath}" done local tmp_manpath="${USR_PATH}/share/postgresql-${curslot}/man/" [[ -d ${tmp_manpath} ]] && manpath+=":${tmp_manpath}" @@ -421,5 +411,6 @@ do_update() { store_config "${ENV_FILE}" LDPATH "${ldpath}" store_config "${ENV_FILE}" MANPATH "${manpath}" + store_config "${ENV_FILE}" PKG_CONFIG_PATH "${pcpath}" do_action env update &> /dev/null }