[gentoo-commits] proj/eselect:master commit in: libs/, bin/, /

2023-05-12 Thread Ulrich Müller
commit: ad863d288f29bcca776369dec7765dbb0174ba82
Author: Ulrich Müller  gentoo  org>
AuthorDate: Thu May 11 17:04:20 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Thu May 11 17:04:20 2023 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=ad863d28

Don't autodetect bash and env-update at configure time

* bin/eselect.in: Update shebang to use EPREFIX. Bug 905934.
* bin/Makefile.am (dosed): Don't substitute BASH.
* libs/package-manager.bash.in (env_update): Don't use an absolute
path for env-update.
* libs/Makefile.am (dosed): Don't substitute ENV_UPDATE.
* configure.ac: Drop checks for bash and env-update paths.

Bug: https://bugs.gentoo.org/905934
Signed-off-by: Ulrich Müller  gentoo.org>

 ChangeLog|  7 +++
 bin/Makefile.am  |  3 +--
 bin/eselect.in   |  2 +-
 configure.ac | 12 
 libs/Makefile.am |  1 -
 libs/package-manager.bash.in |  4 ++--
 6 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0684481..ce13578 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2023-05-11  Ulrich Müller  
 
+   * bin/eselect.in: Update shebang to use EPREFIX. Bug 905934.
+   * bin/Makefile.am (dosed): Don't substitute BASH.
+   * libs/package-manager.bash.in (env_update): Don't use an absolute
+   path for env-update.
+   * libs/Makefile.am (dosed): Don't substitute ENV_UPDATE.
+   * configure.ac: Drop checks for bash and env-update paths.
+
* libs/Makefile.am (dosed): Don't substitute PORTAGEQ, it no
longer exists in configure.
 

diff --git a/bin/Makefile.am b/bin/Makefile.am
index 20902c1..a4bf2a2 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -1,8 +1,7 @@
 bin_SCRIPTS = eselect
 EXTRA_DIST = eselect.in
 
-dosed = @SED@ -e 's%\@BASH\@%$(BASH)%g' \
- -e 's%\@DATADIR\@%$(datadir)%g' \
+dosed = @SED@ -e 's%\@DATADIR\@%$(datadir)%g' \
  -e 's%\@EPREFIX\@%$(EPREFIX)%g' \
  -e 's%\@VERSION\@%$(VERSION)$(EXTRAVERSION)%g'
 

diff --git a/bin/eselect.in b/bin/eselect.in
index 7a74098..9109627 100755
--- a/bin/eselect.in
+++ b/bin/eselect.in
@@ -1,4 +1,4 @@
-#!@BASH@
+#!@EPREFIX@/bin/bash
 # -*-eselect-*-  vim: ft=eselect
 # Copyright (c) 2005-2023 Gentoo Authors
 #

diff --git a/configure.ac b/configure.ac
index e767884..3d5741b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,15 +8,6 @@ test x$prefix = xNONE && prefix="$ac_default_prefix"
 test x$datadir = xNONE && datadir="$ac_default_datadir"
 test x$sysconfdir = xNONE && sysconfdir="$ac_default_sysconfdir"
 
-# BASH may already be set in the shell, if the admin then changes the
-# the /bin/sh symlink to a non-bash shell, all hell will break lose.
-# thanks to James Rowe for the heads up.
-unset BASH
-AC_PATH_PROGS(BASH, bash)
-if test x$BASH = x; then
-AC_MSG_ERROR([bash is required])
-fi
-
 # AC_PROG_SED doesn't work here, because on Gentoo FreeBSD systems it
 # is confused by a wrapper script that is in the PATH at build time.
 AC_CHECK_PROGS(SED, [gsed sed])
@@ -31,9 +22,6 @@ else
 AC_MSG_ERROR([GNU sed is required])
 fi
 
-AC_PATH_PROG(ENV_UPDATE, env-update, /usr/sbin/env-update,
-  [$PATH:$prefix/sbin:/usr/sbin])
-
 CANONICALISE=""
 # realpath is included with Coreutils since version 8.15 (2012)
 AC_CHECK_PROGS(REALPATH, [grealpath realpath])

diff --git a/libs/Makefile.am b/libs/Makefile.am
index c5f3de3..debaa1d 100644
--- a/libs/Makefile.am
+++ b/libs/Makefile.am
@@ -28,7 +28,6 @@ EXTRA_DIST = \
 
 dosed = @SED@ \
-e 's%\@SED\@%@SED@%g' \
-   -e 's%\@ENV_UPDATE\@%@ENV_UPDATE@%g' \
-e 's%\@CANONICALISE\@%@CANONICALISE@%g' \
-e 's%\@libdir\@%@libdir@%g'
 

diff --git a/libs/package-manager.bash.in b/libs/package-manager.bash.in
index c32fcb4..7688b96 100644
--- a/libs/package-manager.bash.in
+++ b/libs/package-manager.bash.in
@@ -1,5 +1,5 @@
 # -*-eselect-*-  vim: ft=eselect
-# Copyright (c) 2005-2021 Gentoo Authors
+# Copyright (c) 2005-2023 Gentoo Authors
 #
 # This file is part of the 'eselect' tools framework.
 #
@@ -209,7 +209,7 @@ env_update() {
local noldconfig
[[ $1 -ne 0 ]] || noldconfig=y
case $(package_manager) in
-   portage) "@ENV_UPDATE@" ${noldconfig:+--no-ldconfig} ;;
+   portage) env-update ${noldconfig:+--no-ldconfig} ;;
pkgcore) pmaint env-update ${noldconfig:+--skip-ldconfig} ;;
paludis) return 127 ;;
esac



[gentoo-commits] proj/eselect:master commit in: libs/, /

2023-05-12 Thread Ulrich Müller
commit: 9a77220d8ef4f4cca4e95be0af8e67571cc5f5ad
Author: Ulrich Müller  gentoo  org>
AuthorDate: Thu May 11 16:59:57 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Thu May 11 16:59:57 2023 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=9a77220d

Don't substitute PORTAGEQ in libs

* libs/Makefile.am (dosed): Don't substitute PORTAGEQ, it no
longer exists in configure.

Signed-off-by: Ulrich Müller  gentoo.org>

 ChangeLog| 5 +
 libs/Makefile.am | 1 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index f807496..0684481 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-05-11  Ulrich Müller  
+
+   * libs/Makefile.am (dosed): Don't substitute PORTAGEQ, it no
+   longer exists in configure.
+
 2023-03-20  Ulrich Müller  
 
* configure.ac: Update version to 1.4.22.

diff --git a/libs/Makefile.am b/libs/Makefile.am
index 6ebd08e..c5f3de3 100644
--- a/libs/Makefile.am
+++ b/libs/Makefile.am
@@ -28,7 +28,6 @@ EXTRA_DIST = \
 
 dosed = @SED@ \
