Commit graph

279 commits

Author SHA1 Message Date
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
Hans-Christoph Steiner
285c06d156 metadata: use unified method for getting default app metadata dict
This puts process of setting up the defaults for the internal dict
that represents a parsed app into a single method that is reused for all
metadata formats.
2015-09-01 11:39:51 +02:00
Hans-Christoph Steiner
32e257d742 support app metadata in YAML format
YAML is a format that is quite similar to the .txt format, but is a
widespread standard that has editing modes in popular editors.  It is also
easily parsable in python.

The .pickle for testing is a lightly edited version of the real metadata
for org.videolan.vlc:

 * comments were removed
2015-09-01 11:39:51 +02:00
Hans-Christoph Steiner
0b62e7f22a set appid in get_default_app_info_list() 2015-09-01 11:39:51 +02:00
Hans-Christoph Steiner
0425788b7d consolidate all post-parse metadata checks
This puts all of the needed post parsing checks on the metadata into a
single method that is used by all parsing methods (.txt, JSON, XML, YAML).
This provides the single place to normalize the internal representation of
the metadata.

It would be good to also change the internal representation to use more Python
bool/int types so that less post parsing is needed for JSON, XML, and YAML.

The SMSSecure test .pickle was changed to account for the use of lstrip()
and rstrip() on all 'script' types.

This also changes the example JSON to use ints for versionCodes
2015-09-01 11:39:51 +02:00
Hans-Christoph Steiner
014df8426f eliminate Boolean metadata type, only 'bool' is needed
No need for a specific metadata type for 'Requires Root'.  Just use 'bool',
then convert on output.  This keeps the internal representation consistent
since all boolean-ish values will be Python bools.  This in turn makes
parsing metadata in various formats easier.  This also makes setting
booleans more tolerant since all these values are valid:

 Yes yes No no True true False false
2015-09-01 11:39:51 +02:00
Hans-Christoph Steiner
ab145de6bc support app metadata in XML format
While the current text metadata format is good for human readability and
editability, it is difficult to produce and parse using code.  XML is a
widespread standard format for easy automatic parsing and creating, while
having decent human readability.

The .pickle for testing is a lightly edited version of the real metadata
for net.osmand.plus:

* comments were removed
* "NonFreeNet" was added as an AntiFeature
2015-09-01 11:39:51 +02:00
Hans-Christoph Steiner
2831b3e93f convert internal representation of AntiFeatures to list
The AntiFeatures metadata is a comma-separated list of tags, like
Categories, so it should also be stored internally as a list.  This makes
parsing XML and JSON easier.

The test cases' .pickle files look like they change a lot, but they really
don't, its only the change of default AntiFeatures value from None to []
2015-09-01 11:39:51 +02:00
Hans-Christoph Steiner
cc29d39f0a metadata: store comments in lists since lists are used everywhere else
The only data produced by parsing metadata that was stored as a tuple was
the comments' key/values.  Everywhere else, lists are used.  This changes
the comments to also only use lists to keep the data consistent internally.
That makes it vastly easier to produce the exact same metadata dict when
parsing .txt, JSON, XML, etc.
2015-09-01 11:39:51 +02:00
Hans-Christoph Steiner
61f6be1a7b in JSON metadata, convert unicode to str to match the internal format
fdroidserver currently uses plain python 2.x strings rather than unicode
strings, so the parsed JSON should produce the same format as the parsed
.txt metadata.
2015-09-01 11:39:51 +02:00
Hans-Christoph Steiner
eeb8ba02b0 move metadata post-parse processing to reusable function 2015-09-01 11:39:50 +02:00
Hans-Christoph Steiner
84c9777e9e support app metadata in JSON format
While the current text metadata format is good for human readability and
editability, it is difficult to produce and parse using code.  JSON is a
widespread standard format for easy automatic parsing and creating, while
having decent human readability.
2015-09-01 11:39:50 +02:00
Hans-Christoph Steiner
2b72634120 use common method to set up defaults in metadata dict
This is needed for the upcoming metadata formats: JSON, XML, etc.
2015-09-01 11:39:50 +02:00
Hans-Christoph Steiner
141e0e24c7 metadata: rename parse_metadata() to parse_txt_metadata()
This makes the code clear as support for other metadata formats is added.
2015-09-01 11:39:50 +02:00
Daniel Martí
e0870f6e76 metadata: error on url titles that aren't 2015-08-28 15:48:53 -07:00
Daniel Martí
ecd0e07e93 Revert "metadata: complain if link url isn't a url"
I already tried this once. It had to be reverted because Maintainer Notes
often don't obey this. I had forgotten.

