1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-14 02:50:12 +01:00
Commit Graph

7903 Commits

Author SHA1 Message Date
Hans-Christoph Steiner
386fb55b99
keep old test case intact 2023-05-05 09:49:27 +02:00
Jason A. Donenfeld
26472c22ce build: check AllowedAPKSigningKeys in reproducible build scenario
The builder should check the `AllowedAPKSigningKeys` at build time, so
that the CI can check if somebody gives a wrong value that doesn't match
a compared RB binary.  In the event it fails, it gives useful
information, and in the event it succeeds, it makes it clear that this
build has verification back to the developer's original key.

Also, add tests for this to the test suite.
2023-05-05 06:14:31 +00:00
Jason A. Donenfeld
8a0b7e5b1b lint: binary or Binaries requires AllowedAPKSigningKeys
Per fdroiddata!12911 the linter should error out if somebody uses `binary` or
`Binaries` without supplying an `AllowedAPKSigningKeys`.

There are two reasons for this:

- Security: this allows full verification that the binaries built match
  the developers, not just what happened to get uploaded onto github at
  some later point in time.

- Reliable updates: if the signing key changes, users won't be able to
  update, so this is something we should learn about when upstreams send
  in commits changing their signing key, rather than just leaving it to
  chance.
2023-05-05 06:14:31 +00:00
Hans-Christoph Steiner
41104e217b Merge branch 'consistent-linting-formatting' into 'master'
make linting and formatting rules consistent

See merge request fdroid/fdroidserver!1160
2023-05-04 14:12:09 +00:00
proletarius101
4b898287e9 make linting and formatting rules consistent 2023-05-04 14:12:08 +00:00
Michael Pöhn
acc774f91e Merge branch 'clean-up-metadata' into 'master'
collection of cleanups, tests and minor refactoring related to metadata

See merge request fdroid/fdroidserver!1351
2023-05-04 12:55:38 +00:00
Hans-Christoph Steiner
f871df502d metadata: minor optimization: call fieldtype() once per loop
I profiled this with timeit and a dict with 1000000000 items, and this is
the time difference:

with_equals:		0.8466835720173549
with_is:		0.8536969239939936
with_old:		1.4458542719949037

