From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (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 finch.gentoo.org (Postfix) with ESMTPS id BDE1B1580EB for ; Wed, 28 May 2025 10:36:58 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (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) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 9E01534308B for ; Wed, 28 May 2025 10:36:58 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 98CB1110287; Wed, 28 May 2025 10:36:57 +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)) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 8BF1F110287 for ; Wed, 28 May 2025 10:36:57 +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 10DBE34308B for ; Wed, 28 May 2025 10:36:57 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AAF38275F for ; Wed, 28 May 2025 10:36:55 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1748428588.8640db01f2f2d1c37821c0a6d096ed67a8b734e2.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/eapi.sh X-VCS-Directories: bin/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 8640db01f2f2d1c37821c0a6d096ed67a8b734e2 X-VCS-Branch: master Date: Wed, 28 May 2025 10:36:55 +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: 26c718f8-1231-497e-9400-abf52255f3b8 X-Archives-Hash: 67d8e4ea29fe4332ff496abcfeb6ca42 commit: 8640db01f2f2d1c37821c0a6d096ed67a8b734e2 Author: Kerin Millar plushkava net> AuthorDate: Fri Jul 26 00:37:42 2024 +0000 Commit: Sam James gentoo org> CommitDate: Wed May 28 10:36:28 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=8640db01 eapi.sh: match by extended glob rather than by ERE As regards the [[ keyword, bash always treats the right-hand side of == and != as an extended globbing pattern. However, prior to bash-4.1, the parser required for the extglob shopt to be enabled in order to tolerate a raw extglob. Otherwise, the only alternative was to conceal the extglob by expanding it from a variable. Given that I am targeting bash-4.2+, these constraints no longer apply. As such, employ conventional pattern matching throughout eapi.sh. Testing with == and != is measurably faster than with =~ and is easier on the eye in most cases. It should be noted that extglobs support branching, just as regular expressions do. For instance, @([0-9]|4-slot-abi|10) would be a perfectly legal pattern. Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> bin/eapi.sh | 136 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/bin/eapi.sh b/bin/eapi.sh index 3ea24cbb06..fa64458183 100644 --- a/bin/eapi.sh +++ b/bin/eapi.sh @@ -5,281 +5,281 @@ # PHASES ___eapi_has_pkg_pretend() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] + [[ ${1-${EAPI-0}} != [0-3] ]] } ___eapi_has_src_prepare() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1)$ ]] + [[ ${1-${EAPI-0}} != [01] ]] } ___eapi_has_src_configure() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1)$ ]] + [[ ${1-${EAPI-0}} != [01] ]] } ___eapi_default_src_test_disables_parallel_jobs() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4)$ ]] + [[ ${1-${EAPI-0}} == [0-4] ]] } ___eapi_has_S_WORKDIR_fallback() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] + [[ ${1-${EAPI-0}} == [0-3] ]] } # VARIABLES ___eapi_has_prefix_variables() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2)$ ]] + [[ ${1-${EAPI-0}} != [0-2] ]] } ___eapi_has_BROOT() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6)$ ]] + [[ ${1-${EAPI-0}} != [0-6] ]] } ___eapi_has_SYSROOT() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6)$ ]] + [[ ${1-${EAPI-0}} != [0-6] ]] } ___eapi_has_BDEPEND() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6)$ ]] + [[ ${1-${EAPI-0}} != [0-6] ]] } ___eapi_has_IDEPEND() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} != [0-7] ]] } ___eapi_has_RDEPEND_DEPEND_fallback() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] + [[ ${1-${EAPI-0}} == [0-3] ]] } ___eapi_has_PORTDIR_ECLASSDIR() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6)$ ]] + [[ ${1-${EAPI-0}} == [0-6] ]] } ___eapi_has_accumulated_PROPERTIES() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} != [0-7] ]] } ___eapi_has_accumulated_RESTRICT() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} != [0-7] ]] } # HELPERS PRESENCE ___eapi_has_dohard() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] + [[ ${1-${EAPI-0}} == [0-3] ]] } ___eapi_has_dosed() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] + [[ ${1-${EAPI-0}} == [0-3] ]] } ___eapi_has_einstall() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5)$ ]] + [[ ${1-${EAPI-0}} == [0-5] ]] } ___eapi_has_dohtml() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6)$ ]] + [[ ${1-${EAPI-0}} == [0-6] ]] } ___eapi_has_dolib_libopts() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6)$ ]] + [[ ${1-${EAPI-0}} == [0-6] ]] } ___eapi_has_docompress() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] + [[ ${1-${EAPI-0}} != [0-3] ]] } ___eapi_has_dostrip() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6)$ ]] + [[ ${1-${EAPI-0}} != [0-6] ]] } ___eapi_has_nonfatal() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] + [[ ${1-${EAPI-0}} != [0-3] ]] } ___eapi_has_doheader() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4)$ ]] + [[ ${1-${EAPI-0}} != [0-4] ]] } ___eapi_has_usex() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4)$ ]] + [[ ${1-${EAPI-0}} != [0-4] ]] } ___eapi_has_get_libdir() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5)$ ]] + [[ ${1-${EAPI-0}} != [0-5] ]] } ___eapi_has_einstalldocs() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5)$ ]] + [[ ${1-${EAPI-0}} != [0-5] ]] } ___eapi_has_eapply() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5)$ ]] + [[ ${1-${EAPI-0}} != [0-5] ]] } ___eapi_has_eapply_user() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5)$ ]] + [[ ${1-${EAPI-0}} != [0-5] ]] } ___eapi_has_in_iuse() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5)$ ]] + [[ ${1-${EAPI-0}} != [0-5] ]] } ___eapi_has_version_functions() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6)$ ]] + [[ ${1-${EAPI-0}} != [0-6] ]] } ___eapi_has_hasq() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} == [0-7] ]] } ___eapi_has_hasv() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} == [0-7] ]] } ___eapi_has_useq() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} == [0-7] ]] } # HELPERS BEHAVIOR ___eapi_best_version_and_has_version_support_--host-root() { - [[ ${1-${EAPI-0}} =~ ^(5|6)$ ]] + [[ ${1-${EAPI-0}} == [56] ]] } ___eapi_best_version_and_has_version_support_-b_-d_-r() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6)$ ]] + [[ ${1-${EAPI-0}} != [0-6] ]] } ___eapi_unpack_supports_xz() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2)$ ]] + [[ ${1-${EAPI-0}} != [0-2] ]] } ___eapi_unpack_supports_txz() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5)$ ]] + [[ ${1-${EAPI-0}} != [0-5] ]] } ___eapi_unpack_supports_7z() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} == [0-7] ]] } ___eapi_unpack_supports_lha() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} == [0-7] ]] } ___eapi_unpack_supports_rar() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} == [0-7] ]] } ___eapi_econf_passes_--disable-dependency-tracking() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] + [[ ${1-${EAPI-0}} != [0-3] ]] } ___eapi_econf_passes_--disable-silent-rules() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4)$ ]] + [[ ${1-${EAPI-0}} != [0-4] ]] } ___eapi_econf_passes_--datarootdir() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} != [0-7] ]] } ___eapi_econf_passes_--disable-static() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} != [0-7] ]] } ___eapi_econf_passes_--docdir_and_--htmldir() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5)$ ]] + [[ ${1-${EAPI-0}} != [0-5] ]] } ___eapi_econf_passes_--with-sysroot() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6)$ ]] + [[ ${1-${EAPI-0}} != [0-6] ]] } ___eapi_use_enable_and_use_with_support_empty_third_argument() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] + [[ ${1-${EAPI-0}} != [0-3] ]] } ___eapi_dodoc_supports_-r() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] + [[ ${1-${EAPI-0}} != [0-3] ]] } ___eapi_doins_and_newins_preserve_symlinks() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] + [[ ${1-${EAPI-0}} != [0-3] ]] } ___eapi_newins_supports_reading_from_standard_input() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4)$ ]] + [[ ${1-${EAPI-0}} != [0-4] ]] } ___eapi_helpers_can_die() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] + [[ ${1-${EAPI-0}} != [0-3] ]] } ___eapi_unpack_is_case_sensitive() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5)$ ]] + [[ ${1-${EAPI-0}} == [0-5] ]] } ___eapi_unpack_supports_absolute_paths() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5)$ ]] + [[ ${1-${EAPI-0}} != [0-5] ]] } ___eapi_die_can_respect_nonfatal() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5)$ ]] + [[ ${1-${EAPI-0}} != [0-5] ]] } ___eapi_domo_respects_into() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6)$ ]] + [[ ${1-${EAPI-0}} == [0-6] ]] } ___eapi_has_DESTTREE_INSDESTTREE() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6)$ ]] + [[ ${1-${EAPI-0}} == [0-6] ]] } ___eapi_has_dosym_r() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} != [0-7] ]] } ___eapi_usev_has_second_arg() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} != [0-7] ]] } ___eapi_doconfd_respects_insopts() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} == [0-7] ]] } ___eapi_doenvd_respects_insopts() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} == [0-7] ]] } ___eapi_doheader_respects_insopts() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} == [0-7] ]] } ___eapi_doinitd_respects_exeopts() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} == [0-7] ]] } # OTHERS ___eapi_enables_failglob_in_global_scope() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5)$ ]] + [[ ${1-${EAPI-0}} != [0-5] ]] } ___eapi_bash_3_2() { - [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5)$ ]] + [[ ${1-${EAPI-0}} == [0-5] ]] } ___eapi_bash_4_2() { - [[ ${1-${EAPI-0}} =~ ^(6|7)$ ]] + [[ ${1-${EAPI-0}} == [67] ]] } ___eapi_bash_5_0() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} != [0-7] ]] } ___eapi_has_ENV_UNSET() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6)$ ]] + [[ ${1-${EAPI-0}} != [0-6] ]] } ___eapi_has_strict_keepdir() { - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6|7)$ ]] + [[ ${1-${EAPI-0}} != [0-7] ]] }