221 lines
9.6 KiB
Ruby
221 lines
9.6 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/18/6c/6fe6f718073024e23fb0bfaff8d0a6db596adc7d29f259edd325e93bd33c/fdroidserver-0.7.0.tar.gz"
|
|
sha256 "3de76a02d17260a5fd65b089ceaabcc578e238ffe71f205a8f6f37e705648d6e"
|
|
revision 6
|
|
|
|
bottle do
|
|
sha256 "149a47a04cf22b9eee63231b3b9bc3772bcb0aa6238a54e79e4a6ad4ed782133" => :sierra
|
|
sha256 "a8a48d0e78dd730093809eb8419eb099524017b9bc1ed89dadcbfbe17c0ce009" => :el_capitan
|
|
sha256 "650aa7fe89a6ffc2d7b8f9a4494a1f44a7d494efc95975e15dbd7286e5a53655" => :yosemite
|
|
end
|
|
|
|
depends_on :python3
|
|
depends_on "freetype"
|
|
depends_on "jpeg"
|
|
depends_on "libtiff"
|
|
depends_on "webp"
|
|
depends_on "openssl@1.1"
|
|
depends_on "android-sdk" => :recommended
|
|
|
|
resource "apache-libcloud" do
|
|
url "https://files.pythonhosted.org/packages/1d/a6/569313d0c95b6e0bbebc5f2c8197a7261c85556a3de84d42e9093d7d6996/apache-libcloud-1.5.0.tar.bz2"
|
|
sha256 "ea3dd7825e30611e5a018ab18107b33a9029097d64bd8b39a87feae7c2770282"
|
|
end
|
|
|
|
resource "appdirs" do
|
|
url "https://files.pythonhosted.org/packages/48/69/d87c60746b393309ca30761f8e2b49473d43450b150cb08f3c6df5c11be5/appdirs-1.4.3.tar.gz"
|
|
sha256 "9e5896d1372858f8dd3344faf4e5014d21849c756c8d5701f78f8a103b372d92"
|
|
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/ce/39/17e90c2efacc4060915f7d1f9b8d2a5b20e54e46233bdf3092e68193407d/asn1crypto-0.21.1.tar.gz"
|
|
sha256 "4e6d7b22814d680114a439faafeccb9402a78095fb23bf0b25f9404c6938a017"
|
|
end
|
|
|
|
resource "cffi" do
|
|
url "https://files.pythonhosted.org/packages/a1/32/e3d6c3a8b5461b903651dd6ce958ed03c093d2e00128e3f33ea69f1d7965/cffi-1.9.1.tar.gz"
|
|
sha256 "563e0bd53fda03c151573217b3a49b3abad8813de9dd0632e10090f6190fdaf8"
|
|
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/ec/5f/d5bc241d06665eed93cd8d3aa7198024ce7833af7a67f6dc92df94e00588/cryptography-1.8.1.tar.gz"
|
|
sha256 "323524312bb467565ebca7e50c8ae5e9674e544951d28a2904a50012a8828190"
|
|
end
|
|
|
|
resource "gitdb2" do
|
|
url "https://files.pythonhosted.org/packages/5c/bb/ab74c6914e3b570ab2e960fda17a01aec93474426eecd3b34751ba1c3b38/gitdb2-2.0.0.tar.gz"
|
|
sha256 "b9f3209b401b8b4da5f94966c9c17650e66b7474ee5cd2dde5d983d1fba3ab66"
|
|
end
|
|
|
|
resource "GitPython" do
|
|
url "https://files.pythonhosted.org/packages/e8/87/a1cdd8b210e4b825ec34fef996d2680dc00ee9517379c167e9a57af0664e/GitPython-2.1.3.tar.gz"
|
|
sha256 "3826185b11e1fc372e7d31251e9b65e11ccb7c27f82c771d619048bdb5b66c81"
|
|
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/66/84/e99c39f3ab25a18eea9371d4e47ba79866d08f2e0ef3d70926f3ebd05c1b/mwclient-0.8.4.tar.gz"
|
|
sha256 "eedffd90912ec9ea1044c3e15c62d62df8763ad87cfd1f47ccf7ef53e1b7a018"
|
|
end
|
|
|
|
resource "oauthlib" do
|
|
url "https://files.pythonhosted.org/packages/d2/4c/5ac894a469e25ebd02f6b3c2adb9f55253e6d1ca1f16a7d247ae6d48b4c8/oauthlib-2.0.1.tar.gz"
|
|
sha256 "132ad46df25e53a84b33f1fd43f80e973cda2cb018cc0168d7d0c8c4d5cef9b5"
|
|
end
|
|
|
|
resource "olefile" do
|
|
url "https://files.pythonhosted.org/packages/35/17/c15d41d5a8f8b98cc3df25eb00c5cee76193114c78e5674df6ef4ac92647/olefile-0.44.zip"
|
|
sha256 "61f2ca0cd0aa77279eb943c07f607438edf374096b66332fae1ee64a6f0f73ad"
|
|
end
|
|
|
|
resource "packaging" do
|
|
url "https://files.pythonhosted.org/packages/c6/70/bb32913de251017e266c5114d0a645f262fb10ebc9bf6de894966d124e35/packaging-16.8.tar.gz"
|
|
sha256 "5d50835fdf0a7edf0b55e311b7c887786504efea1177abd7e69329a8e5ea619e"
|
|
end
|
|
|
|
resource "paramiko" do
|
|
url "https://files.pythonhosted.org/packages/64/79/5e8baeedb6baf1d5879efa8cd012f801efc232e56a068550ba00d7e82625/paramiko-2.1.2.tar.gz"
|
|
sha256 "5fae49bed35e2e3d45c4f7b0db2d38b9ca626312d91119b3991d0ecf8125e310"
|
|
end
|
|
|
|
resource "Pillow" do
|
|
url "https://files.pythonhosted.org/packages/8d/80/eca7a2d1a3c2dafb960f32f844d570de988e609f5fd17de92e1cf6a01b0a/Pillow-4.0.0.tar.gz"
|
|
sha256 "ee26d2d7e7e300f76ba7b796014c04011394d0c4a5ed9a288264a3e443abca50"
|
|
end
|
|
|
|
resource "pyasn1" do
|
|
url "https://files.pythonhosted.org/packages/69/17/eec927b7604d2663fef82204578a0056e11e0fc08d485fdb3b6199d9b590/pyasn1-0.2.3.tar.gz"
|
|
sha256 "738c4ebd88a718e700ee35c8d129acce2286542daa80a82823a7073644f706ad"
|
|
end
|
|
|
|
resource "pyasn1-modules" do
|
|
url "https://files.pythonhosted.org/packages/60/32/7703bccdba05998e4ff04db5038a6695a93bedc45dcf491724b85b5db76a/pyasn1-modules-0.0.8.tar.gz"
|
|
sha256 "10561934f1829bcc455c7ecdcdacdb4be5ffd3696f26f468eb6eb41e107f3837"
|
|
end
|
|
|
|
resource "pycparser" do
|
|
url "https://files.pythonhosted.org/packages/be/64/1bb257ffb17d01f4a38d7ce686809a736837ad4371bcc5c42ba7a715c3ac/pycparser-2.17.tar.gz"
|
|
sha256 "0aac31e917c24cb3357f5a4d5566f2cc91a19ca41862f6c3c22dc60a629673b6"
|
|
end
|
|
|
|
resource "pyparsing" do
|
|
url "https://files.pythonhosted.org/packages/3c/ec/a94f8cf7274ea60b5413df054f82a8980523efd712ec55a59e7c3357cf7c/pyparsing-2.2.0.tar.gz"
|
|
sha256 "0832bcf47acd283788593e7a0f542407bd9550a55a8a8435214a1960e04bcb04"
|
|
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/16/09/37b69de7c924d318e51ece1c4ceb679bf93be9d05973bb30c35babd596e2/requests-2.13.0.tar.gz"
|
|
sha256 "5722cd09762faa01276230270ff16af7acf7c5c45d623868d9ba116f15791ce8"
|
|
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 "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/83/ce/e5b3aee7ca420b0ab24d4fcc2aa577f7aa6ea7e9306fafceabee3e8e4703/smmap2-2.0.1.tar.gz"
|
|
sha256 "5c9fd3ac4a30b85d041a8bd3779e16aa704a161991e74b9a46692bc368e68752"
|
|
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\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
|