summaryrefslogtreecommitdiff
path: root/sys-apps/gentoo-functions
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-08-07 12:37:21 +0100
committerV3n3RiX <venerix@koprulu.sector>2024-08-07 12:37:21 +0100
commitb8c7370a682e4e29cda623222d17a790c01c3642 (patch)
treef6caa14689bd00a5760eadaa381ff41e50ef3c1b /sys-apps/gentoo-functions
parent8a4997a7e2d1e36c089d4d76935b5a902d98d3d0 (diff)
gentoo auto-resync : 07:08:2024 - 12:37:20
Diffstat (limited to 'sys-apps/gentoo-functions')
-rw-r--r--sys-apps/gentoo-functions/Manifest8
-rw-r--r--sys-apps/gentoo-functions/files/gentoo-functions-1.6-add-warn-function.patch34
-rw-r--r--sys-apps/gentoo-functions/files/gentoo-functions-1.6-relax-parameter-validation.patch233
-rw-r--r--sys-apps/gentoo-functions/gentoo-functions-1.6-r1.ebuild (renamed from sys-apps/gentoo-functions/gentoo-functions-1.6.ebuild)5
-rw-r--r--sys-apps/gentoo-functions/gentoo-functions-1.7-r1.ebuild52
-rw-r--r--sys-apps/gentoo-functions/gentoo-functions-1.7.1.ebuild52
6 files changed, 383 insertions, 1 deletions
diff --git a/sys-apps/gentoo-functions/Manifest b/sys-apps/gentoo-functions/Manifest
index cb8da3b248c1..c9268c55eb68 100644
--- a/sys-apps/gentoo-functions/Manifest
+++ b/sys-apps/gentoo-functions/Manifest
@@ -1,8 +1,14 @@
+AUX gentoo-functions-1.6-add-warn-function.patch 827 BLAKE2B b14277a0799fa3eab52cbec08a6277dc2e585fe5f8e757a7b25dc81490c5975e8aac9b245ed8000dc4d9f6b2f17922a685c44182acb7a2e452c57e599c5de701 SHA512 8d0dc12d9ef32bda3797882408de7e9796a891d55c5158aa9ab2d7e6bb1f1c0f6c952b64429ec0c4fdc74d37c165f3dd9b020199ee9061fb75c305586b7ae93d
+AUX gentoo-functions-1.6-relax-parameter-validation.patch 5644 BLAKE2B db68c8f83ce6cb010fc1c25d2f643f0a26cea5a6bc29045c85177db722a5cfdb461c594aaf9c840173a3d173088cfe984c7187b6c62468f70d50eda985b824f9 SHA512 c790ebbd308e257470b30b96a787e4085939847938ab9c8ffa3b4e2758ff7eedc23fb2df0907d2676d5deb2718ce526e43cd4d77fe82982949de74fb42eb7ee4
DIST gentoo-functions-0.19.tar.bz2 12079 BLAKE2B be0a3a54d4dee1755866047b670a69cd6fec368239123c3f0c08180b79a33c20147bca0e35e568faef6877513551e731bdf0c181aeb0460f6574d2d708219373 SHA512 2674d3fe5724cc6d685ae58bf0ee33f4a1bdba2c5e5809cfb193fd0a710d4678c2d9392c2c62d2321cf455f524950266dc1629ab684fe46632d179e539d5a39e
DIST gentoo-functions-1.5.tar.bz2 15808 BLAKE2B 99c330eb4c7f1d7af67b6f93dba565f9ea37c15e82d0b97157067279671dc3918668bf8120f7c410f018d67761cee41320efaec4df43639765d023b23a3a9a7f SHA512 f7add7770f40e110864f16978e968bfd937c1a5099e336cc04f6861483bae36ff7932f502994df1ddfa347beef8736bd39bd276bafbe04190c9915446457ce15
DIST gentoo-functions-1.6.tar.bz2 16795 BLAKE2B c901cdb8f2fcb507b5397e9ce674a12641f2129b9be05776bb272e09b9db3a6d205e6a00ef51f71b3203eac4e333b297cfe5ae5d61f9dd43074073a749ca171e SHA512 922b801c79f12d15bcabdb6cd52246cc60a4b512dfcc10bb3933f07d2ec03e01fe5be72502ae34c87374c8a7e880ce268e7dc8d1afcbd28b65efb51b9e467306
+DIST gentoo-functions-1.7.1.tar.bz2 26081 BLAKE2B d62259bdbce08043ce266f6ef78eeda2d103feb541526eb3c8fd692d46eec83368c8d4173b72a1dd8a3acd48f13681ef5e44544b7c185f76b325b6bb05c36e9c SHA512 67b7df5d17ac74aeec8cb6733e6270a184bb11f25c86871758835d860d3466e636f5b7660ef7ab189f3ba90ab3b14f7fb65f1c1e95cf7629220aee8e1d93c72a
+DIST gentoo-functions-1.7.tar.bz2 25934 BLAKE2B f105d8dfab99d56256828ea833c1035445667d80261576a7c7ba3bc74cce64a58567a75d2dad37dff02836989bac2bd9d32f0fd87f93ca337f90eeb04889b991 SHA512 a7e8498dea93bf6f7796d25eb55fd440f9c675ef32d7c2e059bc8206adba7334b7f07b7510174e181dd88dbc9753494e3ff0fbd3c129a6f8524ee07a85edb8cf
EBUILD gentoo-functions-0.19.ebuild 877 BLAKE2B 457e5c405c05e9e928c4f8e9e764fe07b7ace335750bebb01d7226e9b7b1f7ceac0fcb49148087439c8a6b42c034aa1f7590b4203e9d42f06031f2b3acee58d4 SHA512 c846b3451c764b64ec601e9d579542a47d68775e94eac97b8680a08891076226279f0611a19a72ba1b75b0cb35941b22ff3c734831e6c8665c2ca5b65cd1f5b4
EBUILD gentoo-functions-1.5.ebuild 1025 BLAKE2B ec059aed56465fcfd1ee9e057b77c1d1f9c4c251a863c742806a191459b2432a1bc5c7d339d4028fd80f4a77de2c8a21bd7d3724e2dd7c17fa628e7110d658c6 SHA512 0e0b913559b3bd975a53a69bdebb1b04350f59c6c3f5e761ad3ac6472db70a8cbe4c3273158569ce35597d4e81a0e4e15c5805e2585e6ff3025967b02e0b503d
-EBUILD gentoo-functions-1.6.ebuild 1025 BLAKE2B ec059aed56465fcfd1ee9e057b77c1d1f9c4c251a863c742806a191459b2432a1bc5c7d339d4028fd80f4a77de2c8a21bd7d3724e2dd7c17fa628e7110d658c6 SHA512 0e0b913559b3bd975a53a69bdebb1b04350f59c6c3f5e761ad3ac6472db70a8cbe4c3273158569ce35597d4e81a0e4e15c5805e2585e6ff3025967b02e0b503d
+EBUILD gentoo-functions-1.6-r1.ebuild 1135 BLAKE2B 1e5a1a5a25fd10f662c8edf97ddeec7b327c70da9ca31cdf154d16fbf801932c9eeed2bc38873c0d8a675f2991ac957470cf260b4c5a37e06dfd37c01788aaf7 SHA512 003dda154594ad45ceccb1fbed0b54923d08e61b4fb6dde54a0cd420ae6c97ed5ec82681974c54132f0c22be1f3443bf5c01eefe9b091b3d96c10aa2981f59e6
+EBUILD gentoo-functions-1.7-r1.ebuild 1403 BLAKE2B 1f76b45647e4cbcfdff6bb17fd551f09bc311af7e82c8c3e8b9b5b7931c310367ff04e0b827d0551b6c71218e23fcae167de27096a7f99b13202a99ab3a02722 SHA512 201cd97be2e61fccdcb6efd38a0759a0297af7ad0f3c76f8570ec9de7ab35afc523bb8f2d03e42ac771a5ebda2423bed785ac6cf83ff623231fbbded2f968bba
+EBUILD gentoo-functions-1.7.1.ebuild 1403 BLAKE2B 1f76b45647e4cbcfdff6bb17fd551f09bc311af7e82c8c3e8b9b5b7931c310367ff04e0b827d0551b6c71218e23fcae167de27096a7f99b13202a99ab3a02722 SHA512 201cd97be2e61fccdcb6efd38a0759a0297af7ad0f3c76f8570ec9de7ab35afc523bb8f2d03e42ac771a5ebda2423bed785ac6cf83ff623231fbbded2f968bba
EBUILD gentoo-functions-9999.ebuild 1403 BLAKE2B 1f76b45647e4cbcfdff6bb17fd551f09bc311af7e82c8c3e8b9b5b7931c310367ff04e0b827d0551b6c71218e23fcae167de27096a7f99b13202a99ab3a02722 SHA512 201cd97be2e61fccdcb6efd38a0759a0297af7ad0f3c76f8570ec9de7ab35afc523bb8f2d03e42ac771a5ebda2423bed785ac6cf83ff623231fbbded2f968bba
MISC metadata.xml 487 BLAKE2B c34b1b196d84a44ca3f2729101b826a6460f6b560f942e95e444d23b821256e9c4f330e5b7a2530dabd34b0f1e0a3844ed4b52ea5944500b0b4c72bd955f988a SHA512 3c3008734be30e74ccf3a1f34e4112eef2df0f4e8b0b5d1dd1e90037d130428b21b05ad3686a74c18e5a035a15b32e89cd04de4274e311aa1e30a42ad8cf97f0
diff --git a/sys-apps/gentoo-functions/files/gentoo-functions-1.6-add-warn-function.patch b/sys-apps/gentoo-functions/files/gentoo-functions-1.6-add-warn-function.patch
new file mode 100644
index 000000000000..8fcce19a8fda
--- /dev/null
+++ b/sys-apps/gentoo-functions/files/gentoo-functions-1.6-add-warn-function.patch
@@ -0,0 +1,34 @@
+From 755177bbfcf4c46ad1ac31ad9501a6c8725b1a68 Mon Sep 17 00:00:00 2001
+From: Kerin Millar <kfm@plushkava.net>
+Date: Sun, 2 Jun 2024 04:36:27 +0100
+Subject: Add the warn() function
+
+This will be used internally by a forthcoming commit.
+
+Signed-off-by: Kerin Millar <kfm@plushkava.net>
+---
+ functions.sh | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/functions.sh b/functions.sh
+index 9736747..a97dde7 100644
+--- a/functions.sh
++++ b/functions.sh
+@@ -473,6 +473,14 @@ vewend()
+ fi
+ }
+
++#
++# Prints a diagnostic message prefixed with the basename of the running script.
++#
++warn()
++{
++ printf '%s: %s\n' "${0##*/}" "$*" >&2
++}
++
+ #
+ # Determines whether the first parameter is truthy. The values taken to be true
+ # are "yes", "true", "on" and "1", whereas their opposites are taken to be
+--
+cgit v1.2.3-65-gdbad
+
diff --git a/sys-apps/gentoo-functions/files/gentoo-functions-1.6-relax-parameter-validation.patch b/sys-apps/gentoo-functions/files/gentoo-functions-1.6-relax-parameter-validation.patch
new file mode 100644
index 000000000000..4f89c9f4acb6
--- /dev/null
+++ b/sys-apps/gentoo-functions/files/gentoo-functions-1.6-relax-parameter-validation.patch
@@ -0,0 +1,233 @@
+From 3f2519288f1074a7ef5e8378f4bdf37809b262e5 Mon Sep 17 00:00:00 2001
+From: Kerin Millar <kfm@plushkava.net>
+Date: Sun, 2 Jun 2024 04:36:37 +0100
+Subject: Relax parameter validation for various functions
+
+Following some deliberation over the matter, I have concluded that
+calling die() for the handling of invalid parameters ought not to be
+considered as a matter of course. As such, this commit retains the
+existing diagnostics for the functions listed below, while modifying
+them so as to no longer attempt to exit the shell.
+
+- eend
+- eqatag
+- esyslog
+- ewend
+- is_older than
+- veend
+- vewend
+- yesno
+
+Signed-off-by: Kerin Millar <kfm@plushkava.net>
+---
+ functions.sh | 69 ++++++++++++++++++++++++++++++++++------------------------
+ test-functions | 13 ++---------
+ 2 files changed, 42 insertions(+), 40 deletions(-)
+
+diff --git a/functions.sh b/functions.sh
+index 48b4c5a..ec1f339 100644
+--- a/functions.sh
++++ b/functions.sh
+@@ -63,7 +63,7 @@ if ! command -v die >/dev/null; then
+ *)
+ genfun_status=$?
+ esac
+- printf '%s: %s\n' "${0##*/}" "$*" >&2
++ warn "$@"
+ exit "${genfun_status}"
+ }
+ fi
+@@ -209,7 +209,8 @@ eqatag()
+ shift
+ fi
+ if [ "$#" -eq 0 ]; then
+- die "eqatag: no tag specified"
++ warn "eqatag: no tag specified"
++ return 1
+ fi
+ positional=0
+ tag=$1
+@@ -222,7 +223,8 @@ eqatag()
+ case ${arg} in
+ [!=/]*=?*)
+ if [ "${positional}" -eq 1 ]; then
+- _throw_invalid_args eqatag "${arg}"
++ _warn_for_args eqatag "${arg}"
++ return 1
+ fi
+ set -- "$@" --arg "${arg%%=*}" "${arg#*=}"
+ ;;
+@@ -234,7 +236,8 @@ eqatag()
+ set -- "$@" "${arg}"
+ ;;
+ *)
+- _throw_invalid_args eqatag "${arg}"
++ _warn_for_args eqatag "${arg}"
++ return 1
+ esac
+ done
+ json=$(
+@@ -269,7 +272,8 @@ esyslog()
+ local pri tag msg
+
+ if [ "$#" -lt 2 ]; then
+- die "esyslog: too few arguments (got $#, expected at least 2)"
++ warn "esyslog: too few arguments (got $#, expected at least 2)"
++ return 1
+ elif yesno "${EINFO_LOG}" && hash logger 2>/dev/null; then
+ pri=$1
+ tag=$2
+@@ -380,8 +384,9 @@ is_older_than()
+ {
+ local ref has_gfind
+
+- if [ "$#" -lt 2 ]; then
+- die "is_older_than: too few arguments (got $#, expected at least 2)"
++ if [ "$#" -eq 0 ]; then
++ warn "is_older_than: too few arguments (got $#, expected at least 1)"
++ return 1
+ elif [ -e "$1" ]; then
+ ref=$1
+ else
+@@ -431,7 +436,8 @@ veend()
+ if yesno "${EINFO_VERBOSE}"; then
+ GENFUN_CALLER=veend eend "$@"
+ elif [ "$#" -gt 0 ] && { ! is_int "$1" || [ "$1" -lt 0 ]; }; then
+- _throw_invalid_args veend "$1"
++ _warn_for_args veend "$1"
++ false
+ else
+ return "$1"
+ fi
+@@ -442,7 +448,8 @@ vewend()
+ if yesno "${EINFO_VERBOSE}"; then
+ GENFUN_CALLER=vewend ewend "$@"
+ elif [ "$#" -gt 0 ] && { ! is_int "$1" || [ "$1" -lt 0 ]; }; then
+- _throw_invalid_args vewend "$1"
++ _warn_for_args vewend "$1"
++ false
+ else
+ return "$1"
+ fi
+@@ -459,7 +466,8 @@ yesno()
+ local arg
+
+ if [ "$#" -eq 0 ]; then
+- die "yesno: too few arguments (got $#, expected 1)"
++ warn "yesno: too few arguments (got $#, expected 1)"
++ return 1
+ fi
+ arg=$1
+ for _ in 1 2; do
+@@ -471,14 +479,15 @@ yesno()
+ return 0
+ esac
+ if [ "$_" -ne 1 ] || ! is_identifier "$1"; then
+- ! break
++ break
+ else
+ # The value appears to be a legal variable name. Treat
+ # it as a name reference and try again, once only.
+ eval "arg=\$$1"
+ fi
+- done || _throw_invalid_args yesno "$1"
+- return 1
++ done
++ _warn_for_args yesno "$@"
++ false
+ }
+
+ #
+@@ -494,7 +503,9 @@ _eend()
+ if [ "$#" -eq 0 ]; then
+ retval=0
+ elif ! is_int "$1" || [ "$1" -lt 0 ]; then
+- _throw_invalid_args "${GENFUN_CALLER}" "$1"
++ _warn_for_args "${GENFUN_CALLER}" "$1"
++ retval=1
++ msg=
+ else
+ retval=$1
+ shift
+@@ -662,21 +673,6 @@ _print_args()
+ EOF
+ }
+
+-#
+-# Prints a diganostic message concerning invalid function arguments then exits.
+-# The first argument shall be taken as a function identifier. The remaining
+-# arguments shall be safely rendered as a part of the diagnostic.
+-#
+-_throw_invalid_args()
+-{
+- local ident plural
+-
+- ident=$1
+- shift
+- [ "$#" -gt 1 ] && plural=s || plural=
+- die "${ident}: invalid argument${plural}: $(_print_args "$@")"
+-}
+-
+ #
+ # Determines whether the terminal on STDIN is able to report its dimensions.
+ # Upon success, the number of columns shall be stored in genfun_cols.
+@@ -718,6 +714,21 @@ _update_tty_level()
+ fi
+ }
+
++#
++# Prints a diganostic message concerning invalid function arguments. The first
++# argument shall be taken as a function identifier. The remaining arguments
++# shall be safely rendered as a part of the diagnostic.
++#
++_warn_for_args()
++{
++ local ident plural
++
++ ident=$1
++ shift
++ [ "$#" -gt 1 ] && plural=s || plural=
++ warn "${ident}: invalid argument${plural}: $(_print_args "$@")"
++}
++
+ # All function declarations end here! Initialisation code only from hereon.
+ # shellcheck disable=2034
+ RC_GOT_FUNCTIONS=yes
+diff --git a/test-functions b/test-functions
+index d65a3a2..4a6e7dd 100755
+--- a/test-functions
++++ b/test-functions
+@@ -196,11 +196,7 @@ test_is_older_than() {
+ callback() {
+ shift
+ test_description="is_older_than $(_print_args "$@")"
+- if [ "$#" -lt 2 ]; then
+- ( is_older_than "$@" )
+- else
+- is_older_than "$@"
+- fi
++ is_older_than "$@"
+ }
+
+ iterate_tests 4 "$@"
+@@ -392,16 +388,11 @@ test_yesno() {
+
+ # shellcheck disable=2034
+ truthful_nameref=yes
+- row=0
+
+ callback() {
+ shift
+ test_description="yesno $(_print_args "$@")"
+- if [ "$(( row += 1 ))" -ge 22 ]; then
+- ( yesno "$@" )
+- else
+- yesno "$@"
+- fi
++ yesno "$@"
+ }
+
+ iterate_tests 3 "$@"
+--
+cgit v1.2.3-65-gdbad
+
diff --git a/sys-apps/gentoo-functions/gentoo-functions-1.6.ebuild b/sys-apps/gentoo-functions/gentoo-functions-1.6-r1.ebuild
index 8df3a1e88bad..191370d892fa 100644
--- a/sys-apps/gentoo-functions/gentoo-functions-1.6.ebuild
+++ b/sys-apps/gentoo-functions/gentoo-functions-1.6-r1.ebuild
@@ -24,6 +24,11 @@ RESTRICT="!test? ( test )"
# Specifically needs GNU find, as well.
RDEPEND=">=sys-apps/findutils-4.9"
+PATCHES=(
+ "${FILESDIR}/${P}-relax-parameter-validation.patch"
+ "${FILESDIR}/${P}-add-warn-function.patch"
+)
+
src_configure() {
local emesonargs=(
# Deliberately avoid /usr as consumers assume we're at /lib/gentoo.
diff --git a/sys-apps/gentoo-functions/gentoo-functions-1.7-r1.ebuild b/sys-apps/gentoo-functions/gentoo-functions-1.7-r1.ebuild
new file mode 100644
index 000000000000..864663a97757
--- /dev/null
+++ b/sys-apps/gentoo-functions/gentoo-functions-1.7-r1.ebuild
@@ -0,0 +1,52 @@
+# Copyright 2014-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit meson
+
+DESCRIPTION="Base functions required by all Gentoo systems"
+HOMEPAGE="https://gitweb.gentoo.org/proj/gentoo-functions.git"
+
+if [[ ${PV} == 9999* ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/gentoo-functions.git"
+else
+ SRC_URI="https://gitweb.gentoo.org/proj/gentoo-functions.git/snapshot/${P}.tar.bz2"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+fi
+
+LICENSE="GPL-2 public-domain"
+SLOT="0"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+# Specifically needs GNU find, as well.
+RDEPEND=">=sys-apps/findutils-4.9"
+
+src_configure() {
+ local emesonargs=(
+ # Deliberately avoid /usr as consumers assume we're at /lib/gentoo.
+ --prefix="${EPREFIX:-/}"
+ --mandir="${EPREFIX}/usr/share/man"
+ $(meson_use test tests)
+ )
+
+ meson_src_configure
+}
+
+src_install() {
+ meson_src_install
+
+ if [[ ${EPREFIX} ]]; then
+ while read -r; do
+ if [[ ${REPLY} == $'\t'genfun_prefix= ]]; then
+ printf 'genfun_prefix=%q\n' "${EPREFIX}"
+ else
+ printf '%s\n' "${REPLY}"
+ fi || ! break
+ done < "${ED}/lib/gentoo/functions.sh" > "${T}/functions.sh" \
+ && mv -- "${T}/functions.sh" "${ED}/lib/gentoo/functions.sh" \
+ || die
+ fi
+}
diff --git a/sys-apps/gentoo-functions/gentoo-functions-1.7.1.ebuild b/sys-apps/gentoo-functions/gentoo-functions-1.7.1.ebuild
new file mode 100644
index 000000000000..864663a97757
--- /dev/null
+++ b/sys-apps/gentoo-functions/gentoo-functions-1.7.1.ebuild
@@ -0,0 +1,52 @@
+# Copyright 2014-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit meson
+
+DESCRIPTION="Base functions required by all Gentoo systems"
+HOMEPAGE="https://gitweb.gentoo.org/proj/gentoo-functions.git"
+
+if [[ ${PV} == 9999* ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/gentoo-functions.git"
+else
+ SRC_URI="https://gitweb.gentoo.org/proj/gentoo-functions.git/snapshot/${P}.tar.bz2"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+fi
+
+LICENSE="GPL-2 public-domain"
+SLOT="0"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+# Specifically needs GNU find, as well.
+RDEPEND=">=sys-apps/findutils-4.9"
+
+src_configure() {
+ local emesonargs=(
+ # Deliberately avoid /usr as consumers assume we're at /lib/gentoo.
+ --prefix="${EPREFIX:-/}"
+ --mandir="${EPREFIX}/usr/share/man"
+ $(meson_use test tests)
+ )
+
+ meson_src_configure
+}
+
+src_install() {
+ meson_src_install
+
+ if [[ ${EPREFIX} ]]; then
+ while read -r; do
+ if [[ ${REPLY} == $'\t'genfun_prefix= ]]; then
+ printf 'genfun_prefix=%q\n' "${EPREFIX}"
+ else
+ printf '%s\n' "${REPLY}"
+ fi || ! break
+ done < "${ED}/lib/gentoo/functions.sh" > "${T}/functions.sh" \
+ && mv -- "${T}/functions.sh" "${ED}/lib/gentoo/functions.sh" \
+ || die
+ fi
+}