Gentoo Archives: gentoo-dev

From: Sam James <sam@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH 0/2] Add esed.eclass for sed that dies if caused no changes
Date: Fri, 03 Jun 2022 05:02:32
Message-Id: D524F3AA-C7C7-4B87-A131-ADCE374DF907@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH 0/2] Add esed.eclass for sed that dies if caused no changes by Sam James
1 > On 3 Jun 2022, at 05:59, Sam James <sam@g.o> wrote:
2 >
3 >
4 >
5 >> On 31 May 2022, at 12:23, Ionen Wolkens <ionen@g.o> wrote:
6 >>
7 >> Often preferable to use patches so this happens, but sed have its
8 >> uses/convenience and this intend to help reduce the amount of old
9 >> broken seds causing issues that go unnoticed on bumps.
10 >>
11 >> Inspired by app-portage/iwdevtools' qa-sed (warns on any seds), but
12 >> this is for more deterministic use in ebuilds.
13 >>
14 >> Also slightly shortens sed use, -i is default, and no need to || die.
15 >> (see @EXAMPLE in eclass for a quick usage overview).
16 >>
17 >> Implementation / available wrappers / usefulness still up for debate,
18 >> but without further comments I consider this ready (albeit first time
19 >> touching / making an eclass, so I could be overlooking simple things).
20 >> Also partly uses >=bash-4.4, so EAPI-7 is not considered.
21 >>
22 >> See github PR[1] for old changelog background.
23 >>
24 >> Up to maintainers but personally would encourage to slowly replace
25 >> (almost) all use of sed with either this or patches. Some cases
26 >> where it can be inconvenient like eclasses "guessing" that a package
27 >> may or may not have something to replace, and that nothing happened
28 >> is not an issue.
29 >>
30 >
31 > I like it. I'd prefer it if GNU sed supported it by itself (exit code indicating
32 > if any changes were made) but it doesn't right now.
33 >
34 > Ebuilds use sed aplenty and making it easier to be "less bad" is a good
35 > thing. It's a practical solution to a real problem we have (zombie seds,
36 > or more rarely, overzealous-and-not-realising-it seds).
37 >
38 > I don't want us to have to keep it forever and I wouldn't want
39 > people to actively use this instead of patches, but they certainly should
40 > instead of sed.
41 >
42
43 Also, I like that we let ourselves experiment a bit with edo.eclass,
44 and I don't see this as too different from that. Unless something is
45 absolutely the wrong approach and we know it won't go anywhere,
46 I think exploring options is generally a good thing.
47
48 Plus, we've seen the actual need for this from iwdevtools usage
49 (warns on such zombie seds). Let's give it a go, I think?
50
51 >> [1] https://github.com/gentoo/gentoo/pull/25662
52 >>
53 >> Ionen Wolkens (2):
54 >> esed.eclass: new eclass
55 >> eclass/tests/esed.sh: basic tests for esed.eclass
56 >>
57 >> eclass/esed.eclass | 199 +++++++++++++++++++++++++++++++++++++++++++
58 >> eclass/tests/esed.sh | 173 +++++++++++++++++++++++++++++++++++++
59 >> 2 files changed, 372 insertions(+)
60 >> create mode 100644 eclass/esed.eclass
61 >> create mode 100755 eclass/tests/esed.sh
62 >>
63 >> --
64 >> 2.35.1
65 >>
66 >
67 > best,
68 > sam

Attachments

File name MIME type
signature.asc application/pgp-signature