1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-21 04:10:37 +02:00

Compare commits

...

11 Commits

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

See merge request fdroid/fdroidserver!1425
2024-06-05 16:16:43 +00:00
Hans-Christoph Steiner
e7ff344f2b Merge branch 'gradle' into 'master'
gradle 8.8

See merge request fdroid/fdroidserver!1489
2024-06-05 15:00:19 +00:00
linsui
41e90e5ee7 gradle 8.8 2024-06-01 16:24:26 +08: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,
@ -1346,22 +1347,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)
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(iconfilename)
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, iconfilename)
shutil.copy(exampleicon, icon_filename)
def extract_pubkey():

View File

@ -2598,11 +2598,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

@ -200,6 +200,7 @@ get_sha() {
'8.5') echo '9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026' ;;
'8.6') echo '9631d53cf3e74bfa726893aee1f8994fee4e060c401335946dba2156f440f24c' ;;
'8.7') echo '544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d'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 1.1 1.0 0.9.2 0.9.1 0.9 0.8 0.7)
plugin_v=(8.8 8.7 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

@ -453,6 +453,35 @@ class IndexTest(unittest.TestCase):
)
self.assertTrue(os.path.exists(os.path.join('repo', 'index.xml')))
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')