I also compared using `==` and `is`, and `==` was slightly faster.
2023-05-02 13:53:53 +02:00
Hans-Christoph Steiner
9a9705a667 update test_read_metadata to use ruamel.yaml and YAML 1.2
I tried to get this to indent the .yaml files properly so yamllint defaults
work with tests/metadata/dump/*.yaml, but it didn't take for some reason:

    yaml.indent(mapping=4, sequence=4, offset=2)
2023-05-02 13:52:38 +02:00
Hans-Christoph Steiner
28ea6cea7f add tests of TYPE_LIST parsing 2023-05-02 13:52:06 +02:00
Hans-Christoph Steiner
0b3fd725c3 metadata.TestCase: metadata.warnings_action = 'error' as default
The default state for the tests should be to fail on errors.
2023-05-02 13:51:44 +02:00
Hans-Christoph Steiner
822439dff5 remove exception for ruamel.yaml on Debian/stretch
stretch is no more, and this code base specifies Python 3.9 as minimum.
2023-05-02 13:50:54 +02:00
Hans-Christoph Steiner
74dddfd9fb refactor App.get_last_build() to checkupdates
This function is only used in checkupdates, and removing it from the App
class moves the App class one step closer to being a plain dict, which is a
more Pythonic style.
2023-05-02 13:50:31 +02:00
Hans-Christoph Steiner
8300ed051b ruamel.yaml is now required and the packages are all new enough 2023-05-02 13:41:39 +02:00
Hans-Christoph Steiner
e794ccb38c work towards switching fdroidserver/metadata.py to black 2023-05-02 13:41:27 +02:00
Hans-Christoph Steiner
e5fda54693 add test_check_metadata_AntiFeatures 2023-05-02 13:37:07 +02:00
Hans-Christoph Steiner
c6ad8505d4 some easier fixes for black code format 2023-05-02 13:37:07 +02:00
Hans-Christoph Steiner
5968cfe7e0 Merge branch 'litecoin' into 'master'
add litecoin address native segwit format

See merge request fdroid/fdroidserver!1332
2023-05-02 11:31:41 +00:00
linsui
1a0a0a1839 add litecoin address native segwit format 2023-05-02 11:31:34 +00:00
Michael Pöhn
2135a9e7fb Merge branch 'refactor-into-single-yaml-post-process' into 'master'
refactor into a single function to do YAML post processing

See merge request fdroid/fdroidserver!1346
2023-05-02 11:31:06 +00:00
Hans-Christoph Steiner
572819dbc8 gitlab-ci: use bookworm for "Build documentation" job
I think most fdroidserver core devs are working on bookworm these days, and
the bullseye version is erroring on things that the bookworm version does
not.

fdroidserver/metadata.py:777 in public function `post_parse_yaml_metadata`:
        D202: No blank lines allowed after function docstring (found 1)
2023-04-28 10:55:21 +02:00
Hans-Christoph Steiner
a692cd9d72 hooks/pre-commit: enable pydocstyle, if installed 2023-04-28 10:55:21 +02:00
Hans-Christoph Steiner
d7214a7f1c hooks/pre-commit: run yamllint on more YAML files
I keep messing up YAML syntax with values that have : in them...

This doesn't work for all YAML files:
* tests/metadata/dump/*.yaml have bad indenting
* tests/metadata/*.yml have bad indenting, which is useful for tests
2023-04-28 10:55:21 +02:00
Hans-Christoph Steiner
1bcd9a8489 metadata: handle empty files and dicts, and error out on non-dicts 2023-04-28 10:55:20 +02:00
Hans-Christoph Steiner
2b81a66b79 App.comments is no more since !772 2023-04-28 10:44:19 +02:00
Hans-Christoph Steiner
dbe21b2b94 metadata: transform all TYPE_STRING values w/ _normalize_type_string()
Before this, there were separate post-parse paths for app-fields versus
build-flags.  This makes all TYPE_STRING values always go through the same
post-parse code path.
2023-04-28 10:44:19 +02:00
Hans-Christoph Steiner
a8531a03a6 metadata: refactor into one function to do YAML post processing
It used to be that there had to be separate post processing steps depending
on whether it was parsing .txt or .yml.  The .txt format is long gone!

!772
2023-04-28 10:44:19 +02:00
Hans-Christoph Steiner
3869e1374b metadata: force TYPE_STRING fields to string in internal dict
* YAML 1.2's boolean is 'true' so this makes the conversion correct.
* rewritemeta would also have to be changed to support this.
2023-04-27 21:51:10 +02:00
Hans-Christoph Steiner
c0ae09e0df metadata: remove strange app arg construct from parse_yaml_metadata()
My guess is that this is some kind of vestige of the old code structure,
back when there was .txt and .yml formats.  This makes it a normal Python
function: input as arg, return value is the result.
2023-04-27 21:51:10 +02:00
Hans-Christoph Steiner
41972e6525 warn on all unrecognized build flags
No need to put the list of keys in a set beforehand, just report all build
flags that are invalid.
2023-04-27 21:51:10 +02:00
Hans-Christoph Steiner
1166258145 map out type conversions in metadata.PostMetadataParseTest suite 2023-04-27 21:50:49 +02:00
Hans-Christoph Steiner
27a0df9ddb metadata: failfast=False like the rest of the tests 2023-04-27 21:48:27 +02:00
Michael Pöhn
2293633380 Merge branch 'enable-more-black' into 'master'
enable more black code format

See merge request fdroid/fdroidserver!1349
2023-04-27 09:50:59 +00:00
Hans-Christoph Steiner
6dcdadd0e3
config black exceptions in pyproject.toml
This means that anyone can run `black .` and it won't break things. Plus it
gives us a roadmap for fully enabling black.
2023-04-27 11:34:19 +02:00
Hans-Christoph Steiner
32ea4ef19a
enable black on fdroidserver/asynchronousfilereader/__init__.py 2023-04-27 11:34:18 +02:00
Hans-Christoph Steiner
2273d8203b
enable black on fdroidserver/signatures.py 2023-04-27 11:34:16 +02:00
Hans-Christoph Steiner
6620bf0208
enable black on tests: api, gpgsign, main, net, vcs 2023-04-27 11:34:14 +02:00
Hans-Christoph Steiner
77f9ac9fa8
enable black on fdroidserver/rewritemeta.py 2023-04-27 11:34:12 +02:00
Hans-Christoph Steiner
eb81af57bb
enable black on fdroidserver/init.py 2023-04-27 11:34:10 +02:00
Hans-Christoph Steiner
c7070b2799
index.TestCase: manually convert to black code format
* switch to `from fdroidserver import common, index, signindex...`
2023-04-27 11:34:07 +02:00
Hans-Christoph Steiner
98decf8cfa index: use 'fake.url' as test domain when no networking is used 2023-04-27 10:35:09 +02:00
Michael Pöhn
5e75b03814 Merge branch 'mirror-metadata' into 'master'
index-v2 'mirrors' fully settable from config

See merge request fdroid/fdroidserver!1344
2023-04-27 08:06:13 +00:00
Hans-Christoph Steiner
7c692a4532 index-v2 'mirrors' fully settable from config
This lets mirrors: in config.yml be the same list-of-dicts format as it is
in index-v2.  This also includes a data format conversion to maintain the
right format for the old, unchanging index v0 and v1 formats.

#928
#1107
2023-04-27 07:53:02 +00:00
Hans-Christoph Steiner
ceef07d2f2 test of current internal format of mirrors list in config 2023-04-27 07:53:02 +00:00
Hans-Christoph Steiner
c4d202f2d8 Merge branch 'gradle-release-checksums.py' into 'master'
update to gradle v8.1.1

See merge request fdroid/fdroidserver!1348
2023-04-24 09:35:05 +00:00
fdroid-bot
087fd04b02 gradle v8.1.1 2023-04-24 09:21:53 +00:00
Hans-Christoph Steiner
60e11cab6c Merge branch 'remove-last-maven-quirks' into 'master'
remove last `maven:` quirks and make it always a string

See merge request fdroid/fdroidserver!1345
2023-04-24 09:21:11 +00:00
Hans-Christoph Steiner
ad960c6ecd
remove last maven: quirks and make it always a string
It turns out that the maven: field was originally declared as a TYPE_STRING,
given that it was not given a different type in metadata.py's 	flagtypes.
The code was confused because it was given a default value of `False` rather
than `None` as the rest of the TYPE_STRING fields have.

This construct in build.py means maven: should always be a string:

        if '@' in build.maven:
            maven_dir = os.path.join(root_dir, build.maven.split('@', 1)[1])
        else:
            maven_dir = root_dir
2023-04-24 11:08:48 +02:00
Hans-Christoph Steiner
a107e810d4
build: add test case for maven: builds 2023-04-24 11:08:46 +02:00
Hans-Christoph Steiner
7641c30389
add real test of moving files with deploy.update_serverwebroot() 2023-04-24 11:08:42 +02:00
Hans-Christoph Steiner
fa95302580
add myself to .mailmap !1347 2023-04-21 08:01:44 +02:00