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/e5/7e/3098f7ba4e5b6caec1657cd44e3c5d309fad83ba7bb6f6b8433315a5adbc/borgbackup-1.2.1.tar.gz"
sha256 "9f9ce2d1923cb33a147ee6d08177d860974567721b1142fca67914a02e64c633"
license "BSD-3-Clause"
bottle do
sha256 cellar: :any, arm64_monterey: "8a621b7294cb415f7647f084cf8456e22618f40f382ac452ee03afee0162e450"
sha256 cellar: :any, arm64_big_sur: "1f870d585a275d40a76572c37fadf0912394a8e4b502ff76436826d03313487c"
sha256 cellar: :any, monterey: "cba587a67b8eea83172f97405312ecb3433275026a384bb68bd57bca54e79420"
sha256 cellar: :any, big_sur: "23f930a50117c9a626d078300d5b4d98ea6a74896044452285d9b2b1101cf8d0"
sha256 cellar: :any, catalina: "3f89b9b1b41908f490af7e1fdbf7172e2258e49b47592937965abd49012e153c"
sha256 cellar: :any_skip_relocation, x86_64_linux: "3e2e57b70c6ab3007cbb0e0015d2153c07ce9fb8e7a6647bbe51501287ab13b3"
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
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"
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
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