236 lines
10 KiB
Ruby
236 lines
10 KiB
Ruby
class Fdroidserver < Formula
|
|
include Language::Python::Virtualenv
|
|
|
|
desc "Create and manage Android app repositories for F-Droid"
|
|
homepage "https://f-droid.org"
|
|
url "https://files.pythonhosted.org/packages/6e/1f/c424b700e0bb97841e5e6ee82b939150bdff0960c5727fb4c02aec2b3369/fdroidserver-0.8.tar.gz"
|
|
sha256 "8069f88cdb34a12abe22422c0024aee7c74e5a90f8bf18f07243017a85d74757"
|
|
revision 1
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "de3c1a60924ecb0c77bd9c32da98ccf7465d83a2bbb3936d7a974cde17b880b9" => :sierra
|
|
sha256 "f6ff682e0fcffddd17c0e24ce8a8ccd0ab82979441ffb22af6d8f68b3fa1f827" => :el_capitan
|
|
sha256 "a910e135eeb197be743ec07d22564374b20623fd0fa483e5bf99fe40fac17525" => :yosemite
|
|
end
|
|
|
|
depends_on :python3
|
|
depends_on "freetype"
|
|
depends_on "jpeg"
|
|
depends_on "libtiff"
|
|
depends_on "webp"
|
|
depends_on "openssl@1.1"
|
|
|
|
resource "apache-libcloud" do
|
|
url "https://files.pythonhosted.org/packages/a8/17/87d42df2558518bc17ba33de876e2ce12bc94dd785e0ccb75f8ffe81142b/apache-libcloud-2.1.0.tar.gz"
|
|
sha256 "7e812f730495e5d59d0adb06792115241f08a59566d25445613b15f008c73a05"
|
|
end
|
|
|
|
resource "args" do
|
|
url "https://files.pythonhosted.org/packages/e5/1c/b701b3f4bd8d3667df8342f311b3efaeab86078a840fb826bd204118cc6b/args-0.1.0.tar.gz"
|
|
sha256 "a785b8d837625e9b61c39108532d95b85274acd679693b71ebb5156848fcf814"
|
|
end
|
|
|
|
resource "asn1crypto" do
|
|
url "https://files.pythonhosted.org/packages/67/14/5d66588868c4304f804ebaff9397255f6ec5559e46724c2496e0f26e68d6/asn1crypto-0.22.0.tar.gz"
|
|
sha256 "cbbadd640d3165ab24b06ef25d1dca09a3441611ac15f6a6b452474fdf0aed1a"
|
|
end
|
|
|
|
resource "bcrypt" do
|
|
url "https://files.pythonhosted.org/packages/58/e9/6d7f1d883d8c5876470b5d187d72c04f2a9954d61e71e7eb5d2ea2a50442/bcrypt-3.1.3.tar.gz"
|
|
sha256 "6645c8d0ad845308de3eb9be98b6fd22a46ec5412bfc664a423e411cdd8f5488"
|
|
end
|
|
|
|
resource "cffi" do
|
|
url "https://files.pythonhosted.org/packages/5b/b9/790f8eafcdab455bcd3bd908161f802c9ce5adbf702a83aa7712fcc345b7/cffi-1.10.0.tar.gz"
|
|
sha256 "b3b02911eb1f6ada203b0763ba924234629b51586f72a21faacc638269f4ced5"
|
|
end
|
|
|
|
resource "clint" do
|
|
url "https://files.pythonhosted.org/packages/3d/b4/41ecb1516f1ba728f39ee7062b9dac1352d39823f513bb6f9e8aeb86e26d/clint-0.5.1.tar.gz"
|
|
sha256 "05224c32b1075563d0b16d0015faaf9da43aa214e4a2140e51f08789e7a4c5aa"
|
|
end
|
|
|
|
resource "cryptography" do
|
|
url "https://files.pythonhosted.org/packages/9c/1a/0fc8cffb04582f9ffca61b15b0681cf2e8588438e55f61403eb9880bd8e0/cryptography-2.0.3.tar.gz"
|
|
sha256 "d04bb2425086c3fe86f7bc48915290b13e798497839fbb18ab7f6dffcf98cc3a"
|
|
end
|
|
|
|
resource "docker-py" do
|
|
url "https://files.pythonhosted.org/packages/d7/32/1e6be8c9ebc7d02fe74cb1a050008bc9d7e2eb9219f5d5e257648166e275/docker-py-1.9.0.tar.gz"
|
|
sha256 "6dc6b914a745786d97817bf35bfc1559834c08517c119f846acdfda9cc7f6d7e"
|
|
end
|
|
|
|
resource "gitdb2" do
|
|
url "https://files.pythonhosted.org/packages/be/eb/69f956a2b4b7c529999e624ce86d7a986a29b23f15599e8e58e17ffd9d44/gitdb2-2.0.2.tar.gz"
|
|
sha256 "f2e36d7561e91f30a6a44858756dc020d8f1e81ca6e4185979d5c6c24c648070"
|
|
end
|
|
|
|
resource "GitPython" do
|
|
url "https://files.pythonhosted.org/packages/6d/c1/d1c852f787a1ad4fd8346603e520e2b8b886158f177276cd8c2acf594001/GitPython-2.1.5.tar.gz"
|
|
sha256 "5c00cbd256e2b1d039381d4f7d71fcb7ee5cc196ca10c101ff7191bd82ab5d9c"
|
|
end
|
|
|
|
resource "idna" do
|
|
url "https://files.pythonhosted.org/packages/d8/82/28a51052215014efc07feac7330ed758702fc0581347098a81699b5281cb/idna-2.5.tar.gz"
|
|
sha256 "3cb5ce08046c4e3a560fc02f138d0ac63e00f8ce5901a56b32ec8b7994082aab"
|
|
end
|
|
|
|
resource "mwclient" do
|
|
url "https://files.pythonhosted.org/packages/cd/38/beaf985032b42a0b0c8f9028b469c4dcb0bd7bfab62707ec27af7e890e84/mwclient-0.8.6.tar.gz"
|
|
sha256 "08f917b995b331b937ed8c7e297406e3c8d33b80234679ee7fbfeeafd7570a8e"
|
|
end
|
|
|
|
resource "oauthlib" do
|
|
url "https://files.pythonhosted.org/packages/fa/2e/25f25e6c69d97cf921f0a8f7d520e0ef336dd3deca0142c0b634b0236a90/oauthlib-2.0.2.tar.gz"
|
|
sha256 "b3b9b47f2a263fe249b5b48c4e25a5bce882ff20a0ac34d553ce43cff55b53ac"
|
|
end
|
|
|
|
resource "olefile" do
|
|
url "https://files.pythonhosted.org/packages/35/17/c15d41d5a8f8b98cc3df25eb00c5cee76193114c78e5674df6ef4ac92647/olefile-0.44.zip"
|
|
sha256 "61f2ca0cd0aa77279eb943c07f607438edf374096b66332fae1ee64a6f0f73ad"
|
|
end
|
|
|
|
resource "paramiko" do
|
|
url "https://files.pythonhosted.org/packages/d1/0b/c8bc96c79bbda0bcc9f2912389fa59789bb8e7e161f24b01082b4c3f948d/paramiko-2.2.1.tar.gz"
|
|
sha256 "ff94ae65379914ec3c960de731381f49092057b6dd1d24d18842ead5a2eb2277"
|
|
end
|
|
|
|
resource "Pillow" do
|
|
url "https://files.pythonhosted.org/packages/55/aa/f7f983fb72710a9daa4b3374b7c160091d3f94f5c09221f9336ade9027f3/Pillow-4.2.1.tar.gz"
|
|
sha256 "c724f65870e545316f9e82e4c6d608ab5aa9dd82d5185e5b2e72119378740073"
|
|
end
|
|
|
|
resource "pyasn1" do
|
|
url "https://files.pythonhosted.org/packages/17/a2/266818077dbd002d53ebe5aaaa05a04786256cea8dba1899ac0b832ef028/pyasn1-0.3.2.tar.gz"
|
|
sha256 "90bd82e0db59d4319eaf01c2549b34c817d645275fce9ad41bac7429aa380690"
|
|
end
|
|
|
|
resource "pyasn1-modules" do
|
|
url "https://files.pythonhosted.org/packages/de/5f/0c6a1a096bfc2831ee8e2e951f79e6ec23c853c17ab5ba655322bfcde20a/pyasn1-modules-0.0.11.tar.gz"
|
|
sha256 "60d5c80bfee9b79b492d5d8a934b3ecfc523f2f83aaab4ffafa2bbb651d3c67a"
|
|
end
|
|
|
|
resource "pycparser" do
|
|
url "https://files.pythonhosted.org/packages/8c/2d/aad7f16146f4197a11f8e91fb81df177adcc2073d36a17b1491fd09df6ed/pycparser-2.18.tar.gz"
|
|
sha256 "99a8ca03e29851d96616ad0404b4aad7d9ee16f25c9f9708a11faf2810f7b226"
|
|
end
|
|
|
|
resource "PyNaCl" do
|
|
url "https://files.pythonhosted.org/packages/8d/f3/02605b056e465bf162508c4d1635a2bccd9abd1ee3ed2a1bb4e9676eac33/PyNaCl-1.1.2.tar.gz"
|
|
sha256 "32f52b754abf07c319c04ce16905109cab44b0e7f7c79497431d3b2000f8af8c"
|
|
end
|
|
|
|
resource "python-vagrant" do
|
|
url "https://files.pythonhosted.org/packages/bb/c6/0a6d22ae1782f261fc4274ea9385b85bf792129d7126575ec2a71d8aea18/python-vagrant-0.5.15.tar.gz"
|
|
sha256 "af9a8a9802d382d45dbea96aa3cfbe77c6e6ad65b3fe7b7c799d41ab988179c6"
|
|
end
|
|
|
|
resource "PyYAML" do
|
|
url "https://files.pythonhosted.org/packages/4a/85/db5a2df477072b2902b0eb892feb37d88ac635d36245a72a6a69b23b383a/PyYAML-3.12.tar.gz"
|
|
sha256 "592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab"
|
|
end
|
|
|
|
resource "requests" do
|
|
url "https://files.pythonhosted.org/packages/49/6f/183063f01aae1e025cf0130772b55848750a2f3a89bfa11b385b35d7329d/requests-2.10.0.tar.gz"
|
|
sha256 "63f1815788157130cee16a933b2ee184038e975f0017306d723ac326b5525b54"
|
|
end
|
|
|
|
resource "requests-oauthlib" do
|
|
url "https://files.pythonhosted.org/packages/80/14/ad120c720f86c547ba8988010d5186102030591f71f7099f23921ca47fe5/requests-oauthlib-0.8.0.tar.gz"
|
|
sha256 "883ac416757eada6d3d07054ec7092ac21c7f35cb1d2cf82faf205637081f468"
|
|
end
|
|
|
|
resource "ruamel.yaml" do
|
|
url "https://files.pythonhosted.org/packages/a7/7d/d77b8df7cb7616d87ae1465d1a9dd7f090ecc0ceec58ca22181e86cb9359/ruamel.yaml-0.15.23.tar.gz"
|
|
sha256 "25b29c13004b9f6a1a2f490229e228ab34f3af383887f1af88574711b216b76a"
|
|
end
|
|
|
|
resource "six" do
|
|
url "https://files.pythonhosted.org/packages/b3/b2/238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/six-1.10.0.tar.gz"
|
|
sha256 "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a"
|
|
end
|
|
|
|
resource "smmap2" do
|
|
url "https://files.pythonhosted.org/packages/48/d8/25d9b4b875ab3c2400ec7794ceda8093b51101a9d784da608bf65ab5f5f5/smmap2-2.0.3.tar.gz"
|
|
sha256 "c7530db63f15f09f8251094b22091298e82bf6c699a6b8344aaaef3f2e1276c3"
|
|
end
|
|
|
|
resource "websocket-client" do
|
|
url "https://files.pythonhosted.org/packages/06/19/f00725a8aee30163a7f257092e356388443034877c101757c1466e591bf8/websocket_client-0.44.0.tar.gz"
|
|
sha256 "15f585566e2ea7459136a632b9785aa081093064391878a448c382415e948d72"
|
|
end
|
|
|
|
def install
|
|
venv = virtualenv_create(libexec, "python3")
|
|
|
|
resource("Pillow").stage do
|
|
inreplace "setup.py" do |s|
|
|
sdkprefix = MacOS::CLT.installed? ? "" : MacOS.sdk_path
|
|
s.gsub! "openjpeg.h", "probably_not_a_header_called_this_eh.h"
|
|
s.gsub! "ZLIB_ROOT = None", "ZLIB_ROOT = ('#{sdkprefix}/usr/lib', '#{sdkprefix}/usr/include')"
|
|
s.gsub! "JPEG_ROOT = None", "JPEG_ROOT = ('#{Formula["jpeg"].opt_prefix}/lib', '#{Formula["jpeg"].opt_prefix}/include')"
|
|
s.gsub! "FREETYPE_ROOT = None", "FREETYPE_ROOT = ('#{Formula["freetype"].opt_prefix}/lib', '#{Formula["freetype"].opt_prefix}/include')"
|
|
end
|
|
|
|
# avoid triggering "helpful" distutils code that doesn't recognize Xcode 7 .tbd stubs
|
|
ENV.delete "SDKROOT"
|
|
ENV.append "CFLAGS", "-I#{MacOS.sdk_path}/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers" unless MacOS::CLT.installed?
|
|
venv.pip_install Pathname.pwd
|
|
end
|
|
|
|
res = resources.map(&:name).to_set - ["Pillow"]
|
|
|
|
res.each do |r|
|
|
venv.pip_install resource(r)
|
|
end
|
|
|
|
venv.pip_install_and_link buildpath
|
|
doc.install "examples"
|
|
end
|
|
|
|
def caveats; <<-EOS.undent
|
|
In order to function, fdroidserver requires that the Android SDK's
|
|
"Build-tools" and "Platform-tools" are installed. Also, it is best if the
|
|
base path of the Android SDK is set in the standard environment variable
|
|
ANDROID_HOME. To install them from the command line, run:
|
|
android update sdk --no-ui --all --filter tools,platform-tools,build-tools-25.0.0
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
# fdroid prefers to work in a dir called 'fdroid'
|
|
mkdir testpath/"fdroid" do
|
|
mkdir "repo"
|
|
mkdir "metadata"
|
|
|
|
open("config.py", "w") do |f|
|
|
f << "gradle = 'gradle'"
|
|
end
|
|
|
|
open("metadata/fake.txt", "w") do |f|
|
|
f << "License:GPL-3.0\n"
|
|
f << "Summary:Yup still fake\n"
|
|
f << "Categories:Internet\n"
|
|
f << "Description:\n"
|
|
f << "this is fake\n"
|
|
f << ".\n"
|
|
end
|
|
|
|
system "#{bin}/fdroid", "checkupdates", "--verbose"
|
|
system "#{bin}/fdroid", "lint", "--verbose"
|
|
system "#{bin}/fdroid", "rewritemeta", "fake", "--verbose"
|
|
system "#{bin}/fdroid", "scanner", "--verbose"
|
|
|
|
# TODO: enable once Android SDK build-tools are reliably installed
|
|
# ENV["ANDROID_HOME"] = Formula["android-sdk"].opt_prefix
|
|
# system "#{bin}/fdroid", "readmeta", "--verbose"
|
|
# system "#{bin}/fdroid", "init", "--verbose"
|
|
# assert File.exist?("config.py")
|
|
# assert File.exist?("keystore.jks")
|
|
# system "#{bin}/fdroid", "update", "--create-metadata", "--verbose"
|
|
# assert File.exist?("metadata")
|
|
# assert File.exist?("repo/index.jar")
|
|
end
|
|
end
|
|
end
|