-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify logic around abi crosswalk #276
Comments
Hmm... My initial reaction to this problem (which I see is in line with what was done previously for the Are there any issues with that technique? I'm assuming there's a potential issue around if the api version changes during a patch/minor release, but is that an issue any more? And/or if it is an issue, I'd assume it's only an issue with non-LTS releases, in which case is the user opting in to instability? Because, wrt to the specific issue that just happened, then just a simple patch that tweaks the Eg (only looking at patch version - could always cycle through minor as well if that aligns with upstream)
Maybe this is just a short term solution whilst the solution you mention above is a more long term one? (Although, I have this nagging feeling I might be reading a little more complexity into your solution than there actually is.) My thought was that it seems in line with some of the existing handling, it's simple, and it's only an issue (leading to busywork) around minor (or major, if minor is abi stable now) jumps. |
Thanks for the thoughts @bruce-one. Right I'd love to both 1) avoid the need to update the abi_crosswalk.json regularly, and 2) remove all this tedious code node-pre-gyp/lib/util/versioning.js Lines 122 to 154 in 737d9cf
|
Okay, yep... So... Another quick thought.... (Just a bit of a (magic-ish) tweak on your solution - but writing it all out for my understanding :-p )
It adds some async-ness around get_runtime_abi (if the version is unknown and a new abi.json is downloaded) which might be a bit clumsy, but hopefully it's survivable? (Happy to look at how clumsy...) That would increase the likelihood of it "just working" for people using I think what you're suggesting makes sense and is a reasonable trade off, just thought I'd mention a possible alternative if the complexity seems "worth it" :-) (And it came to mind because of the potential of adding a ~/.node-pre-gyp directory for the cache.) |
@bruce-one I really like your plan, especially moving to reading the https://nodejs.org/download/release/index.json format directly. And I agree that keeping the Sounds like a potential way forward would be to merge your caching PR and then followup with this work once |
Context
When node-pre-gyp started node was at
0.8.x
andprocess.versions.modules
had recently been added to node core to allow dynamically knowing the ABI version for a given node version.node-pre-gyp needs to know this crosswalk in order to allow you to install a module for a given node version different than your host (important for packaging like https://github.com/mapbox/mapbox-studio-classic/blob/89bce13040c0ae3ff7c6c64371a8c428962c8b24/scripts/build-atom.sh#L81-L85). Instead of making you provide the ABI it makes sense to provide your exact node version you are targeting (MAJOR.MINOR.PATCH) and then node-pre-gyp is smart enough to grab the right ABI.
Two constraints existed:
In an effort to avoid extra network that might result in a build/install failure for node modules using node-pre-
gyp, I committed to storing the generated crosswalk inside a json file in node-pre-gyp.
Over time what happened is that:
0.x
series the minor version bumped the ABI during the even series but during the odd series the ABI got bumped even in patch versions. So, a cross walk of exact major.minor.patch was needed to tame the chaos.1.x
releases the ABI version was bumped during a minor release.2.x
and above we've seen the ABI only get bumped with new major versions, predictably.Problem
This crosswalk is hard to maintain. Every time a node release happens (even a point release) it needs to be updated. And modules depending on node-pre-gyp also need to be updated if they use the
--target
flag and specific a release node version that node-pre-gyp does not know about. Tests in node-pre-gyp assert that it is updated, but this means the node-pre-gyp tests start failing after new releases of node, which is annoying and creates busywork.Solution
Here is a potential solution that keeps this functionality working but reduces maintenance burden.
--target
flag would download https://nodejs.org/download/release/index.json and supply the path to it to node-pre-gypThe text was updated successfully, but these errors were encountered: