Commit Graph

311 Commits

Author SHA1 Message Date
Hans-Christoph Steiner 62c8fd5999
add Liberapay: field with username as data
Liberapay was originally included using a numeric ID, since they had
not yet finalized the public URLs.  Now it is a username.  So this
logic prefers the username in Liberapay: field, and keeps the old
LiberapayID: to ease migration.  LiberapayID: will not override
Liberapay:.  Clients are expected to prefer Liberapay: over LiberapayID:
2020-06-16 15:35:28 +02:00
Hans-Christoph Steiner 0183592526
update: insert donation links based on FUNDING.yml
GitHub has specified FUNDING.yml, a file to include in a git repo for
pointing people to donation links.  Since F-Droid also points people
to donation links, this parses them to fill out Donate:
and OpenCollective:.  Specifying those in the metadata file takes
precedence over the FUNDING.yml.  This follows the same pattern as how
`fdroid update` includes Fastlane/Triple-T metadata.  This lets the
git repo maintain those specific donations links themselves.

https://help.github.com/en/articles/displaying-a-sponsor-button-in-your-repository#about-funding-files

The test file was generated using:

```python
import os, re, yaml

found = dict()
for root, dirs, files in os.walk('.'):
    for f in files:
        if f == 'FUNDING.yml':
            with open(os.path.join(root, f)) as fp:
                data = yaml.safe_load(fp)
            for k, v in data.items():
                if k not in found:
                    found[k] = set()
                if not v:
                    continue
                if isinstance(v, list):
                    for i in v:
                        found[k].add(i)
                else:
                    found[k].add(v)

            with open('gather-funding-names.yaml', 'w') as fp:
                output = dict()
                for k, v in found.items():
                    output[k] = sorted(v)
                yaml.dump(output, fp, default_flow_style=False)
```
2020-06-16 15:35:26 +02:00
Hans-Christoph Steiner 13d9a122bf metadata: validate STRING and INT build field types
This converts float/int to string for things like commit: or versionName:.
For versionCode, which must be an integer, it throws an exception if the
data is any other type.
2020-06-02 22:06:01 +02:00
Hans-Christoph Steiner a0e3b01e94 metadata: parsed srclibs must always return a dict as the container 2020-05-14 16:28:13 +02:00
Michael Pöhn 4e69ff582f run yamllint when parsing failed and also on fdroid lint runs 2020-04-24 15:47:31 +02:00
Michael Pöhn 5741e6930b yml srclibs: support Subdir as list 2020-04-16 11:31:59 +02:00
Michael Pöhn 1ac7d612b1 yml srclibs: support multiline Prepare 2020-04-16 11:31:59 +02:00
Michael Pöhn aa020af040 srclibs: forward yml parsing error cause 2020-04-16 11:31:59 +02:00
Michael Pöhn ee3d8d2f18 srclib: yml parsing + tests for yml and txt 2020-04-16 11:31:59 +02:00
Michael Pöhn 2c86d38028 srclib: no spaces in dict key 2020-04-16 11:31:59 +02:00
Michael Pöhn c6a97939f1 rename parse_srclib to parese_txt_srclib + test case 2020-04-16 11:31:59 +02:00
Marcus Hoffmann 56ee7fe765 opencollecive: fix allowed characters
The url slug used by opencollective allows case variations, they all
lead back to the canonical lowercase variant though.

Apart from ascii characters and numbers only - and _ are allowed.
2020-03-10 16:26:34 +01:00
Marcus 9d24f2e4a7 add opencollective metadata and index field 2020-03-10 14:56:03 +00:00
Hans-Christoph Steiner e9830fc4ab Merge branch 'faster_yaml' into 'master'
metadata: use yaml C implementation when available

Closes #716

See merge request fdroid/fdroidserver!696
2019-12-23 10:09:50 +00:00
Marcus Hoffmann 01d00d54ca metadata: use yaml C implementation when available
This is an order of magnitude faster. Requires the C yaml bindings to be
installed.

Fixes fdroid/fdroidserver#716
2019-12-23 01:59:33 +01:00
Marcus Hoffmann 5642dc56ae remove unused function
The users of this were removed years ago in
013315bf10.
2019-12-23 01:29:06 +01:00
Hans-Christoph Steiner 7090ce63dd Merge branch 'remove-provides-in-yml' into 'master'
Remove `Provides:` in yaml metadata

Closes #676

