• [gentoo-dev] EAPI 9 feature proposal

    From Oskari Pirhonen@21:1/5 to All on Wed May 17 07:10:01 2023
    Hi,

    Matt recently made a PR to a QA check script in Portage [1] which
    included the following function:

    is_in() {
    local needle=$1
    shift

    local x
    for x in "$@"; do
    [[ "${needle}" = ${x} ]] && return 0
    done
    return 1
    }

    It's more or less `has` but with Bash pattern matching support. The
    difference is in how it handles the conditional. For reference, here is
    the implementation of `has` in Portage:

    has() {
    local needle=$1
    shift

    local x
    for x in "$@"; do
    [[ "${x}" = "${needle}" ]] && return 0
    done
    return 1
    }

    We agreed that it could potentially be useful as something that's
    available for general use, so I'd like to propose the idea of adding the ability to query a list for something like "foo*" or "foob??". Here's
    two possibilities for how I would go about implementing it:

    1. Add Matt's function. Perhaps as `hasp` (for "has pattern") or
    something.
    2. Change `has` to support pattern matching in EAPI 9+

    Thoughts?

    - Oskari

    [1]: https://github.com/gentoo/portage/pull/1034

    -----BEGIN PGP SIGNATURE-----

    iHUEABYIAB0WIQQfOU+JeXjo4uxN6vCp8he9GGIfEQUCZGRgNwAKCRCp8he9GGIf EW91APwJx/c1XJgWkS/w4IjV7u8/eEwGTLhVZxmkiNm+/MBcNwD/SD5HlN7J3Xky xc+y05uOq7/drR2IhavJE6kHDwYP/Q0=
    =XWQT
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?=@21:1/5 to Oskari Pirhonen on Wed May 17 08:30:01 2023
    On Wed, 2023-05-17 at 00:03 -0500, Oskari Pirhonen wrote:
    We agreed that it could potentially be useful as something that's
    available for general use

    We generally don't add something into EAPI unless it's either:

    1) used widely, or

    2) hard to implement outside the PM.

    I don't think this qualifies as either. I don't immediately see any use
    case for it myself.

    --
    Best regards,
    Michał Górny

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Oskari Pirhonen@21:1/5 to All on Sat May 20 20:20:01 2023
    On Wed, May 17, 2023 at 08:19:48 +0200, Michał Górny wrote:
    On Wed, 2023-05-17 at 00:03 -0500, Oskari Pirhonen wrote:
    We agreed that it could potentially be useful as something that's
    available for general use

    We generally don't add something into EAPI unless it's either:

    1) used widely, or

    2) hard to implement outside the PM.

    I don't think this qualifies as either. I don't immediately see any use
    case for it myself.


    That's fine. Which is why I wanted to ask here first before opening an
    EAPI bug only for it to be closed right away as NOTINTERESTED or
    whatever.

    - Oskari

    -----BEGIN PGP SIGNATURE-----

    iHQEABYIAB0WIQQfOU+JeXjo4uxN6vCp8he9GGIfEQUCZGkNagAKCRCp8he9GGIf Ea23APY3a2R8JRXNAhiSaTLItY65E4kZxFLMG+z6tXh1EJqTAQC4pS1ik9stBgkO y+YreBpuG9HVBMsk71MBvaY2pL4+Bw==
    =lM1A
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?=@21:1/5 to Oskari Pirhonen on Sun May 21 05:50:01 2023
    On Sat, 2023-05-20 at 13:11 -0500, Oskari Pirhonen wrote:
    On Wed, May 17, 2023 at 08:19:48 +0200, Michał Górny wrote:
    On Wed, 2023-05-17 at 00:03 -0500, Oskari Pirhonen wrote:
    We agreed that it could potentially be useful as something that's available for general use

    We generally don't add something into EAPI unless it's either:

    1) used widely, or

    2) hard to implement outside the PM.

    I don't think this qualifies as either. I don't immediately see any use case for it myself.


    That's fine. Which is why I wanted to ask here first before opening an
    EAPI bug only for it to be closed right away as NOTINTERESTED or
    whatever.


    For the record, there's no harm in opening "future EAPI" bugs. They
    also serve as a record of historical requests and provide wider
    (and easier to find) context if anyone has the same problem/idea
    in the future.

    --
    Best regards,
    Michał Górny

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)