Skip to content

Commit

Permalink
Use gzip instead of bzip2
Browse files Browse the repository at this point in the history
  • Loading branch information
joergschiller committed May 27, 2019
1 parent 4e225b9 commit f2d79ae
Show file tree
Hide file tree
Showing 33 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .docker/Dockerfile-centos_6
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM centos:6

RUN yum install -y ruby libjpeg-turbo libpng libXrender fontconfig libXext bzip2
RUN yum install -y ruby libjpeg-turbo libpng libXrender fontconfig libXext

CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version
2 changes: 1 addition & 1 deletion .docker/Dockerfile-centos_7
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM centos:7

RUN yum install -y ruby libjpeg-turbo libpng libXrender fontconfig libXext bzip2
RUN yum install -y ruby libjpeg-turbo libpng libXrender fontconfig libXext

CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version
2 changes: 1 addition & 1 deletion .docker/Dockerfile-debian_8
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ FROM debian:8
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update
RUN apt-get install -y ruby libjpeg62-turbo libpng12-0 libxrender1 libfontconfig1 libxext6 bzip2
RUN apt-get install -y ruby libjpeg62-turbo libpng12-0 libxrender1 libfontconfig1 libxext6

CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version
2 changes: 1 addition & 1 deletion .docker/Dockerfile-debian_9
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ FROM debian:9
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update
RUN apt-get install -y ruby libjpeg62-turbo libpng16-16 libxrender1 libfontconfig1 libxext6 bzip2
RUN apt-get install -y ruby libjpeg62-turbo libpng16-16 libxrender1 libfontconfig1 libxext6

CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version
2 changes: 1 addition & 1 deletion .docker/Dockerfile-ubuntu_14.04
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ FROM ubuntu:14.04
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update
RUN apt-get install -y ruby libjpeg8 libxrender1 libfontconfig1 bzip2
RUN apt-get install -y ruby libjpeg8 libxrender1 libfontconfig1

CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version
2 changes: 1 addition & 1 deletion .docker/Dockerfile-ubuntu_16.04
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ FROM ubuntu:16.04
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update
RUN apt-get install -y ruby libjpeg8 libxrender1 libfontconfig1 bzip2
RUN apt-get install -y ruby libjpeg8 libxrender1 libfontconfig1

CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version
2 changes: 1 addition & 1 deletion .docker/Dockerfile-ubuntu_18.04
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ FROM ubuntu:18.04
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update
RUN apt-get install -y ruby libjpeg8 libxrender1 libfontconfig1 bzip2
RUN apt-get install -y ruby libjpeg8 libxrender1 libfontconfig1

CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ macOS

## Compression

Binaries should be compressed with `bzip2 -9` after extracting. The matching binary will be extracted on first
Binaries should be compressed with `gzip --best` after extracting. The matching binary will be extracted on first
execution of `bin/wkhtmltopdf`.

## Testing with Docker
Expand Down
11 changes: 5 additions & 6 deletions bin/wkhtmltopdf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# of the License at http://www.apache.org/licenses/LICENSE-2.0

require 'rbconfig'
require 'zlib'

suffix = case RbConfig::CONFIG['host_os']
when /linux/
Expand All @@ -29,12 +30,10 @@ suffix = case RbConfig::CONFIG['host_os']

binary = "#{__FILE__}_#{suffix}"

if File.exist?("#{binary}.bz2") && !File.exist?(binary)
# There was an error on macOS when a hard link to the archive exists (could be
# Time Machine). Even with `--keep` it states: 'Input file has 1 other link'.
# Using `--force` fixes this.
system("bzip2 --decompress --keep --force #{binary}.bz2") ||
raise("Decompression of #{binary}.bz2 failed. Do you have bzip2 installed?")
if File.exist?("#{binary}.gz") && !File.exist?(binary)
File.open binary, 'wb', 0o755 do |file|
Zlib::GzipReader.open("#{binary}.gz") { |gzip| file << gzip.read }
end
end

unless File.exist? binary
Expand Down
Binary file removed bin/wkhtmltopdf_centos_6_amd64.bz2
Binary file not shown.
Binary file not shown.
Binary file removed bin/wkhtmltopdf_centos_6_i386.bz2
Binary file not shown.
Binary file added bin/wkhtmltopdf_centos_6_i386.gz
Binary file not shown.
Binary file removed bin/wkhtmltopdf_centos_7_amd64.bz2
Binary file not shown.
Binary file not shown.
Binary file removed bin/wkhtmltopdf_centos_7_i386.bz2
Binary file not shown.
Binary file not shown.
Binary file removed bin/wkhtmltopdf_debian_8_amd64.bz2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added bin/wkhtmltopdf_debian_9_amd64.gz
Binary file not shown.
Binary file added bin/wkhtmltopdf_debian_9_i386.gz
Binary file not shown.
Binary file added bin/wkhtmltopdf_macos_carbon.gz
Binary file not shown.
Binary file added bin/wkhtmltopdf_macos_cocoa.gz
Binary file not shown.
Binary file removed bin/wkhtmltopdf_ubuntu_14.04_amd64.bz2
Binary file not shown.
Binary file not shown.
Binary file removed bin/wkhtmltopdf_ubuntu_14.04_i386.bz2
Binary file not shown.
Binary file not shown.
Binary file removed bin/wkhtmltopdf_ubuntu_16.04_amd64.bz2
Binary file not shown.
Binary file not shown.
Binary file added bin/wkhtmltopdf_ubuntu_16.04_i386.gz
Binary file not shown.
Binary file added bin/wkhtmltopdf_ubuntu_18.04_amd64.gz
Binary file not shown.
Binary file added bin/wkhtmltopdf_ubuntu_18.04_i386.gz
Binary file not shown.

0 comments on commit f2d79ae

Please sign in to comment.