See merge request fdroid/fdroidserver!654
2019-08-28 13:39:59 +00:00
Michael Pöhn 8e5232076f do not delete yml metadata when raumel not installed 2019-08-27 15:38:40 +02:00
Michael Pöhn 08acb55897 keep yaml metadata when rewrite failed 2019-08-27 15:38:40 +02:00
Michael Pöhn dcf3837bcb parse yaml: ignore (and warn) deprecated field: Provides 2019-07-15 15:45:02 +02:00
Michael Pöhn 191363ad55 exclude Provides metadata from yml 2019-07-11 03:35:23 +02:00
Michael Pöhn 66105de833 improve litecoin validation + tests 2019-05-28 11:04:43 +02:00
Michael Pöhn 06cec2041d improve bitcoin validation regex + testcases 2019-05-07 22:43:05 +02:00
Licaon_Kter 0ea03ddfaa metadata.py - typo 2019-04-08 16:30:32 +00:00
Michael Pöhn 67731470cc Revert "Merge branch 'write-yaml-overhaul' into 'master'"
This reverts merge request !630
2019-04-01 10:24:00 +00:00
Michael Pöhn 2683b37044 yml metadata write: do not use local functions 2019-03-19 01:01:18 +01:00
Michael Pöhn 63afc0acb5 use pyyaml for writing metadata instead of ruamel 2019-03-18 22:45:35 +01:00
Hans-Christoph Steiner 217e6a7c30 metadata: fix pyflakes "use ==/!= to compare str, bytes, and int literals"
$ ./hooks/pre-commit || export EXITVALUE=1
WARNING: ruby is not installed, using dummy placeholder!
fdroidserver/metadata.py:1180: use ==/!= to compare str, bytes, and int literals
fdroidserver/metadata.py:1184: use ==/!= to compare str, bytes, and int literals
fdroidserver/metadata.py:1186: use ==/!= to compare str, bytes, and int literals
fdroidserver/metadata.py:1189: use ==/!= to compare str, bytes, and int literals
ERROR: pyflakes tests failed!
2019-01-27 23:00:00 +01:00
Michael Pöhn 31ca2092a1 yaml parsing: script build flags can now be lists 2018-11-29 21:53:37 +01:00
Michael Pöhn c15a7508e7 write yaml script metadata as lists 2018-11-29 21:53:37 +01:00
Michael Pöhn afdc0be954 yaml build flag prebuild: keep writing string rathern than list of strings when theres just 1 entry 2018-11-29 21:53:37 +01:00
Michael Pöhn 942de28fa5 yaml metadata: split prebuild build field to list 2018-11-29 21:53:37 +01:00
Hans-Christoph Steiner 57556aceee remove redundant open() arg: encoding='utf8'
By default, open() returns a str:
https://docs.python.org/3/library/functions.html#open

By default, str is UTF-8:
https://docs.python.org/3/library/stdtypes.html#str

This used to matter on Python 2.x, but this code is 3.x only now.
2018-10-19 15:01:34 +02:00
Michael Pöhn aea2589c67 metadata: remove redundant build flags list creation
picked out of fdroid/fdroidserver!559
2018-10-10 16:02:34 +02:00
Hans-Christoph Steiner 58b14279af rewritemeta: rewrite AntiFeature str entries like Categories 2018-10-09 23:49:27 +02:00
Hans-Christoph Steiner 6e6afeec65 unset Categories should be empty by default, not ['None']
This is an ancient, bizarre vestige.  This makes the TYPE_LIST fields
behave the same, e.g. AntiFeatures and Categories.
2018-10-09 23:39:09 +02:00
Hans-Christoph Steiner 2113e29082 throw error on ancient, obsolete BuildVersion/UseBuilt metadata fields 2018-10-09 22:23:42 +02:00
Hans-Christoph Steiner 5d161cc9fd validate appid when reading metadata files
The metadata file must be named after the Application ID of the app it is
describing, and Android Application IDs must be valid Java Package Names.
2018-09-03 22:56:08 +02:00
Michael Pöhn ee4945cb84 remove unused YamlLoader optimization 2018-08-29 11:25:01 +02:00
Michael Pöhn e7a34807f7 use yaml.safe_load for parsing metadata 2018-08-29 00:33:58 +02:00
Michael Pöhn 6a06944945 better exception and waring message when yaml metadata checks fail; build flags check optional 2018-08-14 12:31:12 +02:00
Michael Pöhn 0d005ab83a make parse_yaml_metadata ignore empty input 2018-08-14 12:31:12 +02:00
Michael Pöhn e83221eb03 improve yaml build flag check cost; added unit test for unknown app fields, builds flags checks when parsing yaml 2018-08-14 12:31:12 +02:00
Michael Pöhn 25b4a47951 check for unknown app fields and build flags when parsing yml 2018-08-14 12:31:12 +02:00
Michael Pöhn 1e7d9b854d never interpret "disable" as bool in yaml metadata 2018-08-02 17:31:58 +02:00
Hans-Christoph Steiner b03c4a7353 NoSourceSince Anti-Feature should only be added to index
Before, it was being added to the metadata, so that rewritemeta would
output it.

fdroid/fdroidserver!529
#508
2018-07-10 23:32:07 +02:00
Izzy 5d8e1bde4f new AntiFeature: SourceGone (automatically set at NoSourceSince). closes #508 2018-07-10 12:36:49 +00:00
Hans-Christoph Steiner ff90c0246e fix PEP8 W605 invalid escape sequence
Python 3.7 will get a lot stricter with escape sequences.  They must be
valid.

* https://lintlyci.github.io/Flake8Rules/rules/W605.html
* https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior
2018-05-29 13:51:47 +02:00
relan 4d56c6c262 metadata: write values of TYPE_INT fields
Otherwise we end up with empty values after "fdroid rewritemeta".
2018-02-11 09:51:53 +03:00
Hans-Christoph Steiner 05eef5a454 metadata: add new Translation app field for URL for contributions
This is a field requested from a bunch of translators so they can easily
find where to translate apps:
https://forum.f-droid.org/t/translation-field-for-app-entries/1403/5
2018-02-05 15:45:12 +01:00