Implementation / available wrappers / usefulness still up for debate,
but without further comments I consider this ready (albeit first time touching / making an eclass, so I could be overlooking simple things).
Also partly uses >=bash-4.4, so EAPI-7 is not considered.
Beginning with EAPI 4, the dosed helper no longer exists
Ebuilds should call sed(1) directly (and assume that it is GNU
sed).
esed does bring back the -i/die skipping but that's not its inherent
purpose and GNU sed currently does not support a mean to report if
changes occurred (if this happens, esed may well become obsolete too).
On 2022-05-31 07:23, Ionen Wolkens wrote:
Implementation / available wrappers / usefulness still up for debate,
but without further comments I consider this ready (albeit first time touching / making an eclass, so I could be overlooking simple things).
Also partly uses >=bash-4.4, so EAPI-7 is not considered.
From ebuild(5):
Beginning with EAPI 4, the dosed helper no longer exists
Ebuilds should call sed(1) directly (and assume that it is GNU
sed).
What were the reasons to remove this helper? Do they still apply to esed
as an eclass?
Often preferable to use patches so this happens, but sed have its uses/convenience and this intend to help reduce the amount of old
broken seds causing issues that go unnoticed on bumps.
Inspired by app-portage/iwdevtools' qa-sed (warns on any seds), but
this is for more deterministic use in ebuilds.
Also slightly shortens sed use, -i is default, and no need to || die.
(see @EXAMPLE in eclass for a quick usage overview).
On Fri, Jun 03, 2022 at 06:09:38AM +0200, Michał Górny wrote:
On Tue, 2022-05-31 at 07:23 -0400, Ionen Wolkens wrote:
Often preferable to use patches so this happens, but sed have its uses/convenience and this intend to help reduce the amount of old
broken seds causing issues that go unnoticed on bumps.
Inspired by app-portage/iwdevtools' qa-sed (warns on any seds), but
this is for more deterministic use in ebuilds.
Also slightly shortens sed use, -i is default, and no need to || die. (see @EXAMPLE in eclass for a quick usage overview).
To be honest, I strongly dislike this. It really feels like trying to
make an adapter for a square wheel, while the right solution would be to replace the wheel. On top of that, ton of evals which are pretty much
a huge "no-no".
About evals, the two eval is just to silence this:
var=$(printf "\0")
The 2>/dev/null doesn't work without wrapping it, aka
eval 'var=$(printf "\0")' 2>/dev/null
No variables are expanded pre-eval so it's just evaluating a
static statement. eval can be removed, but it'll be noisy
if someone happens to sed binary files.
Perhaps it would be better to forget about trying to work miracles with
sed and instead write a trivial shell replacement for the most common
use cases. One thing I'd love to see is a simple substitution command
that would work for paths/CFLAGS on RHS without having to worry about
them conflicting with the pattern delimiter.
--
Best regards,
Michał Górny
--
ionen
On Tue, 2022-05-31 at 07:23 -0400, Ionen Wolkens wrote:
Often preferable to use patches so this happens, but sed have its uses/convenience and this intend to help reduce the amount of old
broken seds causing issues that go unnoticed on bumps.
Inspired by app-portage/iwdevtools' qa-sed (warns on any seds), but
this is for more deterministic use in ebuilds.
Also slightly shortens sed use, -i is default, and no need to || die.
(see @EXAMPLE in eclass for a quick usage overview).
To be honest, I strongly dislike this. It really feels like trying to
make an adapter for a square wheel, while the right solution would be to replace the wheel. On top of that, ton of evals which are pretty much
a huge "no-no".
Perhaps it would be better to forget about trying to work miracles with
sed and instead write a trivial shell replacement for the most common
use cases. One thing I'd love to see is a simple substitution command
that would work for paths/CFLAGS on RHS without having to worry about
them conflicting with the pattern delimiter.
--
Best regards,
Michał Górny
On 31 May 2022, at 12:23, Ionen Wolkens <[email protected]> wrote:
Often preferable to use patches so this happens, but sed have its uses/convenience and this intend to help reduce the amount of old
broken seds causing issues that go unnoticed on bumps.
Inspired by app-portage/iwdevtools' qa-sed (warns on any seds), but
this is for more deterministic use in ebuilds.
Also slightly shortens sed use, -i is default, and no need to || die.
(see @EXAMPLE in eclass for a quick usage overview).
Implementation / available wrappers / usefulness still up for debate,
but without further comments I consider this ready (albeit first time touching / making an eclass, so I could be overlooking simple things).
Also partly uses >=bash-4.4, so EAPI-7 is not considered.
See github PR[1] for old changelog background.
Up to maintainers but personally would encourage to slowly replace
(almost) all use of sed with either this or patches. Some cases
where it can be inconvenient like eclasses "guessing" that a package
may or may not have something to replace, and that nothing happened
is not an issue.
[1] https://github.com/gentoo/gentoo/pull/25662
Ionen Wolkens (2):
esed.eclass: new eclass
eclass/tests/esed.sh: basic tests for esed.eclass
eclass/esed.eclass | 199 +++++++++++++++++++++++++++++++++++++++++++ eclass/tests/esed.sh | 173 +++++++++++++++++++++++++++++++++++++
2 files changed, 372 insertions(+)
create mode 100644 eclass/esed.eclass
create mode 100755 eclass/tests/esed.sh
--
2.35.1
On 2022-06-03 00:45, Ionen Wolkens wrote:
On Fri, Jun 03, 2022 at 06:09:38AM +0200, Michał Górny wrote:
On Tue, 2022-05-31 at 07:23 -0400, Ionen Wolkens wrote:
Often preferable to use patches so this happens, but sed have its uses/convenience and this intend to help reduce the amount of old broken seds causing issues that go unnoticed on bumps.
Inspired by app-portage/iwdevtools' qa-sed (warns on any seds), but this is for more deterministic use in ebuilds.
Also slightly shortens sed use, -i is default, and no need to || die. (see @EXAMPLE in eclass for a quick usage overview).
To be honest, I strongly dislike this. It really feels like trying to make an adapter for a square wheel, while the right solution would be to replace the wheel. On top of that, ton of evals which are pretty much
a huge "no-no".
About evals, the two eval is just to silence this:
var=$(printf "\0")
printf -v var "\0"
The 2>/dev/null doesn't work without wrapping it, aka
eval 'var=$(printf "\0")' 2>/dev/null
No variables are expanded pre-eval so it's just evaluating a
static statement. eval can be removed, but it'll be noisy
if someone happens to sed binary files.
Perhaps it would be better to forget about trying to work miracles with sed and instead write a trivial shell replacement for the most common
use cases. One thing I'd love to see is a simple substitution command that would work for paths/CFLAGS on RHS without having to worry about them conflicting with the pattern delimiter.
--
Best regards,
Michał Górny
--
ionen
On Tue, 2022-05-31 at 07:23 -0400, Ionen Wolkens wrote:
Often preferable to use patches so this happens, but sed have its uses/convenience and this intend to help reduce the amount of old
broken seds causing issues that go unnoticed on bumps.
Inspired by app-portage/iwdevtools' qa-sed (warns on any seds), but
this is for more deterministic use in ebuilds.
Also slightly shortens sed use, -i is default, and no need to || die.
(see @EXAMPLE in eclass for a quick usage overview).
To be honest, I strongly dislike this. It really feels like trying to
make an adapter for a square wheel, while the right solution would be to replace the wheel. On top of that, ton of evals which are pretty much
a huge "no-no".
Perhaps it would be better to forget about trying to work miracles with
sed and instead write a trivial shell replacement for the most common
use cases. One thing I'd love to see is a simple substitution command
that would work for paths/CFLAGS on RHS without having to worry about
them conflicting with the pattern delimiter.
--
Best regards,
Michał Górny
Nothing fundamentally different until further feedback,
mostly to get eval out of the way.
Changelog
v2:
- replace use of eval (realized another way works)
- add missing quotes around one _esed_output
- move diff checks inside comparison blocks
Ionen Wolkens (1):
esed.eclass: new eclass
eclass/esed.eclass | 201 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 201 insertions(+)
create mode 100644 eclass/esed.eclass
--
2.35.1
Often preferable to use patches so this happens, but sed have its uses/convenience and this intend to help reduce the amount of old
broken seds causing issues that go unnoticed on bumps.
Inspired by app-portage/iwdevtools' qa-sed (warns on any seds), but
this is for more deterministic use in ebuilds.
Also slightly shortens sed use, -i is default, and no need to || die.
(see @EXAMPLE in eclass for a quick usage overview).
Implementation / available wrappers / usefulness still up for debate,
but without further comments I consider this ready (albeit first time touching / making an eclass, so I could be overlooking simple things).
Also partly uses >=bash-4.4, so EAPI-7 is not considered.
See github PR[1] for old changelog background.
Up to maintainers but personally would encourage to slowly replace
(almost) all use of sed with either this or patches. Some cases
where it can be inconvenient like eclasses "guessing" that a package
may or may not have something to replace, and that nothing happened
is not an issue.
[1] https://github.com/gentoo/gentoo/pull/25662
Ionen Wolkens (2):
esed.eclass: new eclass
eclass/tests/esed.sh: basic tests for esed.eclass
eclass/esed.eclass | 199 +++++++++++++++++++++++++++++++++++++++++++
eclass/tests/esed.sh | 173 +++++++++++++++++++++++++++++++++++++
2 files changed, 372 insertions(+)
create mode 100644 eclass/esed.eclass
create mode 100755 eclass/tests/esed.sh
--
2.35.1
When I use sed is for dynamic content and mostly like to do this: s|lib|$(get_libdir)|g
In this case esed would be deleterious because it would fail on 32 bit
arches
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 155:43:55 |
| Calls: | 12,092 |
| Files: | 15,000 |
| Messages: | 6,517,709 |