-
-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
Set "NVH_USE_XZ" to "true" to use xz compression.
--use-xz for xz, --no-use-xz for gzip. Overrides environment variable.
Node.js has had xz support on Linux and macOS since 4.0.0 (io.js had xz starting from 1.0+ for Linux, from 2.3.2+ for macOS. Node.js picks up where io.js left off, so 4.0+ has xz for both Linux and macOS as well.) There are some versions of Node.js in the 0.10 and 0.12 series that also have xz tarballs, but these aren't downloaded often, and checking just the major version is simpler than checking major, minor and patch versions.
Nice work after all the hard research. I could run with this and make a few changes myself. I'll let you know what I am thinking. Some code comments coming about smaller details. I don't like the complication of However, I suggest you do not change the code for that because I have some opinions about the normalising and |
Tiny updates in force push:
|
That was something I was going to comment on, already addressed. 👍 |
Determine whether xz can be used, based on platform/system details.
Updated |
If can_use_xz() checks fail, revert to using gzip.
Adapted from this comment: shadowspawn#8 (comment) Co-authored-by: John Gee <john@ruru.gen.nz>
Skips node version checks, which would otherwise gate xz usage. In other words: Overrides any checks that would normally be run, so that nvh always attempts to use xz. --- Also updates "--use-xz" to not set the "xz forced on" state. (This matches the flag's description in the help messages.) --- Partly adapted from this comment (with liberties taken on implementation): shadowspawn#8 (comment) Co-authored-by: John Gee <john@ruru.gen.nz>
Activates "force use xz" state, which skips xz-related sanity checks.
More tiny changes in force-push:
|
local resolved_major_version | ||
resolved_major_version="$(echo ${resolved_version#v} | cut -d '.' -f '1')" | ||
if [[ "${resolved_major_version}" -lt 4 ]]; then | ||
NVH_USE_XZ="false" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought: the Node version check could be moved back into can_use_xz()
.
Not sure which I prefer, but putting it in can_use_xz()
could be a bit more DRY, due to not having to check for NVH_USE_XZ
again.
Could gate any of the checks in can_use_xz()
(e.g. just the platform checks) with: if [[ "${g_xz_force_enabled}" = "false" ]]; then
if need be.
Working on code now, almost done... |
Pushed to a branch on nvh. I'll open a PR back to you! |
It is getting a bit late in my time zone, but I may have a look before I log off for the evening. Happy to take a look if not this evening then tomorrow. Edit: I take it this is the branch in question: https://github.com/shadowspawn/nvh/tree/feature/auto-xz Taking a quick look now, but if it is much of a change I probably should wait until tomorrow to really give it a proper look. Edit 2: Looks more in line with the coding style of the rest of nvh. 👍 (I couldn't tell if the branch changes scenarios where xz will be used. on my TODO for tomorrow would be to take a closer look at that, etc.) Logging off for the night. Thanks for the back and forth! |
No worries, no hurry. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Planning some refactoring as per changes on feature/auto-xz
, but happy with PR as stands.
Thanks for the deep investigations!
Thanks for the review! Miscellaneous comments regarding the branch at
In any case I am happy to ship this feature off to wider, bluer waters (upstream). Thanks for the rounds of feedback and review. |
Good tip about dropping the two commits, I can do that. And I'll update the errata in the comments, thanks. |
Merged and tweaked on develop. Preparing for release. Thank you for your contributions. |
Closes #8
This is the xz feature. As I see it...
Technical goals include:
Preferences already identified:
Nice to have:
Totally optional:
tj/n
(Feature: xz compression option tj/n#571)n
, or the oldn
environment variable could be tweaked/deprecated, etc.I believe this PR as initially posted meets those goals, but could perhaps be refined. (Although I note it is quite possible to bikeshed the minor things, so would prefer to settle on something soonish, rather than extend discussion too indefinitely...)
meta: commits are very spaced out/tiny, to aid in some rebasing and tweaks I have been doing. Can consolidate a bit if/as desired.