public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: app-eselect/eselect-lapack/files/, app-eselect/eselect-lapack/
@ 2019-11-10 13:03 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2019-11-10 13:03 UTC (permalink / raw
  To: gentoo-commits

commit:     27cc3b1773da166c1354e572708cdb2007605c58
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 10 12:58:53 2019 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Nov 10 13:03:23 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=27cc3b17

app-eselect/eselect-lapack: Remove old (EAPI 0)

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../eselect-lapack/eselect-lapack-0.1.ebuild       | 27 ----------------------
 .../eselect-lapack/files/lapack.eselect-0.1        | 14 -----------
 2 files changed, 41 deletions(-)

diff --git a/app-eselect/eselect-lapack/eselect-lapack-0.1.ebuild b/app-eselect/eselect-lapack/eselect-lapack-0.1.ebuild
deleted file mode 100644
index 66d8e1a9084..00000000000
--- a/app-eselect/eselect-lapack/eselect-lapack-0.1.ebuild
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=0
-
-inherit eutils
-
-DESCRIPTION="LAPACK module for eselect"
-HOMEPAGE="https://www.gentoo.org/proj/en/eselect/"
-SRC_URI=""
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
-IUSE=""
-
-# Need skel.bash lib
-RDEPEND=">=app-admin/eselect-1.0.5"
-DEPEND="${RDEPEND}"
-
-src_install() {
-	local MODULEDIR="/usr/share/eselect/modules"
-	local MODULE="lapack"
-	insinto ${MODULEDIR}
-	newins "${FILESDIR}"/${MODULE}.eselect-${PVR} ${MODULE}.eselect
-	doman "${FILESDIR}"/lapack.eselect.5
-}

diff --git a/app-eselect/eselect-lapack/files/lapack.eselect-0.1 b/app-eselect/eselect-lapack/files/lapack.eselect-0.1
deleted file mode 100644
index a01ad15ab49..00000000000
--- a/app-eselect/eselect-lapack/files/lapack.eselect-0.1
+++ /dev/null
@@ -1,14 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-inherit skel
-
-MODULE="LAPACK"
-IFACE="lapack"
-
-DESCRIPTION="Manage installed $MODULE implementations"
-MAINTAINER="spyderous@gentoo.org"
-SVN_DATE='$Date: 2015/03/31 16:49:51 $'
-VERSION=$(svn_date_to_version "${SVN_DATE}" )
-
-# vim: set ft=eselect :


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: app-eselect/eselect-lapack/files/, app-eselect/eselect-lapack/
@ 2023-03-18 21:45 James Le Cuirot
  0 siblings, 0 replies; 2+ messages in thread
From: James Le Cuirot @ 2023-03-18 21:45 UTC (permalink / raw
  To: gentoo-commits

commit:     7174cefafde328549353f72f365032df71524e3e
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 27 23:35:10 2023 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sat Mar 18 21:44:39 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7174cefa

app-eselect/eselect-lapack: Bump to fix ROOT handling and apply quoting

The module assumed that ROOT should be present in LDPATH variable of the
generated config files. This makes no sense because ROOT is not applicable at
runtime.

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 .../eselect-lapack/eselect-lapack-0.3.ebuild       |  27 ++++
 .../eselect-lapack/files/lapack.eselect-0.3        | 167 +++++++++++++++++++++
 2 files changed, 194 insertions(+)

diff --git a/app-eselect/eselect-lapack/eselect-lapack-0.3.ebuild b/app-eselect/eselect-lapack/eselect-lapack-0.3.ebuild
new file mode 100644
index 000000000000..ace0c922c6fa
--- /dev/null
+++ b/app-eselect/eselect-lapack/eselect-lapack-0.3.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="LAPACK module for eselect"
+HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+IUSE=""
+
+# Need skel.bash lib
+RDEPEND=( ">=app-admin/eselect-1.0.5" )
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+src_install() {
+	local MODULEDIR="/usr/share/eselect/modules"
+	local MODULE="lapack"
+	insinto ${MODULEDIR}
+	newins "${FILESDIR}"/${MODULE}.eselect-${PVR} ${MODULE}.eselect
+	doman "${FILESDIR}"/lapack.eselect.5
+}

diff --git a/app-eselect/eselect-lapack/files/lapack.eselect-0.3 b/app-eselect/eselect-lapack/files/lapack.eselect-0.3
new file mode 100644
index 000000000000..f3fd6619f22f
--- /dev/null
+++ b/app-eselect/eselect-lapack/files/lapack.eselect-0.3
@@ -0,0 +1,167 @@
+# -*-eselect-*-  vim: ft=eselect
+# Copyright 2019-2023 Gentoo Authors
+# Distributed under the terms of the GNU GPL version 2 or later
+
+inherit config tests multilib skel
+
+MODULE="LAPACK"
+IFACE="lapack"
+DESCRIPTION="Manage installed alternatives of $MODULE shared objects"
+MAINTAINER="lumin@debian.org"
+VERSION="0.3"
+
+### helper utility to find all available LAPACK implementations
+find_targets_in() {
+	[[ $# -eq 1 ]] || die -q "in which libdir?"
+
+	local cand
+	for cand in "${EROOT}/etc/env.d/lapack/$1"/*; do
+		[[ "config" = $(basename ${cand}) ]] && continue
+		[[ -r ${cand} ]] && basename ${cand}
+	done
+}
+
+### helper utility to validate a LAPACK library directory
+validate_lapacklibdir() {
+	[[ -d $1 ]] || return 2  # dir doesn't exist
+	[[ -r "${1}/liblapack.so.3" ]] && [[ -r "${1}/liblapack.so" ]] \
+	|| return 1
+}
+
+### show action
+do_show() {
+	# do_show -- show both lib64 and lib32 selection
+	# do_show libxx -- show libxx selection
+	local libdir cur libdirs=( $(list_libdirs) )
+
+	# if manually specified libdirs
+	if [[ ! $# -eq 0 ]]; then
+		for libdir in $@; do
+			has $libdir ${libdirs[@]} || die -q "invalid libdir '$libdir'!"
+		done
+		libdirs=( $@ )
+	fi
+
+	for libdir in ${libdirs[@]}; do
+		[[ ! -d ${EROOT}/usr/$libdir ]] && continue
+		[[ ! -r ${EROOT}/etc/env.d/lapack/${libdir}/config ]] && continue
+		cur=$(load_config "${EROOT}"/etc/env.d/lapack/${libdir}/config CURRENT)
+		echo ${libdir}: $cur
+	done
+}
+
+### list action
+do_list() {
+	local i cur targets
+	local libdir libdirs=( $(list_libdirs) )
+
+	# if manually specified libdirs
+	if [[ ! $# -eq 0 ]]; then
+		for libdir in $@; do
+			has $libdir ${libdirs[@]} || die -q "invalid libdir '$libdir'!"
+		done
+		libdirs=( $@ )
+	fi
+
+	for libdir in ${libdirs[@]}; do
+		[[ ! -d ${EROOT}/usr/$libdir ]] || [[ -L ${EROOT}/usr/$libdir ]] && continue
+		targets=( $(find_targets_in $libdir) )
+		cur=$(load_config "${EROOT}"/etc/env.d/lapack/${libdir}/config CURRENT)
+
+		write_list_start "Available LAPACK ($libdir) candidates:"
+		for (( i = 0; i < ${#targets[@]}; i++ )); do
+			[[ ${targets[i]} = $cur ]] \
+			&& targets[i]=$(highlight_marker "${targets[i]}")
+		done
+		write_numbered_list -m "(none found)" "${targets[@]}"
+	done
+}
+
+### validate action
+describe_validate() {
+	echo "validate candidates and remove invalid ones"
+}
+
+do_validate() {
+	local i ldpath targets target candidate
+	local libdir libdirs=( $(list_libdirs) )
+	for libdir in ${libdirs[@]}; do
+		[[ ! -d ${EROOT}/usr/$libdir ]] || [[ -L ${EROOT}/usr/$libdir ]] && continue
+		targets=( $(find_targets_in $libdir) )
+		for target in ${targets[@]}; do
+			candidate=${EROOT}/etc/env.d/lapack/${libdir}/${target}
+			ldpath=$(load_config "$candidate" LDPATH)
+			if ! validate_lapacklibdir "${ROOT}/$ldpath"; then
+				echo "Removing invalid LAPACK candidate ($candidate) ..."
+				rm -v "$candidate"
+			fi
+		done
+	done
+}
+
+### set action
+
+describe_set() {
+        echo "Activate one of the installed $MODULE implementations"
+}
+
+describe_set_parameters() {
+        echo "[<libdir>] <implementation>"
+}
+
+describe_set_options() {
+	echo "libdir: lib64 or lib32. Will use the native one when omitted."
+        echo "implementation : implementation name or number (from 'list' action)"
+}
+
+do_set() {
+	local libdirs=( $(list_libdirs) )
+	local targets libdir ldconf libpath impl
+
+	# check argument existence
+	[[ $# -eq 1 ]] || [[ $# -eq 2 ]] || \
+		die -q "Please specify [<libdir>] <impl> to activate!"
+	# read argumenets
+	if [[ $# -eq 2 ]]; then libdir="$1"; else libdir="$(get_libdir)"; fi
+	if [[ $# -eq 2 ]]; then impl="$2"; else impl="$1"; fi
+	# validate arguments
+	has "$libdir" "${libdirs[@]}" || die -q "Invalid libdir ($libdir) !"
+	targets=( $(find_targets_in $libdir) )
+	if ! has "$impl" "${targets[@]}"; then
+		if [[ ${impl} -gt 0 ]] && [[ ${impl} -le ${#targets[@]} ]]; then
+			impl=${targets[(${impl} - 1)]}
+		else
+			die -q "Invalid impl ($impl) !"
+		fi
+	fi
+	# store the configuration to env.d
+	store_config "${EROOT}"/etc/env.d/lapack/${libdir}/config CURRENT "${impl}"
+	# generate ld.so.conf file
+	ldconf="${EROOT}/etc/ld.so.conf.d/82-lapack-${libdir}.conf"
+	libpath=$(load_config ${EROOT}/etc/env.d/lapack/${libdir}/${impl} LDPATH)
+	truncate -s0 "$ldconf"
+	echo "# Auto-generated by eselect::lapack. DON'T EDIT." >> "$ldconf"
+	echo "$libpath" >> "$ldconf"
+
+	# refresh cache. env-update will call ldconfig (see
+	# portage::env_update.py) so we don't need to call it explicitly.
+	env-update
+}
+
+### add action
+describe_add_parameters() {
+	echo "<libdir> <dir> <impl>"
+}
+
+describe_add_options() {
+	echo "libdir : library directory where $MODULE implementation is installed (lib, lib64, etc.)"
+	echo "dir : directory containing liblapack.so{.3}"
+	echo "impl : name of the $MODULE implementation"
+}
+
+do_add() {
+	[[ $# -eq 3 ]] \
+		|| die -q "Please specify <libdir> <dir> <impl> to activate!"
+	validate_lapacklibdir "${ROOT}/$2" || die -q "invalid lapack libdir!"
+	store_config "${EROOT}/etc/env.d/lapack/$1/$3" LDPATH "$2"
+}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-18 21:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-18 21:45 [gentoo-commits] repo/gentoo:master commit in: app-eselect/eselect-lapack/files/, app-eselect/eselect-lapack/ James Le Cuirot
  -- strict thread matches above, loose matches on Subject: below --
2019-11-10 13:03 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox