Gentoo Archives: gentoo-dev

From: Michael Orlitzky <mjo@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Upstream build uses "npm install", how to handle this in an ebuild?
Date: Sat, 08 Dec 2018 20:27:32
Message-Id: 967e6f2b-53f4-5e7a-58fe-583ce801aca3@gentoo.org
In Reply to: [gentoo-dev] Upstream build uses "npm install", how to handle this in an ebuild? by Ralph Seichter
1 On 12/8/18 1:27 PM, Ralph Seichter wrote:
2 > I am trying to add NodeJS support to www-servers/nginx-unit, but the
3 > upstream build relies on a working network connection to download
4 > dependencies and execute "npm install ..." during the build process.
5 >
6 > How can this scenario be handled properly in an ebuild? I don't see
7 > obvious existing ebuilds that I could use as a guide. Electron seems to
8 > perform some npm wizardry, but I don't know what to make of it.
9
10 (I proposed one of those eclasses)
11
12 If you're really, really lucky you can:
13
14 * Package all of the javascript dependencies first, installing them to
15 /usr/lib/node_modules or wherever NodeJS is looking these days.
16
17 * Add those new packages as dependencies to your ebuild.
18
19 * Hack the build system to keep it from accessing the network during
20 installation.
21
22 But, you're going to have problems:
23
24 * The dependency tree for the simplest thing is hundreds of packages
25 long. I'm guessing you don't have time to package them all.
26
27 * In that mile-long list, there are packages that outright conflict.
28 So ngingx-unit might depend on dev-js/foo-1.0 which depends on
29 dev-js/bar-2.0 which depends on dev-js/baz-1.0 which depends on
30 dev-js/foo-2.0.
31
32 * There's no build system for these packages, so you can't install two
33 libraries simultaneously and point the program to the right version.
34 NodeJS upstream is actively hostile to not copy/pasting all
35 libraries (recursively!) into your programs.
36
37 * All of the upstream library developer are... javascript developers,
38 and have never used anything else and agree that this is a fine way
39 to do things, so they won't accept any of your PRs to make their
40 dependencies consistent or to use modern versions or to avoid hard-
41 coding the "node_modules" path everywhere or...

Replies

Subject Author
Re: [gentoo-dev] Upstream build uses "npm install", how to handle this in an ebuild? Ralph Seichter <gentoo@××××××××.de>