From Fedora Project Wiki

< Changes

Revision as of 19:36, 14 September 2022 by Sgallagh (talk | contribs) (Update with redesign from feedback)


Node.js Repackaging

Important.png
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 are reworking the Node.js packaging to make Node.js versions available as parallel-installable packages.

Owner


Current status

  • Targeted release: Fedora Linux 38
  • Last updated: 2022-09-14
  • devel thread
  • FESCo issue: <will be assigned by the Wrangler>
  • Tracker bug: <will be assigned by the Wrangler>
  • Release notes tracker: <will be assigned by the Wrangler>

Detailed Description

We will be creating the packages nodejs-16, nodejs-18 and (in April) nodejs-20. These packages will be parallel-installable (with the exception of the -devel subpackages) and provide /usr/bin/node-$MAJOR. Each source package will also generate a subpackage named nodejs-$MAJOR-unversioned-command. Packaging dependency requirements will ensure that exactly one of these unversioned-command subpackages is installed whenever one or more nodejs-$MAJOR packages are installed.

Node.js applications packaged in Fedora will need to modify their startup scripts to point at an appropriate /usr/bin/node-$MAJOR binary, to ensure compatibility, unless they are certain that it is compatible with all current stable releases.

Notes:

  • When installing a single version of Node.js, that version will automatically own /usr/bin/node. If other versions are installed later, this link will remain as-is unless the versioned-command subpackage is swapped with another.
  • If multiple versions of nodejs are installed in the same transaction onto a system without any nodejs packages, the newest version of Node.js will be picked to own /usr/bin/node.

Feedback

Mailing list thread

Neal Gompa raised the question of using a subpackage to own /usr/bin/node instead of using the alternatives subsystem, citing python as an example. My response was that the problem with this is that I want /usr/bin/node to always be available so long as any nodejs-$MAJOR version is installed. It also ensures that the node(1) manpage always matches the /usr/bin/node executable.

2022-09-14: After discussion on the list, this Change has been updated to drop the use of update-alternatives and replace it with nodejs-$MAJOR-unversioned-command. Additionally, we will be shipping an npm binary version-matched with each Node.js version.

Benefit to Fedora

User Benefits

  • Provides a simple way to have a different (or multiple) Node.js interpreters on their system. No dealing with Modularity.
  • Enables multiple versions of Node.js on the system (can test code against different versions without using containers)

Packager Benefits

  • No more modules to maintain.
  • Availability of multiple Node.js versions in the buildroot means that other nodejs-* packages can test against multiple supported options.

Scope

  • Proposal owners:

The packaging work is done and can be played with at https://copr.fedorainfracloud.org/coprs/sgallagh/nodejs-alternatives/ today.

  • Other developers:

There should be no need to change any dependent packages, though packagers of Node.js software may wish to take advantage of the testing opportunities afforded.

2022-09-14: Packagers of Node applications will probably want to pin their application to a known-good Node.js release. This can be done by modifying the startup scripts to look for /usr/bin/node-$MAJOR explicitly.

  • Policies and guidelines: N/A (not needed for this Change)

We will be updating the Node.js Packaging Guidelines with the new best practices.

  • Trademark approval: N/A (not needed for this Change)
  • Alignment with Objectives:

N/A

Upgrade/compatibility impact

Systems using the existing nodejs RPM package will be upgraded to the matching nodejs-$MAJOR version. Work is pending on how to migrate users of Modular Node.js to the new packages.


How To Test

User Experience

Done correctly, this should be handled entirely without the user's need to know about it.

Dependencies

Contingency Plan

  • Contingency mechanism: (What to do? Who will do it?) N/A (not a System Wide Change)
  • Contingency deadline: N/A (not a System Wide Change)
  • Blocks release? N/A (not a System Wide Change), Yes/No


Documentation

https://lists.fedoraproject.org/archives/list/nodejs@lists.fedoraproject.org/thread/NLZXYISZPBAU3VXLUZCYSJJ66YH4ALSG/

N/A (not a System Wide Change)

Release Notes

Multiple releases of Node.js may now be installed in parallel from the Fedora repositories.