This reverts commit 97ba94903e.
2015-08-28 14:10:05 -07:00
Daniel Martí
97ba94903e metadata: complain if link url isn't a url 2015-08-28 11:08:59 -07:00
Daniel Martí
e99ae53538 metadata: fix harmless typo 2015-08-27 20:41:18 -07:00
Daniel Martí
06c94b3a44 Add support for gradle properties via gradleprops 2015-08-24 15:54:05 -07:00
Daniel Martí
bad611ce5a Properly default to NDK r10e 2015-08-05 10:33:42 -07:00
Daniel Martí
db7eda3b47 Be more specific about empty build flags 2015-07-24 18:08:48 -07:00
Daniel Martí
184ae8e2f6 "Changelog:" will be empty often, so only put it if present 2015-06-04 01:01:52 +02:00
Daniel Martí
4b59f913f1 Merge branch 'changelog' of https://gitlab.com/krt/fdroidserver 2015-06-03 15:52:01 +02:00
Daniel Martí
439cabb7f3 Remove "Srclibs:" from srclib metadata files
They are handled per build, this feature is of little help and practically
unused in master.
2015-06-03 13:52:47 +02:00
Ciaran Gultnieks
7a3baa01ed Allow gpg home directory to be overridden 2015-06-02 09:17:08 +01:00
Daniel Martí
ac004264f0 Make comma-separated list parsing code common 2015-05-15 17:09:21 +02:00
Daniel Martí
dd70c9441c Detect most bad URLs
Also [appid] links that should really be [[appid]]
2015-05-13 13:06:10 +02:00
Boris Kraut
b1ec8cc47a Add "Changelog:" metadata field. 2015-01-11 02:26:41 +01:00
Daniel Martí
526813eae6 Plaintext descriptions are no longer needed 2015-01-03 00:08:21 +01:00
Daniel Martí
f60f1bc59e Add NDK r10d, this time alongside r9b
Specified per-build with ndk=<version> defaulting to the oldest, r9b.
2015-01-03 00:07:01 +01:00
Daniel Martí
14f654fabc Apply some autopep8-python2 suggestions 2014-12-31 16:44:06 +01:00
Ciaran Gultnieks
872e57c8da Set correct defaults for Binaries metadata field 2014-10-27 17:21:04 +00: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í
ce61186cd2 Fix issue where gradle=yes would be removed by rewritemeta 2014-09-15 17:03:45 +02:00
Daniel Martí
1757017b8a More list comprehension fixes 2014-09-13 13:07:21 +02:00
Daniel Martí
34a3405208 Centralise handling of default gradle flavours 2014-09-13 13:04:24 +02:00
Daniel Martí
a195556378 Make gradle and antcommands (previously antcommand) proper lists 2014-09-13 13:01:08 +02:00
Daniel Martí
b5c363b6c8 Sort builds by vercode when reading them
Then, when written, the order will be enforced.
2014-08-31 00:21:29 +02:00
Daniel Martí
a1f51ebb4d Fix typo in app link hrefs 2014-08-28 15:36:09 +02:00
Daniel Martí
5822df9231 metadata: Simplify the writing of optional fields 2014-08-26 14:06:59 +02:00
Daniel Martí
3d50ecf5fe Don't accept empty commits
With SCMs like git, "git checkout ''" doesn't actually fail, so one may
commit builds without noticing that they left the commit empty.
2014-08-26 13:40:18 +02:00