Compare commits

...

11 Commits

Author SHA1 Message Date
1024mb 0d9d9aa4b7 Merge branch 'fix-icon-check' into 'master'
fix: fix existing icon detection for repo and archive

See merge request fdroid/fdroidserver!1425
2024-02-15 08:05:39 +00:00
Hans-Christoph Steiner 35c373a473 Merge branch 'gradle-release-checksums.py' into 'master'
update to gradle v7.6.4

See merge request fdroid/fdroidserver!1445
2024-02-14 17:41:46 +00:00
fdroid-bot ec88cc627f gradle v8.6 2024-02-14 17:32:15 +00:00
1024mb a7b521ab47 Merge branch fdroidserver:master into fix-icon-check 2024-01-25 19:46:39 +00:00
Angel f309dc5d22
test: update and add test 2024-01-25 01:17:41 -05:00
Angel f8c8261630
check for the basename of the repo_icon value 2024-01-25 00:56:30 -05:00
1024mb 65934f35a8 Merge branch fdroidserver:master into fix-icon-check 2024-01-25 05:46:15 +00:00
Angel 901b05e14a
test: add test_copy_repo_icon() 2024-01-14 19:20:42 -05:00
Angel e5ae22ac83
refactor: refactor to its own function 2024-01-14 18:32:06 -05:00
Angel ead6691bf7
only check for repo_icon existence 2024-01-14 18:02:04 -05:00
Angel 7ab93617f0
fix: fix existing icon detection for repo and archive 2024-01-08 20:25:24 -05:00
4 changed files with 57 additions and 21 deletions

View File

@ -120,6 +120,7 @@ def make(apps, apks, repodir, archive):
make_v0(sortedapps, apks, repodir, repodict, requestsdict,
fdroid_signing_key_fingerprints)
copy_repo_icon(repodir)
make_v1(sortedapps, apks, repodir, repodict, requestsdict,
fdroid_signing_key_fingerprints)
make_v2(sortedapps, apks, repodir, repodict, requestsdict,
@ -1331,22 +1332,28 @@ def make_v0(apps, apks, repodir, repodict, requestsdict, fdroid_signing_key_fing
signindex.config = common.config
signindex.sign_jar(signed, use_old_algs=True)
# Copy the repo icon into the repo directory...
def copy_repo_icon(repodir):
icon_dir = os.path.join(repodir, 'icons')
repo_icon = common.config.get('repo_icon', common.default_config['repo_icon'])
iconfilename = os.path.join(icon_dir, os.path.basename(repo_icon))
if os.path.exists(repo_icon):
shutil.copyfile(common.config['repo_icon'], iconfilename)
if repodir == 'archive':
icon_key_name = 'archive_icon'
else:
logging.warning(_('repo_icon "repo/icons/%s" does not exist, generating placeholder.')
% repo_icon)
os.makedirs(os.path.dirname(iconfilename), exist_ok=True)
try:
qrcode.make(common.config['repo_url']).save(iconfilename)
except Exception:
exampleicon = os.path.join(common.get_examples_dir(),
common.default_config['repo_icon'])
shutil.copy(exampleicon, iconfilename)
icon_key_name = 'repo_icon'
config_icon_name = common.config.get(icon_key_name, common.default_config['repo_icon'])
icon_filename = os.path.join(icon_dir, os.path.basename(config_icon_name))
if not os.path.exists(icon_filename):
if os.path.exists(config_icon_name):
shutil.copyfile(config_icon_name, icon_filename)
else:
logging.warning(_('%s "%s" does not exist, generating placeholder.')
% (icon_key_name, icon_filename))
os.makedirs(os.path.dirname(icon_filename), exist_ok=True)
try:
qrcode.make(common.config['repo_url']).save(icon_filename)
except Exception:
exampleicon = os.path.join(common.get_examples_dir(),
common.default_config['repo_icon'])
shutil.copy(exampleicon, icon_filename)
def extract_pubkey():

View File

@ -2301,11 +2301,10 @@ def main():
options.clean = True
# check that icons exist now, rather than fail at the end of `fdroid update`
for k in ['repo_icon', 'archive_icon']:
if k in config:
if not os.path.exists(config[k]):
logging.warning(_('{name} "{section}/icons/{path}" does not exist! Check "config.yml".')
.format(name=k, section=k.split('_')[0], path=config[k]))
if 'repo_icon' in config:
if not os.path.exists(os.path.join(repodirs[0], 'icons', os.path.basename(config['repo_icon']))):
logging.warning(_('repo_icon "repo/icons/{path}" does not exist! Check "config.yml".').
format(path=os.path.basename(config['repo_icon'])))
# if the user asks to create a keystore, do it now, reusing whatever it can
if options.create_key:

View File

@ -187,6 +187,7 @@ get_sha() {
'7.6.1') echo '6147605a23b4eff6c334927a86ff3508cb5d6722cd624c97ded4c2e8640f1f87' ;;
'7.6.2') echo 'a01b6587e15fe7ed120a0ee299c25982a1eee045abd6a9dd5e216b2f628ef9ac' ;;
'7.6.3') echo '740c2e472ee4326c33bf75a5c9f5cd1e69ecf3f9b580f6e236c86d1f3d98cfac' ;;
'7.6.4') echo 'bed1da33cca0f557ab13691c77f38bb67388119e4794d113e051039b80af9bb1' ;;
'8.0') echo '4159b938ec734a8388ce03f52aa8f3c7ed0d31f5438622545de4f83a89b79788' ;;
'8.0.1') echo '1b6b558be93f29438d3df94b7dfee02e794b94d9aca4611a92cdb79b6b88e909' ;;
'8.0.2') echo 'ff7bf6a86f09b9b2c40bb8f48b25fc19cf2b2664fd1d220cd7ab833ec758d0d7' ;;
@ -218,7 +219,7 @@ d_gradle_plugin_ver_k=(8.4 8.3 8.2 8.1 8.0 7.4 7.3 7.2.0 7.1 7.0 4.2 4.1 4.0 3.6
d_plugin_min_gradle_v=(8.6 8.4 8.2 8.0 8.0 7.5 7.4 7.3.3 7.2 7.0.2 6.7.1 6.5 6.1.1 5.6.4 5.4.1 5.1.1 4.10.1 4.6 4.4 4.1 3.3 2.14.1 2.14.1 2.12 2.12 2.4 2.4 2.3 2.2.1 2.2.1 2.1 2.1 1.12 1.12 1.12 1.11 1.10 1.9 1.8 1.6 1.6 1.4 1.4)
# All gradle versions we know about
plugin_v=(8.6 8.5 8.4 8.3 8.2.1 8.2 8.1.1 8.1 8.0.2 8.0.1 8.0 7.6.3 7.6.2 7.6.1 7.6 7.5.1 7.5 7.4.2 7.4.1 7.4 7.3.3 7.3.2 7.3.1 7.3 7.2 7.1.1 7.1 7.0.2 7.0.1 7.0 6.9.4 6.9.3 6.9.2 6.9.1 6.9 6.8.3 6.8.2 6.8.1 6.8 6.7.1 6.7 6.6.1 6.6 6.5.1 6.5 6.4.1 6.4 6.3 6.2.2 6.2.1 6.2 6.1.1 6.1 6.0.1 6.0 5.6.4 5.6.3 5.6.2 5.6.1 5.6 5.5.1 5.5 5.4.1 5.4 5.3.1 5.3 5.2.1 5.2 5.1.1 5.1 5.0 4.10.3 4.10.2 4.10.1 4.10 4.9 4.8.1 4.8 4.7 4.6 4.5.1 4.5 4.4.1 4.4 4.3.1 4.3 4.2.1 4.2 4.1 4.0.2 4.0.1 4.0 3.5.1 3.5 3.4.1 3.4 3.3 3.2.1 3.2 3.1 3.0 2.14.1 2.14 2.13 2.12 2.11 2.10 2.9 2.8 2.7 2.6 2.5 2.4 2.3 2.2.1 2.2 2.1 2.0 1.12 1.11 1.10 1.9 1.8 1.7 1.6 1.5 1.4 1.3 1.2 1.1 1.0 0.9.2 0.9.1 0.9 0.8 0.7)
plugin_v=(8.6 8.5 8.4 8.3 8.2.1 8.2 8.1.1 8.1 8.0.2 8.0.1 8.0 7.6.4 7.6.3 7.6.2 7.6.1 7.6 7.5.1 7.5 7.4.2 7.4.1 7.4 7.3.3 7.3.2 7.3.1 7.3 7.2 7.1.1 7.1 7.0.2 7.0.1 7.0 6.9.4 6.9.3 6.9.2 6.9.1 6.9 6.8.3 6.8.2 6.8.1 6.8 6.7.1 6.7 6.6.1 6.6 6.5.1 6.5 6.4.1 6.4 6.3 6.2.2 6.2.1 6.2 6.1.1 6.1 6.0.1 6.0 5.6.4 5.6.3 5.6.2 5.6.1 5.6 5.5.1 5.5 5.4.1 5.4 5.3.1 5.3 5.2.1 5.2 5.1.1 5.1 5.0 4.10.3 4.10.2 4.10.1 4.10 4.9 4.8.1 4.8 4.7 4.6 4.5.1 4.5 4.4.1 4.4 4.3.1 4.3 4.2.1 4.2 4.1 4.0.2 4.0.1 4.0 3.5.1 3.5 3.4.1 3.4 3.3 3.2.1 3.2 3.1 3.0 2.14.1 2.14 2.13 2.12 2.11 2.10 2.9 2.8 2.7 2.6 2.5 2.4 2.3 2.2.1 2.2 2.1 2.0 1.12 1.11 1.10 1.9 1.8 1.7 1.6 1.5 1.4 1.3 1.2 1.1 1.0 0.9.2 0.9.1 0.9 0.8 0.7)
v_all=${plugin_v[@]}

View File

@ -442,7 +442,36 @@ class IndexTest(unittest.TestCase):
)
self.assertTrue(os.path.exists(os.path.join('repo', 'index.xml')))
def test_make_v0(self):
def test_generate_repo_icon(self):
os.chdir(self.testdir)
os.mkdir('repo')
repo_icons_dir = os.path.join('repo', 'icons')
generated_path = os.path.join(repo_icons_dir, common.default_config['repo_icon'])
self.assertFalse(os.path.isdir(repo_icons_dir))
self.assertFalse(os.path.exists(generated_path))
index.copy_repo_icon('repo')
self.assertTrue(os.path.isdir(repo_icons_dir))
self.assertTrue(os.path.exists(generated_path))
def test_copy_repo_icon(self):
os.chdir(self.testdir)
os.mkdir('repo')
repo_icons_dir = os.path.join('repo', 'icons')
self.assertFalse(os.path.isdir(repo_icons_dir))
common.config['repo_icon'] = 'test_icon.png'
test_value = 'test'
Path(common.config['repo_icon']).write_text(test_value)
copied_path = os.path.join(repo_icons_dir, os.path.basename(common.config['repo_icon']))
self.assertFalse(os.path.isdir(repo_icons_dir))
self.assertFalse(os.path.exists(copied_path))
index.copy_repo_icon('repo')
self.assertTrue(os.path.isdir(repo_icons_dir))
self.assertEquals(test_value, Path(copied_path).read_text())
def test_make_v0(self):
os.chdir(self.testdir)
os.mkdir('metadata')
os.mkdir('repo')