Commit graph

2896 commits

Author SHA1 Message Date
Hans-Christoph Steiner
ae3c9c0552 change make_current_version_link to default to False
This is semi-broken and barely used, it should be off by default for 2.0.
2020-10-08 08:10:36 +02:00
Hans-Christoph Steiner
00c2cc969a update: deprecate --wiki option, the wiki is going away 2020-10-08 08:10:36 +02:00
Hans-Christoph Steiner
75cdb1fd97 update: remove -b / --buildreport which has done nothing since 2013
The functionality was removed in 48296df5b0
2020-10-08 08:10:36 +02:00
Hans-Christoph Steiner
602cf30c1e update: fix bug where only last appid was added to antiFeatures status
appid will never be present in `antiFeatures[af]`, so the entry was being
reinitalized each time.
2020-10-07 18:57:59 +02:00
Hans-Christoph Steiner
05cd8c6810 scanner: expose "usual suspects" patterns for use in an API 2020-10-07 18:56:17 +02:00
Hans-Christoph Steiner
3c64996089 update: test if options is instantated before using attributes
This makes it possible to use process_apks(), get_cache(), and anything
calling disabled_algorithms_allowed() as an API without having to set
options up beforehand.
2020-10-07 18:56:17 +02:00
Hans-Christoph Steiner
790b5a2888 update: use "app" as dict not App instance in apply_info_from_latest_apk
This allows update.apply_info_from_latest_apk() to be used as part of the
API.  This way "app" can be a dict or an App instance.
2020-10-07 18:56:17 +02:00
Hans-Christoph Steiner
283f10dec1 index: generate repo icon if missing, and add tests 2020-10-07 18:56:17 +02:00
Hans-Christoph Steiner
7adba093e4 Merge branch 'keytool_smartcardoptions' into 'master'
fix keytool not working with default smartcardoptions

See merge request fdroid/fdroidserver!812
2020-10-07 16:53:49 +00:00
Marcus Hoffmann
0d5fde334d fix keytool not working with default smartcardoptions
This broke in 74af61f255.
Keytool has still a different opinion from both apksigner and jarsigner
about the providerName argument. apksigner doesn't support it at all,
jarsigner ignores it but keytool fails without it. :-/

So we add it back to the default argument list but filter it out before
calling apksigner.
2020-10-07 16:12:21 +02:00
Hans-Christoph Steiner
fede58a710 use ArgumentParser's own "usage" line in help output 2020-10-01 23:01:55 +02:00
Hans-Christoph Steiner
b23cf9f8ad use YAML names for referring to metadata fields in messages 2020-10-01 23:01:55 +02:00
Hans-Christoph Steiner
5e1377c77a standardize on "Application ID" in UI text 2020-10-01 23:01:55 +02:00
akwizgran
896ffed703 Use jarsigner to verify reproducible APKs 2020-09-29 12:18:56 +00:00
Michael Pöhn
1baa5fd895 Merge branch 'signing-2.0-fixes-with-build-tweaks' into 'master'
Signing 2.0 fixes with build tweaks

See merge request fdroid/fdroidserver!801
2020-09-23 15:03:30 +00:00
Hans-Christoph Steiner
d6d5ad6b7c Merge branch 'public-api' into 'master'
expose public api in fdroidserver module

Closes #831

See merge request fdroid/fdroidserver!798
2020-09-23 14:57:47 +00:00
Hans-Christoph Steiner
29965a1598 Merge branch 'metadata-refactoring' into 'master'
refactor metadata.warn_or_exception to private func

See merge request fdroid/fdroidserver!796
2020-09-23 14:57:28 +00:00
Hans-Christoph Steiner
8c1cf724e1 init: force keystore to PKCS12 format
Java 8 supports PKCS12, Java 9+ uses PKCS12 by default, which should have
a .p12 file extension.  `fdroid init` has always just added .jks which is
the old default format.

