mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-04 19:56:32 +02:00
app-eselect/eselect-lua: Add from Gentoo
It's from Gentoo commit 06fa47c693d40e796c7ea5907970e0cc3cf2f4c7.
This commit is contained in:
parent
264a941f76
commit
5f24d6fadd
22
sdk_container/src/third_party/portage-stable/app-eselect/eselect-lua/eselect-lua-4-r1.ebuild
vendored
Normal file
22
sdk_container/src/third_party/portage-stable/app-eselect/eselect-lua/eselect-lua-4-r1.ebuild
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
# Copyright 1999-2022 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=7
|
||||
|
||||
DESCRIPTION="Lua eselect module"
|
||||
HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"
|
||||
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
|
||||
IUSE=""
|
||||
|
||||
RDEPEND="app-admin/eselect
|
||||
!dev-lang/lua:0"
|
||||
|
||||
S="${WORKDIR}"
|
||||
|
||||
src_install() {
|
||||
insinto /usr/share/eselect/modules/
|
||||
newins "${FILESDIR}"/lua.eselect-${PV} lua.eselect
|
||||
}
|
||||
133
sdk_container/src/third_party/portage-stable/app-eselect/eselect-lua/files/lua.eselect-4
vendored
Normal file
133
sdk_container/src/third_party/portage-stable/app-eselect/eselect-lua/files/lua.eselect-4
vendored
Normal file
@ -0,0 +1,133 @@
|
||||
# -*-eselect-*- vim: ft=eselect
|
||||
# Copyright 2014-2020 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
inherit config multilib
|
||||
|
||||
DESCRIPTION="Manage lua symlinks"
|
||||
MAINTAINER="mva@gentoo.org"
|
||||
|
||||
HEADER_FILES="lauxlib.h luaconf.h lua.h lua.hpp lualib.h"
|
||||
|
||||
remove_symlinks() {
|
||||
rm -f "${EROOT}"/usr/bin/{lua,luac} &>/dev/null
|
||||
rm -f "${EROOT}"/usr/share/man/man1/lua{,c}.1{,.*} &>/dev/null
|
||||
# Possible leftovers from earlier versions
|
||||
for dir in $(get_libdirs) ; do
|
||||
rm -f "${EROOT}"${dir}/liblua.so &>/dev/null && \
|
||||
rm -f "${EROOT}"${dir}/pkgconfig/lua.pc &>/dev/null
|
||||
done
|
||||
for f in $HEADER_FILES ; do
|
||||
rm -f "${EROOT}"/usr/include/${f}
|
||||
done
|
||||
}
|
||||
|
||||
_dup() {
|
||||
dirname ${1}/.
|
||||
}
|
||||
|
||||
set_symlinks() {
|
||||
local ver=${1#lua}
|
||||
local bin_prefix="${EROOT}/usr/bin"
|
||||
ln -s lua${ver} $(_dup "${bin_prefix}"/lua)
|
||||
if [[ -f "${bin_prefix}"/luac${ver} ]]; then
|
||||
ln -s luac${ver} $(_dup "${bin_prefix}"/luac)
|
||||
fi
|
||||
for manpage in "${EROOT}"/usr/share/man/man1/lua{,c}${ver}.1.* ; do
|
||||
test -f ${manpage} &&
|
||||
ln -s $(basename "${manpage}") $(_dup "${manpage//${ver}}")
|
||||
done
|
||||
}
|
||||
|
||||
get_libdirs() {
|
||||
local dir libdirs
|
||||
for dir in $(list_libdirs); do
|
||||
[[ -L ${EROOT}/usr/${dir} ]] && continue
|
||||
ls "${EROOT}"/usr/${dir}/liblua*.* > /dev/null 2>&1 || continue
|
||||
|
||||
libdirs+=' '/usr/${dir}
|
||||
done
|
||||
echo ${libdirs:-/usr/lib}
|
||||
}
|
||||
|
||||
find_targets() {
|
||||
local dirs
|
||||
local prefix="${EROOT}/usr/bin/"
|
||||
for f in ${prefix}lua{5,jit-2}.* ; do
|
||||
[[ -f "${f}" ]] && dirs="${dirs} ${f##$prefix}"
|
||||
done
|
||||
echo $dirs
|
||||
}
|
||||
|
||||
resolve_target() {
|
||||
local targets=( $(find_targets) )
|
||||
if is_number $1; then
|
||||
[[ $1 -le ${#targets[@]} && $1 -gt 0 ]] && echo "${targets[ $(( $1 - 1 )) ]}"
|
||||
elif has $1 ${targets[@]}; then
|
||||
echo $1
|
||||
fi
|
||||
}
|
||||
|
||||
get_active_version() {
|
||||
readlink -e "${EROOT}"/usr/bin/lua | sed -ne "s:.*/usr/bin/\([\w.-]*\):\1:p"
|
||||
}
|
||||
|
||||
## Actual actions
|
||||
|
||||
## set action
|
||||
|
||||
describe_set() {
|
||||
echo "Sets the current version of lua"
|
||||
}
|
||||
|
||||
describe_set_parameters() {
|
||||
echo '[--if-unset] <target>'
|
||||
}
|
||||
|
||||
describe_set_options() {
|
||||
echo '--if-unset: Do not replace currently selected implementation'
|
||||
echo 'target: Target name or number (from "list" action)'
|
||||
}
|
||||
|
||||
do_set() {
|
||||
if [ "${1}" == "--if-unset" ]; then
|
||||
if [[ -n "$(get_active_version)" ]]; then
|
||||
return
|
||||
fi
|
||||
shift
|
||||
fi
|
||||
|
||||
local target=$(resolve_target $1)
|
||||
if [[ -z "${target}" ]]; then
|
||||
die -q "You need to specify a version"
|
||||
fi
|
||||
remove_symlinks
|
||||
set_symlinks $target
|
||||
}
|
||||
|
||||
## List action
|
||||
|
||||
describe_list() {
|
||||
echo 'Lists available lua versions'
|
||||
}
|
||||
|
||||
do_list() {
|
||||
local targets
|
||||
local a
|
||||
targets=( $(find_targets) )
|
||||
a=$(get_active_version)
|
||||
for (( i = 0; i < ${#targets[@]}; i++ )) ; do
|
||||
[[ $a == ${targets[i]} ]] && targets[i]=$(highlight_marker "${targets[i]}")
|
||||
done
|
||||
write_numbered_list -m '(none found)' "${targets[@]}"
|
||||
}
|
||||
|
||||
## Show action
|
||||
|
||||
describe_show() {
|
||||
echo 'Show the active lua version'
|
||||
}
|
||||
|
||||
do_show() {
|
||||
get_active_version
|
||||
}
|
||||
13
sdk_container/src/third_party/portage-stable/app-eselect/eselect-lua/metadata.xml
vendored
Normal file
13
sdk_container/src/third_party/portage-stable/app-eselect/eselect-lua/metadata.xml
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="person">
|
||||
<email>williamh@gentoo.org</email>
|
||||
<name>William Hubbs</name>
|
||||
</maintainer>
|
||||
<maintainer type="person">
|
||||
<email>mva@gentoo.org</email>
|
||||
<name>Vadim Misbakh-Soloviov</name>
|
||||
</maintainer>
|
||||
<stabilize-allarches/>
|
||||
</pkgmetadata>
|
||||
Loading…
x
Reference in New Issue
Block a user