homebrew-core/Formula/borgbackup.rb

73 lines
3.2 KiB
Ruby

class Borgbackup < Formula
include Language::Python::Virtualenv
desc "Deduplicating archiver with compression and authenticated encryption"
homepage "https://borgbackup.org/"
url "https://files.pythonhosted.org/packages/a2/98/479f364b69182b9a29c82607a17a9cf2e3cdc8743bb9570a4da9d511d0a6/borgbackup-1.2.2.tar.gz"
sha256 "d730687443f1beb602b1d72bae36318f6f9654818fcdc50458540ec579e57260"
license "BSD-3-Clause"
bottle do
sha256 cellar: :any, arm64_monterey: "b929151bd6f3b5642bf903a6bd75be2fd7c4faa93aee52ddc6af01d5ed7be4ab"
sha256 cellar: :any, arm64_big_sur: "6e4dd7ad86102b4c93476b19b329df59b919b21c0bcc6f6d6ac162759b1c22e9"
sha256 cellar: :any, monterey: "c86342dd2b8ce4a7964ce5d44616875707862cc0f8a48712473be17224fbfdbd"
sha256 cellar: :any, big_sur: "e32b3f60fdb6bb3c6db29bbec4cd661e232629ae09806e0bd0f104b023d4fd2d"
sha256 cellar: :any, catalina: "3aca5c98e7a4ca2e3e16bed77b4c091bcf68a023de157fd761ae1612e581d1bf"
sha256 cellar: :any_skip_relocation, x86_64_linux: "0e1efd7ef10c3d89ef63b01aa165905b9b3d1b0db70386bfa6628ca6e991ba65"
end
depends_on "pkg-config" => :build
depends_on "libb2"
depends_on "lz4"
depends_on "openssl@1.1"
depends_on "python@3.10"
depends_on "xxhash"
depends_on "zstd"
on_linux do
depends_on "acl"
end
resource "msgpack" do
url "https://files.pythonhosted.org/packages/22/44/0829b19ac243211d1d2bd759999aa92196c546518b0be91de9cacc98122a/msgpack-1.0.4.tar.gz"
sha256 "f5d869c18f030202eb412f08b28d2afeea553d6613aee89e200d7aca7ef01f5f"
end
resource "packaging" do
url "https://files.pythonhosted.org/packages/df/9e/d1a7217f69310c1db8fdf8ab396229f55a699ce34a203691794c5d1cad0c/packaging-21.3.tar.gz"
sha256 "dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"
end
resource "pyparsing" do
url "https://files.pythonhosted.org/packages/71/22/207523d16464c40a0310d2d4d8926daffa00ac1f5b1576170a32db749636/pyparsing-3.0.9.tar.gz"
sha256 "2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb"
end
def install
ENV["BORG_LIBB2_PREFIX"] = Formula["libb2"].prefix
ENV["BORG_LIBLZ4_PREFIX"] = Formula["lz4"].prefix
ENV["BORG_LIBXXHASH_PREFIX"] = Formula["xxhash"].prefix
ENV["BORG_LIBZSTD_PREFIX"] = Formula["zstd"].prefix
ENV["BORG_OPENSSL_PREFIX"] = Formula["openssl@1.1"].prefix
virtualenv_install_with_resources
bash_completion.install "scripts/shell_completions/bash/borg"
fish_completion.install "scripts/shell_completions/fish/borg.fish"
zsh_completion.install "scripts/shell_completions/zsh/_borg"
end
test do
# Create a repo and archive, then test extraction.
cp test_fixtures("test.pdf"), testpath
Dir.chdir(testpath) do
system "#{bin}/borg", "init", "-e", "none", "test-repo"
system "#{bin}/borg", "create", "--compression", "zstd", "test-repo::test-archive", "test.pdf"
end
mkdir testpath/"restore" do
system "#{bin}/borg", "extract", testpath/"test-repo::test-archive"
end
assert_predicate testpath/"restore/test.pdf", :exist?
assert_equal File.size(testpath/"restore/test.pdf"), File.size(testpath/"test.pdf")
end
end