* https://docs.oracle.com/en/java/javase/12/tools/keytool.html#GUID-5990A2E4-78E3-47B7-AE75-6D1826259549__GUID-A8B9E662-C1C2-4A0E-9307-A8464F0E95D4
* https://openjdk.java.net/jeps/229
2020-09-23 16:40:37 +02:00
Hans-Christoph Steiner
ad6985cb40 update: allow --nosign to work with only repo_pubkey set
repo_pubkey is required for `fdroid update --nosign`, but repo_keyalias is
not.  For regular signing, the opposite true.
2020-09-17 15:25:56 +02:00
Michael Pöhn
75c4be2ea9 expose public api in fdroidserver module 2020-09-16 18:26:16 +02:00
Hans-Christoph Steiner
08f724651e remove "force_build_tools" config option, closes #738
The `force_build_tools` config option was added a long time ago to
brute force the _build-tools_ version by trying to replace the value
in `build.gradle` files. This is never something that should be used
in production, since the app's build metadata should specify this kind
of thing. And now that we're moving towards _androguard_ for
everything except fdroid build and fdroid publish, _build-tools_ will
no longer even be used in the other commands.
2020-09-16 16:30:49 +02:00
Michael Pöhn
301ca0a949 refactor metadata.warn_or_exception to private func 2020-09-16 15:25:10 +02:00
Hans-Christoph Steiner
3c148941f7 Merge branch 'remove_latestapps_dat' into 'master'
remove unused latestapps.dat code

See merge request fdroid/fdroidserver!794
2020-09-15 07:48:01 +00:00
Marcus Hoffmann
36e5fec418 remove unused latestapps.dat code
latestapps.dat was being used for the old-website, it's not used anymore

Fixes the following crash in production:
```
2020-09-13 19:26:59,000 CRITICAL: Unknown exception found!
Traceback (most recent call last):
  File "/home/fbuild/fdroidserver/fdroid", line 22, in <module>
    fdroidserver.__main__.main()
  File "/home/fbuild/fdroidserver/fdroidserver/__main__.py", line 230,
in main
    raise e
  File "/home/fbuild/fdroidserver/fdroidserver/__main__.py", line 211,
in main
    mod.main()
  File "/home/fbuild/fdroidserver/fdroidserver/update.py", line 2451, in
main
    app = apps[appid]
KeyError: '45b464b398a7d9fac5a186bd3d3d8dc1e6a25f7f9cd48c7462619b1e5fba87c2'
```
2020-09-14 16:22:09 +02:00
Marcus Hoffmann
7de601a5b5 fallback to minsdk when targetsdk isn't set
Androguard already has a function always returning an int here, so let's
use that.

Also put in a guard against minsdk not being set.
2020-09-14 14:12:18 +02:00
Marcus Hoffmann
7eb32feaa5 skip new signing test when we can't find apksigner
Also add some error handling to the find_apksigner() method.
2020-09-10 18:59:39 +02:00
Hans-Christoph Steiner
06766ba48b Merge branch 'signing' into 'master'
sign using apksigner

Closes #827 and #634

See merge request fdroid/fdroidserver!736
2020-09-10 11:49:02 +00:00
Marcus Hoffmann
dfecdcc1bd set minimum apksigner version to 26.0.2 2020-09-10 13:20:01 +02:00
Marcus Hoffmann
145ba9db54 fix apksigner smartcardoptions
apksigner documents the options as --ks-provider-class and --ks-provider-arg
those seem to be accepted but fail when actually making a signature with
weird internal exceptions. The new options actually work.
From: https://geoffreymetais.github.io/code/key-signing/#scripting
2020-09-09 22:51:08 +02:00
Marcus Hoffmann
74af61f255 remove providerName from default smartcardoptions
apksigner doesn't recognize the SunPKCS11-OpenSC set via providerName
Neither jarsigner nor apksigner need this to work.
2020-09-09 22:50:58 +02:00
Marcus Hoffmann
768a91370c publish: use apksigner for signing apks with targetSDK>=30
This makes apksigner a hard requirement of the signing procedure.
We'll first try to find a globally installed version from PATH and if
that's not available fall back to using a version from build-tools.

Future TODO: always sign with apksigner, blocked on signature transplant
support for apksigv2/v3

Closes fdroid/fdroidserver#634
Closes fdroid/fdroidserver#827
2020-09-09 18:09:28 +02:00
Marcus Hoffmann
c90a72e14d scanner: check for test in path relative to build dir
This was degrading scanner errors to warnings whenever the path from the
current running install of fdroidserver contained test, as has been
happening in the CI image builder:

