123 lines
4.9 KiB
Ruby
123 lines
4.9 KiB
Ruby
class Duplicity < Formula
|
|
include Language::Python::Virtualenv
|
|
|
|
desc "Bandwidth-efficient encrypted backup"
|
|
homepage "https://launchpad.net/duplicity"
|
|
url "https://launchpad.net/duplicity/0.8-series/0.8.03/+download/duplicity-0.8.03.tar.gz"
|
|
sha256 "4ae3abb8b6bdd6b90dc42a4a0e6d867677b96c43c6e3c0cd20883b4813ad4966"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "652a2842bc4bce4e34996a9c9e0d055f3c6feef9cc9cf4232b7a50c288618a10" => :mojave
|
|
sha256 "b492b3a0c4b667a8f3a502817905d0a42cc00797551c5cb7689a86da978bd98b" => :high_sierra
|
|
sha256 "42f4e7ff49845d13aa54249d0027da1955a3bf3717c7587a01043c032c156af8" => :sierra
|
|
end
|
|
|
|
depends_on "gnupg"
|
|
depends_on "librsync"
|
|
depends_on "openssl@1.1"
|
|
depends_on "python"
|
|
|
|
# Generated with homebrew-pypi-poet from
|
|
# for i in fasteners future mock requests urllib3; do poet -r $i >> resources; done
|
|
|
|
resource "fasteners" do
|
|
url "https://files.pythonhosted.org/packages/15/d7/1e8b3270f21dffcaaf5a2889675e8b2fa35f8a43a5817a31d3820e8e9495/fasteners-0.15.tar.gz"
|
|
sha256 "3a176da6b70df9bb88498e1a18a9e4a8579ed5b9141207762368a1017bf8f5ef"
|
|
end
|
|
|
|
resource "monotonic" do
|
|
url "https://files.pythonhosted.org/packages/19/c1/27f722aaaaf98786a1b338b78cf60960d9fe4849825b071f4e300da29589/monotonic-1.5.tar.gz"
|
|
sha256 "23953d55076df038541e648a53676fb24980f7a1be290cdda21300b3bc21dfb0"
|
|
end
|
|
|
|
resource "future" do
|
|
url "https://files.pythonhosted.org/packages/90/52/e20466b85000a181e1e144fd8305caf2cf475e2f9674e797b222f8105f5f/future-0.17.1.tar.gz"
|
|
sha256 "67045236dcfd6816dc439556d009594abf643e5eb48992e36beac09c2ca659b8"
|
|
end
|
|
|
|
resource "mock" do
|
|
url "https://files.pythonhosted.org/packages/2e/ab/4fe657d78b270aa6a32f027849513b829b41b0f28d9d8d7f8c3d29ea559a/mock-3.0.5.tar.gz"
|
|
sha256 "83657d894c90d5681d62155c82bda9c1187827525880eda8ff5df4ec813437c3"
|
|
end
|
|
|
|
resource "six" do
|
|
url "https://files.pythonhosted.org/packages/dd/bf/4138e7bfb757de47d1f4b6994648ec67a51efe58fa907c1e11e350cddfca/six-1.12.0.tar.gz"
|
|
sha256 "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73"
|
|
end
|
|
|
|
resource "certifi" do
|
|
url "https://files.pythonhosted.org/packages/c5/67/5d0548226bcc34468e23a0333978f0e23d28d0b3f0c71a151aef9c3f7680/certifi-2019.6.16.tar.gz"
|
|
sha256 "945e3ba63a0b9f577b1395204e13c3a231f9bc0223888be653286534e5873695"
|
|
end
|
|
|
|
resource "chardet" do
|
|
url "https://files.pythonhosted.org/packages/fc/bb/a5768c230f9ddb03acc9ef3f0d4a3cf93462473795d18e9535498c8f929d/chardet-3.0.4.tar.gz"
|
|
sha256 "84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"
|
|
end
|
|
|
|
resource "idna" do
|
|
url "https://files.pythonhosted.org/packages/ad/13/eb56951b6f7950cadb579ca166e448ba77f9d24efc03edd7e55fa57d04b7/idna-2.8.tar.gz"
|
|
sha256 "c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407"
|
|
end
|
|
|
|
resource "requests" do
|
|
url "https://files.pythonhosted.org/packages/01/62/ddcf76d1d19885e8579acb1b1df26a852b03472c0e46d2b959a714c90608/requests-2.22.0.tar.gz"
|
|
sha256 "11e007a8a2aa0323f5a921e9e6a2d7e4e67d9877e85773fba9ba6419025cbeb4"
|
|
end
|
|
|
|
resource "urllib3" do
|
|
url "https://files.pythonhosted.org/packages/fd/fa/b21f4f03176463a6cccdb612a5ff71b927e5224e83483012747c12fc5d62/urllib3-1.24.2.tar.gz"
|
|
sha256 "9a247273df709c4fedb38c711e44292304f73f39ab01beda9f6b9fc375669ac3"
|
|
end
|
|
|
|
def install
|
|
virtualenv_install_with_resources
|
|
inreplace Dir[bin/"*"], %r{^#!/usr/bin/env python.*$},
|
|
"#!#{libexec}/bin/python"
|
|
man1.install Dir[libexec/"share/man/man1/*"]
|
|
end
|
|
|
|
test do
|
|
(testpath/"batch.gpg").write <<~EOS
|
|
Key-Type: RSA
|
|
Key-Length: 2048
|
|
Subkey-Type: RSA
|
|
Subkey-Length: 2048
|
|
Name-Real: Testing
|
|
Name-Email: testing@foo.bar
|
|
Expire-Date: 1d
|
|
%no-protection
|
|
%commit
|
|
EOS
|
|
|
|
system Formula["gnupg"].opt_bin/"gpg", "--batch", "--gen-key", "batch.gpg"
|
|
begin
|
|
(testpath/"test/hello.txt").write "Hello!"
|
|
(testpath/"command.sh").write <<~EOS
|
|
#!/usr/bin/expect -f
|
|
set timeout -1
|
|
spawn #{bin}/duplicity #{testpath} "file://test"
|
|
expect -exact "Local and Remote metadata are synchronized, no sync needed."
|
|
expect -exact "Last full backup date: none"
|
|
expect -exact "GnuPG passphrase:"
|
|
send -- "brew\n"
|
|
expect -exact "Retype passphrase to confirm:"
|
|
send -- "brew\n"
|
|
expect -exact "No signatures found, switching to full backup."
|
|
expect eof
|
|
EOS
|
|
chmod 0555, testpath/"command.sh"
|
|
system "./command.sh"
|
|
assert_match "duplicity-full-signatures", Dir["test/*"].to_s
|
|
|
|
# Ensure requests[security] is activated
|
|
script = "import requests as r; r.get('https://mozilla-modern.badssl.com')"
|
|
system libexec/"bin/python", "-c", script
|
|
ensure
|
|
system Formula["gnupg"].opt_bin/"gpgconf", "--kill", "gpg-agent"
|
|
system Formula["gnupg"].opt_bin/"gpgconf", "--homedir", "keyrings/live",
|
|
"--kill", "gpg-agent"
|
|
end
|
|
end
|
|
end
|