Open k3rni opened 6 years ago
This would be great to see merged. @zakird any suggestions to getting this moved along?
I believe this solves a blocker related to update_to_0.12.5 - let's get it merged.
@k3rni I've merged PR #49, and the built gem for that is around 250mb (instead of 171 as claimed here, but probably because it's changed since you looked).
I'd love to add this, but after making some adjustments to this (unpacking the .gz files, running upx over them all), and re-creating the gem, it only comes out 9Mb smaller (241mb), and gzipping the ups-compressed binaries comes out pretty much the same (as I'm sure is expected).
Am I doing something wrong? I'd love to get this working, as a 250mb gem is huge.
You are correct in that both versions result in a gem file of roughly the same size. UPX uses basically the same compression method as gzip, it just keeps the files executable directly, with no additional unpacking step required.
The changes to bin/wkhtmltopdf
(0c076abc7 and later f2d79ae) were made much later than my PR (about 7 months later), and result in mostly the same thing - binaries are shipped compressed, with the one you actually need extracted on first use. The only difference now is if you were to use the gem on a restricted, read-only filesystem (like Heroku's slugs) or install gems system-wide, then try to use them as a regular user and fail on a permission error. Whereas with upx, the files can be run with no additional steps.
Those error conditions listed are strictly conjecture - haven't tested that. So feel free to keep the current solution and discard this, as the goals were achieved anyway :)
Closing due to inactivity and the issue being solved elsewhere.
Reopening because I think we want to do this. I've had a number of reports from people having trouble uncompressing the gzipped files, especially on systems with restricted filesystems.
It's been added to the gem package task's prerequisites, so the binaries will be changed locally and then packed into the gem. This PR doesn't contain the packed binaries themselves. My idea is that we should grab and store the upstream binaries untouched, but ship the compact versions with this gem.
Gemfile size before packing: 171MB After packing: 45MB
Also, the task is safe to run multiple times - already-compressed files will be detected and skipped (using
upx -t
).