Commit graph

238 commits

Author SHA1 Message Date
Hans-Christoph Steiner
a089614225 checkupdates: remove magic number 99999999 from HTTP checks
It is vestigal from old code and no longer is needed.
2018-08-29 17:24:24 +02:00
Michael Pöhn
24b20d7668 use simple ast+operator based calculator for evaluating Vercode Operation 2018-05-22 13:08:14 +02:00
mimi89999
aaa6b55bf7
checkupdates: Save app data to correct metadata format
Closes #461
2018-03-09 20:46:59 +01:00
Hans-Christoph Steiner
70d9633555 build/checkupdates/update: log current fdroiddata commit to wiki 2018-03-05 21:49:09 +01:00
Hans-Christoph Steiner
86907d2ebf checkupdates: exit with error if fdroiddata git repo is dirty
One key security property of the F-Droid ecosystem is that the sensitive
code is all stored forever in git repos and source tarballs.  That means
we can easily go back and see if there where exploits and where they came
from.  Therefore, checkupdates should require everything in fdroiddata be
committed to git before running.

This provides --allow-dirty to override that behavior.
2018-03-05 21:49:09 +01:00
Hans-Christoph Steiner
8f30c892c5 VercodeOperation: only allow simple math expresssions and %c 2018-03-05 09:45:58 +01:00
Hans-Christoph Steiner
7da0747849 checkupdates: require UpdateCheckData has valid HTTPS URL 2018-03-01 23:51:36 +01:00
Hans-Christoph Steiner
f841ec745f wiki: move checkupdates wiki log to separate function 2018-01-22 13:49:10 +01:00
Hans-Christoph Steiner
010f1c5029 log installed android sdk versions for update and checkupdates 2018-01-22 13:49:10 +01:00
Hans-Christoph Steiner
22c6acc026 wiki: log appids as checkupdates goes through them 2018-01-22 13:49:10 +01:00
Hans-Christoph Steiner
fc4f5a79a7 wiki: log checkupdates start/stop time and command line for each run 2018-01-22 13:49:10 +01:00
Marcus Hoffmann
db0a97e8e7 checkupdates: don't fail when we can't init submodules
Later revisions might have removed the submodules so we want to keep
going when there are no submodules present.
We still abort when there is an error initializing submodules.

Fixes fdroid/fdroidserver#231
2017-12-04 16:30:37 +01: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
cb10f0df09 standardize os.walk() var names based on Python 3.5 docs
There were multiple conventions used in the code, but mostly it was already
using the convention from the docs, so this converts things to using that
convention:

https://docs.python.org/3/library/os.html#os.walk
2017-09-15 11:37:21 +02:00
Marcus Hoffmann
5ebde251b1 checkupdates: use html.unescape instead of HTMLParser.unescape
HTMLParser.unescape is only an internal method and deprecated.
This requires Pyhton 3.4.
2017-09-13 01:42:15 +02:00
Marcus Hoffmann
921524081c checkupdates: fix google play check method
This has never worked with python3 and was also not properly adapted to
apps as objects. So we fix both of these issues.
2017-09-13 01:40:09 +02:00
Hans-Christoph Steiner
17cd07f1a7 fix pylint unused-argument 2017-05-23 22:34:16 +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
Ciaran Gultnieks
0ef818486d Remove whitespace from HTTP update check versions 2017-03-15 19:54:09 +00:00
Ciaran Gultnieks
7306e1cf69 Catch update check failure and proceed, not bomb out 2017-03-15 19:54:09 +00:00
Hans-Christoph Steiner
e0f39a7e7b rename Build fields: version -> versionName, vercode -> versionCode
Since the YAML/JSON/etc. field names are now exactly the same as the field
names used in the internal dict in the Build class, this is a global rename

This keeps with the standard names used in Android:
https://developer.android.com/guide/topics/manifest/manifest-element.html
2017-02-24 11:01:01 +01:00
Hans-Christoph Steiner
b91cdffe17 App.get_last_build() method to replace duplicated code
Look @mvdan, I added a method to the App class!
2016-12-05 20:16:54 +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í
bcd31401ac checkupdates: avoid crash with --auto and None CVC
Reproducible via `fdroid checkupdates --auto subreddit.android.appstore`
at fdroiddata HEAD (e76449ab).

WARNING: ...subreddit.android.appstore : Couldn't find package ID
CRITICAL: Unknown exception found!
Traceback (most recent call last):
  File "/home/mvdan/.bin/fdroid", line 147, in <module>
    main()
  File "/home/mvdan/.bin/fdroid", line 124, in main
    mod.main()
  File "/home/mvdan/git/fsr/fdroidserver/checkupdates.py", line 571, in main
    checkupdates_app(app)
  File "/home/mvdan/git/fsr/fdroidserver/checkupdates.py", line 469, in checkupdates_app
    if int(build.vercode) >= int(app.CurrentVersionCode):
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
2016-09-26 21:07:55 +01:00
Hans-Christoph Steiner
d522988d8c make metadata exceptions optional based on CLI flag
In many cases, there are times where metadata errors need to be ignored, or
at least not stop the command from running.  For example, there will
inevitably be new metadata fields added, in which case a packaged version
of fdroidserver will throw errors on each one.  This adds a standard -W
flag to customize the response: ignore, default, or error.

* by default, the errors are still errors
* `fdroid readmeta -W` will just print errors
* `fdroid readmeta -Wignore` will not even print errors

https://gitlab.com/fdroid/fdroidserver/issues/150
2016-09-12 12:55:48 +02:00
Hans-Christoph Steiner
994488ad47 rename metadata.write_metadata() to match metadata.parse_*_metadata()
This changes the function name to include the format of the metadata file,
and also changes the order of the args to match the parse_*_metadata()
functions.
2016-03-23 17:16:28 +01:00
Ciaran Gultnieks
5d296f8c61 Fix python3 checkupdates crashes 2016-03-14 22:29:46 +00:00
Daniel Martí
f267a1d7c9 Merge branch 'py3' into 'master'
Python 3

I tried to keep commits separate, so if anything causes trouble, it can be reverted or changed easily.

* pre-commit hooks pass
* all tests pass
* My use of `build`, `checkupdates`, `lint`, `import`, `publish` and `update` work as usual
* 2to3 does not report anything useful anymore (only useless parentheses and list() encapsulation of iterators)
* rewritemeta works exactly as usual

CC @eighthave

See merge request !88
2016-03-11 23:51:56 +00:00
Daniel Martí
d39bf37ce8 Port urllib and HTMLParser imports to python3 2016-03-10 16:43:37 +00:00
Daniel Martí
920ae4692f Port all imports to python3 2016-03-10 16:43:37 +00:00
Daniel Martí
75419c1f04 Replace iteritems() with items() 2016-03-10 16:43:37 +00:00
Daniel Martí
99edd64372 Switch all headers to python3 2016-03-10 16:43:36 +00:00
Daniel Martí
2a73b74603 checkupdates: sort tags by date in one go
This greatly speeds up checkupdates when UCM:Tags is used on git
repositories, especially on ones with lots of tags. The old method ran a
command per tag. The new method runs a single command and doesn't
require any sorting.

Test runs show that `fdroid checkupdates org.adaway` is down from ~13s
to ~10s on my laptop.
2016-03-10 11:14:08 +00:00
Julian Strobl
dd0b38a7e5 use tag if version name is unknown
If we don't find the version name neither in the AndroidManifest.xml nor
in the build.grade file, we fallback to the tag the user specified to
search for.

That way we have a better version name than 'Unknown'.
2016-02-11 19:50:16 +01:00
NeroBurner
5ca182a20d except named exception handling 2015-12-29 20:09:27 +01:00
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í
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í
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í
97a637b9b4 Don't crash if no auto name is found 2015-11-14 22:05:28 +01:00
Daniel Martí
f604d845f5 checkupdates: find new subdirs for autonames too
The same method used for Tags and RepoManifest.
2015-11-14 10:24:43 +01:00
Daniel Martí
3ace102bd5 checkupdates: work around multiple package ids
If there are multiple package ids in a build.gradle file and the first
one we don't want, checkupdates would get stuck. Make it ignore any
package id that we don't want so that it can get past that.
2015-10-30 19:03:53 +01:00
Daniel Martí
2de274326a checkupdates: better "no tags" messages 2015-10-27 13:42:02 +01:00
Daniel Martí
ece3317be0 checkupdates: no need to sort tags if len()<=5 2015-10-27 13:41:09 +01:00
Daniel Martí
d141bd1be0 checkupdates: don't blindly accept subdir
This is unnecessary because dirs_with_manifest will pick it up anyway.
But the problem manifested because we weren't checking the package id
here.
2015-10-26 16:29:26 +01:00
Daniel Martí
da92845f9c checkupdates: compare CVs as ints, not strs 2015-10-26 16:13:35 +01:00
Daniel Martí
995afdcbfd checkupdates: never auto-update to older versions 2015-10-25 19:14:23 +01:00
Daniel Martí
8812e9339d Don't double check package name 2015-10-25 19:10:23 +01:00
Daniel Martí
1f42b83120 checkupdates: don't ignore root directory 2015-10-25 19:09:55 +01:00