1{ lib
2, fetchFromGitLab
3, fetchPypi
4, apksigner
5, buildPythonApplication
6, python3
7, pythonRelaxDepsHook
8, installShellFiles
9, androguard
10, babel
11, clint
12, defusedxml
13, gitpython
14, libcloud
15, mwclient
16, paramiko
17, pillow
18, pyasn1
19, pyasn1-modules
20, python-vagrant
21, pyyaml
22, qrcode
23, requests
24, ruamel-yaml
25, yamllint
26}:
27
28buildPythonApplication rec {
29 pname = "fdroidserver";
30 version = "unstable-2023-10-23";
31 format = "setuptools";
32
33 src = fetchFromGitLab {
34 owner = "fdroid";
35 repo = "fdroidserver";
36 rev = "f4b10cf83935432d19948dac669964384bef0728";
37 hash = "sha256-GmR6Td5pScwEKK9W6m26xQV4XxBdZ7frN2UvwUGY4Dw=";
38 };
39
40 pythonRelaxDeps = [
41 "pyasn1"
42 "pyasn1-modules"
43 ];
44
45 postPatch = ''
46 substituteInPlace fdroidserver/common.py \
47 --replace "FDROID_PATH = os.path.realpath(os.path.join(os.path.dirname(__file__), '..'))" "FDROID_PATH = '$out/bin'"
48 '';
49
50 preConfigure = ''
51 ${python3.pythonOnBuildForHost.interpreter} setup.py compile_catalog
52 '';
53
54 postInstall = ''
55 patchShebangs gradlew-fdroid
56 install -m 0755 gradlew-fdroid $out/bin
57 installShellCompletion --cmd fdroid \
58 --bash completion/bash-completion
59 '';
60
61 nativeBuildInputs = [
62 pythonRelaxDepsHook
63 installShellFiles
64 ];
65
66 buildInputs = [
67 babel
68 ];
69
70 propagatedBuildInputs = [
71 androguard
72 clint
73 defusedxml
74 gitpython
75 libcloud
76 mwclient
77 paramiko
78 pillow
79 pyasn1
80 pyasn1-modules
81 python-vagrant
82 pyyaml
83 qrcode
84 requests
85 (ruamel-yaml.overrideAttrs (old: {
86 src = fetchPypi {
87 pname = "ruamel.yaml";
88 version = "0.17.21";
89 hash = "sha256-i3zml6LyEnUqNcGsQURx3BbEJMlXO+SSa1b/P10jt68=";
90 };
91 }))
92 yamllint
93 ];
94
95 makeWrapperArgs = [
96 "--prefix"
97 "PATH"
98 ":"
99 "${lib.makeBinPath [ apksigner ]}"
100 ];
101
102 # no tests
103 doCheck = false;
104
105 pythonImportsCheck = [
106 "fdroidserver"
107 ];
108
109 meta = with lib; {
110 homepage = "https://github.com/f-droid/fdroidserver";
111 changelog = "https://github.com/f-droid/fdroidserver/blob/${version}/CHANGELOG.md";
112 description = "Server and tools for F-Droid, the Free Software repository system for Android";
113 license = licenses.agpl3Plus;
114 maintainers = with maintainers; [ linsui jugendhacker ];
115 };
116}