From e8854632856b6641bc5439395ee8d7a3ad6b1a5c Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Sun, 20 Feb 2022 13:58:01 -0500 Subject: [PATCH] dev(package): handle either .tar.gz or .tar.xz archive names preparing for the libxml2 and libxslt upgrades --- rakelib/extensions.rake | 8 ++++++-- scripts/test-gem-file-contents | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/rakelib/extensions.rake b/rakelib/extensions.rake index 567a8f3321..17004227cc 100644 --- a/rakelib/extensions.rake +++ b/rakelib/extensions.rake @@ -213,6 +213,10 @@ def java? end def add_file_to_gem(relative_source_path) + if relative_source_path.nil? || !File.exist?(relative_source_path) + raise "Cannot find file '#{relative_source_path}'" + end + dest_path = File.join(gem_build_path, relative_source_path) dest_dir = File.dirname(dest_path) @@ -377,8 +381,8 @@ else ["libxml2", "libxslt"].each do |lib| version = dependencies[lib]["version"] - archive = File.join("ports", "archives", "#{lib}-#{version}.tar.gz") - add_file_to_gem archive + archive = Dir.glob(File.join("ports", "archives", "#{lib}-#{version}.tar.*")).first + add_file_to_gem(archive) patchesdir = File.join("patches", lib) patches = %x(#{["git", "ls-files", patchesdir].shelljoin}).split("\n").grep(/\.patch\z/) diff --git a/scripts/test-gem-file-contents b/scripts/test-gem-file-contents index 08a3c0905f..58a59d637d 100755 --- a/scripts/test-gem-file-contents +++ b/scripts/test-gem-file-contents @@ -119,9 +119,9 @@ describe File.basename(gemfile) do it "contains the port files" do actual_ports = gemfile_contents.grep(%r{^ports/}) - assert_equal(1, actual_ports.grep(/libxml2-\d+\.\d+\.\d+\.tar\.gz/).length, + assert_equal(1, actual_ports.grep(/libxml2-\d+\.\d+\.\d+\.tar\.[gx]z/).length, "expected #{actual_ports} to include libxml2") - assert_equal(1, actual_ports.grep(/libxslt-\d+\.\d+\.\d+\.tar\.gz/).length, + assert_equal(1, actual_ports.grep(/libxslt-\d+\.\d+\.\d+\.tar\.[gx]z/).length, "expected #{actual_ports} to include libxslt") assert_equal(2, actual_ports.length) end