mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-04 22:40:29 +03:00
Merge branch 'polish-verification.f-droid.org-setup' into 'master'
Polish verification.f droid.org setup See merge request fdroid/fdroidserver!509
This commit is contained in:
commit
8231042699
6 changed files with 45 additions and 30 deletions
|
|
@ -121,24 +121,17 @@ pip_install:
|
||||||
- fdroid readmeta
|
- fdroid readmeta
|
||||||
- fdroid update --help
|
- fdroid update --help
|
||||||
|
|
||||||
pyup_io_safety_check:
|
lint_format_safety_checks:
|
||||||
image: alpine:3.7
|
image: alpine:3.7
|
||||||
variables:
|
variables:
|
||||||
LANG: C.UTF-8
|
LANG: C.UTF-8
|
||||||
script:
|
script:
|
||||||
- apk add --no-cache ca-certificates python3
|
- apk add --no-cache bash dash ca-certificates python3
|
||||||
- python3 -m ensurepip
|
- python3 -m ensurepip
|
||||||
- pip3 install safety
|
- pip3 install pep8 pyflakes pylint safety
|
||||||
- safety check --full-report
|
- export EXITVALUE=0
|
||||||
|
- ./hooks/pre-commit || export EXITVALUE=1
|
||||||
pylint:
|
- safety check --full-report || export EXITVALUE=1
|
||||||
image: alpine:3.7
|
|
||||||
variables:
|
|
||||||
LANG: C.UTF-8
|
|
||||||
script:
|
|
||||||
- apk add --no-cache ca-certificates python3
|
|
||||||
- python3 -m ensurepip
|
|
||||||
- pip3 install pylint
|
|
||||||
- pylint --rcfile=.pylint-rcfile --output-format=colorized --reports=n
|
- pylint --rcfile=.pylint-rcfile --output-format=colorized --reports=n
|
||||||
fdroid
|
fdroid
|
||||||
makebuildserver
|
makebuildserver
|
||||||
|
|
@ -146,6 +139,8 @@ pylint:
|
||||||
fdroidserver/*.py
|
fdroidserver/*.py
|
||||||
tests/*.py
|
tests/*.py
|
||||||
tests/*.TestCase
|
tests/*.TestCase
|
||||||
|
|| export EXITVALUE=1
|
||||||
|
- exit $EXITVALUE
|
||||||
|
|
||||||
fedora_latest:
|
fedora_latest:
|
||||||
image: fedora:latest
|
image: fedora:latest
|
||||||
|
|
|
||||||
2
fdroid
2
fdroid
|
|
@ -156,7 +156,7 @@ def main():
|
||||||
# str(e) often doesn't contain a reason, so just show the backtrace
|
# str(e) often doesn't contain a reason, so just show the backtrace
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.critical(_("Unknown exception found!"))
|
logging.critical(_("Unknown exception found!"))
|
||||||
raise
|
raise e
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2788,7 +2788,7 @@ def compare_apks(apk1, apk2, tmp_dir, log_dir=None):
|
||||||
htmlfile = logfilename + '.diffoscope.html'
|
htmlfile = logfilename + '.diffoscope.html'
|
||||||
textfile = logfilename + '.diffoscope.txt'
|
textfile = logfilename + '.diffoscope.txt'
|
||||||
if subprocess.call([config['diffoscope'],
|
if subprocess.call([config['diffoscope'],
|
||||||
'--max-report-size', '12345678', '--max-diff-block-lines', '100',
|
'--max-report-size', '12345678', '--max-diff-block-lines', '128',
|
||||||
'--html', htmlfile, '--text', textfile,
|
'--html', htmlfile, '--text', textfile,
|
||||||
absapk1, absapk2]) != 0:
|
absapk1, absapk2]) != 0:
|
||||||
return("Failed to run diffoscope " + apk1)
|
return("Failed to run diffoscope " + apk1)
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@ def main():
|
||||||
parser = ArgumentParser(usage="%(prog)s [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]")
|
parser = ArgumentParser(usage="%(prog)s [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]")
|
||||||
common.setup_global_opts(parser)
|
common.setup_global_opts(parser)
|
||||||
parser.add_argument("appid", nargs='*', help=_("applicationId with optional versionCode in the form APPID[:VERCODE]"))
|
parser.add_argument("appid", nargs='*', help=_("applicationId with optional versionCode in the form APPID[:VERCODE]"))
|
||||||
|
parser.add_argument("--reuse-remote-apk", action="store_true", default=False,
|
||||||
|
help=_("Verify against locally cached copy rather than redownloading."))
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
config = common.read_config(options)
|
config = common.read_config(options)
|
||||||
|
|
@ -74,18 +76,19 @@ def main():
|
||||||
logging.info("Processing {apkfilename}".format(apkfilename=apkfilename))
|
logging.info("Processing {apkfilename}".format(apkfilename=apkfilename))
|
||||||
|
|
||||||
remoteapk = os.path.join(tmp_dir, apkfilename)
|
remoteapk = os.path.join(tmp_dir, apkfilename)
|
||||||
if os.path.exists(remoteapk):
|
if not options.reuse_remote_apk or not os.path.exists(remoteapk):
|
||||||
os.remove(remoteapk)
|
if os.path.exists(remoteapk):
|
||||||
url = 'https://f-droid.org/repo/' + apkfilename
|
os.remove(remoteapk)
|
||||||
logging.info("...retrieving " + url)
|
url = 'https://f-droid.org/repo/' + apkfilename
|
||||||
try:
|
logging.info("...retrieving " + url)
|
||||||
net.download_file(url, dldir=tmp_dir)
|
|
||||||
except requests.exceptions.HTTPError as e:
|
|
||||||
try:
|
try:
|
||||||
net.download_file(url.replace('/repo', '/archive'), dldir=tmp_dir)
|
net.download_file(url, dldir=tmp_dir)
|
||||||
except requests.exceptions.HTTPError as e:
|
except requests.exceptions.HTTPError:
|
||||||
raise FDroidException(_('Downloading {url} failed. {error}')
|
try:
|
||||||
.format(url=url, error=e))
|
net.download_file(url.replace('/repo', '/archive'), dldir=tmp_dir)
|
||||||
|
except requests.exceptions.HTTPError as e:
|
||||||
|
raise FDroidException(_('Downloading {url} failed. {error}')
|
||||||
|
.format(url=url, error=e))
|
||||||
|
|
||||||
compare_result = common.verify_apks(
|
compare_result = common.verify_apks(
|
||||||
remoteapk,
|
remoteapk,
|
||||||
|
|
@ -101,9 +104,11 @@ def main():
|
||||||
logging.info("...NOT verified - {0}".format(e))
|
logging.info("...NOT verified - {0}".format(e))
|
||||||
notverified += 1
|
notverified += 1
|
||||||
|
|
||||||
logging.info(_("Finished"))
|
if verified > 0:
|
||||||
logging.info("{0} successfully verified".format(verified))
|
logging.info("{0} successfully verified".format(verified))
|
||||||
logging.info("{0} NOT verified".format(notverified))
|
if notverified > 0:
|
||||||
|
logging.info("{0} NOT verified".format(notverified))
|
||||||
|
sys.exit(notverified)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ config = {
|
||||||
if os.path.isfile('/usr/bin/systemd-detect-virt'):
|
if os.path.isfile('/usr/bin/systemd-detect-virt'):
|
||||||
try:
|
try:
|
||||||
virt = subprocess.check_output('/usr/bin/systemd-detect-virt').strip().decode('utf-8')
|
virt = subprocess.check_output('/usr/bin/systemd-detect-virt').strip().decode('utf-8')
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError:
|
||||||
virt = 'none'
|
virt = 'none'
|
||||||
if virt == 'qemu' or virt == 'kvm' or virt == 'bochs':
|
if virt == 'qemu' or virt == 'kvm' or virt == 'bochs':
|
||||||
logger.info('Running in a VM guest, defaulting to QEMU/KVM via libvirt')
|
logger.info('Running in a VM guest, defaulting to QEMU/KVM via libvirt')
|
||||||
|
|
|
||||||
|
|
@ -447,6 +447,21 @@ test -e repo/com.politedroid_5.apk
|
||||||
! test -e repo/com.politedroid_6.apk
|
! test -e repo/com.politedroid_6.apk
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------#
|
||||||
|
echo_header 'test that verify can succeed and fail'
|
||||||
|
|
||||||
|
REPOROOT=`create_test_dir`
|
||||||
|
cd $REPOROOT
|
||||||
|
test -d tmp || mkdir tmp
|
||||||
|
test -d unsigned || mkdir unsigned
|
||||||
|
cp $WORKSPACE/tests/repo/com.politedroid_6.apk tmp/
|
||||||
|
cp $WORKSPACE/tests/repo/com.politedroid_6.apk unsigned/
|
||||||
|
$fdroid verify --reuse-remote-apk --verbose com.politedroid
|
||||||
|
# force a fail
|
||||||
|
cp $WORKSPACE/tests/repo/com.politedroid_5.apk unsigned/com.politedroid_6.apk
|
||||||
|
! $fdroid verify --reuse-remote-apk --verbose com.politedroid
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------#
|
#------------------------------------------------------------------------------#
|
||||||
echo_header 'test allowing disabled signatures in repo and archive'
|
echo_header 'test allowing disabled signatures in repo and archive'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue