1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-06-03 06:10:10 +02:00
Commit Graph

58 Commits

Author SHA1 Message Date
Hans-Christoph Steiner
18f3acc32e split out options from read_config()
There is no longer any reason for these to be intertwined.

This deliberately avoids touching some files as much as possible because
they are super tangled and due to be replaced.  Those files are:

* fdroidserver/build.py
* fdroidserver/update.py

# Conflicts:
#	tests/testcommon.py

# Conflicts:
#	fdroidserver/btlog.py
#	fdroidserver/import_subcommand.py
2024-05-08 16:26:46 +02:00
Hans-Christoph Steiner
b92e280eab fix code format for new black rule 2023-03-20 14:47:48 +01:00
Hans-Christoph Steiner
ed3622ffff
convert verify.py and verify.TestCase to black code format 2022-08-24 19:16:36 +02:00
Hans-Christoph Steiner
9e58fc8cda
verify: normalize dicts via JSON for reliable comparisons
13016c5d63 in !602 used a set to prevent
duplicate entries, but that worked poorly because it required lots of
data wrapping.  Instead, just normalize to JSON, then equality is easy.
2022-08-24 19:16:33 +02:00
Jochen Sprickerhof
4ce79a7eaa explicitly re-raising exceptions
To fix pylint.
2022-06-01 22:52:22 +02:00
Romain Lebbadi-Breteau
b2eca0fc3b
remove useless import in verify.py 2021-12-04 18:26:26 -05:00
Romain Lebbadi-Breteau
3576d025fe
fix verify.py use sha256sum from common 2021-12-04 18:14:21 -05:00
Benedikt Brückmann
1e943a22df rewrite docstrings to match numpy style guide 2021-06-25 06:28:47 +02:00
Felix C. Stegerman
3e557a1a8a
check for invalid appids passed to commands 2021-04-08 10:31:33 +02:00
Hans-Christoph Steiner
9135dfbeed verify: include diffoscope setup info in output JSON 2021-03-23 11:01:40 +01:00
Hans-Christoph Steiner
5e1377c77a standardize on "Application ID" in UI text 2020-10-01 23:01:55 +02:00
Hans-Christoph Steiner
d16478b10b
update: write status in JSON repo file, using new internal API 2020-02-18 23:45:48 +01:00
Hans-Christoph Steiner
13016c5d63 verify: add --output-json option to generate status reports
This has to do custom dict/encoder/decoder tricks in order to make sure
that each run of `fdroid verify` on the same files doesn't add duplicate
entries.
2018-12-07 13:13:10 +01:00
Hans-Christoph Steiner
e85256e248 verify: rename var remoteapk to remote_apk to fit other style 2018-12-07 11:19:26 +01:00
Hans-Christoph Steiner
fb02073cab fix "local variable 'e' is assigned to but never used" 2018-05-25 12:32:34 +02:00
Hans-Christoph Steiner
5ff1b5ef37 verify: exit with error code if any APK fails to verify 2018-05-25 11:56:13 +02:00
Hans-Christoph Steiner
a3a0b8dcf0 verify: --reuse-remote-apk to reuse local APKs
For something like a verification server, this avoids having `fdroid verify`
redownload the remote APK from f-droid.org every time its run.  For normal
users, it should download a fresh copy each time to avoid false errors
based on confusion over anything that might have changed the local copy of
the remote APK.

This patch has been used on verification.f-droid.org for a while now. It is
the last thing keeping verification.f-droid.org from using fdroidserver
straight from stretch-backports.
2018-05-25 11:48:01 +02:00
Hans-Christoph Steiner
6c7b987239 fix string formats that are ambiguous for translators 2017-09-16 13:19:38 +02:00
Hans-Christoph Steiner
fa0d618d2f rename 'app-id' to standard Android 'applicationId'
* https://developer.android.com/studio/build/application-id.html
* https://sites.google.com/a/android.com/tools/tech-docs/new-build-system/applicationid-vs-packagename

This only changes the term in the human texts, not var names or CLI flags.
2017-09-15 11:41:51 +02:00
Hans-Christoph Steiner
278d67d960 implement gettext localization
This allows all the text to be localized via Weblate.  This is a quick
overview of all the strings, but there are certainly some that were left
out.

closes #342
2017-09-15 11:39:00 +02:00
Hans-Christoph Steiner
c1e9379f67 remove errant trailing slash added in 7613c18dd8 2017-07-20 00:00:08 +02:00
Hans-Christoph Steiner
7613c18dd8 verify: if downloading from /repo/ fails, try /archive/
The Builds entries in metadata/ files do not easily say whether a
given APK is in the repo/ or the archive/.  So it should also try to
download the official APK from the archive/ when verifying.
2017-07-19 15:07:50 +02:00
Torsten Grote
1fcd8e63a3
Replace sys.exit() in non-main functions by exceptions
Also move all exceptions into one module
2017-05-22 16:51:11 -03:00
Michael Pöhn
abe04272b1 throw proper error when download of apks fail 2017-04-20 17:48:38 +02:00
Hans-Christoph Steiner
364e609ebe make fdroid verify use common.verify_apks()
This makes the jarsigner the ultimate and only judge of whether two APKs
match.  This is the best tool since APK signatures are jar signatures. This
should be eventually updated to use the official Android APK signing tool
called apksigner.

https://android.googlesource.com/platform/tools/apksig/
2017-03-22 10:51:12 +01:00
Hans-Christoph Steiner
6c2cf2ccdd convert internal dict keys to match fdroidclient's Apk class
This syncs up the field names between the fdroiddata .yml files, the keys
used in the implementation in fdroidserver, the index data format, and the
final data structures in fdroidclient.  This makes it easier for devs to
follow, and makes the Jackson parsing library automatically handle
converting the data from the index file to Java instances.

This bumps the metadata version since the apkcache will have to be
discarded.

Here are the name changes:
* apkname --> apkName
* id --> packageName
* sha256 --> hash
* version --> versionName
* versioncode --> versionCode

tests/repo/index.xml was changed only to bump the metadata version
from 17 to 18.
2017-03-17 13:55:40 +01:00
Hans-Christoph Steiner
bc27dee950 fdroid publish now includes OTA ZIPs and related source
This adds support for publishing ZIP files which were built with
`fdroid build`.  This is for "Over-The-Air" (OTA) update ZIP files for
flashing to ROMs.  The first example of this is the Privileged Extension,
which must be installed by flashing an OTA ZIP on Android > 5.0.

!181
https://gitlab.com/fdroid/privileged-extension/issues/9
https://gitlab.com/fdroid/privileged-extension/issues/10
https://gitlab.com/fdroid/fdroiddata/merge_requests/1804

Also, "if app.Binaries:" is the same as "if app.Binaries is not None:", but
is the standard Python style.
2017-01-09 11:32:52 +01:00
Daniel Martí
82b1d7ad14 all: make newer pycodestyle happy
Apparently the "two empty lines" rule is now stricter.
2016-11-15 20:55:06 +00:00
Daniel Martí
920ae4692f Port all imports to python3 2016-03-10 16:43:37 +00:00
Daniel Martí
99edd64372 Switch all headers to python3 2016-03-10 16:43:36 +00:00
NeroBurner
5ca182a20d except named exception handling 2015-12-29 20:09:27 +01:00
Daniel Martí
576da1d048 all: deduplicate -v/-q setup 2015-09-11 23:42:50 -07:00
nero-tux
d23ecf1b35 replace deprecated optparse with argparse
following guidelines from:
https://docs.python.org/2/library/argparse.html#upgrading-optparse-code
except, still using option = parse.parse_args() instead of args = ...

- using the following script in folder fdroidserver:
	for i in *.py; do
		sed -i -e 's/optparse/argparse/' \
			-e 's/OptionParser/ArgumentParser/' \
			-e 's/OptionError/ArgumentError/' \
			-e 's/add_option/add_argument/' \
			-e 's/(options, args) = parser/options = parser/' \
			-e 's/options, args = parser/options = parser/' \
			-e 's/Usage: %prog/%(prog)s/' $i;
	done
- use ArgumentParser argument to replace (option, args) = parser.parse()
  call
- use parser.error(msg) instead of raise ArgumentException as suggested
  in https://docs.python.org/2/library/argparse.html#exiting-methods
- in fdroid catch ArgumentError instead of OptionError
2015-09-06 10:34:50 +02:00
Daniel Martí
04e6f2ebfd Move requests code out of common.py, closes #114 2015-08-31 17:05:08 -07:00
Hans-Christoph Steiner
f625005ec3 remove dependency on wget for 'build' and 'verify'
To make the core tools portable to platforms like Mac OS X and Windows,
remove the dependency on wget and instead use Python Requests, which
probably has better performance anyway.
2015-07-24 11:53:14 -07:00
Daniel Martí
3829896a8a Fix all pep8 warnings 2014-10-24 22:23:58 +02:00
Ciaran Gultnieks
8568805866 Support for publishing signed binaries from elsewhere
Done after verifying that they match ones built using a recipe.
Everything in the metadata should be the same as normal, with the
addition of the Binaries: directive to specify where (with pattern
substitution) to get the binaries from.

Publishing only takes place if there is a proper match. (Which seems
very unlikely to be the case unless the exact same toolchain is used, so
I would imagine that unless the person building and signing the incoming
binaries uses fdroidserver to build them, probably the exact same
buildserver id, they will not match. But at least we have the
functionality to support that.)
2014-10-24 21:04:15 +01:00
Daniel Martí
ff06694adc Don't use generic Exception raises
That hides bugs, since all exceptions (including bugs that cause raises that
weren't our doing) fall under the "Exception" except
2014-07-07 15:41:50 +02:00
Daniel Martí
8888962ace Rename PopenResult.stdout to output since it also contains stderr 2014-07-01 18:04:41 +02:00
Hans-Christoph Steiner
0e00b36db5 fix PEP8 E124/E125/126/127/128 indentation issues
* E124 closing bracket does not match visual indentation
* E125 continuation line does not distinguish itself from next logical line
* E126 continuation line over-indented for hanging indent
* E127 continuation line over-indented for visual indent
* E128 continuation line under-indented for visual indent
2014-05-06 14:36:33 -04:00
Hans-Christoph Steiner
aa5f317c26 fix PEP8 "W391 blank line at end of file" 2014-05-06 11:45:03 -04:00
Hans-Christoph Steiner
3f4f7a544b fix PEP8 "E302 expected 2 blank lines, found 1" 2014-05-06 11:45:03 -04:00
Ciaran Gultnieks
37dda9414c Add --quiet option, restricting output to warnings/errors 2014-02-22 09:46:24 +00:00
Daniel Martí
1e3c2eee25 More logging switching 2014-01-27 21:49:29 +01:00
Daniel Martí
040e575b10 Add logging to verify 2014-01-27 21:49:01 +01:00
Daniel Martí
62c3663df3 Lots more FDroidPopen replacements 2014-01-27 21:48:22 +01:00
Daniel Martí
efc8317272 Replace finds with pythonic terms 2013-12-20 09:34:03 +01:00
Daniel Martí
8f3a2d4355 Add some remaining help strings 2013-12-19 23:18:27 +01:00
Daniel Martí
c4236ba761 Remove some unnecessary stuff 2013-12-19 23:14:51 +01:00
Daniel Martí
19ea8fd894 Adapt verify 2013-12-19 23:14:22 +01:00