https://gitlab.com/fdroid/ci-images-server/-/blob/master/test#L6
2020-08-30 20:09:19 +02:00
Marcus Hoffmann
34717fe88a fix typoes 2020-08-25 21:32:54 +02:00
Marcus Hoffmann
d07b4123e9 scanner: docstrings for handleproblem functions 2020-08-25 21:32:29 +02:00
Marcus Hoffmann
a656be82ae update: calculate added date for an app over all apks
This was accidentally changed in !756 because the functionality was
hidden in `apply_info_from_latest_apk` which is a less than stellar name
for something that also applies infos from app->apk and in this case did
apply info from *oldest* apk->app.
So instead move that into a separate step.

Note: This restores the previous behaviour. There's discussion in #801
on further changes to make the added date also work for repos which
don't keep an archive at all.
2020-08-25 21:32:29 +02:00
Marcus Hoffmann
d5311fff09 vcs: don't fail when git remote set-head fails
There's valid use-cases for setups where set-head --auto fails. This
happens when building an app from a gitlab CI checkout where no remote
tracking branches are setup.

This isn't really a fatal error. When a remote HEAD exists we'll
continue setting it and if none exists and something requires this being
set up later on (either a build script or fdroid checkupdates) then
we'll fail later on with "origin/HEAD not being known to git".
By not failing early we allow the majority of use-cases that don't need
a remote HEAD to continue with just a warning.

The setup in which this can be reproduced is as follows:
(This is roughly what gitlab runner does when setting up a git checkout
for CI)
- mkdir test && cd test
- git init
- git remote add https://gitlab.com/Bubu/fdroidclassic.git
- git fetch --all
- git checkout db0d2a9a5d1d89101a344169013ac5d518185f31
- mkdir nested_repo && cd nested_repo
- git clone .. .
- git remote set-head origin --auto
  > error: Cannot determine remote HEAD
2020-08-25 21:32:29 +02:00
Marcus Hoffmann
03e723b1af fix crash when scanner wants to remove the same file more than once
A file can be flagged for multiple problems (i.e. multiple unknown maven
repos in one build.gradle file that is included in a scandelete path).

The scanner will try to delete it once for every problem detected, we
don't really care, as long as the file is gone.

fixes fdroid/fdroidserver#759
2020-08-25 21:32:29 +02:00
Marcus Hoffmann
78491a0a5b add used extlibs to scanignore path
fixes fdroid/fdroidserver#795
2020-08-25 21:32:29 +02:00
Marcus
8801d37649 Merge branch 'publish_json' into 'master'
Some publish.py improvements

Closes #820

See merge request fdroid/fdroidserver!787
2020-08-25 12:33:39 +00:00
Marcus Hoffmann
a114c73c2d publish: factor out the signing key creation into a method 2020-08-24 19:34:08 +02:00
Marcus Hoffmann
7813a17cf8 publish: extract a few functions out of main
publish is currently not reusable from other modules as everything is
happening in main. It's also not testable from python unittests.

There's already a function for getting the key_alias, so we can use
that.

Introduce tests for the split out functions.
2020-08-24 19:34:08 +02:00
Marcus Hoffmann
eaca3d5faa publish: better json reporting
* newKeyAliases wasn't providing any useful information
* generatedKeys now contains the used keyalias as well
* signedApks now also records the used keyalias for each apk
2020-08-24 19:34:08 +02:00
Marcus Hoffmann
ca86c18e33 publish: reformat 2020-08-24 19:34:08 +02:00
Hans-Christoph Steiner
0b92e60266 handle file type detection using Pythonic methods
This ditches the custom common.get_extension() for straight core Python
methods.  This should make the code closer to Python conventions.  For
example, pathlib also includes the "." in the extension it returns.
2020-08-24 17:05:49 +02:00
Hans-Christoph Steiner
da31120b5a build: refactor missing srclibs error reporting for only .yml 2020-08-24 17:05:49 +02:00
Michael Pöhn
5c3db9a7cc rewritemeta: overwrite existing metadata only if no exception occurred 2020-08-20 20:40:15 +02:00
Michael Pöhn
c45ef453fd remove SUPPORTED_FORMATS list from rewritemeta 2020-08-20 20:40:15 +02:00
Michael Pöhn
fac033314a fix a comment and a warning 2020-08-20 20:40:15 +02:00
Michael Pöhn
f5a5fffb10 purge accepted_formats from config 2020-08-20 20:40:15 +02:00
Michael Pöhn
f8bc51399e remove txt from nightly default supported metadata formats 2020-08-20 20:40:15 +02:00