From 03b314ec2238976960e6a9b4a2c1b02241d10ea9 Mon Sep 17 00:00:00 2001 From: Raboneko <119771935+raboneko@users.noreply.github.com> Date: Mon, 3 Mar 2025 02:18:21 -0800 Subject: [PATCH] Add: pokeget-rs and pokeshell (#3647) (#3718) * Add pokeget-rs and pokeshell * Checkout latest commit? Signed-off-by: Gilver * Wonder if this actually works Signed-off-by: Gilver * I genuinely have no idea what happened there I HATE MOBILE Signed-off-by: Gilver * Go back to checkout Signed-off-by: Gilver * Provides(bundled) Signed-off-by: Gilver * Did that wrong Signed-off-by: Gilver * Try sourcing instead Signed-off-by: Gilver * Try this convoluted mess Signed-off-by: Gilver * Update pokeget-rs.spec Signed-off-by: Gilver * Hate how confusing RPM is Signed-off-by: Gilver * Update pokeget-rs.spec Signed-off-by: Gilver * Update pokeget-rs.spec Signed-off-by: Gilver * Hmm Signed-off-by: Gilver * Hhhh Signed-off-by: Gilver * Update pokeget-rs.spec Signed-off-by: Gilver * Aaaaa Signed-off-by: Gilver * Update pokeget-rs.spec Signed-off-by: Gilver * Come on Signed-off-by: Gilver * ? Signed-off-by: Gilver * Why is RPM incomprehensible Signed-off-by: Gilver * Update pokeget-rs.spec Signed-off-by: Gilver * Update pokeget-rs.spec Signed-off-by: Gilver * Update pokeget-rs.spec Signed-off-by: Gilver * Enough Signed-off-by: Gilver * Cleanup Signed-off-by: Gilver * Fix directory tree Signed-off-by: Gilver * Just fully flesh out macros Signed-off-by: Gilver * Make macros consistent Signed-off-by: Gilver * Tar stupid moment Signed-off-by: Gilver * Update pokeget-rs.spec Signed-off-by: Gilver * I genuinely do not know what is going wrong at this point Signed-off-by: Gilver * Remove git dep I guess Signed-off-by: Gilver * Man Signed-off-by: Gilver * Update pokeget-rs.spec Signed-off-by: Gilver * Why is the pipe failing Signed-off-by: Gilver * Maybe? Signed-off-by: Gilver * Oops Signed-off-by: Gilver * Just not sure where to put this Signed-off-by: Gilver * Get rid of build log spam, track dep just in case * Okay FINALLY done --------- Signed-off-by: Gilver (cherry picked from commit 21afcbc6b851635ed0e569504979517b34bf40ff) Co-authored-by: Gilver --- anda/misc/pokeget-rs/anda.hcl | 5 ++ anda/misc/pokeget-rs/pokeget-rs.spec | 47 ++++++++++++ anda/misc/pokeget-rs/update.rhai | 9 +++ anda/misc/pokeshell/HELPER_ALIASES | 11 +++ anda/misc/pokeshell/anda.hcl | 9 +++ anda/misc/pokeshell/pokeshell.spec | 102 +++++++++++++++++++++++++++ anda/misc/pokeshell/update.rhai | 8 +++ 7 files changed, 191 insertions(+) create mode 100644 anda/misc/pokeget-rs/anda.hcl create mode 100644 anda/misc/pokeget-rs/pokeget-rs.spec create mode 100644 anda/misc/pokeget-rs/update.rhai create mode 100644 anda/misc/pokeshell/HELPER_ALIASES create mode 100644 anda/misc/pokeshell/anda.hcl create mode 100644 anda/misc/pokeshell/pokeshell.spec create mode 100644 anda/misc/pokeshell/update.rhai diff --git a/anda/misc/pokeget-rs/anda.hcl b/anda/misc/pokeget-rs/anda.hcl new file mode 100644 index 0000000000..9a46c244e6 --- /dev/null +++ b/anda/misc/pokeget-rs/anda.hcl @@ -0,0 +1,5 @@ +project pkg { + rpm { + spec = "pokeget-rs.spec" + } +} diff --git a/anda/misc/pokeget-rs/pokeget-rs.spec b/anda/misc/pokeget-rs/pokeget-rs.spec new file mode 100644 index 0000000000..cde6f4768d --- /dev/null +++ b/anda/misc/pokeget-rs/pokeget-rs.spec @@ -0,0 +1,47 @@ +%global pname pokesprite +%global pcommit c5aaa610ff2acdf7fd8e2dccd181bca8be9fcb3e +%global pshortcommit %(c=%{pcommit}; echo ${c:0:7}) +%global pcommit_date 20220622 + +Name: pokeget-rs +Version: 1.6.3 +Release: 1%{?dist} +SourceLicense: MIT +License: MIT AND (0BSD OR MIT OR Apache-2.0) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND BSD-2-Clause AND (MIT OR Apache-2.0 OR Zlib) AND (MIT OR Apache-2.0) AND (Unlicense OR MIT) AND (Zlib OR Apache-2.0 OR MIT) +Summary: A better Rust version of pokeget. +URL: https://github.com/talwat/%{name} +Source0: %{url}/archive/refs/tags/%{version}.tar.gz +Source1: https://github.com/msikma/%{pname}/archive/%{pcommit}/%{pname}-%{pcommit}.tar.gz#/%{pname}-%{pshortcommit}.tar.gz +BuildRequires: anda-srpm-macros +BuildRequires: cargo-rpm-macros +BuildRequires: mold +Provides: pokeget = %{version}-%{release} +Provides: bundled(%{pname}) = 2.7.0^%{pcommit_date}.%{pshortcommit} +Packager: Gilver E. + +%description +Successor to pokeget, written in Rust. + +%prep +%autosetup -n %{name}-%{version} +mkdir -p data/%{pname} +pushd data/%{pname} +/usr/bin/gzip -dc '%{SOURCE1}' | /usr/bin/tar -xof - --strip-components=1 +popd +%cargo_prep_online + +%build +%cargo_build + +%install +install -Dpm755 target/rpm/pokeget %{buildroot}%{_bindir}/%{name} +%{cargo_license_online} > LICENSE.dependencies + +%files +%license LICENSE LICENSE.dependencies data/%{pname}/license.md +%doc README.md +%{_bindir}/%{name} + +%changelog +* Sat Mar 01 2025 Gilver E. +- Initial package diff --git a/anda/misc/pokeget-rs/update.rhai b/anda/misc/pokeget-rs/update.rhai new file mode 100644 index 0000000000..6e9adc7f26 --- /dev/null +++ b/anda/misc/pokeget-rs/update.rhai @@ -0,0 +1,9 @@ +rpm.version(crates("pokeget")); +// pokesprites has not received an update in years but let's keep the dep commit current just in case +if rpm.changed () { + let url = `https://api.github.com/repos/talwat/pokeget-rs/contents/data`; + let json = get(url).json(); + let c = json.2.sha; + rpm.global("pcommit", c); + rpm.global("pcommit_date", date()); // could potentially result in the wrong date, fix if it becomes a problem +} diff --git a/anda/misc/pokeshell/HELPER_ALIASES b/anda/misc/pokeshell/HELPER_ALIASES new file mode 100644 index 0000000000..c793b37ae8 --- /dev/null +++ b/anda/misc/pokeshell/HELPER_ALIASES @@ -0,0 +1,11 @@ +For ease of use, packaged helper scripts are aliased in /usr/bin. + +To use them, run: + +uv run create-pokemon-identifier + +OR: + +pokeget-timing + +to run the create_pokemon_identifier or timing scripts, respectively. diff --git a/anda/misc/pokeshell/anda.hcl b/anda/misc/pokeshell/anda.hcl new file mode 100644 index 0000000000..631d456eeb --- /dev/null +++ b/anda/misc/pokeshell/anda.hcl @@ -0,0 +1,9 @@ +project pkg { + arches = ["x86_64"] + rpm { + spec = "pokeshell.spec" + } + labels { + nightly = 1 + } +} diff --git a/anda/misc/pokeshell/pokeshell.spec b/anda/misc/pokeshell/pokeshell.spec new file mode 100644 index 0000000000..4c7741fc10 --- /dev/null +++ b/anda/misc/pokeshell/pokeshell.spec @@ -0,0 +1,102 @@ +%global debug_package %{nil} +%global commit 6c9e2569843b08db14a964951f17a3943fd89fa2 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) +%global date 20241124 +%global ver 1.0.0 + +Name: pokeshell +Version: %{ver}^%{date}git.%{shortcommit} +Release: 1%{?dist} +Summary: A shell program to show Pokémon sprites in the terminal. +License: GPL-3.0-or-later +URL: https://github.com/acxz/pokeshell +Source0: %{url}/archive/%{commit}.tar.gz#/%{name}-%{shortcommit}.tar.gz +Source1: HELPER_ALIASES +Requires: jq +Requires: ImageMagick +Requires: python3 +Requires: (timg or chafa) +BuildArch: noarch +Packager: Gilver E. + +%description +A featureful shell program to show Pokémon sprites in the terminal. + +%package helper-scripts +Summary: This package contains helper scripts for Pokéshell +Requires: %{name} +Requires: uv +Recommends: hyperfine +Recommends: pokeget-rs +Recommends: pokemon-colorscripts + +%description helper-scripts +Generates pokemon identifiers (such as localized names) using PokeAPI that the sprite backends do not support natively. + +See included README for what these scripts can do. + +%package bash-completion +Summary: Bash completion for Pokéshell +Requires: bash +Requires: %{name} +Supplements: (%{name} and bash) + +%description bash-completion +Pokéshell Bash completion. + +%package zsh-completion +Summary: Zsh completion for Pokéshell +Requires: %{name} +Requires: zsh +Supplements: (%{name} and zsh) + +%description zsh-completion +Basic Zsh completion support for Pokéshell. + +%prep +%autosetup -n %{name}-%{commit} +cp %{SOURCE1} . + +%build + +%install +install -Dm755 bin/pokeshell %{buildroot}%{_bindir}/%{name} +install -Dm755 bin/imageshell/imageshell.sh -t %{buildroot}%{_datadir}/%{name}/imageshell +install -Dm644 share/pokemon_identifiers.json -t %{buildroot}%{_datadir}/%{name} +install -Dm644 scripts/*.py -t %{buildroot}%{_datadir}/%{name}/scripts +install -Dm644 scripts/*.sh -t %{buildroot}%{_datadir}/%{name}/scripts +# Bash and Zsh completion share a single file, Zsh completion is pretty rudimentary +install -Dm644 share/bash-completion/completions/pokeshell -t %{buildroot}%{bash_completions_dir} +install -Dm644 share/bash-completion/completions/pokeshell %{buildroot}%{zsh_completions_dir}/_%{name} +# Keep actual directories out of /usr/bin +ln -sf %{_datadir}/%{name}/imageshell %{buildroot}%{_bindir}/imageshell +# Make helper scripts directly executable +ln -sf %{_datadir}/%{name}/scripts/create_pokemon_identifiers.py %{buildroot}%{_bindir}/create-pokemon-identifiers +ln -sf %{_datadir}/%{name}/scripts/timing.sh %{buildroot}%{_bindir}/pokeget-timing + +%files +%license LICENSE.md +%doc README.md +%{_bindir}/%{name} +%{_bindir}/imageshell +%dir %{_datadir}/%{name} +%{_datadir}/%{name}/pokemon_identifiers.json +%dir %{_datadir}/%{name}/imageshell +%{_datadir}/%{name}/imageshell/imageshell.sh + +%files helper-scripts +%doc scripts/README.md HELPER_ALIASES +%dir %{_datadir}/%{name}/scripts +%{_datadir}/%{name}/scripts/* +%{_bindir}/create-pokemon-identifiers +%{_bindir}/pokeget-timing + +%files bash-completion +%{bash_completions_dir}/%{name} + +%files zsh-completion +%{zsh_completions_dir}/_%{name} + +%changelog +* Sat Mar 01 2025 Gilver E. +- Initial package diff --git a/anda/misc/pokeshell/update.rhai b/anda/misc/pokeshell/update.rhai new file mode 100644 index 0000000000..9fca409203 --- /dev/null +++ b/anda/misc/pokeshell/update.rhai @@ -0,0 +1,8 @@ +rpm.global("commit", gh_commit("acxz/pokeshell")); +if rpm.changed() { + rpm.release(); + rpm.global("date", date()); + let v = gh_tag("acxz/pokeshell"); + v.crop(1); + rpm.global("ver", v); +}