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

Attachments

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

Replies