-e 's%\@SED\@%@SED@%g' \
-   -e 's%\@PORTAGEQ\@%@PORTAGEQ@%g' \
-e 's%\@ENV_UPDATE\@%@ENV_UPDATE@%g' \
-e 's%\@CANONICALISE\@%@CANONICALISE@%g' \
-e 's%\@libdir\@%@libdir@%g'



[gentoo-commits] proj/eselect:master commit in: /, libs/

2023-03-14 Thread Ulrich Müller
commit: c7e76fc0b9add97eda8cf406cbd168a1997e9ae3
Author: Florian Schmaus  gentoo  org>
AuthorDate: Tue Mar 14 14:23:07 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Tue Mar 14 16:54:40 2023 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=c7e76fc0

Allow to specify modules by path

* libs/core.bash.in (find_module): Allow to specify an absolute
path as the module's filename.

Bug: https://bugs.gentoo.org/901205
Signed-off-by: Florian Schmaus  gentoo.org>
Signed-off-by: Ulrich Müller  gentoo.org>

 ChangeLog |  5 +
 libs/core.bash.in | 11 ++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index aab936d..57a53fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-03-14  Florian Schmaus  
+
+   * libs/core.bash.in (find_module): Allow to specify an absolute
+   path as the module's filename.
+
 2023-02-28  Ulrich Müller  
 
* bin/eselect.in: Disable colours if NO_COLOR is nonempty.

diff --git a/libs/core.bash.in b/libs/core.bash.in
index 740354e..2800cc5 100644
--- a/libs/core.bash.in
+++ b/libs/core.bash.in
@@ -1,5 +1,5 @@
 # -*-eselect-*-  vim: ft=eselect
-# Copyright (c) 2005-2020 Gentoo Authors
+# Copyright (c) 2005-2023 Gentoo Authors
 #
 # This file is part of the 'eselect' tools framework.
 #
@@ -69,6 +69,15 @@ die() {
 # Find module and echo its filename. Die if module doesn't exist.
 find_module() {
local modname=$1 modpath
+
+   if [[ ${modname} == */* ]]; then
+   if [[ ${modname} == *.eselect && -f ${modname} ]]; then
+   echo "${modname}"
+   return
+   fi
+   die -q "Can't load module ${modname}"
+   fi
+
for modpath in "${ESELECT_MODULES_PATH[@]}"; do
if [[ -f ${modpath}/${modname}.eselect ]]; then
echo "${modpath}/${modname}.eselect"



[gentoo-commits] proj/eselect:master commit in: libs/, /

2023-03-14 Thread Ulrich Müller
commit: ea6e42593c5d070462f450341b561bb415ad1bac
Author: Florian Schmaus  gentoo  org>
AuthorDate: Tue Mar 14 14:23:07 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Tue Mar 14 16:52:06 2023 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=ea6e4259

Allow to specify modules by path

* libs/core.bash.in (find_module): Allow to specify an absolute
path as the module's filename.

Bug: https://bugs.gentoo.org/901205
Signed-off-by: Florian Schmaus  gentoo.org>
Signed-off-by: Ulrich Müller  gentoo.org>

 ChangeLog |  5 +
 libs/core.bash.in | 11 ++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index aab936d..4b57867 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-03-14  Ulrich Müller  
+
+   * libs/core.bash.in (find_module): Allow to specify an absolute
+   path as the module's filename.
+
 2023-02-28  Ulrich Müller  
 
* bin/eselect.in: Disable colours if NO_COLOR is nonempty.

diff --git a/libs/core.bash.in b/libs/core.bash.in
index 740354e..2800cc5 100644
--- a/libs/core.bash.in
+++ b/libs/core.bash.in
@@ -1,5 +1,5 @@
 # -*-eselect-*-  vim: ft=eselect
-# Copyright (c) 2005-2020 Gentoo Authors
+# Copyright (c) 2005-2023 Gentoo Authors
 #
 # This file is part of the 'eselect' tools framework.
 #
@@ -69,6 +69,15 @@ die() {
 # Find module and echo its filename. Die if module doesn't exist.
 find_module() {
local modname=$1 modpath
+
+   if [[ ${modname} == */* ]]; then
+   if [[ ${modname} == *.eselect && -f ${modname} ]]; then
+   echo "${modname}"
+   return
+   fi
+   die -q "Can't load module ${modname}"
+   fi
+
for modpath in "${ESELECT_MODULES_PATH[@]}"; do
if [[ -f ${modpath}/${modname}.eselect ]]; then
echo "${modpath}/${modname}.eselect"



[gentoo-commits] proj/eselect:master commit in: /, libs/

2021-08-26 Thread Ulrich Müller
commit: a49477f39d3f000cc2ca57f18aafbd66656aba05
Author: Ulrich Müller  gentoo  org>
AuthorDate: Tue Aug 24 12:13:08 2021 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Tue Aug 24 12:13:08 2021 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=a49477f3

Recognise loongarch*/loong in package-manager lib

* libs/package-manager.bash.in (arch): Recognise loongarch*/loong.

Signed-off-by: Ulrich Müller  gentoo.org>

 ChangeLog| 4 
 libs/package-manager.bash.in | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index dfdfe47..f2ea0b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2021-08-24  Ulrich Müller  
+
+   * libs/package-manager.bash.in (arch): Recognise loongarch*/loong.
+
 2021-02-17  Ulrich Müller  
 
* modules/news.eselect (do_list): Recognise "new" and "all"

diff --git a/libs/package-manager.bash.in b/libs/package-manager.bash.in
index 35a1e11..c32fcb4 100644
--- a/libs/package-manager.bash.in
+++ b/libs/package-manager.bash.in
@@ -1,5 +1,5 @@
 # -*-eselect-*-  vim: ft=eselect
-# Copyright (c) 2005-2020 Gentoo Authors
+# Copyright (c) 2005-2021 Gentoo Authors
 #
 # This file is part of the 'eselect' tools framework.
 #
@@ -76,6 +76,7 @@ arch() {
hppa*)  ret=hppa;;
i?86)   ret=x86 ;;
ia64*)  ret=ia64;;
+   loongarch*) ret=loong   ;;
m68k*)  ret=m68k;;
mips*)  ret=mips;;
nios2)  ret=nios2   ;;



[gentoo-commits] proj/eselect:master commit in: libs/, bin/, /, modules/, doc/, misc/, man/

2020-12-16 Thread Ulrich Müller
commit: 3ea2cdf4b80fd7f1285bf9d129788cb8ccb92c9f
Author: Ulrich Müller  gentoo  org>
AuthorDate: Wed Dec 16 11:34:21 2020 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Wed Dec 16 11:34:21 2020 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=3ea2cdf4

Update copyright years.

Signed-off-by: Ulrich Müller  gentoo.org>

 README | 2 +-
 bin/eselect.in | 4 ++--
 doc/developer-guide.txt| 2 +-
 libs/config.bash.in| 2 +-
 libs/core.bash.in  | 2 +-
 libs/default.eselect.in| 2 +-
 libs/editor-variable.bash.in   | 2 +-
 libs/manip.bash.in | 2 +-
 libs/multilib.bash.in  | 2 +-
 libs/output.bash.in| 2 +-
 libs/package-manager.bash.in   | 2 +-
 libs/path-manipulation.bash.in | 2 +-
 libs/skel.bash.in  | 2 +-
 libs/tests.bash.in | 2 +-
 man/editor.eselect.5   | 2 +-
 man/env.eselect.5  | 2 +-
 man/eselect.1  | 2 +-
 man/kernel.eselect.5   | 2 +-
 man/news.eselect.5 | 2 +-
 man/pager.eselect.5| 2 +-
 man/profile.eselect.5  | 2 +-
 man/rc.eselect.5   | 2 +-
 man/visual.eselect.5   | 2 +-
 misc/eselect-mode.el   | 2 +-
 misc/eselect.bashcomp  | 2 +-
 modules/config.eselect | 2 +-
 modules/cow.eselect| 2 +-
 modules/editor.eselect | 2 +-
 modules/env.eselect| 2 +-
 modules/kernel.eselect | 2 +-
 modules/locale.eselect | 2 +-
 modules/modules.eselect| 2 +-
 modules/news.eselect   | 2 +-
 modules/pager.eselect  | 2 +-
 modules/profile.eselect| 2 +-
 modules/rc.eselect | 2 +-
 modules/visual.eselect | 2 +-
 37 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/README b/README
index bfcb6f9..e9f2a76 100644
--- a/README
+++ b/README
@@ -14,7 +14,7 @@ See ``doc/``. Use ``make html`` for HTML versions.
 Copyright
 -
 
-eselect is Copyright (c) 2005-2019 Gentoo Authors. This code is
+eselect is Copyright (c) 2005-2020 Gentoo Authors. This code is
 distributed under the terms of the `GNU General Public License,
 version 2 or later`__.
 

diff --git a/bin/eselect.in b/bin/eselect.in
index f9d4d0b..5d3fc9b 100755
--- a/bin/eselect.in
+++ b/bin/eselect.in
@@ -1,6 +1,6 @@
 #!@BASH@
 # -*-eselect-*-  vim: ft=eselect
-# Copyright (c) 2005-2019 Gentoo Authors
+# Copyright (c) 2005-2020 Gentoo Authors
 #
 # This file is part of the 'eselect' tools framework.
 #
@@ -98,7 +98,7 @@ es_do_help() {
 es_do_version() {
echo "eselect ${ESELECT_VERSION}"
echo
-   echo "Copyright (c) 2005-2019 Gentoo Authors."
+   echo "Copyright (c) 2005-2020 Gentoo Authors."
echo "Distributed under the terms of the GNU GPL version 2 or later."
 }
 

diff --git a/doc/developer-guide.txt b/doc/developer-guide.txt
index ffe095c..694b64d 100644
--- a/doc/developer-guide.txt
+++ b/doc/developer-guide.txt
@@ -31,7 +31,7 @@ and ``set``, plus the standard ``help``, ``usage``, and 
``version``
 actions, and is installed to ``$(datadir)/eselect/modules/`` ::
 
 # -*-eselect-*-  vim: ft=eselect
-# Copyright 2005-2019 Gentoo Authors
+# Copyright 2005-2020 Gentoo Authors
 # Distributed under the terms of the GNU GPL version 2 or later
 
 DESCRIPTION="Manage the /usr/src/linux symlink"

diff --git a/libs/config.bash.in b/libs/config.bash.in
index 78d2d75..9e36aa2 100644
--- a/libs/config.bash.in
+++ b/libs/config.bash.in
@@ -1,5 +1,5 @@
 # -*-eselect-*-  vim: ft=eselect
-# Copyright (c) 2005-2019 Gentoo Authors
+# Copyright (c) 2005-2020 Gentoo Authors
 #
 # This file is part of the 'eselect' tools framework.
 #

diff --git a/libs/core.bash.in b/libs/core.bash.in
index 46c08bd..740354e 100644
--- a/libs/core.bash.in
+++ b/libs/core.bash.in
@@ -1,5 +1,5 @@
 # -*-eselect-*-  vim: ft=eselect
-# Copyright (c) 2005-2019 Gentoo Authors
+# Copyright (c) 2005-2020 Gentoo Authors
 #
 # This file is part of the 'eselect' tools framework.
 #

diff --git a/libs/default.eselect.in b/libs/default.eselect.in
index 8c34ef4..45636f6 100644
--- a/libs/default.eselect.in
+++ b/libs/default.eselect.in
@@ -1,5 +1,5 @@
 # -*-eselect-*-  vim: ft=eselect
-# Copyright (c) 2005-2019 Gentoo Authors
+# Copyright (c) 2005-2020 Gentoo Authors
 #
 # This file is part of the 'eselect' tools framework.
 #

diff --git a/libs/editor-variable.bash.in b/libs/editor-variable.bash.in
index a3bfdc7..b7420b1 100644
--- a/libs/editor-variable.bash.in
+++ b/libs/editor-variable.bash.in
@@ -1,5 +1,5 @@
 # -*-eselect-*-  vim: ft=eselect
-# Copyright (c) 2005-2019 Gentoo Authors
+# Copyright (c) 2005-2020 Gentoo Authors
 #
 # This file is part of the 'eselect' tools framework.
 #

diff --git a/libs/manip.bash.in b/libs/manip.bash.in
index 2c16001..e7dc730 100644
--- a/libs/manip.bash.in
+++ b/libs/manip.bash.in
@@ -1,5 +1,5 @@
 # -*-eselect-*-  vim: ft=eselect

[gentoo-commits] proj/eselect:master commit in: libs/, man/, /, modules/

2019-09-02 Thread Ulrich Müller
commit: 0905154aae24c2f17b137b45f5a1dd11fb4774fb
Author: Ulrich Müller  gentoo  org>
AuthorDate: Mon Sep  2 10:25:45 2019 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Mon Sep  2 10:25:45 2019 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=0905154a

Support relative pathnames in editor-variable library.

* libs/editor-variable.bash.in (find_in_path): New function, looks
up its first argument in EDITOR_PATH, and tests if it exists.
(find_targets, do_set): Use it.
* modules/pager.eselect (EDITOR_LIST):
* modules/editor.eselect (EDITOR_LIST): Don't use absolute paths.
* man/editor.eselect.5:
* man/pager.eselect.5: Update.

Signed-off-by: Ulrich Müller  gentoo.org>

 ChangeLog| 10 ++
 libs/editor-variable.bash.in | 47 
 man/editor.eselect.5 | 14 ++---
 man/pager.eselect.5  | 13 ++--
 modules/editor.eselect   |  7 +--
 modules/pager.eselect|  2 +-
 6 files changed, 56 insertions(+), 37 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 94f8577..cbb6229 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2019-09-02  Ulrich Müller  
+
+   * libs/editor-variable.bash.in (find_in_path): New function, looks
+   up its first argument in EDITOR_PATH, and tests if it exists.
+   (find_targets, do_set): Use it.
+   * modules/pager.eselect (EDITOR_LIST):
+   * modules/editor.eselect (EDITOR_LIST): Don't use absolute paths.
+   * man/editor.eselect.5:
+   * man/pager.eselect.5: Update.
+
 2019-05-26  Ulrich Müller  
 
* modules/news.eselect (do_read, do_unread): Allow specification

diff --git a/libs/editor-variable.bash.in b/libs/editor-variable.bash.in
index ac71ecf..a3bfdc7 100644
--- a/libs/editor-variable.bash.in
+++ b/libs/editor-variable.bash.in
@@ -21,26 +21,49 @@
 # EDITOR_VAR is the name of the environment variable, e.g. "EDITOR".
 # EDITOR_ENVFILE is the path to the config file where the variable should be
 # stored, e.g. "/etc/env.d/99editor". Several modules may share the same file.
-# EDITOR_LIST is a space-separated list of available programs (full pathnames)
-# e.g. "/bin/nano /usr/bin/emacs /usr/bin/vi". Alternatively, items can be of
-# the form "name:/path/to/binary".
+# EDITOR_LIST is a space-separated list of available programs (with or without
+# full pathname), e.g., "nano emacs /usr/bin/vi". Alternatively, items can be
+# of the form "name:/path/to/binary".
 # EDITOR_PATH (optional) is a colon-separated list of directories where to
 # search for available programs. Default is "/bin:/usr/bin".
 
 inherit config
 
+# find file in EDITOR_PATH
+find_in_path() {
+   local file=$1
+
+   # do we already have an absolute path?
+   if [[ ${file} == /* ]]; then
+   [[ -f ${ROOT}${file} ]]
+   return
+   fi
+
+   # try to find it
+   local IFS=:
+   for dir in ${EDITOR_PATH-/bin:/usr/bin}; do
+   [[ -f ${EROOT}${dir}/${file} ]] && return 0
+   done
+   return 1
+}
+
 # find a list of valid targets
 find_targets() {
-   local cur i
+   local cur i file
 
for i in ${EDITOR_LIST}; do
-   [[ -f ${EROOT}${i#*:} ]] && echo "${EPREFIX}${i%%:*}"
+   file=${i#*:}
+   [[ ${file} == /* ]] && file=${EPREFIX}${file}
+   if find_in_path "${file}"; then
+   [[ ${i} == *:* ]] && echo "${i%%:*}" || echo "${file}"
+   fi
done
 
# also output the current value if it isn't in our list
cur=$(read_env_value)
-   [[ -n ${cur} && ${EDITOR_LIST} != *:* && -f ${ROOT}${cur} ]] \
+   [[ -n ${cur} && ${EDITOR_LIST} != *:* ]] \
&& ! has "${cur#${EPREFIX}}" ${EDITOR_LIST} \
+   && find_in_path "${cur}" \
&& echo "${cur}"
 }
 
@@ -130,18 +153,8 @@ do_set() {
fi
 
if [[ ${EDITOR_LIST} != *:* ]]; then
-   # is the target an absolute path? if not, try to find it
-   if [[ ${target} != /* ]]; then
-   local ifs_save=${IFS} IFS=:
-   for dir in ${EDITOR_PATH-/bin:/usr/bin}; do
-   [[ -f ${EROOT}${dir}/${target} ]] || continue
-   target=${EPREFIX}${dir}/${target}
-   break
-   done
-   IFS=${ifs_save}
-   fi
# target is valid if it's a path to an existing binary
-   [[ ${target} == /* && -f ${ROOT}${target} ]] \
+   find_in_path "${target}" \
|| die -q "Target \"${target}\" doesn't appear to be 
valid!"
else
# target is valid only if it's in our list

diff --git a/man/editor.eselect.5 b/man/editor.eselect.5
index 218500a..8a296f1 100644
--- a/man/editor.eselect.5
+++ b/man/editor.eselect.5
@@ -2,7 

[gentoo-commits] proj/eselect:master commit in: /, libs/

2019-02-13 Thread Ulrich Müller
commit: 50fd0e9ae91c7d953278eaba90716e7f5fa4ebb4
Author: Ulrich Müller  gentoo  org>
AuthorDate: Wed Feb 13 20:43:08 2019 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Wed Feb 13 20:43:08 2019 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=50fd0e9a

Output warning messages in yellow.

* libs/output.bash.in (colours): Display warning messages in
yellow, in order to distinguish from errors which are red.

Signed-off-by: Ulrich Müller  gentoo.org>

 ChangeLog   | 5 +
 libs/output.bash.in | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 84673d3..446cd31 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-02-13  Ulrich Mueller  
+
+   * libs/output.bash.in (colours): Display warning messages in
+   yellow, in order to distinguish from errors which are red.
+
 2018-12-22  Ulrich Mueller  
 
* modules/profile.eselect (set_symlink): Warn about deprecated

diff --git a/libs/output.bash.in b/libs/output.bash.in
index 2d32bc6..2f6fc02 100644
--- a/libs/output.bash.in
+++ b/libs/output.bash.in
@@ -20,8 +20,8 @@ colours() {
COLOUR_NORMAL=$(tput sgr0)
COLOUR_BOLD=$(tput bold)
COLOUR_HI=$(tput setaf 4)${COLOUR_BOLD} # blue
-   COLOUR_WARN=$(tput setaf 1)${COLOUR_BOLD} # red
-   COLOUR_ERROR=${COLOUR_WARN}
+   COLOUR_WARN=$(tput setaf 3)${COLOUR_BOLD} # yellow
+   COLOUR_ERROR=$(tput setaf 1)${COLOUR_BOLD} # red
COLOUR_LIST_HEADER=$(tput setaf 2)${COLOUR_BOLD} # green
COLOUR_LIST_LEFT=${COLOUR_BOLD}
COLOUR_LIST_RIGHT=${COLOUR_NORMAL}



[gentoo-commits] proj/eselect:master commit in: /, libs/

2018-01-23 Thread Ulrich Müller
commit: 95b7bee70378a6fcbf838301f2f98e8825544c22
Author: Ulrich Müller  gentoo  org>
AuthorDate: Tue Jan 23 12:43:39 2018 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Tue Jan 23 12:51:42 2018 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=95b7bee7

Update arch list in package-manager list.

* libs/package-manager.bash.in (arch): Restore sparc64 which was
lost in a previous update. Sync with arch.list in the gentoo repo.

 ChangeLog|  5 +
 libs/package-manager.bash.in | 34 +-
 2 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 398b23c..3846850 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-01-23  Ulrich Müller  
+
+   * libs/package-manager.bash.in (arch): Restore sparc64 which was
+   lost in a previous update. Sync with arch.list in the gentoo repo.
+
 2018-01-09  Ulrich Müller  
 
* configure.ac: Update version to 1.4.11.

diff --git a/libs/package-manager.bash.in b/libs/package-manager.bash.in
index baf49df..220e09c 100644
--- a/libs/package-manager.bash.in
+++ b/libs/package-manager.bash.in
@@ -70,23 +70,23 @@ arch() {
# Try to determine arch from HOSTTYPE and OSTYPE, which are
# derived from the GNU triplet (at build time of bash)
case ${HOSTTYPE} in
-   aarch64*)   ret=arm64   ;;
-   alpha*) ret=alpha   ;;
-   arm*)   ret=arm ;;
-   hppa*)  ret=hppa;;
-   i?86)   ret=x86 ;;
-   ia64*)  ret=ia64;;
-   m68k*)  ret=m68k;;
-   mips*)  ret=mips;;
-   nios2)  ret=nios2   ;;
-   or1k|or32*) ret=openrisc;;
-   powerpc64*) ret=ppc64   ;;
-   powerpc*)   ret=ppc ;;
-   riscv*) ret=riscv   ;;
-   s390*)  ret=s390;;
-   sh*)ret=sh  ;;
-   sparc*) ret=sparc   ;;
-   x86_64) ret=amd64   ;;
+   aarch64*)   ret=arm64   ;;
+   alpha*) ret=alpha   ;;
+   arm*)   ret=arm ;;
+   hppa*)  ret=hppa;;
+   i?86)   ret=x86 ;;
+   ia64*)  ret=ia64;;
+   m68k*)  ret=m68k;;
+   mips*)  ret=mips;;
+   nios2)  ret=nios2   ;;
+   powerpc64*) ret=ppc64   ;;
+   powerpc*)   ret=ppc ;;
+   riscv*) ret=riscv   ;;
+   s390*)  ret=s390;;
+   sh*)ret=sh  ;;
+   sparc64*)   ret=sparc64 ;;
+   sparc*) ret=sparc   ;;
+   x86_64) ret=amd64   ;;
*)
write_warning_msg \
"Unknown architecture \"${HOSTTYPE}\"." 
\



[gentoo-commits] proj/eselect:master commit in: libs/, /

2017-12-25 Thread Ulrich Müller
commit: bc8d7b4d1cffbf60d31753aee798c65d554d0fa2
Author: Ulrich Müller  gentoo  org>
AuthorDate: Mon Dec 25 09:11:29 2017 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Mon Dec 25 09:11:29 2017 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=bc8d7b4d

Make eval die.

* libs/core.bash.in (eval): Make it fatal again, after more than
one year of transition time.

 ChangeLog | 5 +
 libs/core.bash.in | 3 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a8d3693..648e874 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-12-25  Ulrich Müller  
+
+   * libs/core.bash.in (eval): Make it fatal again, after more than
+   one year of transition time.
+
 2017-10-14  Ulrich Müller  
 
* man/news.eselect.5: Update URI of GLEP 42.

diff --git a/libs/core.bash.in b/libs/core.bash.in
index 06f767e..281dbde 100644
--- a/libs/core.bash.in
+++ b/libs/core.bash.in
@@ -121,8 +121,7 @@ inherit() {
 
 # make eval not work, because it's evil
 eval() {
-   write_warning_msg "Don't use eval. Find another way."
-   builtin eval "$@"
+   die "Don't use eval. Find another way."
 }
 
 # GNU sed wrapper (sed or gsed, as determined by configure)



[gentoo-commits] proj/eselect:master commit in: libs/, /

2017-06-18 Thread Ulrich Müller
commit: 4dc56d6df4edec24762052abbcdf171a478335fb
Author: Ulrich Müller  gentoo  org>
AuthorDate: Sun Jun 18 19:23:31 2017 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Sun Jun 18 19:23:31 2017 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=4dc56d6d

Fix mapping for nios2 in package-manager lib.

* libs/package-manager.bash.in (arch): Map nios2 to nios2 (as it
is called in profiles/arch.list) rather than nios.

 ChangeLog| 5 +
 libs/package-manager.bash.in | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 11bc25d..35260ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-06-18  Ulrich Müller  
+
+   * libs/package-manager.bash.in (arch): Map nios2 to nios2 (as it
+   is called in profiles/arch.list) rather than nios.
+
 2017-05-22  Ulrich Müller  
 
* modules/profile.eselect (set_symlink): Fix regex, bug 614008.

diff --git a/libs/package-manager.bash.in b/libs/package-manager.bash.in
index fb922a8..c675e7d 100644
--- a/libs/package-manager.bash.in
+++ b/libs/package-manager.bash.in
@@ -78,7 +78,7 @@ arch() {
ia64*)  ret=ia64;;
m68k*)  ret=m68k;;
mips*)  ret=mips;;
-   nios2)  ret=nios;;
+   nios2)  ret=nios2   ;;
or1k|or32*) ret=openrisc;;
powerpc64*) ret=ppc64   ;;
powerpc*)   ret=ppc ;;



[gentoo-commits] proj/eselect:master commit in: libs/

2017-06-18 Thread Ulrich Müller
commit: 3f5b5bd616ae02a632ff03c2b95fbea510c0cf05
Author: Ulrich Müller  gentoo  org>
AuthorDate: Sun Jun 18 19:27:06 2017 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Sun Jun 18 19:27:06 2017 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=3f5b5bd6

Whitespace.

 libs/package-manager.bash.in | 34 +-
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/libs/package-manager.bash.in b/libs/package-manager.bash.in
index c675e7d..b2c5aba 100644
--- a/libs/package-manager.bash.in
+++ b/libs/package-manager.bash.in
@@ -70,23 +70,23 @@ arch() {
# Try to determine arch from HOSTTYPE and OSTYPE, which are
# derived from the GNU triplet (at build time of bash)
case ${HOSTTYPE} in
-   aarch64*)   ret=arm64   ;;
-   alpha*) ret=alpha   ;;
-   arm*)   ret=arm ;;
-   hppa*)  ret=hppa;;
-   i?86)   ret=x86 ;;
-   ia64*)  ret=ia64;;
-   m68k*)  ret=m68k;;
-   mips*)  ret=mips;;
-   nios2)  ret=nios2   ;;
-   or1k|or32*) ret=openrisc;;
-   powerpc64*) ret=ppc64   ;;
-   powerpc*)   ret=ppc ;;
-   riscv*) ret=riscv   ;;
-   s390*)  ret=s390;;
-   sh*)ret=sh  ;;
-   sparc*) ret=sparc   ;;
-   x86_64) ret=amd64   ;;
+   aarch64*)   ret=arm64   ;;
+   alpha*) ret=alpha   ;;
+   arm*)   ret=arm ;;
+   hppa*)  ret=hppa;;
+   i?86)   ret=x86 ;;
+   ia64*)  ret=ia64;;
+   m68k*)  ret=m68k;;
+   mips*)  ret=mips;;
+   nios2)  ret=nios2   ;;
+   or1k|or32*) ret=openrisc;;
+   powerpc64*) ret=ppc64   ;;
+   powerpc*)   ret=ppc ;;
+   riscv*) ret=riscv   ;;
+   s390*)  ret=s390;;
+   sh*)ret=sh  ;;
+   sparc*) ret=sparc   ;;
+   x86_64) ret=amd64   ;;
*)
write_warning_msg \
"Unknown architecture \"${HOSTTYPE}\"." 
\



[gentoo-commits] proj/eselect:master commit in: libs/, /

2017-03-21 Thread Ulrich Müller
commit: 5f31448766d94618df7ac25c53a05270aec344ce
Author: Mike Frysinger  gentoo  org>
AuthorDate: Tue Mar 21 04:35:11 2017 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Tue Mar 21 06:31:28 2017 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=5f314487

Fill out arch matches a bit more in package-manager lib.

* libs/package-manager.bash.in (arch): Fill out arch matches
a bit more.

 ChangeLog|  5 +
 libs/package-manager.bash.in | 14 --
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 20e9ad3..9508639 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-03-21  Mike Frysinger 
+
+   * libs/package-manager.bash.in (arch): Fill out arch matches
+   a bit more.
+
 2016-12-10  Ulrich Müller  
 
* configure.ac: Update version to 1.4.8.

diff --git a/libs/package-manager.bash.in b/libs/package-manager.bash.in
index aececfd..8194fff 100644
--- a/libs/package-manager.bash.in
+++ b/libs/package-manager.bash.in
@@ -75,15 +75,17 @@ arch() {
arm*)   ret=arm ;;
hppa*)  ret=hppa;;
i?86)   ret=x86 ;;
-   ia64)   ret=ia64;;
-   m68k)   ret=m68k;;
+   ia64*)  ret=ia64;;
+   m68k*)  ret=m68k;;
mips*)  ret=mips;;
-   powerpc)ret=ppc ;;
-   powerpc64)  ret=ppc64   ;;
+   nios2)  ret=nios;;
+   or1k|or32*) ret=openrisc;;
+   powerpc64*) ret=ppc64   ;;
+   powerpc*)   ret=ppc ;;
+   riscv*) ret=riscv   ;;
s390*)  ret=s390;;
sh*)ret=sh  ;;
-   sparc)  ret=sparc   ;;
-   sparc64)ret=sparc64 ;;
+   sparc*) ret=sparc   ;;
x86_64) ret=amd64   ;;
*)
write_warning_msg \



[gentoo-commits] proj/eselect:master commit in: libs/, /

2016-12-10 Thread Ulrich Müller
commit: eb8e92c757d14ed3c1769d622a5588a5d47f3a3e
Author: Ulrich Müller  gentoo  org>
AuthorDate: Sun Dec  4 06:04:34 2016 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Sun Dec  4 12:22:01 2016 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=eb8e92c7

Fix pkgcore support.

* libs/package-manager.bash.in (get_repositories)
(get_repo_news_dir): Fix pinspect calls, bug 304011.

 ChangeLog| 3 +++
 libs/package-manager.bash.in | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4d12473..0d77f5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2016-12-04  Ulrich Müller  
 
+   * libs/package-manager.bash.in (get_repositories)
+   (get_repo_news_dir): Fix pinspect calls, bug 304011.
+
* modules/news.eselect (find_items, find_repo_dir): Check return
status of package manager calls, bug 601506.
 

diff --git a/libs/package-manager.bash.in b/libs/package-manager.bash.in
index b6d8218..aececfd 100644
--- a/libs/package-manager.bash.in
+++ b/libs/package-manager.bash.in
@@ -180,7 +180,7 @@ has_version() {
 get_repositories() {
case $(package_manager) in
portage) portageq get_repos "${EROOT:-/}" ;;
-   pkgcore) pinspect portageq get_repositories ;;
+   pkgcore) pinspect portageq get_repos "${ROOT:-/}" ;;
paludis) run_paludis print-repositories ;;
esac
 }
@@ -193,7 +193,7 @@ get_repo_news_dir() {
case $(package_manager) in
portage) echo "$(portageq get_repo_path \
"${EROOT:-/}" "${repo}")/metadata/news" ;;
-   pkgcore) pinspect portageq get_repo_news_path "${repo}" ;;
+   pkgcore) pinspect portageq get_repo_news_path "${ROOT:-/}" 
"${repo}" ;;
paludis) run_paludis print-repository-metadata ${repo} \
--raw-name newsdir --format '%v\n' ;;
esac



[gentoo-commits] proj/eselect:master commit in: libs/, /

2016-11-01 Thread Ulrich Müller
commit: 6e078f8a6e665f473bbf96668f13871e6119e0d8
Author: Ulrich Müller  gentoo  org>
AuthorDate: Mon Oct 31 08:30:55 2016 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Mon Oct 31 08:30:55 2016 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=6e078f8a

Disable eval again.

* libs/core.bash.in (eval): Disable eval again, because the
workaround for the rc module (sourcing functions.sh) is no longer
needed. See also 2005-05-15 change by ciaranm.

This partially reverts commit 76867bf1a47570cd9548100caed519252b5ced5a.

 ChangeLog | 6 ++
 README| 2 +-
 libs/core.bash.in | 6 ++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index c7a54f6..80bc483 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-10-31  Ulrich Müller  
+
+   * libs/core.bash.in (eval): Disable eval again, because the
+   workaround for the rc module (sourcing functions.sh) is no longer
+   needed. See also 2005-05-15 change by ciaranm.
+
 2016-10-30  Ulrich Müller  
 
* configure.ac: Update version to 1.4.7.

diff --git a/README b/README
index 945dc41..de19882 100644
--- a/README
+++ b/README
@@ -34,7 +34,7 @@ Style Notes
   one tab per indent level, with each tab representing 4 places.
 * Avoid lines wider than 79 positions.
 * Public functions don't get the ``es_`` prefix, private functions do.
-* eval is evil, so don't use it.
+* eval is evil, so we disabled it.
 * Absolute paths to executables are not portable, so don't use them.
 
 

diff --git a/libs/core.bash.in b/libs/core.bash.in
index baddfde..da35ee9 100644
--- a/libs/core.bash.in
+++ b/libs/core.bash.in
@@ -119,6 +119,12 @@ inherit() {
done
 }
 
+# make eval not work, because it's evil
+eval() {
+   write_warning_msg "Don't use eval. Find another way."
+   builtin eval "$@"
+}
+
 # GNU sed wrapper (sed or gsed, as determined by configure)
 sed() {
command @SED@ "$@"



[gentoo-commits] proj/eselect:master commit in: /, libs/

2016-11-01 Thread Ulrich Müller
commit: 1b4e2608f7463d98270c0b709cffe09d1b5d2d86
Author: Ulrich Müller  gentoo  org>
AuthorDate: Mon Oct 31 08:30:55 2016 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Mon Oct 31 08:30:55 2016 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=1b4e2608

Disable eval again.

* libs/core.bash.in (eval): Disable eval again, because the
workaround for the rc module (sourcing functions.sh) is no longer
needed. See also 2005-05-15 change by ciaranm.

This partially reverts commit 76867bf1a47570cd9548100caed519252b5ced5a.

 ChangeLog | 6 ++
 README| 2 +-
 libs/core.bash.in | 6 +-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c7a54f6..80bc483 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-10-31  Ulrich Müller  
+
+   * libs/core.bash.in (eval): Disable eval again, because the
+   workaround for the rc module (sourcing functions.sh) is no longer
+   needed. See also 2005-05-15 change by ciaranm.
+
 2016-10-30  Ulrich Müller  
 
* configure.ac: Update version to 1.4.7.

diff --git a/README b/README
index 945dc41..de19882 100644
--- a/README
+++ b/README
@@ -34,7 +34,7 @@ Style Notes
   one tab per indent level, with each tab representing 4 places.
 * Avoid lines wider than 79 positions.
 * Public functions don't get the ``es_`` prefix, private functions do.
-* eval is evil, so don't use it.
+* eval is evil, so we disabled it.
 * Absolute paths to executables are not portable, so don't use them.
 
 

diff --git a/libs/core.bash.in b/libs/core.bash.in
index baddfde..4418d51 100644
--- a/libs/core.bash.in
+++ b/libs/core.bash.in
@@ -119,7 +119,11 @@ inherit() {
done
 }
 
-# GNU sed wrapper (sed or gsed, as determined by configure)
+# make eval not work, because it's evil
+eval() {
+   die "Don't use eval. Find another way."
+}
+
 sed() {
command @SED@ "$@"
 }



[gentoo-commits] proj/eselect:master commit in: libs/, /

2016-10-30 Thread Ulrich Müller
commit: a121df41e723306bdd925098ebd4a8939ac188fe
Author: Ulrich Müller  gentoo  org>
AuthorDate: Sat Oct 29 23:09:10 2016 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Sat Oct 29 23:09:10 2016 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=a121df41

Ignore comment lines when parsing config files.

* libs/config.bash.in (store_config): Ignore comment lines in
config files and make parsing more robust, bug 598480.

 ChangeLog   | 5 +
 libs/config.bash.in | 8 +---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index eb3db3b..e9fc937 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-10-30  Ulrich Müller  
+
+   * libs/config.bash.in (store_config): Ignore comment lines in
+   config files and make parsing more robust, bug 598480.
+
 2016-06-17  Ulrich Müller  
 
* configure.ac: Update version to 1.4.6.

diff --git a/libs/config.bash.in b/libs/config.bash.in
index 80ef798..9fbecf0 100644
--- a/libs/config.bash.in
+++ b/libs/config.bash.in
@@ -57,9 +57,11 @@ store_config() {
# parse the names of all settings in the file
local ifs_save=${IFS} IFS=$'\n'
for line in ${content} ; do
-   [[ ${line/=/} != ${line} ]] || continue
-   line=${line/=*/}
-   local ${line}=""
+   line=${line##*([[:space:]])}
+   [[ ${line} != "#"* && ${line} == *=* ]] || continue
+   line=${line%%=*}
+   # assignment will fail if ${line} is not a valid 
identifier
+   local ${line}="" || continue
vars=(${vars[@]} ${line})
done
IFS=${ifs_save}



[gentoo-commits] proj/eselect:master commit in: libs/, /

2016-06-01 Thread Ulrich Müller
commit: da9a451824ccd5e4e2b9be405fecad82599ba702
Author: Ulrich Müller  gentoo  org>
AuthorDate: Wed Jun  1 19:41:11 2016 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Wed Jun  1 19:41:11 2016 +
URL:https://gitweb.gentoo.org/proj/eselect.git/commit/?id=da9a4518

Avoid absolute paths for programs.

* configure.ac: Where possible, use AC_CHECK_PROGS instead of
AC_PATH_PROGS, in order to avoid absolute paths, bug 122260.
* libs/core.bash.in (sed):
* libs/package-manager.bash.in (portageq): Invoke commands with
"command" so that they will work without a path.

 ChangeLog|  8 
 configure.ac | 31 +--
 libs/core.bash.in|  4 ++--
 libs/package-manager.bash.in |  4 ++--
 4 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5bb2855..c166ad0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-06-01  Ulrich Müller  
+
+   * configure.ac: Where possible, use AC_CHECK_PROGS instead of
+   AC_PATH_PROGS, in order to avoid absolute paths, bug 122260.
+   * libs/core.bash.in (sed):
+   * libs/package-manager.bash.in (portageq): Invoke commands with
+   "command" so that they will work without a path.
+
 2016-01-27  Ulrich Müller  
 
* bin/eselect.in: Set umask +rx, bug 572348.

diff --git a/configure.ac b/configure.ac
index 8f38759..6fce662 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,7 @@ fi
 
 # AC_PROG_SED doesn't work here, because on Gentoo FreeBSD systems it
 # is confused by a wrapper script that is in the PATH at build time.
-AC_PATH_PROGS(SED, [gsed sed])
+AC_CHECK_PROGS(SED, [gsed sed])
 if test x$SED = x; then
 AC_MSG_ERROR([sed is required])
 fi
@@ -31,27 +31,22 @@ else
 AC_MSG_ERROR([GNU sed is required])
 fi
 
-AC_PATH_PROG(PORTAGEQ, portageq, /usr/bin/portageq,
-  [$prefix/bin:/usr/bin:/bin:$PATH])
 AC_PATH_PROG(ENV_UPDATE, env-update, /usr/sbin/env-update,
   [$PATH:$prefix/sbin:/usr/sbin])
 
-AC_PATH_PROG(READLINK, greadlink)
-if test x$READLINK = x; then
-AC_PATH_PROG(READLINK, readlink)
-if test x$READLINK != x; then
-AC_MSG_CHECKING([whether readlink supports -f])
-if $READLINK -f . >/dev/null 2>&1; then
-AC_MSG_RESULT(yes)
-else
-AC_MSG_RESULT(no)
-READLINK=""
-fi
-fi
-if test x$READLINK = x; then
-AC_PATH_PROG(REALPATH, realpath)
+AC_CHECK_PROGS(READLINK, [greadlink readlink])
+if test x$READLINK != x; then
+AC_MSG_CHECKING([whether $READLINK supports -f])
+if $READLINK -f . >/dev/null 2>&1; then
+AC_MSG_RESULT(yes)
+else
+AC_MSG_RESULT(no)
+READLINK=""
 fi
 fi
+if test x$READLINK = x; then
+AC_CHECK_PROGS(REALPATH, realpath)
+fi
 if test x$READLINK != x; then
 CANONICALISE="$READLINK -f"
 elif test x$REALPATH != x; then
@@ -63,7 +58,7 @@ AC_SUBST(CANONICALISE)
 
 # Gentoo uses rst2html.py but most other
 # distros install it w/o the .py extension
-AC_PATH_PROGS(RST2HTML, [rst2html rst2html.py])
+AC_CHECK_PROGS(RST2HTML, [rst2html rst2html.py])
 
 # Support for Gentoo Prefix
 AC_MSG_CHECKING([if target installation is in an offset prefix])

diff --git a/libs/core.bash.in b/libs/core.bash.in
index 6b6f049..baddfde 100644
--- a/libs/core.bash.in
+++ b/libs/core.bash.in
@@ -119,7 +119,7 @@ inherit() {
done
 }
 
-# GNU sed wrapper (real path to GNU sed determined by configure)
+# GNU sed wrapper (sed or gsed, as determined by configure)
 sed() {
-   @SED@ "$@"
+   command @SED@ "$@"
 }

diff --git a/libs/package-manager.bash.in b/libs/package-manager.bash.in
index 691bd3c..b6d8218 100644
--- a/libs/package-manager.bash.in
+++ b/libs/package-manager.bash.in
@@ -28,9 +28,9 @@ package_manager() {
 }
 
 # portageq
-# Run portageq with safe filename as set by configure. Redirect stderr
+# Run portageq. Redirect stderr
 portageq() {
-   @PORTAGEQ@ "$@" 2>/dev/null
+   command portageq "$@" 2>/dev/null
 }
 
 # run_paludis PRIVATE



[gentoo-commits] proj/eselect:master commit in: libs/, /, modules/

2014-08-28 Thread Ulrich Müller
commit: 759fb65536efbd7efd171d0fb8e461d192b5c0d9
Author: Ulrich Müller ulm AT gentoo DOT org
AuthorDate: Thu Aug 28 12:53:42 2014 +
Commit: Ulrich Müller ulm AT gentoo DOT org
CommitDate: Thu Aug 28 12:53:42 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/eselect.git;a=commit;h=759fb655

Remove redundant $@ in for loops throughout.

* libs/core.bash.in (inherit):
* libs/tests.bash.in (has):
* modules/config.eselect (generic_handle_one_file, accept_handler)
(merge_handler, display_handler):
* modules/news.eselect (find_items, do_list, do_read, do_unread):
* modules/rc.eselect (run_runscript, do_show): Remove redundant $@
in for loops throughout.

---
 ChangeLog  | 10 ++
 libs/core.bash.in  |  2 +-
 libs/tests.bash.in |  2 +-
 modules/config.eselect |  8 
 modules/news.eselect   |  8 
 modules/rc.eselect |  4 ++--
 6 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1f01c16..92d7730 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2014-08-28  Ulrich Müller  u...@gentoo.org
+
+   * libs/core.bash.in (inherit):
+   * libs/tests.bash.in (has):
+   * modules/config.eselect (generic_handle_one_file, accept_handler)
+   (merge_handler, display_handler):
+   * modules/news.eselect (find_items, do_list, do_read, do_unread):
+   * modules/rc.eselect (run_runscript, do_show): Remove redundant $@
+   in for loops throughout.
+
 2014-06-05  Ulrich Müller  u...@gentoo.org
 
* misc/eselect.bashcomp (_eselect): Improve handling of options

diff --git a/libs/core.bash.in b/libs/core.bash.in
index 1384188..cc263b8 100644
--- a/libs/core.bash.in
+++ b/libs/core.bash.in
@@ -111,7 +111,7 @@ do_action() {
 # Sources a given eselect library file
 inherit() {
local x
-   for x in $@; do
+   for x; do
[[ -e ${ESELECT_CORE_PATH}/${x}.bash ]] \
|| die Couldn't find ${x}.bash
source ${ESELECT_CORE_PATH}/${x}.bash \

diff --git a/libs/tests.bash.in b/libs/tests.bash.in
index eeafc94..8fb8559 100644
--- a/libs/tests.bash.in
+++ b/libs/tests.bash.in
@@ -20,7 +20,7 @@
 has() {
local test=${1} item
shift
-   for item in $@ ; do
+   for item; do
[[ ${item} == ${test} ]]  return 0
done
return 1

diff --git a/modules/config.eselect b/modules/config.eselect
index dfa3826..7383b2f 100644
--- a/modules/config.eselect
+++ b/modules/config.eselect
@@ -62,7 +62,7 @@ generic_handle_one_file() {
local file_raw file
 
# for each parameter...
-   for file_raw in $@ ; do
+   for file_raw; do
[[ -z ${file_raw} ]]  continue
 
# do we have a number or a name?
@@ -162,7 +162,7 @@ do_accept() {
 
 accept_handler() {
local file
-   for file in $@ ; do
+   for file; do
local sfile=${file} dfile=${file/._cfg_}
echo Replacing ${dfile} with ${sfile}...
mv --interactive ${sfile} ${dfile}
@@ -201,7 +201,7 @@ do_merge() {
 
 merge_handler() {
local file
-   for file in $@ ; do
+   for file; do
local sfile=${file} dfile=${file/._cfg_}
echo Merging ${dfile} with ${sfile}...
merge_prog ${dfile} ${sfile}
@@ -242,7 +242,7 @@ do_display() {
 
 display_handler() {
local file
-   for file in $@ ; do
+   for file; do
local sfile=${file} dfile=${file/._cfg_}
echo Proposed changes to ${dfile}:
diff_prog -u ${dfile} ${sfile}

diff --git a/modules/news.eselect b/modules/news.eselect
index 782f81c..3cc1f84 100644
--- a/modules/news.eselect
+++ b/modules/news.eselect
@@ -15,7 +15,7 @@ NEWS_DIR=/var/lib/gentoo/news
 # sort order: by item name (i.e. effectively by date)
 find_items() {
local stat repos=$(get_repositories) repo file item
-   for stat in $@; do
+   for stat; do
for repo in ${repos}; do
file=${EROOT}${NEWS_DIR}/news-${repo}.${stat}
[[ -f ${file} ]] || continue
@@ -174,7 +174,7 @@ do_list() {
 
set -- $(find_items unread read)
write_list_start News items:
-   for item in $@; do
+   for item; do
stat=${item%%/*}; item=${item#*/}
repo=${item%%/*}; item=${item#*/}
find_repo_dir ${repo}
@@ -270,7 +270,7 @@ do_read() {
 echo No news is good news.
fi
 
-   for i in $@; do
+   for i; do
if ! is_number ${i} || [[ ${i} -lt 1 || ${i} -gt ${#items[@]} 
]]
then
write_warning_msg Bad item number: ${i}
@@ -378,7 +378,7 @@ do_unread() {
set -- ${seq}
fi
 
-   for i in $@; do
+   for i; do
if ! is_number