One of the requirements of Fedora packages that contain the result of
nodejs modules is to list them as Provides. Listing them manually in the
spec file would be a manual job, too error prone.
As solution, create the static list of nodejs modules as RPM Provides,
and include it in the spec file so it is used when building the RPM
package. This is done by querying npm for the list of locally installed
modules, and using jq to output that as Provides. There are manglings
done:
- the '@' in the name of a module is removed, and '/' replaced with '-'
- e.g. "-alpha" or "-beta-" in the version of a module are turned into
"~something", as "-" is not accepted as version by RPM (whereas the
tilde is the compliant way for pre-releases in versioning guidelines)
Sadly this static inclusion is the only possible way at the moment,
as a in-package dependency generator is not possible, nor any other form
of dynamic filling of package relationships only at build/install time.
/usr is package manager territory, and not even writable on OSTree based
systems such as Fedora CoreOS or RHEL Edge. This has been common and
good practice in autotools for decades.
You can still override this with `make install PREFIX=...`. Use that in
the RPM spec file.
RHEL 8 has node 10, which is too old for current
jest-worker/eslint/stylelint NPM modules.
The webpack rebuild during RPM build was introduced to satisfy Fedora
packaging policy, but it's not a requirement on RHEL 8. So just disable
it there.
All cockpit extensions should only require the bridge, at least as long
as they are independent from any other page (which is usually the case).
We still need cockpit-system for the tests (thus keep it in
test/browser/main.fmf), but it is perfectly reasonable to look at a
particular Cockpit page via the "remote hosts" panel, cockpit-desktop,
or Cockpit Client.
This forces the package build to happen on a koji builder which actually
supports node. It's pointless at runtime (as the code runs in a browser,
not through node), but in practice, `nodejs_arches` encompasses all
supported Fedora/RHEL architectures anyway.
https://docs.fedoraproject.org/en-US/packaging-guidelines/Node.js/#_exclusivearch
According to the Fedora guidelines, nodejs-devel is needed for using
nodejs modules:
https://docs.fedoraproject.org/en-US/packaging-guidelines/Node.js/#_buildrequires
Since this applies only on Fedora, and that nodejs-devel may not even
exist on other distros (e.g. CentOS 9 Stream), then limit the
nodejs-devel requirement only to Fedora, keep using nodejs
unconditionally everywhere.
It's useless there -- any style error that may happen there has already
slipped through the upstream release, and at RPM build time there is
nothing that can be done about it. It just wastes time.
This allows us to bump eslint to a newer version which is incompatible
with the older node.js on RHEL/CentOS 8.
When installing the module, instead of copying the metainfo file to the
destination, merge the available translations for it. Since this is done
at install time, add gettext as BuildRequires for the RPM packaging;
add libappstream-glib-devel as well only on RHEL/CentOS 8, since it
contains the metainfo.its for gettext in order to handle .metainfo.xml
files.
This requires a LINGUAS file with the list of translations currently
available: this is the way msgfmt picks the available languages to
merge. Generate it dynamically from the list of available .po files.
The generated RPM is noarch, so by definition has no binaries to extract
debug symbols from. Hence, drop the %define that makes RPM not error out
in case there are no debug symbols around (usually in archful binaries).