mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 22:42:29 +03:00
rename functions and variables to reflect stats/ going away
This commit is contained in:
parent
b911fb9ed9
commit
8565a97465
5 changed files with 26 additions and 27 deletions
|
@ -4219,7 +4219,7 @@ def get_jar_signer_certificate(pkcs7obj: cms.ContentInfo, signature_file: bytes)
|
||||||
return first_verified_signer_info_signing_certificate
|
return first_verified_signer_info_signing_certificate
|
||||||
|
|
||||||
|
|
||||||
def load_stats_fdroid_signing_key_fingerprints():
|
def load_publish_signer_fingerprints():
|
||||||
"""Load signing-key fingerprints stored in file generated by fdroid publish.
|
"""Load signing-key fingerprints stored in file generated by fdroid publish.
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
|
|
|
@ -51,7 +51,7 @@ from . import _
|
||||||
from . import common
|
from . import common
|
||||||
from . import metadata
|
from . import metadata
|
||||||
from . import signindex
|
from . import signindex
|
||||||
from fdroidserver.common import ANTIFEATURES_CONFIG_NAME, CATEGORIES_CONFIG_NAME, CONFIG_CONFIG_NAME, MIRRORS_CONFIG_NAME, RELEASECHANNELS_CONFIG_NAME, DEFAULT_LOCALE, FDroidPopen, FDroidPopenBytes, load_stats_fdroid_signing_key_fingerprints
|
from fdroidserver.common import ANTIFEATURES_CONFIG_NAME, CATEGORIES_CONFIG_NAME, CONFIG_CONFIG_NAME, MIRRORS_CONFIG_NAME, RELEASECHANNELS_CONFIG_NAME, DEFAULT_LOCALE, FDroidPopen, FDroidPopenBytes, load_publish_signer_fingerprints
|
||||||
from fdroidserver._yaml import yaml
|
from fdroidserver._yaml import yaml
|
||||||
from fdroidserver.exception import FDroidException, VerificationException
|
from fdroidserver.exception import FDroidException, VerificationException
|
||||||
|
|
||||||
|
@ -125,14 +125,13 @@ def make(apps, apks, repodir, archive):
|
||||||
raise TypeError(_('only accepts strings, lists, and tuples'))
|
raise TypeError(_('only accepts strings, lists, and tuples'))
|
||||||
requestsdict[command] = packageNames
|
requestsdict[command] = packageNames
|
||||||
|
|
||||||
fdroid_signing_key_fingerprints = load_stats_fdroid_signing_key_fingerprints()
|
signer_fingerprints = load_publish_signer_fingerprints()
|
||||||
|
|
||||||
make_v0(sortedapps, apks, repodir, repodict, requestsdict,
|
make_v0(sortedapps, apks, repodir, repodict, requestsdict, signer_fingerprints)
|
||||||
fdroid_signing_key_fingerprints)
|
make_v1(sortedapps, apks, repodir, repodict, requestsdict, signer_fingerprints)
|
||||||
make_v1(sortedapps, apks, repodir, repodict, requestsdict,
|
make_v2(
|
||||||
fdroid_signing_key_fingerprints)
|
sortedapps, apks, repodir, repodict, requestsdict, signer_fingerprints, archive
|
||||||
make_v2(sortedapps, apks, repodir, repodict, requestsdict,
|
)
|
||||||
fdroid_signing_key_fingerprints, archive)
|
|
||||||
make_website(sortedapps, repodir, repodict)
|
make_website(sortedapps, repodir, repodict)
|
||||||
make_altstore(
|
make_altstore(
|
||||||
sortedapps,
|
sortedapps,
|
||||||
|
@ -709,7 +708,7 @@ def v2_repo(repodict, repodir, archive):
|
||||||
return repo
|
return repo
|
||||||
|
|
||||||
|
|
||||||
def make_v2(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_fingerprints, archive):
|
def make_v2(apps, packages, repodir, repodict, requestsdict, signer_fingerprints, archive):
|
||||||
|
|
||||||
def _index_encoder_default(obj):
|
def _index_encoder_default(obj):
|
||||||
if isinstance(obj, set):
|
if isinstance(obj, set):
|
||||||
|
@ -731,7 +730,7 @@ def make_v2(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_
|
||||||
output["repo"]["requests"] = requestsdict
|
output["repo"]["requests"] = requestsdict
|
||||||
|
|
||||||
# establish sort order of the index
|
# establish sort order of the index
|
||||||
v1_sort_packages(packages, fdroid_signing_key_fingerprints)
|
v1_sort_packages(packages, signer_fingerprints)
|
||||||
|
|
||||||
output_packages = collections.OrderedDict()
|
output_packages = collections.OrderedDict()
|
||||||
output['packages'] = output_packages
|
output['packages'] = output_packages
|
||||||
|
@ -846,7 +845,7 @@ def make_v2(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_
|
||||||
signindex.sign_index(repodir, json_name)
|
signindex.sign_index(repodir, json_name)
|
||||||
|
|
||||||
|
|
||||||
def make_v1(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_fingerprints):
|
def make_v1(apps, packages, repodir, repodict, requestsdict, signer_fingerprints):
|
||||||
|
|
||||||
def _index_encoder_default(obj):
|
def _index_encoder_default(obj):
|
||||||
if isinstance(obj, set):
|
if isinstance(obj, set):
|
||||||
|
@ -876,7 +875,7 @@ def make_v1(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_
|
||||||
output['repo']['mirrors'] = mirrors
|
output['repo']['mirrors'] = mirrors
|
||||||
|
|
||||||
# establish sort order of the index
|
# establish sort order of the index
|
||||||
v1_sort_packages(packages, fdroid_signing_key_fingerprints)
|
v1_sort_packages(packages, signer_fingerprints)
|
||||||
|
|
||||||
appslist = []
|
appslist = []
|
||||||
output['apps'] = appslist
|
output['apps'] = appslist
|
||||||
|
@ -984,7 +983,7 @@ def _copy_to_local_copy_dir(repodir, f):
|
||||||
.format(path=local_copy_dir))
|
.format(path=local_copy_dir))
|
||||||
|
|
||||||
|
|
||||||
def v1_sort_packages(packages, fdroid_signing_key_fingerprints):
|
def v1_sort_packages(packages, signer_fingerprints):
|
||||||
"""Sort the supplied list to ensure a deterministic sort order for package entries in the index file.
|
"""Sort the supplied list to ensure a deterministic sort order for package entries in the index file.
|
||||||
|
|
||||||
This sort-order also expresses
|
This sort-order also expresses
|
||||||
|
@ -1010,7 +1009,7 @@ def v1_sort_packages(packages, fdroid_signing_key_fingerprints):
|
||||||
if dev_signer and dev_signer == signer:
|
if dev_signer and dev_signer == signer:
|
||||||
group = GROUP_DEV_SIGNED
|
group = GROUP_DEV_SIGNED
|
||||||
else:
|
else:
|
||||||
fdroid_signer = fdroid_signing_key_fingerprints.get(packageName, {}).get('signer')
|
fdroid_signer = signer_fingerprints.get(packageName, {}).get('signer')
|
||||||
if fdroid_signer and fdroid_signer == signer:
|
if fdroid_signer and fdroid_signer == signer:
|
||||||
group = GROUP_FDROID_SIGNED
|
group = GROUP_FDROID_SIGNED
|
||||||
|
|
||||||
|
@ -1023,7 +1022,7 @@ def v1_sort_packages(packages, fdroid_signing_key_fingerprints):
|
||||||
packages.sort(key=v1_sort_keys)
|
packages.sort(key=v1_sort_keys)
|
||||||
|
|
||||||
|
|
||||||
def make_v0(apps, apks, repodir, repodict, requestsdict, fdroid_signing_key_fingerprints):
|
def make_v0(apps, apks, repodir, repodict, requestsdict, signer_fingerprints):
|
||||||
"""Aka index.jar aka index.xml."""
|
"""Aka index.jar aka index.xml."""
|
||||||
doc = Document()
|
doc = Document()
|
||||||
|
|
||||||
|
@ -1122,7 +1121,7 @@ def make_v0(apps, apks, repodir, repodict, requestsdict, fdroid_signing_key_fing
|
||||||
if name_from_apk is None:
|
if name_from_apk is None:
|
||||||
name_from_apk = apk.get('name')
|
name_from_apk = apk.get('name')
|
||||||
for versionCode, apksforver in apksbyversion.items():
|
for versionCode, apksforver in apksbyversion.items():
|
||||||
fdroid_signer = fdroid_signing_key_fingerprints.get(appid, {}).get('signer')
|
fdroid_signer = signer_fingerprints.get(appid, {}).get('signer')
|
||||||
fdroid_signed_apk = None
|
fdroid_signed_apk = None
|
||||||
name_match_apk = None
|
name_match_apk = None
|
||||||
for x in apksforver:
|
for x in apksforver:
|
||||||
|
|
|
@ -139,7 +139,7 @@ def sign_sig_key_fingerprint_list(jar_file):
|
||||||
raise FDroidException("Failed to sign '{}'!".format(jar_file))
|
raise FDroidException("Failed to sign '{}'!".format(jar_file))
|
||||||
|
|
||||||
|
|
||||||
def store_stats_fdroid_signing_key_fingerprints(appids, indent=None):
|
def store_publish_signer_fingerprints(appids, indent=None):
|
||||||
"""Store list of all signing-key fingerprints for given appids to HD.
|
"""Store list of all signing-key fingerprints for given appids to HD.
|
||||||
|
|
||||||
This list will later on be needed by fdroid update.
|
This list will later on be needed by fdroid update.
|
||||||
|
@ -460,7 +460,7 @@ def main():
|
||||||
publish_source_tarball(apkfilename, unsigned_dir, output_dir)
|
publish_source_tarball(apkfilename, unsigned_dir, output_dir)
|
||||||
logging.info('Published ' + apkfilename)
|
logging.info('Published ' + apkfilename)
|
||||||
|
|
||||||
store_stats_fdroid_signing_key_fingerprints(allapps.keys())
|
store_publish_signer_fingerprints(allapps.keys())
|
||||||
status_update_json(generated_keys, signed_apks)
|
status_update_json(generated_keys, signed_apks)
|
||||||
logging.info('published list signing-key fingerprints')
|
logging.info('published list signing-key fingerprints')
|
||||||
|
|
||||||
|
|
|
@ -383,7 +383,7 @@ class IndexTest(unittest.TestCase):
|
||||||
common.write_config_file('')
|
common.write_config_file('')
|
||||||
|
|
||||||
index.v1_sort_packages(
|
index.v1_sort_packages(
|
||||||
i, common.load_stats_fdroid_signing_key_fingerprints()
|
i, common.load_publish_signer_fingerprints()
|
||||||
)
|
)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertEqual(json.dumps(i, indent=2), json.dumps(o, indent=2))
|
self.assertEqual(json.dumps(i, indent=2), json.dumps(o, indent=2))
|
||||||
|
@ -656,7 +656,7 @@ class IndexTest(unittest.TestCase):
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
index.v1_sort_packages(i, common.load_stats_fdroid_signing_key_fingerprints())
|
index.v1_sort_packages(i, common.load_publish_signer_fingerprints())
|
||||||
|
|
||||||
def test_package_metadata(self):
|
def test_package_metadata(self):
|
||||||
"""A smoke check and format check of index.package_metadata()"""
|
"""A smoke check and format check of index.package_metadata()"""
|
||||||
|
|
|
@ -77,7 +77,7 @@ class PublishTest(unittest.TestCase):
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertEqual(expected, result)
|
self.assertEqual(expected, result)
|
||||||
|
|
||||||
def test_store_and_load_fdroid_signing_key_fingerprints(self):
|
def test_store_and_load_signer_fingerprints(self):
|
||||||
common.config = {}
|
common.config = {}
|
||||||
common.fill_config_defaults(common.config)
|
common.fill_config_defaults(common.config)
|
||||||
publish.config = common.config
|
publish.config = common.config
|
||||||
|
@ -97,7 +97,7 @@ class PublishTest(unittest.TestCase):
|
||||||
os.chdir(self.testdir)
|
os.chdir(self.testdir)
|
||||||
common.write_config_file('')
|
common.write_config_file('')
|
||||||
|
|
||||||
publish.store_stats_fdroid_signing_key_fingerprints(appids, indent=2)
|
publish.store_publish_signer_fingerprints(appids, indent=2)
|
||||||
|
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
expected = {
|
expected = {
|
||||||
|
@ -114,7 +114,7 @@ class PublishTest(unittest.TestCase):
|
||||||
"signer": "6ae5355157a47ddcc3834a71f57f6fb5a8c2621c8e0dc739e9ddf59f865e497c"
|
"signer": "6ae5355157a47ddcc3834a71f57f6fb5a8c2621c8e0dc739e9ddf59f865e497c"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
self.assertEqual(expected, common.load_stats_fdroid_signing_key_fingerprints())
|
self.assertEqual(expected, common.load_publish_signer_fingerprints())
|
||||||
|
|
||||||
with open(common.CONFIG_FILE) as fp:
|
with open(common.CONFIG_FILE) as fp:
|
||||||
config = yaml.load(fp)
|
config = yaml.load(fp)
|
||||||
|
@ -123,7 +123,7 @@ class PublishTest(unittest.TestCase):
|
||||||
config['repo_key_sha256'],
|
config['repo_key_sha256'],
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_store_and_load_fdroid_signing_key_fingerprints_with_missmatch(self):
|
def test_store_and_load_signer_fingerprints_with_missmatch(self):
|
||||||
common.config = {}
|
common.config = {}
|
||||||
common.fill_config_defaults(common.config)
|
common.fill_config_defaults(common.config)
|
||||||
publish.config = common.config
|
publish.config = common.config
|
||||||
|
@ -134,9 +134,9 @@ class PublishTest(unittest.TestCase):
|
||||||
publish.config['repo_key_sha256'] = 'bad bad bad bad bad bad bad bad bad bad bad bad'
|
publish.config['repo_key_sha256'] = 'bad bad bad bad bad bad bad bad bad bad bad bad'
|
||||||
|
|
||||||
os.chdir(self.testdir)
|
os.chdir(self.testdir)
|
||||||
publish.store_stats_fdroid_signing_key_fingerprints({}, indent=2)
|
publish.store_publish_signer_fingerprints({}, indent=2)
|
||||||
with self.assertRaises(FDroidException):
|
with self.assertRaises(FDroidException):
|
||||||
common.load_stats_fdroid_signing_key_fingerprints()
|
common.load_publish_signer_fingerprints()
|
||||||
|
|
||||||
def test_reproducible_binaries_process(self):
|
def test_reproducible_binaries_process(self):
|
||||||
common.config = {}
|
common.config = {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue