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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A3043158069 for ; Thu, 9 Mar 2023 10:54:12 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A240DE090E; Thu, 9 Mar 2023 10:54:10 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 80886E090E for ; Thu, 9 Mar 2023 10:54:10 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 80E1333BEE9 for ; Thu, 9 Mar 2023 10:54:09 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1A66621 for ; Thu, 9 Mar 2023 10:54:07 +0000 (UTC) From: "Florian Schmaus" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Florian Schmaus" Message-ID: <1678359237.0c82bebe7d8a44c57b0348a2bf2037e30cf409ec.flow@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: app-eselect/eselect-zig/files/, app-eselect/eselect-zig/ X-VCS-Repository: repo/gentoo X-VCS-Files: app-eselect/eselect-zig/eselect-zig-1.ebuild app-eselect/eselect-zig/files/zig.eselect-1 app-eselect/eselect-zig/metadata.xml X-VCS-Directories: app-eselect/eselect-zig/ app-eselect/eselect-zig/files/ X-VCS-Committer: flow X-VCS-Committer-Name: Florian Schmaus X-VCS-Revision: 0c82bebe7d8a44c57b0348a2bf2037e30cf409ec X-VCS-Branch: master Date: Thu, 9 Mar 2023 10:54:07 +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-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 659c8a42-9a89-4b6b-ad81-9011bf25d57a X-Archives-Hash: 452babc4b62c93282bdc8fb2d7950812 commit: 0c82bebe7d8a44c57b0348a2bf2037e30cf409ec Author: Eric Joldasov getgoogleoff me> AuthorDate: Tue Jan 24 11:55:41 2023 +0000 Commit: Florian Schmaus gentoo org> CommitDate: Thu Mar 9 10:53:57 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0c82bebe app-eselect/eselect-zig: new package, add 1 Signed-off-by: Eric Joldasov getgoogleoff.me> Signed-off-by: Florian Schmaus gentoo.org> app-eselect/eselect-zig/eselect-zig-1.ebuild | 24 +++++++ app-eselect/eselect-zig/files/zig.eselect-1 | 93 ++++++++++++++++++++++++++++ app-eselect/eselect-zig/metadata.xml | 13 ++++ 3 files changed, 130 insertions(+) diff --git a/app-eselect/eselect-zig/eselect-zig-1.ebuild b/app-eselect/eselect-zig/eselect-zig-1.ebuild new file mode 100644 index 000000000000..6986fff09954 --- /dev/null +++ b/app-eselect/eselect-zig/eselect-zig-1.ebuild @@ -0,0 +1,24 @@ +# Copyright 2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="Manages Zig versions" +HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86" + +RDEPEND=" + app-admin/eselect + !dev-lang/zig:0 + !dev-lang/zig-bin:0 +" + +S="${WORKDIR}" + +src_install() { + insinto /usr/share/eselect/modules/ + newins "${FILESDIR}"/zig.eselect-${PVR} zig.eselect +} diff --git a/app-eselect/eselect-zig/files/zig.eselect-1 b/app-eselect/eselect-zig/files/zig.eselect-1 new file mode 100644 index 000000000000..f52ce2ee9652 --- /dev/null +++ b/app-eselect/eselect-zig/files/zig.eselect-1 @@ -0,0 +1,93 @@ +# -*-eselect-*- vim: ft=eselect +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +DESCRIPTION="Manage Zig versions" +MAINTAINER="bratishkaerik@getgoogleoff.me" + +show_selected_target() { + readlink "${EROOT}/usr/bin/zig" +} + +find_targets() { + for f in "${EROOT}"/usr/bin/zig-*; do + [[ -f "${f}" ]] && basename "${f}" + done +} + +remove_symlinks() { + rm "${EROOT}/usr/bin/zig" +} + +set_symlinks() { + local target=$1 + if is_number "${target}"; then + local targets=( $(find_targets) ) + target=${targets[target-1]} + fi + + [[ -z "${target}" || ! -f "${EROOT}/usr/bin/${target}" ]] \ + && die -q "Target \"$1\" doesn't appear to be valid!" + + ln -s "${target}" "${EROOT}/usr/bin/zig" +} + + + +### show action ### + +describe_show() { + echo "Show current Zig version" +} + +do_show() { + write_list_start "Current Zig version:" + if [[ -L "${EROOT}/usr/bin/zig" ]]; then + write_kv_list_entry "$(show_selected_target)" "" + else + write_kv_list_entry "(unset)" "" + fi +} + +### list action ### + +describe_list() { + echo "List available Zig versions" +} + +do_list() { + local targets=( $(find_targets) ) + local selected_target + selected_target=$(show_selected_target) + + write_list_start "Available Zig versions:" + for (( i = 0; i < ${#targets[@]}; i++ )); do + [[ ${targets[i]} == "${selected_target}" ]] && targets[i]=$(highlight_marker "${targets[i]}") + done + write_numbered_list -m "(none found)" "${targets[@]}" +} + + +### set action ### + +describe_set() { + echo "Set active Zig version" +} + +describe_set_parameters() { + echo "" +} + +describe_set_options() { + echo "target: Target name or number (from 'list' action)" +} + +do_set() { + [[ -z $1 ]] && die -q "You need to specify a target" + [[ $# -gt 1 ]] && die -q "Too many parameters" + + if [[ -L "${EROOT}/usr/bin/zig" ]]; then + remove_symlinks || die -q "Couldn't remove symlink" + fi + set_symlinks "$1" || die -q "Couldn't set a new symlink" +} diff --git a/app-eselect/eselect-zig/metadata.xml b/app-eselect/eselect-zig/metadata.xml new file mode 100644 index 000000000000..3a2ae2384d95 --- /dev/null +++ b/app-eselect/eselect-zig/metadata.xml @@ -0,0 +1,13 @@ + + + + + bratishkaerik@getgoogleoff.me + Eric Joldasov + + + proxy-maint@gentoo.org + Proxy Maintainers + + +