Wiki - https://fedoraproject.org/wiki/Changes/NodejsAlternativesSystem Discussion thread - https://discussion.fedoraproject.org/t/f43-change-proposal-use-update-altern...
This is a proposed Change for Fedora Linux. This document represents a proposed Change. As part of the Changes process, proposals are publicly announced in order to receive community feedback. This proposal will only be implemented if approved by the Fedora Engineering Steering Committee.
== Summary ==
We aim to move away from manual management of <code>/usr/bin/node</code>, <code>/usr/bin/npm</code>, and similar symlinks to leveraging update-alternatives system.
== Owners ==
* Name: [[User:aradchen|Andrei Radchenko]]
* Email: aradchen@redhat.com
* Name: [[User:jstanek|Jan Stanek]] * Email: jstanek@redhat.com
* Name: [[User:tjuhasz|Tomas Juhasz]] * Email: tjuhasz@redhat.com
== Detailed Description ==
This is a part of a larger iteration in a way we package NodeJS for Fedora and RHEL. The other parts are [[Changes/NodejsNodeModulesPath]] and [[Changes/NodeJSMetapackages]]. This change deals specifically with the management of the non-versioned symlinks in system paths.
Currently, the NodeJS packages (streams) provided in Fedora are all installable in parallel, by virtue of moving any potentially conflicting bits into versioned equivalents and/or versioned directories. For one example of many:
<pre> %install mv %{buildroot}%{_bindir}/node %{buildroot}%{_bindir}/node-%{node_version_major} ... </pre>
One of the streams is designed as the "default" one, and that stream then ships manually created non-versioned symlinks to the renamed paths:
<pre> %if 0%{nodejs_is_default} ln -srf %{buildroot}%{_bindir}/node-%{node_version_major} %{buildroot}%{_bindir}/node ... %endif </pre>
By using update-alternatives, we can iterate on this idea and gain several benefits outlined below.
== Feedback ==
== Benefit to Fedora == # No matter which stream you install, you'll always have <code>/usr/bin/node</code> and other non-versioned names available. The versioned names will be also present, if you want to be specific in your scripts. # There is no "official Fedora endorsement" on which NodeJS stream should be "best" or "default"; if you as a system administrator have multiple streams installed, the decision of which should be the default is up to you.
The second item will also give us the maintainers greater freedom in introducing new streams and obsoleting the old ones without worrying too much about how to switch the "default" in the middle of the distribution life cycle. This is not a big pain point for Fedora, where the length of the life of a single version matches the length of upstream NodeJS LTO support pretty closely, but becomes much more important in longer-living downstream distributions (e.g. RHEL).
== Scope == * Proposal owners: ** Port the manual symlink creation and management to update-alternatives. ** Ensure the streams behave consistently and no conflict is introduced.
== User Experience == * Users will be able to install any number of streams and switch between default one rather easy by just running `update-alternatives --config node'.
== Dependencies == * Should not cause any problems to dependant packages.
== Contingency Plan == * Contingency mechanism: Revert back to manual symlink management and go back to the design phase. * Contingency deadline: Beta Freeze. * Blocks release? We aim to do the rebuilds in Koji side tag and merge it atomically; so NO.
== Documentation == * This is a downstream change; this page is the initial documentation. * [https://docs.fedoraproject.org/en-US/packaging-guidelines/Alternatives/ Fedora Alternatives]
== Release Notes == TODO
Aoife Moloney via devel-announce devel-announce@lists.fedoraproject.org writes:
Wiki - https://fedoraproject.org/wiki/Changes/NodejsAlternativesSystem Discussion thread - https://discussion.fedoraproject.org/t/f43-change-proposal-use-update-altern...
This is a proposed Change for Fedora Linux. This document represents a proposed Change. As part of the Changes process, proposals are publicly announced in order to receive community feedback. This proposal will only be implemented if approved by the Fedora Engineering Steering Committee.
== Summary ==
We aim to move away from manual management of <code>/usr/bin/node</code>, <code>/usr/bin/npm</code>, and similar symlinks to leveraging update-alternatives system.
Will this still continue to work on rpm-ostree based systems? Iirc there were problems with update-alternatives, if they are applied in %post (or at least there are some in openSUSE).
Cheers,
Dan
On 10/07/2025 13:14, Aoife Moloney via devel-announce wrote:
We aim to move away from manual management of <code>/usr/bin/node</code>, <code>/usr/bin/npm</code>, and similar symlinks to leveraging update-alternatives system.
AFAIK, the alternatives system doesn't work reliably on immutable (ostree) Fedora versions.
If you need to provide multiple /usr/bin/node symlinks, consider generating swappable packages: nodeAB-bin, nodeXY-bin, etc. Then users will be able to use dnf swap feature:
sudo dnf swap nodeAB-bin nodeXY-bin --allowerasing
Hello everyone!
On Fri, Jul 11, 2025 at 9:09 AM Vitaly Zaitsev via devel devel@lists.fedoraproject.org wrote:
On 10/07/2025 13:14, Aoife Moloney via devel-announce wrote:
We aim to move away from manual management of <code>/usr/bin/node</code>, <code>/usr/bin/npm</code>, and similar symlinks to leveraging update-alternatives system.
AFAIK, the alternatives system doesn't work reliably on immutable (ostree) Fedora versions.
Thanks for raising this issue; we of course forgot about rpm-ostree and what complications it could bring. This is a compelling argument to reconsider.
If you need to provide multiple /usr/bin/node symlinks, consider generating swappable packages: nodeAB-bin, nodeXY-bin, etc. Then users will be able to use dnf swap feature:
sudo dnf swap nodeAB-bin nodeXY-bin --allowerasing
And thanks for this idea as well – this would not occur to me instinctively, since I would assume that installing one stream (including the -bin package) would prevent installation of any other streams (as it would conflict with the other -bin package). Then I read up some more on weak dependencies and as it turns out, dnf is smart enough to remove any Recommended package from the transaction if it would cause a conflict. With this information, the swappable package approach seems doable. I'll update the wiki page with the feedback and we'll start experimenting with it.
Best regards!
Dne 14. 07. 25 v 16:27 Jan Stanek napsal(a):
Hello everyone!
On Fri, Jul 11, 2025 at 9:09 AM Vitaly Zaitsev via devel devel@lists.fedoraproject.org wrote:
On 10/07/2025 13:14, Aoife Moloney via devel-announce wrote:
We aim to move away from manual management of <code>/usr/bin/node</code>, <code>/usr/bin/npm</code>, and similar symlinks to leveraging update-alternatives system.
AFAIK, the alternatives system doesn't work reliably on immutable (ostree) Fedora versions.
Thanks for raising this issue; we of course forgot about rpm-ostree and what complications it could bring. This is a compelling argument to reconsider.
Perhaps somebody would not mind to update this guidelines section reflecting this information?
https://docs.fedoraproject.org/en-US/packaging-guidelines/Alternatives/
In my reading, this section (kind of) promotes the alternatives, while this feedback suggest quite strongly against.
Vít
If you need to provide multiple /usr/bin/node symlinks, consider generating swappable packages: nodeAB-bin, nodeXY-bin, etc. Then users will be able to use dnf swap feature:
sudo dnf swap nodeAB-bin nodeXY-bin --allowerasing
And thanks for this idea as well – this would not occur to me instinctively, since I would assume that installing one stream (including the -bin package) would prevent installation of any other streams (as it would conflict with the other -bin package). Then I read up some more on weak dependencies and as it turns out, dnf is smart enough to remove any Recommended package from the transaction if it would cause a conflict. With this information, the swappable package approach seems doable. I'll update the wiki page with the feedback and we'll start experimenting with it.
Best regards!
Btw alternatives should be now working on ostree systems https://github.com/fedora-sysv/chkconfig/commit/4224f51d0212318dd0fada3976e2...
út 15. 7. 2025 v 10:07 odesílatel Vít Ondruch vondruch@redhat.com napsal:
Dne 14. 07. 25 v 16:27 Jan Stanek napsal(a):
Hello everyone!
On Fri, Jul 11, 2025 at 9:09 AM Vitaly Zaitsev via devel devel@lists.fedoraproject.org wrote:
On 10/07/2025 13:14, Aoife Moloney via devel-announce wrote:
We aim to move away from manual management of <code>/usr/bin/node</code>, <code>/usr/bin/npm</code>, and similar symlinks to leveraging update-alternatives system.
AFAIK, the alternatives system doesn't work reliably on immutable (ostree) Fedora versions.
Thanks for raising this issue; we of course forgot about rpm-ostree and what complications it could bring. This is a compelling argument to reconsider.
Perhaps somebody would not mind to update this guidelines section reflecting this information?
https://docs.fedoraproject.org/en-US/packaging-guidelines/Alternatives/
In my reading, this section (kind of) promotes the alternatives, while this feedback suggest quite strongly against.
Vít
If you need to provide multiple /usr/bin/node symlinks, consider generating swappable packages: nodeAB-bin, nodeXY-bin, etc. Then users will be able to use dnf swap feature:
sudo dnf swap nodeAB-bin nodeXY-bin --allowerasing
And thanks for this idea as well – this would not occur to me instinctively, since I would assume that installing one stream (including the -bin package) would prevent installation of any other streams (as it would conflict with the other -bin package). Then I read up some more on weak dependencies and as it turns out, dnf is smart enough to remove any Recommended package from the transaction if it would cause a conflict. With this information, the swappable package approach seems doable. I'll update the wiki page with the feedback and we'll start experimenting with it.
Best regards!
-- _______________________________________________ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue