|
| 1 | +class Xz < Formula |
| 2 | + desc "General-purpose data compression with high compression ratio" |
| 3 | + homepage "https://tukaani.org/xz/" |
| 4 | + # The archive.org mirror below needs to be manually created at `archive.org`. |
| 5 | + url "https://github.com/tukaani-project/xz/releases/download/v5.6.2/xz-5.6.2.tar.gz" |
| 6 | + mirror "https://downloads.sourceforge.net/project/lzmautils/xz-5.6.2.tar.gz" |
| 7 | + mirror "https://archive.org/download/xz-5.6.2.tar/xz-5.6.2.tar.gz" |
| 8 | + mirror "http://archive.org/download/xz-5.6.2.tar/xz-5.6.2.tar.gz" |
| 9 | + sha256 "8bfd20c0e1d86f0402f2497cfa71c6ab62d4cd35fd704276e3140bfb71414519" |
| 10 | + license all_of: [ |
| 11 | + "0BSD", |
| 12 | + "GPL-2.0-or-later", |
| 13 | + ] |
| 14 | + version_scheme 1 |
| 15 | + |
| 16 | + bottle do |
| 17 | + root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/xz-5.6.2" |
| 18 | + sha256 cellar: :any_skip_relocation, aarch64_linux: "11e69230aeb03ac236e5fe9420ea2d9ca1fe02c6229e0bd4da7b29ef295295dd" |
| 19 | + end |
| 20 | + |
| 21 | + deny_network_access! [:build, :postinstall] |
| 22 | + |
| 23 | + def install |
| 24 | + system "./configure", *std_configure_args, "--disable-silent-rules", "--disable-nls" |
| 25 | + system "make", "check" |
| 26 | + system "make", "install" |
| 27 | + end |
| 28 | + |
| 29 | + test do |
| 30 | + path = testpath/"data.txt" |
| 31 | + original_contents = "." * 1000 |
| 32 | + path.write original_contents |
| 33 | + |
| 34 | + # compress: data.txt -> data.txt.xz |
| 35 | + system bin/"xz", path |
| 36 | + refute_predicate path, :exist? |
| 37 | + |
| 38 | + # decompress: data.txt.xz -> data.txt |
| 39 | + system bin/"xz", "-d", "#{path}.xz" |
| 40 | + assert_equal original_contents, path.read |
| 41 | + |
| 42 | + # Check that http mirror works |
| 43 | + xz_tar = testpath/"xz.tar.gz" |
| 44 | + stable.mirrors.each do |mirror| |
| 45 | + next if mirror.start_with?("https") |
| 46 | + |
| 47 | + xz_tar.unlink if xz_tar.exist? |
| 48 | + system "curl", "--location", mirror, "--output", xz_tar |
| 49 | + assert_equal stable.checksum.hexdigest, xz_tar.sha256 |
| 50 | + end |
| 51 | + end |
| 52 | +end |
0 commit comments