Skip to content

Commit

Permalink
dev(package): handle either .tar.gz or .tar.xz archive names
Browse files Browse the repository at this point in the history
preparing for the libxml2 and libxslt upgrades
  • Loading branch information
flavorjones committed Feb 20, 2022
1 parent 7957c7b commit e885463
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions rakelib/extensions.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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/)
Expand Down
4 changes: 2 additions & 2 deletions scripts/test-gem-file-contents
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e885463

Please sign in to comment.