1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-06-03 06:10:10 +02:00

Merge branch 'master' into 'docs-numpy'

# Conflicts:
#   fdroidserver/update.py
This commit is contained in:
Hans-Christoph Steiner 2021-06-25 07:25:10 +00:00
commit 578ff7069f
3 changed files with 24 additions and 27 deletions

View File

@ -1367,23 +1367,17 @@ def scan_repo_files(apkcache, repodir, knownapks, use_date_from_file=False):
return repo_files, cachechanged
def scan_apk(apk_file):
"""Scan an APK file and returns dictionary with metadata of the APK.
def scan_apk(apk_file, require_signature=True):
"""
Scans an APK file and returns dictionary with metadata of the APK.
Attention: This does *not* verify that the APK signature is correct.
Parameters
----------
apk_file
The (ideally absolute) path to the APK file
Raises
------
BuildException
Returns
-------
A dict containing APK metadata
:param apk_file: The (ideally absolute) path to the APK file
:param require_signature: Raise an exception is there is no valid
signature. Default to Ture.
:raises BuildException
:return A dict containing APK metadata
"""
apk = {
'hash': common.sha256sum(apk_file),
@ -1408,12 +1402,14 @@ def scan_apk(apk_file):
# Get the signature, or rather the signing key fingerprints
logging.debug('Getting signature of {0}'.format(os.path.basename(apk_file)))
apk['sig'] = getsig(apk_file)
if not apk['sig']:
raise BuildException(_("Failed to get APK signing key fingerprint"))
apk['signer'] = common.apk_signer_fingerprint(os.path.join(os.getcwd(),
apk_file))
if not apk.get('signer'):
raise BuildException(_("Failed to get APK signing key fingerprint"))
if require_signature:
if not apk['sig']:
raise BuildException(_("Failed to get APK signing key fingerprint"))
apk['signer'] = common.apk_signer_fingerprint(
os.path.join(os.getcwd(), apk_file)
)
if not apk.get('signer'):
raise BuildException(_("Failed to get APK signing key fingerprint"))
# Get size of the APK
apk['size'] = os.path.getsize(apk_file)

View File

@ -64,7 +64,7 @@ setup(name='fdroidserver',
packages=['fdroidserver', 'fdroidserver.asynchronousfilereader'],
scripts=['fdroid', 'makebuildserver'],
data_files=get_data_files(),
python_requires='>=3.4',
python_requires='>=3.5',
cmdclass={'versioncheck': VersionCheckCommand},
setup_requires=[
'babel',

View File

@ -95,6 +95,13 @@ if os.getenv('CI_PROJECT_NAMESPACE') != 'fdroid':
git_repo = git.repo.Repo('.')
modified = git_repo.git().ls_files(modified=True).split()
if git_repo.is_dirty() and ('gradlew-fdroid' in modified or 'makebuildserver' in modified):
private_token = os.getenv('PERSONAL_ACCESS_TOKEN')
if not private_token:
print(Fore.RED
+ 'ERROR: GitLab Token not found in PERSONAL_ACCESS_TOKEN!'
+ Style.RESET_ALL)
exit(1)
branch = git_repo.create_head(os.path.basename(__file__), force=True)
branch.checkout()
git_repo.index.add(['gradlew-fdroid', 'makebuildserver'])
@ -112,12 +119,6 @@ if git_repo.is_dirty() and ('gradlew-fdroid' in modified or 'makebuildserver' in
remote.push(force=True)
git.remote.Remote.rm(git_repo, remote_name)
private_token = os.getenv('PERSONAL_ACCESS_TOKEN')
if not private_token:
print(Fore.RED
+ 'ERROR: GitLab Token not found in PERSONAL_ACCESS_TOKEN!'
+ Style.RESET_ALL)
exit(1)
gl = gitlab.Gitlab(os.getenv('CI_SERVER_URL'), api_version=4,
private_token=private_token)
project = gl.projects.get(project_path, lazy=True)