aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny van Dyk <kugelfang@gentoo.org>2006-07-03 00:22:15 +0000
committerDanny van Dyk <kugelfang@gentoo.org>2006-07-03 00:22:15 +0000
commit37dc024f4780af5aab62c15d019758f03ab2680f (patch)
tree797afdde8ca26a96e4aded5973c6aea26d820999
parentFix update action (variable name typo), and handle missing OOo dictionary.lst... (diff)
downloadeselect-37dc024f4780af5aab62c15d019758f03ab2680f.tar.gz
eselect-37dc024f4780af5aab62c15d019758f03ab2680f.tar.bz2
eselect-37dc024f4780af5aab62c15d019758f03ab2680f.zip
2006-07-01 Danny van Dyk <kugelfang@gentoo.org>
* libs/portage.bash.in, libs/paludis.bash.in, libs/package-manager.bash.in, libs/Makefile.am, configure.ac: Added support for other package managers than portage. Public functions are part of package-manager.bash. paludis.bash and portage.bash provide private backend functions. * modules/profile.eselect: Marked as portage-only module. * modules/opengl.eselect, modules/binutils.eselect: Change from inherit portage to inherit package-manager. * modules/rc.eselect: Fix bug in list_runlevels(). Respect setting of ${svcdir} in /etc/rc.conf. Add support to show() runlevels other than the current. diffstat: NEWS | 13 ++++ configure.ac | 13 ++-- libs/Makefile.am | 8 ++ libs/package-manager.bash.in | 125 +++++++++++++++++++++++++++++++++++++++++++ libs/paludis.bash.in | 43 ++++++++++++++ libs/portage.bash.in | 48 ---------------- modules/binutils.eselect | 2 modules/opengl.eselect | 2 modules/profile.eselect | 1 modules/rc.eselect | 19 ++++-- 10 files changed, 211 insertions(+), 63 deletions(-) svn path=/trunk/; revision=279
-rw-r--r--AUTHORS6
-rw-r--r--ChangeLog23
-rw-r--r--NEWS13
-rw-r--r--configure.ac13
-rw-r--r--libs/Makefile.am8
-rw-r--r--libs/package-manager.bash.in125
-rw-r--r--libs/paludis.bash.in43
-rw-r--r--libs/portage.bash.in48
-rw-r--r--modules/binutils.eselect2
-rw-r--r--modules/opengl.eselect2
-rw-r--r--modules/profile.eselect1
-rw-r--r--modules/rc.eselect19
12 files changed, 236 insertions, 67 deletions
diff --git a/AUTHORS b/AUTHORS
index 1e8b8f2..02f55e6 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -5,7 +5,7 @@ Ciaran McCreesh <ciaranm@gentoo.org>
Danny van Dyk <kugelfang@gentoo.org>
Manpages
- Modules: binutils, blas, env, lapack, rc
+ Modules: binutils, env, rc
Libraries: config, multilib
Aaron Walker <ka0ttic@gentoo.org>
@@ -22,3 +22,7 @@ Michael Kohl <citizen428@gentoo.org>
Tobias Scherbaum <dertobi123@gentoo.org>
Modules: oracle
+
+Donnie Berkholz <spyderous@gentoo.org>
+ Modules: blas, cblas, lapack
+ Libraries: skel
diff --git a/ChangeLog b/ChangeLog
index 8d65e27..cab6ff3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,13 +1,30 @@
ChangeLog for eselect
+2006-07-01 Danny van Dyk <kugelfang@gentoo.org>
+
+ * libs/portage.bash.in, libs/paludis.bash.in,
+ libs/package-manager.bash.in, libs/Makefile.am, configure.ac: Added
+ support for other package managers than portage. Public functions are
+ part of package-manager.bash. paludis.bash and portage.bash provide
+ private backend functions.
+
+ * modules/profile.eselect: Marked as portage-only module.
+
+ * modules/opengl.eselect, modules/binutils.eselect: Change from
+ inherit portage to inherit package-manager.
+
+ * modules/rc.eselect: Fix bug in list_runlevels(). Respect setting of
+ ${svcdir} in /etc/rc.conf. Add support to show() runlevels other than
+ the current.
+
2006-06-21 Kevin F. Quinn <kevquinn@gentoo.org>
* modules/oodict.eselect: Fix update action (variable name typo), and
- handle missing OOo dictionary.lst properly
+ handle missing OOo dictionary.lst properly.
2006-06-19 Kevin F. Quinn <kevquinn@gentoo.org>
- * modules/oodict.eselect: Align description with other modules
+ * modules/oodict.eselect: Align description with other modules.
2006-06-18 Donnie Berkholz <spyderous@gentoo.org>
@@ -44,7 +61,7 @@ ChangeLog for eselect
2006-06-03 Kevin F. Quinn <kevquinn@gentoo.org>
* modules/oodict.eselect: Tidy up info messages, clean up handling of
- nothing-installed and configured cases
+ nothing-installed and configured cases.
2006-05-31 Kevin F. Quinn <kevquinn@gentoo.org>
diff --git a/NEWS b/NEWS
index b230b42..f86957c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,21 @@
This file contains a summary of changes in released versions. Please read the
ChangeLog file for a more detailed listing of changes/bug fixes.
+1.0.3:
+ Bug fixes:
+ - Fix env.eselect by white-listing allowed mime-types for files in
+ /etc/env.d/.
+
+ New features:
+ - blas.eselect and lapack.eselect have been rewritten, cblas.eselect has
+ been split out of blas.eselect. All three modules now use skel.bash
+ library.
+ - rc.eselect now supports a non-default service directory.
+
1.0.2:
Bug fixes:
- Fix env.eselect to not bail on missing /etc/profile.env.
-
+
New features:
- kernel.eselect now understands 'set $(uname -r)'.
diff --git a/configure.ac b/configure.ac
index e0c7062..987214d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,24 +23,25 @@ if test x$SED = "x" ; then
fi
AC_PATH_PROG(PORTAGEQ, portageq)
+AC_PATH_PROG(PALUDIS, paludis)
AC_PATH_PROG(READLINK, greadlink)
if test x$CANONICALISE = "x" ; then
AC_CHECK_PROG(READLINK, readlink -f ., yes, no, [$PATH])
if test x$READLINK = "xyes" ; then
- AC_PATH_PROG(READLINK, readlink)
+ AC_PATH_PROG(READLINK, readlink)
fi
-
+
CANONICALISE_TEST=`$READLINK -f . > /dev/null 2>&1`
if ! test x$? = "x0" ; then
- unset READLINK
+ unset READLINK
fi
-
+
if test x$READLINK = "x" ; then
- AC_PATH_PROG(REALPATH, realpath)
+ AC_PATH_PROG(REALPATH, realpath)
if test x$REALPATH = "x" ; then
AC_MSG_ERROR([Either GNU readlink or realpath is required])
- fi
+ fi
fi
fi
if test x$READLINK != "x"; then
diff --git a/libs/Makefile.am b/libs/Makefile.am
index f1e5468..5a7e50e 100644
--- a/libs/Makefile.am
+++ b/libs/Makefile.am
@@ -5,6 +5,8 @@ noinst_SCRIPTS = \
manip.bash \
multilib.bash \
output.bash \
+ package-manager.bash \
+ paludis.bash \
path-manipulation.bash \
portage.bash \
skel.bash \
@@ -12,7 +14,11 @@ noinst_SCRIPTS = \
EXTRA_DIST = $(foreach f, $(noinst_SCRIPTS), $(f).in)
-dosed = @SED@ -e 's,\@SED\@,@SED@,g' -e 's,\@PORTAGEQ\@,@PORTAGEQ@,g' -e 's,\@CANONICALISE\@,@CANONICALISE@,g'
+dosed = @SED@ \
+ -e 's,\@SED\@,@SED@,g' \
+ -e 's,\@PALUDIS\@,@PALUDIS@,g' \
+ -e 's,\@PORTAGEQ\@,@PORTAGEQ@,g' \
+ -e 's,\@CANONICALISE\@,@CANONICALISE@,g'
%.bash : %.bash.in
@$(dosed) $< > $@
diff --git a/libs/package-manager.bash.in b/libs/package-manager.bash.in
new file mode 100644
index 0000000..9815316
--- /dev/null
+++ b/libs/package-manager.bash.in
@@ -0,0 +1,125 @@
+#!/bin/bash
+
+# Copyright (c) 2005 Gentoo Foundation.
+# $Id$
+# This file is part of the 'eselect' tools framework.
+#
+# eselect is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# eselect is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# eselect; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+inherit paludis portage
+
+# arch
+# Return the architecture we're running on...
+arch() {
+ local ret=$(envvar ARCH) suffix
+
+ # $arch will be null if there's no current make.profile symlink
+ # we cannot get a list of valid profiles without it.
+ if [[ -z ${ret} ]] ; then
+
+ if [[ -n "${ROOT}" && ${ROOT} != "/" ]] ; then
+ write_warning_msg "Failed to determine \${ARCH}. Is your make.profile symlink valid?"
+ return 1
+ fi
+
+ ret=$(uname -m)
+ case ${ret} in
+ alpha|ia64|ppc) ;;
+ i?86) ret=x86 ;;
+ mips*) ret=mips ;;
+ sparc*) ret=sparc ;;
+ x86_64) ret=amd64 ;;
+ *) write_warning_msg \
+ "Unknown architecture. Please submit a bug including the output of 'uname -m'!"
+ return 1
+ ;;
+ esac
+
+ case $(uname -s) in
+ Linux) ;;
+ FreeBSD) suffix="-fbsd" ;;
+ NetBSD) suffix="-nbsd" ;;
+ OpenBSD) suffix="-obsd" ;;
+ DragonFly) suffix="-dfly" ;;
+ *) write_warning_msg \
+ "Unknown OS. Please submit a bug including the output of 'uname -s'!"
+ return 1
+ ;;
+ esac
+ fi
+
+ echo ${ret}${suffix}
+}
+
+
+# envvar
+# Return the contents of environment variable $1 as seen by package manager(s)
+envvar() {
+ [[ ${#@} -eq 1 ]] || die "envvar expects exactly 1 argument!"
+
+ local manager=$(package-manager)
+ case ${manager} in
+ paludis)
+ paludis_envvar "${1}" 2>/dev/null
+ ;;
+ portage)
+ portageq envvar "${1}" 2>/dev/null
+ ;;
+ *)
+ die "Unknown package manager: \"${manager}\"!"
+ esac
+}
+
+# has-version
+# Return true if package $2 is available in root $1
+has-version() {
+ [[ ${#@} -eq 2 ]] || die "has_version expects exactly 1 arguments!"
+
+ local manager=$(package-manager)
+ case ${manager} in
+ paludis)
+ paludis_has-version $* 2>/dev/null
+ ;;
+ portage)
+ portageq has_version $* 2>/dev/null
+ ;;
+ *)
+ die "Unknown package manager: \"${manager}\"!"
+ esac
+}
+
+# package-manager PRIVATE
+# Return the package manager we're going to use.
+package-manager() {
+ local manager
+
+ if [[ -n ${ESELECT_PACKAGE_MANAGER_CACHE} ]] ; then
+ echo ${ESELECT_PACKAGE_MANAGER_CACHE}
+ return
+ fi
+
+ # We prefer paludis over portage
+ if ${PALUDIS_COMMAND:-@PALUDIS@} --list-repositories > /dev/null 2>&1 ; then
+ manager="paludis"
+ else
+ manager="portage"
+ fi
+
+ echo ${manager}
+ export ESELECT_PACKAGE_MANAGER_CACHE=${manager}
+}
+
+# vim: set sw=4 et sts=4 tw=80 :
+
+
diff --git a/libs/paludis.bash.in b/libs/paludis.bash.in
new file mode 100644
index 0000000..d522ee8
--- /dev/null
+++ b/libs/paludis.bash.in
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+# Copyright (c) 2005 Gentoo Foundation.
+# $Id$
+# This file is part of the 'eselect' tools framework.
+#
+# eselect is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# eselect is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# eselect; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+# paludis-envvar PRIVATE
+# Run paludis --envvar with safe filename as set by configure
+paludis-envvar() {
+ ${PALUDIS_COMMAND:-@PALUDIS@} --envvar "${1}" --repository $(paludis-repo) 2> /dev/null
+}
+
+# paludis-repo PRIVATE
+# Return the repository to use
+paludis-repo() {
+ echo "gentoo" # TODO:
+ return
+
+ local repo
+ if [[ -n ${ESELECT_PALUDIS_REPO_CACHE} ]] ; then
+ echo ${ESELECT_PALUDIS_REPO_CACHE}
+ return
+ fi
+
+ repo=$(${PALUDIS_COMMAND:-@PALUDIS@} --installed-by "sys-devel/binutils")
+ echo ${repo}
+ export ESELECT_PALUDIS_REPO_CACHE=${repo}
+}
+
+# vim: set sw=4 et sts=4 tw=80 :
diff --git a/libs/portage.bash.in b/libs/portage.bash.in
index 8fa29ca..9b7b25f 100644
--- a/libs/portage.bash.in
+++ b/libs/portage.bash.in
@@ -17,58 +17,10 @@
# eselect; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
-# arch
-# Return the architecture we're running on...
-arch() {
- local ret=$(portageq envvar ARCH 2>/dev/null) suffix
-
- # $arch will be null if there's no current make.profile symlink
- # we cannot get a list of valid profiles without it.
- if [[ -z ${ret} ]] ; then
-
- if [[ -n "${ROOT}" && ${ROOT} != "/" ]] ; then
- write_warning_msg "Failed to determine \${ARCH}. Is your make.profile symlink valid?"
- return 1
- fi
-
- ret=$(uname -m)
- case ${ret} in
- alpha|ia64|ppc) ;;
- i?86) ret=x86 ;;
- mips*) ret=mips ;;
- sparc*) ret=sparc ;;
- x86_64) ret=amd64 ;;
- *) write_warning_msg \
- "Unknown architecture. Please submit a bug including the output of 'uname -m'!"
- return 1
- ;;
- esac
-
- case $(uname -s) in
- Linux) ;;
- FreeBSD) suffix="-fbsd" ;;
- NetBSD) suffix="-nbsd" ;;
- OpenBSD) suffix="-obsd" ;;
- DragonFly) suffix="-dfly" ;;
- *) write_warning_msg \
- "Unknown OS. Please submit a bug including the output of 'uname -s'!"
- return 1
- ;;
- esac
- fi
-
- echo ${ret}${suffix}
-}
-
-
# portageq ...
# Run portageq with safe filename as set by configure
portageq() {
@PORTAGEQ@ $* 2> /dev/null
}
-
-
# vim: set sw=4 et sts=4 tw=80 :
-
-
diff --git a/modules/binutils.eselect b/modules/binutils.eselect
index c8eec5c..699fa28 100644
--- a/modules/binutils.eselect
+++ b/modules/binutils.eselect
@@ -2,7 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
# $Id$
-inherit config portage
+inherit config package-manager
DESCRIPTION="Manage installed versions of sys-devel/binutils"
MAINTAINER="kugelfang@gentoo.org"
diff --git a/modules/opengl.eselect b/modules/opengl.eselect
index 4f006cf..7a20a59 100644
--- a/modules/opengl.eselect
+++ b/modules/opengl.eselect
@@ -7,7 +7,7 @@
# Further modifications by Jeremy Huddleston <eradicator@gentoo.org>
# Made into eselect module by Jeremy Huddleston <eradicator@gentoo.org>
-inherit multilib portage config
+inherit multilib package-manager config
# Eselect data
DESCRIPTION="Manage the OpenGL implementation used by your system"
diff --git a/modules/profile.eselect b/modules/profile.eselect
index 1189cc8..a1dcb11 100644
--- a/modules/profile.eselect
+++ b/modules/profile.eselect
@@ -2,6 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
# $Id$
+# This is a portage-only module.
inherit portage
DESCRIPTION="Manage the /etc/make.profile symlink"
diff --git a/modules/rc.eselect b/modules/rc.eselect
index 49b79d6..14c50f0 100644
--- a/modules/rc.eselect
+++ b/modules/rc.eselect
@@ -2,13 +2,21 @@
# Distributed under the terms of the GNU General Public License v2
# $Id$
+inherit config
+
DESCRIPTION="Manage /etc/init.d scripts in runlevels"
MAINTAINER="Danny van Dyk <kugelfang@gentoo.org>"
SVN_DATE='$Date$'
VERSION=$(svn_date_to_version "${SVN_DATE}")
-# global setting
-RC_SOFTLEVEL=/var/lib/init.d/softlevel
+# default setting
+RC_SVCDIR=/var/lib/init.d/
+
+# return actual rc service directory
+rc_svcdir() {
+ local ret=$(load_config ${ROOT}/etc/conf.d/rc svcdir)
+ echo ${ret:-${RC_SVCDIR}}
+}
# list_runlevels PRIVATE
# list runlevels for file $1
@@ -17,7 +25,7 @@ list_runlevels() {
local runlevels
for x in ${ROOT}/etc/runlevels/* ; do
[[ -d ${x} ]] || continue
- [[ -L ${ROOT}/etc/runlevels/${x##*/}/${file} ]] \
+ [[ -L ${ROOT}/etc/runlevels/${x##*/}/${1} ]] \
&& runlevels=(${runlevels[@]} "${x##*/}")
done
echo -ne "${runlevels[@]}"
@@ -188,12 +196,13 @@ describe_show() {
}
do_show() {
- local runlevel=$(< ${RC_SOFTLEVEL}) script stopped
+ local softlevel=$(< "$(rc_svcdir)"/softlevel) script stopped
+ local runlevel=${1:-${softlevel}}
write_list_start "Status of init scripts in runlevel $(highlight ${runlevel})"
for script in $(find_scripts ${ROOT}/etc/runlevels/${runlevel}) ; do
stopped=true
for x in started starting stopping failed broken ; do
- if [[ -L ${ROOT}/var/lib/init.d/${x}/${script} ]] ; then
+ if [[ -L ${ROOT}/$(rc_svcdir)/${x}/${script} ]] ; then
write_kv_list_entry ${script} "[${x}]"
stopped=false
fi