Skip to content

Commit e885463

Browse files
committed
dev(package): handle either .tar.gz or .tar.xz archive names
preparing for the libxml2 and libxslt upgrades
1 parent 7957c7b commit e885463

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

rakelib/extensions.rake

+6-2
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ def java?
213213
end
214214

215215
def add_file_to_gem(relative_source_path)
216+
if relative_source_path.nil? || !File.exist?(relative_source_path)
217+
raise "Cannot find file '#{relative_source_path}'"
218+
end
219+
216220
dest_path = File.join(gem_build_path, relative_source_path)
217221
dest_dir = File.dirname(dest_path)
218222

@@ -377,8 +381,8 @@ else
377381

378382
["libxml2", "libxslt"].each do |lib|
379383
version = dependencies[lib]["version"]
380-
archive = File.join("ports", "archives", "#{lib}-#{version}.tar.gz")
381-
add_file_to_gem archive
384+
archive = Dir.glob(File.join("ports", "archives", "#{lib}-#{version}.tar.*")).first
385+
add_file_to_gem(archive)
382386

383387
patchesdir = File.join("patches", lib)
384388
patches = %x(#{["git", "ls-files", patchesdir].shelljoin}).split("\n").grep(/\.patch\z/)

scripts/test-gem-file-contents

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ describe File.basename(gemfile) do
119119

120120
it "contains the port files" do
121121
actual_ports = gemfile_contents.grep(%r{^ports/})
122-
assert_equal(1, actual_ports.grep(/libxml2-\d+\.\d+\.\d+\.tar\.gz/).length,
122+
assert_equal(1, actual_ports.grep(/libxml2-\d+\.\d+\.\d+\.tar\.[gx]z/).length,
123123
"expected #{actual_ports} to include libxml2")
124-
assert_equal(1, actual_ports.grep(/libxslt-\d+\.\d+\.\d+\.tar\.gz/).length,
124+
assert_equal(1, actual_ports.grep(/libxslt-\d+\.\d+\.\d+\.tar\.[gx]z/).length,
125125
"expected #{actual_ports} to include libxslt")
126126
assert_equal(2, actual_ports.length)
127127
end

0 commit comments

Comments
 (0)