From 359484888921bb50824097fde3a0116bc84d9352 Mon Sep 17 00:00:00 2001 From: Ryan Egesdahl Date: Tue, 3 Oct 2023 09:02:20 -0700 Subject: [PATCH] Make RPM packaging use threaded compression Because we set `_binary_payload` on RPM packages, we override the selection of compression algorithm defaults; in this case, we specifically choose a non-threaded compression mode. Unfortunately, this means that compression with any compression algorithm other than GZip can take a very long time. Debian packages, on the other hand, use threaded compression modes by default. This change forces `_binary_payload` to use threaded compression modes when selecting an algorithm and compression level. Signed-off-by: Ryan Egesdahl --- lib/omnibus/packagers/rpm.rb | 2 +- spec/unit/packagers/rpm_spec.rb | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/omnibus/packagers/rpm.rb b/lib/omnibus/packagers/rpm.rb index 74a890289..1c4651ecd 100644 --- a/lib/omnibus/packagers/rpm.rb +++ b/lib/omnibus/packagers/rpm.rb @@ -401,7 +401,7 @@ def compression else # default to gzip "gzdio" end - "w#{compression_level}.#{compression_name}" + "w#{compression_level}T.#{compression_name}" end # diff --git a/spec/unit/packagers/rpm_spec.rb b/spec/unit/packagers/rpm_spec.rb index 194ce2cba..438aec0f5 100644 --- a/spec/unit/packagers/rpm_spec.rb +++ b/spec/unit/packagers/rpm_spec.rb @@ -215,7 +215,7 @@ module Omnibus expect(contents).to include("URL: https://example.com") expect(contents).to include("Packager: Chef Software") expect(contents).to include("Obsoletes: old-project") - expect(contents).to include("_binary_payload w9.gzdio") + expect(contents).to include("_binary_payload w9T.gzdio") end context "when RPM compression type xz is configured" do @@ -226,7 +226,7 @@ module Omnibus it "has the correct binary_payload line" do subject.write_rpm_spec contents = File.read(spec_file) - expect(contents).to include("_binary_payload w9.xzdio") + expect(contents).to include("_binary_payload w9T.xzdio") end context "when RPM compression level is also configured" do @@ -237,7 +237,7 @@ module Omnibus it "has the correct binary_payload line" do subject.write_rpm_spec contents = File.read(spec_file) - expect(contents).to include("_binary_payload w6.xzdio") + expect(contents).to include("_binary_payload w6T.xzdio") end end end @@ -250,7 +250,7 @@ module Omnibus it "has the correct binary_payload line" do subject.write_rpm_spec contents = File.read(spec_file) - expect(contents).to include("_binary_payload w9.bzdio") + expect(contents).to include("_binary_payload w9T.bzdio") end context "when RPM compression level is also configured" do @@ -261,7 +261,7 @@ module Omnibus it "has the correct binary_payload line" do subject.write_rpm_spec contents = File.read(spec_file) - expect(contents).to include("_binary_payload w6.bzdio") + expect(contents).to include("_binary_payload w6T.bzdio") end end end