Daniel Martí
5541cb83ac
checkupdates: fix --auto build copy
...
Also, remove origlines which hasn't been used in some time.
2015-12-07 12:39:04 +01:00
Daniel Martí
3101ad6c39
Set all list defaults to an actual list
...
Iterating over the defaults will crash otherwise. Update pickle files.
2015-12-04 00:08:42 +01:00
Daniel Martí
cb8d93e443
Fix tests by not checking private attributes
...
All attrs starting with '_' (e.g. _foo or __bar) are used internally, so
not very relevant for the metadata test anyway.
2015-12-03 19:31:20 +01:00
Daniel Martí
2711f1c868
Also skip unmodified fields in the regex checks
...
Now it's close to 1s.
2015-12-03 17:02:24 +01:00
Daniel Martí
ea99add3da
Keep track of what attrs were modified in apps/builds
...
This allows us to run checks and fix types only on those that were
really modified. On our fdroiddata repo, with 2k apps with many unset
fields and flags, this reduces readmeta runtime from ~1.3s to ~1.1s.
2015-12-03 16:46:21 +01:00
Daniel Martí
8c2e1fedfc
Actually check that bools are valid
...
The metadata check was omitting booleans and lists, as it was only
taking strings. Fix this.
2015-12-03 16:35:46 +01:00
Daniel Martí
7b575e3fdd
Remove need for rstrip() of txt description
2015-12-03 16:19:33 +01:00
Daniel Martí
a9bb5f9713
metadata: write strings directly to txt file
2015-12-03 14:00:47 +01:00
Daniel Martí
28566f6e57
Rename metafieldtype to fieldtype
...
For consistency with flagtype. Also less redundant.
2015-12-03 13:53:49 +01:00
Daniel Martí
2c095df947
Use dicts for field/flag types
2015-12-03 13:52:53 +01:00
Daniel Martí
cd4e43c3c2
Some more readability/performance tweaks
...
* Use set() instead of dict()
* No 'if foo: True else: False'
* Don't check for invalid fields twice
2015-12-03 13:02:54 +01:00
Daniel Martí
b1a9180d12
Use constants for field/flag types
...
Avoids typos, such as one I just found which was 'strsng' isntead of
'string'. The static analyzer can catch those if they are constants.
Comparing ints is also faster than strings, which adds up in readmeta.
2015-12-03 12:55:19 +01:00
Daniel Martí
992406de0e
Avoid conflicting func/var names
2015-12-03 12:41:50 +01:00
Daniel Martí
1b43d8e33c
Make text formatting faster via StringIO
...
Avoid concatenating strings over and over. Also, the wiki formatting
wasn't necessary at all since it was just joining lines.
2015-12-03 12:02:47 +01:00
Daniel Martí
088929711c
Represent multiline fields as str, not list
...
Only keep lists in metadata files in the json format, since they don't
support multiline strings that are readable.
This makes the internal code easier, and a bit faster.
2015-12-03 11:36:15 +01:00
Daniel Martí
c8cc054c8b
Fix tests
2015-12-03 11:16:27 +01:00
Daniel Martí
97c991c4b6
Some more txt parsing tweaks after profiling
2015-12-03 11:06:27 +01:00
Daniel Martí
490da2da22
Remove duplicate build_flags check
...
It's already checked in set_flag
2015-12-03 10:59:48 +01:00
Daniel Martí
1987ee7f54
Remove gradle=main
...
It was only supported in txt metadata, and was unused in fdroiddata
anyway.
2015-12-03 10:56:59 +01:00
Daniel Martí
5e0bc7f2c3
Properly close all metadata files once read
2015-12-03 10:51:27 +01:00
Daniel Martí
96f1fc5355
Never use exit/log in metadata
2015-12-02 22:59:58 +01:00
Daniel Martí
b9ac6fb69a
Speed up metadata reading
...
Total time for `fdroid readmeta` went down from ~1.6s to ~1.4s on my
machine.
2015-12-02 22:38:40 +01:00
Daniel Martí
528e45d22b
Simplify post_metadata_parse usage
2015-12-02 22:29:31 +01:00
Daniel Martí
c975531d87
metadata: properly store nums as strs and bools as bools
2015-12-02 20:49:42 +01:00
Daniel Martí
71a5eac494
Pre-compile more regexes
2015-12-02 20:40:30 +01:00
Daniel Martí
a566ee4475
Fix default update= on ant builds
2015-12-02 20:16:25 +01:00
Daniel Martí
bf8518ee8f
Rework build into a class
...
This simplifies usage, goes from
build['flag']
to
build.flag
Also makes static analyzers able to detect invalid attributes as the set
is now limited in the class definition.
As a bonus, setting of the default field values is now done in the
constructor, not separately and manually.
While at it, unify "build", "thisbuild", "info", "thisinfo", etc into
just "build".
2015-12-02 20:03:11 +01:00
Daniel Martí
6e87a8c45a
Add documentation to new App class
2015-11-28 17:19:59 +01:00
Daniel Martí
ab614ab442
Rework app into a class
...
This simplifies usage, goes from
app['Foo']
to
app.Foo
Also makes static analyzers able to detect invalid attributes as the set
is now limited in the class definition.
As a bonus, setting of the default field values is now done in the
constructor, not separately and manually.
2015-11-28 17:11:05 +01:00
Daniel Martí
de12cfdbe1
Handle duplicate apps in a much cleaner way
...
Don't log and exit in an inner metadata function. Handle it at a higher
level and do a proper exception. This also avoids unnecessary passing of
apps all around.
2015-11-28 14:04:21 +01:00
Daniel Martí
48645072ee
extension simplifications
2015-10-04 18:01:32 +02:00
Daniel Martí
53ed335d4b
Final touches to yaml writing
...
Now it writes and reads properly.
2015-10-04 07:56:32 -07:00
Daniel Martí
ac37e3084e
More improvements to yaml writing
2015-10-04 07:55:55 -07:00
Daniel Martí
9c5b5f7b60
Don't leave an empty line at the end
2015-10-04 07:55:42 -07:00
Daniel Martí
1aa891c4fd
Add basic yaml metadata writing
2015-10-04 07:55:42 -07:00
Daniel Martí
082e275aa1
Rename write_metadata to specify txt
2015-10-03 23:13:44 -07:00
Daniel Martí
885a3a73f1
Simplify format parsing logic
2015-10-03 23:00:18 -07:00
Daniel Martí
911994fc99
Make write_metadata take a writer
...
This will let rewritemeta report format issues without writing to disk.
2015-09-24 22:38:33 -07:00
Daniel Martí
e285a8ac31
Remove Dogecoin donation support
...
Not nearly as popular as bitcoin and litecoin. To the point where it hadn't
been used yet.
Bump index version to 14 to mark its removal.
2015-09-18 19:06:10 -07:00
Daniel Martí
d07bf0754a
metadata: fix html paragraph tag regression
...
Spotted in fdroid/fdroidclient#422
2015-09-17 14:14:54 -07:00
Daniel Martí
fb23b2cff4
metadata: don't break words nor on hyphens
2015-09-11 22:52:50 -07:00
Daniel Martí
223db1588b
metadata: allow links spanning multiple lines
...
This allows for nicer text wrapping.
2015-09-11 22:07:20 -07:00
Daniel Martí
3413965eaa
Wrap descriptions to 80 chars
2015-09-11 21:36:18 -07:00
Daniel Martí
ade5036e23
metadata: rewrite multiline field writing
...
Now description text wrapping can be added.
2015-09-11 19:12:51 -07:00
Daniel Martí
cd202e59b1
Ensure that builds are always sorted when writing
...
This might not be true if builds are appended by e.g. checkupdates --auto.
This ensures that we sort them again before writing.
2015-09-11 18:21:07 -07:00
Hans-Christoph Steiner
c80c1bf017
import: split out URL handling into its own function
...
This is preparation to add other import methods, like checking if the
command was run in a currently checked out git repo.
2015-09-10 11:08:39 +02:00
Daniel Martí
de1c599127
Fix regression introduced in 2831b3e93
...
An empty list of antifeatures should not be written.
2015-09-05 10:10:37 -04:00
Hans-Christoph Steiner
325db90918
set "accepted formats" for metadata in config.py
...
For a bit repo like f-droid.org, it makes sense to standardize on a single
format for metadata files. This adds support for enforcing a single data
format, or a reduced set of data formats. So f-droid.org would run like
this if it changed to YAML:
accepted_formats = ['txt', 'yaml']
Then once everything was converted to YAML, it could look like this:
accepted_formats = ['yaml']
2015-09-01 11:53:37 +02:00
Hans-Christoph Steiner
8d6e0aebb9
exit with error if duplicate metadata file is found
...
In order to prevent confusion caused by multiple metadata files for a given
app, fdroid will exit with an error if it finds any app metadata file with
the same package ID as one that has already been parsed.
2015-09-01 11:39:51 +02:00
Hans-Christoph Steiner
6f334558df
metadata: rename metafile to metadatapath when it is a path
...
To keep the code clear, change the code to use separate variables for the
path to the metadata file, and for the file object of the opened metadata.
2015-09-01 11:39:51 +02:00