mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 15:00:30 +03:00
update: make copy_triple_t_store_metadata and insert_localized_app_metadata not assume /repo
This will enable copying the localized metadata to the archive as well.
This commit is contained in:
parent
ee4ee85cbd
commit
8c71637d43
2 changed files with 13 additions and 13 deletions
|
|
@ -977,7 +977,7 @@ def insert_funding_yml_donation_links(apps):
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
def copy_triple_t_store_metadata(apps):
|
def copy_triple_t_store_metadata(apps, repodir):
|
||||||
"""Include store metadata from the app's source repo
|
"""Include store metadata from the app's source repo
|
||||||
|
|
||||||
The Triple-T Gradle Play Publisher is a plugin that has a standard
|
The Triple-T Gradle Play Publisher is a plugin that has a standard
|
||||||
|
|
@ -1091,14 +1091,14 @@ def copy_triple_t_store_metadata(apps):
|
||||||
dirname = SCREENSHOT_DIRS[tt_screenshot_dirs.index(dirname)]
|
dirname = SCREENSHOT_DIRS[tt_screenshot_dirs.index(dirname)]
|
||||||
else:
|
else:
|
||||||
locale = segments[-2]
|
locale = segments[-2]
|
||||||
destdir = os.path.join('repo', packageName, locale, dirname)
|
destdir = os.path.join(repodir, packageName, locale, dirname)
|
||||||
os.makedirs(destdir, mode=0o755, exist_ok=True)
|
os.makedirs(destdir, mode=0o755, exist_ok=True)
|
||||||
sourcefile = os.path.join(root, f)
|
sourcefile = os.path.join(root, f)
|
||||||
destfile = os.path.join(destdir, repofilename)
|
destfile = os.path.join(destdir, repofilename)
|
||||||
_strip_and_copy_image(sourcefile, destfile)
|
_strip_and_copy_image(sourcefile, destfile)
|
||||||
|
|
||||||
|
|
||||||
def insert_localized_app_metadata(apps):
|
def insert_localized_app_metadata(apps, repodir):
|
||||||
"""scans standard locations for graphics and localized text
|
"""scans standard locations for graphics and localized text
|
||||||
|
|
||||||
Scans for localized description files, changelogs, store graphics, and
|
Scans for localized description files, changelogs, store graphics, and
|
||||||
|
|
@ -1113,7 +1113,7 @@ def insert_localized_app_metadata(apps):
|
||||||
...as well as the /metadata/<packageName>/<locale> directory.
|
...as well as the /metadata/<packageName>/<locale> directory.
|
||||||
|
|
||||||
If it finds them, they will be added to the dict of all packages, with the
|
If it finds them, they will be added to the dict of all packages, with the
|
||||||
versions in the /metadata/ folder taking precendence over the what
|
versions in the /metadata/ folder taking precedence over the what
|
||||||
is in the app's source repo.
|
is in the app's source repo.
|
||||||
|
|
||||||
The <locale> is the locale of the files supplied in that directory, using
|
The <locale> is the locale of the files supplied in that directory, using
|
||||||
|
|
@ -1142,7 +1142,7 @@ def insert_localized_app_metadata(apps):
|
||||||
logging.debug(packageName + ' does not have app metadata, skipping l18n scan.')
|
logging.debug(packageName + ' does not have app metadata, skipping l18n scan.')
|
||||||
continue
|
continue
|
||||||
locale = segments[-1]
|
locale = segments[-1]
|
||||||
destdir = os.path.join('repo', packageName, locale)
|
destdir = os.path.join(repodir, packageName, locale)
|
||||||
|
|
||||||
# flavours specified in build receipt
|
# flavours specified in build receipt
|
||||||
build_flavours = ""
|
build_flavours = ""
|
||||||
|
|
@ -1180,7 +1180,7 @@ def insert_localized_app_metadata(apps):
|
||||||
base, extension = common.get_extension(f)
|
base, extension = common.get_extension(f)
|
||||||
if locale == 'images':
|
if locale == 'images':
|
||||||
locale = segments[-2]
|
locale = segments[-2]
|
||||||
destdir = os.path.join('repo', packageName, locale)
|
destdir = os.path.join(repodir, packageName, locale)
|
||||||
if base in GRAPHIC_NAMES and extension in ALLOWED_EXTENSIONS:
|
if base in GRAPHIC_NAMES and extension in ALLOWED_EXTENSIONS:
|
||||||
os.makedirs(destdir, mode=0o755, exist_ok=True)
|
os.makedirs(destdir, mode=0o755, exist_ok=True)
|
||||||
_strip_and_copy_image(os.path.join(root, f), destdir)
|
_strip_and_copy_image(os.path.join(root, f), destdir)
|
||||||
|
|
@ -1188,7 +1188,7 @@ def insert_localized_app_metadata(apps):
|
||||||
if d in SCREENSHOT_DIRS:
|
if d in SCREENSHOT_DIRS:
|
||||||
if locale == 'images':
|
if locale == 'images':
|
||||||
locale = segments[-2]
|
locale = segments[-2]
|
||||||
destdir = os.path.join('repo', packageName, locale)
|
destdir = os.path.join(repodir, packageName, locale)
|
||||||
for f in glob.glob(os.path.join(root, d, '*.*')):
|
for f in glob.glob(os.path.join(root, d, '*.*')):
|
||||||
_ignored, extension = common.get_extension(f)
|
_ignored, extension = common.get_extension(f)
|
||||||
if extension in ALLOWED_EXTENSIONS:
|
if extension in ALLOWED_EXTENSIONS:
|
||||||
|
|
@ -1196,7 +1196,7 @@ def insert_localized_app_metadata(apps):
|
||||||
os.makedirs(screenshotdestdir, mode=0o755, exist_ok=True)
|
os.makedirs(screenshotdestdir, mode=0o755, exist_ok=True)
|
||||||
_strip_and_copy_image(f, screenshotdestdir)
|
_strip_and_copy_image(f, screenshotdestdir)
|
||||||
|
|
||||||
repodirs = sorted(glob.glob(os.path.join('repo', '[A-Za-z]*', '[a-z][a-z]*')))
|
repodirs = sorted(glob.glob(os.path.join(repodir, '[A-Za-z]*', '[a-z][a-z]*')))
|
||||||
for d in repodirs:
|
for d in repodirs:
|
||||||
if not os.path.isdir(d):
|
if not os.path.isdir(d):
|
||||||
continue
|
continue
|
||||||
|
|
@ -2303,9 +2303,9 @@ def main():
|
||||||
logging.warning(msg + '\n\t' + _('Use `fdroid update -c` to create it.'))
|
logging.warning(msg + '\n\t' + _('Use `fdroid update -c` to create it.'))
|
||||||
|
|
||||||
insert_funding_yml_donation_links(apps)
|
insert_funding_yml_donation_links(apps)
|
||||||
copy_triple_t_store_metadata(apps)
|
copy_triple_t_store_metadata(apps, repodirs[0])
|
||||||
insert_obbs(repodirs[0], apps, apks)
|
insert_obbs(repodirs[0], apps, apks)
|
||||||
insert_localized_app_metadata(apps)
|
insert_localized_app_metadata(apps, repodirs[0])
|
||||||
translate_per_build_anti_features(apps, apks)
|
translate_per_build_anti_features(apps, apks)
|
||||||
|
|
||||||
# Scan the archive repo for apks as well
|
# Scan the archive repo for apks as well
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ class UpdateTest(unittest.TestCase):
|
||||||
build_conversations.gradle = ['free']
|
build_conversations.gradle = ['free']
|
||||||
apps['eu.siacs.conversations']['builds'] = [build_conversations]
|
apps['eu.siacs.conversations']['builds'] = [build_conversations]
|
||||||
|
|
||||||
fdroidserver.update.insert_localized_app_metadata(apps)
|
fdroidserver.update.insert_localized_app_metadata(apps, 'repo')
|
||||||
|
|
||||||
appdir = os.path.join('repo', 'info.guardianproject.urzip', 'en-US')
|
appdir = os.path.join('repo', 'info.guardianproject.urzip', 'en-US')
|
||||||
self.assertTrue(os.path.isfile(os.path.join(
|
self.assertTrue(os.path.isfile(os.path.join(
|
||||||
|
|
@ -183,7 +183,7 @@ class UpdateTest(unittest.TestCase):
|
||||||
os.chdir(tmptestsdir)
|
os.chdir(tmptestsdir)
|
||||||
|
|
||||||
apps = fdroidserver.metadata.read_metadata(xref=True)
|
apps = fdroidserver.metadata.read_metadata(xref=True)
|
||||||
fdroidserver.update.copy_triple_t_store_metadata(apps)
|
fdroidserver.update.copy_triple_t_store_metadata(apps, 'repo')
|
||||||
|
|
||||||
# TODO ideally, this would compare the whole dict like in metadata.TestCase's test_read_metadata()
|
# TODO ideally, this would compare the whole dict like in metadata.TestCase's test_read_metadata()
|
||||||
correctlocales = [
|
correctlocales = [
|
||||||
|
|
@ -211,7 +211,7 @@ class UpdateTest(unittest.TestCase):
|
||||||
|
|
||||||
apps = fdroidserver.metadata.read_metadata(xref=True)
|
apps = fdroidserver.metadata.read_metadata(xref=True)
|
||||||
self.assertTrue(packageName in apps)
|
self.assertTrue(packageName in apps)
|
||||||
fdroidserver.update.copy_triple_t_store_metadata(apps)
|
fdroidserver.update.copy_triple_t_store_metadata(apps, 'repo')
|
||||||
correctlocales = ['de-DE', 'en-US', 'fr-FR', 'kn-IN']
|
correctlocales = ['de-DE', 'en-US', 'fr-FR', 'kn-IN']
|
||||||
app = apps[packageName]
|
app = apps[packageName]
|
||||||
self.assertEqual('android@piwigo.org', app['authorEmail'])
|
self.assertEqual('android@piwigo.org', app['authorEmail'])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue