public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] EAPI 9 feature proposal
@ 2023-05-17  5:03 Oskari Pirhonen
  2023-05-17  6:19 ` Michał Górny
  0 siblings, 1 reply; 4+ messages in thread
From: Oskari Pirhonen @ 2023-05-17  5:03 UTC (permalink / raw
  To: gentoo-dev; +Cc: mattst88, pms

[-- Attachment #1: Type: text/plain, Size: 1123 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] EAPI 9 feature proposal
  2023-05-17  5:03 [gentoo-dev] EAPI 9 feature proposal Oskari Pirhonen
@ 2023-05-17  6:19 ` Michał Górny
  2023-05-20 18:11   ` Oskari Pirhonen
  0 siblings, 1 reply; 4+ messages in thread
From: Michał Górny @ 2023-05-17  6:19 UTC (permalink / raw
  To: gentoo-dev; +Cc: mattst88, pms

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] EAPI 9 feature proposal
  2023-05-17  6:19 ` Michał Górny
@ 2023-05-20 18:11   ` Oskari Pirhonen
  2023-05-21  3:39     ` Michał Górny
  0 siblings, 1 reply; 4+ messages in thread
From: Oskari Pirhonen @ 2023-05-20 18:11 UTC (permalink / raw
  To: Michał Górny; +Cc: gentoo-dev, mattst88, pms

[-- Attachment #1: Type: text/plain, Size: 636 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] EAPI 9 feature proposal
  2023-05-20 18:11   ` Oskari Pirhonen
@ 2023-05-21  3:39     ` Michał Górny
  0 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2023-05-21  3:39 UTC (permalink / raw
  To: gentoo-dev; +Cc: mattst88, pms

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-21  3:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-17  5:03 [gentoo-dev] EAPI 9 feature proposal Oskari Pirhonen
2023-05-17  6:19 ` Michał Górny
2023-05-20 18:11   ` Oskari Pirhonen
2023-05-21  3:39     ` Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox