mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 14:32:28 +03:00
Merge branch 'master' into 'docs-numpy'
# Conflicts: # fdroidserver/update.py
This commit is contained in:
commit
578ff7069f
3 changed files with 24 additions and 27 deletions
|
@ -1367,23 +1367,17 @@ def scan_repo_files(apkcache, repodir, knownapks, use_date_from_file=False):
|
||||||
return repo_files, cachechanged
|
return repo_files, cachechanged
|
||||||
|
|
||||||
|
|
||||||
def scan_apk(apk_file):
|
def scan_apk(apk_file, require_signature=True):
|
||||||
"""Scan an APK file and returns dictionary with metadata of the APK.
|
"""
|
||||||
|
Scans an APK file and returns dictionary with metadata of the APK.
|
||||||
|
|
||||||
Attention: This does *not* verify that the APK signature is correct.
|
Attention: This does *not* verify that the APK signature is correct.
|
||||||
|
|
||||||
Parameters
|
:param apk_file: The (ideally absolute) path to the APK file
|
||||||
----------
|
:param require_signature: Raise an exception is there is no valid
|
||||||
apk_file
|
signature. Default to Ture.
|
||||||
The (ideally absolute) path to the APK file
|
:raises BuildException
|
||||||
|
:return A dict containing APK metadata
|
||||||
Raises
|
|
||||||
------
|
|
||||||
BuildException
|
|
||||||
|
|
||||||
Returns
|
|
||||||
-------
|
|
||||||
A dict containing APK metadata
|
|
||||||
"""
|
"""
|
||||||
apk = {
|
apk = {
|
||||||
'hash': common.sha256sum(apk_file),
|
'hash': common.sha256sum(apk_file),
|
||||||
|
@ -1408,12 +1402,14 @@ def scan_apk(apk_file):
|
||||||
# Get the signature, or rather the signing key fingerprints
|
# Get the signature, or rather the signing key fingerprints
|
||||||
logging.debug('Getting signature of {0}'.format(os.path.basename(apk_file)))
|
logging.debug('Getting signature of {0}'.format(os.path.basename(apk_file)))
|
||||||
apk['sig'] = getsig(apk_file)
|
apk['sig'] = getsig(apk_file)
|
||||||
if not apk['sig']:
|
if require_signature:
|
||||||
raise BuildException(_("Failed to get APK signing key fingerprint"))
|
if not apk['sig']:
|
||||||
apk['signer'] = common.apk_signer_fingerprint(os.path.join(os.getcwd(),
|
raise BuildException(_("Failed to get APK signing key fingerprint"))
|
||||||
apk_file))
|
apk['signer'] = common.apk_signer_fingerprint(
|
||||||
if not apk.get('signer'):
|
os.path.join(os.getcwd(), apk_file)
|
||||||
raise BuildException(_("Failed to get APK signing key fingerprint"))
|
)
|
||||||
|
if not apk.get('signer'):
|
||||||
|
raise BuildException(_("Failed to get APK signing key fingerprint"))
|
||||||
|
|
||||||
# Get size of the APK
|
# Get size of the APK
|
||||||
apk['size'] = os.path.getsize(apk_file)
|
apk['size'] = os.path.getsize(apk_file)
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -64,7 +64,7 @@ setup(name='fdroidserver',
|
||||||
packages=['fdroidserver', 'fdroidserver.asynchronousfilereader'],
|
packages=['fdroidserver', 'fdroidserver.asynchronousfilereader'],
|
||||||
scripts=['fdroid', 'makebuildserver'],
|
scripts=['fdroid', 'makebuildserver'],
|
||||||
data_files=get_data_files(),
|
data_files=get_data_files(),
|
||||||
python_requires='>=3.4',
|
python_requires='>=3.5',
|
||||||
cmdclass={'versioncheck': VersionCheckCommand},
|
cmdclass={'versioncheck': VersionCheckCommand},
|
||||||
setup_requires=[
|
setup_requires=[
|
||||||
'babel',
|
'babel',
|
||||||
|
|
|
@ -95,6 +95,13 @@ if os.getenv('CI_PROJECT_NAMESPACE') != 'fdroid':
|
||||||
git_repo = git.repo.Repo('.')
|
git_repo = git.repo.Repo('.')
|
||||||
modified = git_repo.git().ls_files(modified=True).split()
|
modified = git_repo.git().ls_files(modified=True).split()
|
||||||
if git_repo.is_dirty() and ('gradlew-fdroid' in modified or 'makebuildserver' in modified):
|
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 = git_repo.create_head(os.path.basename(__file__), force=True)
|
||||||
branch.checkout()
|
branch.checkout()
|
||||||
git_repo.index.add(['gradlew-fdroid', 'makebuildserver'])
|
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)
|
remote.push(force=True)
|
||||||
git.remote.Remote.rm(git_repo, remote_name)
|
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,
|
gl = gitlab.Gitlab(os.getenv('CI_SERVER_URL'), api_version=4,
|
||||||
private_token=private_token)
|
private_token=private_token)
|
||||||
project = gl.projects.get(project_path, lazy=True)
|
project = gl.projects.get(project_path, lazy=True)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue