mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-02 09:10:11 +02: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
@ -977,7 +977,7 @@ def insert_funding_yml_donation_links(apps):
|
||||
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
|
||||
|
||||
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)]
|
||||
else:
|
||||
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)
|
||||
sourcefile = os.path.join(root, f)
|
||||
destfile = os.path.join(destdir, repofilename)
|
||||
_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 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.
|
||||
|
||||
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.
|
||||
|
||||
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.')
|
||||
continue
|
||||
locale = segments[-1]
|
||||
destdir = os.path.join('repo', packageName, locale)
|
||||
destdir = os.path.join(repodir, packageName, locale)
|
||||
|
||||
# flavours specified in build receipt
|
||||
build_flavours = ""
|
||||
@ -1180,7 +1180,7 @@ def insert_localized_app_metadata(apps):
|
||||
base, extension = common.get_extension(f)
|
||||
if locale == 'images':
|
||||
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:
|
||||
os.makedirs(destdir, mode=0o755, exist_ok=True)
|
||||
_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 locale == 'images':
|
||||
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, '*.*')):
|
||||
_ignored, extension = common.get_extension(f)
|
||||
if extension in ALLOWED_EXTENSIONS:
|
||||
@ -1196,7 +1196,7 @@ def insert_localized_app_metadata(apps):
|
||||
os.makedirs(screenshotdestdir, mode=0o755, exist_ok=True)
|
||||
_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:
|
||||
if not os.path.isdir(d):
|
||||
continue
|
||||
@ -2303,9 +2303,9 @@ def main():
|
||||
logging.warning(msg + '\n\t' + _('Use `fdroid update -c` to create it.'))
|
||||
|
||||
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_localized_app_metadata(apps)
|
||||
insert_localized_app_metadata(apps, repodirs[0])
|
||||
translate_per_build_anti_features(apps, apks)
|
||||
|
||||
# Scan the archive repo for apks as well
|
||||
|
@ -103,7 +103,7 @@ class UpdateTest(unittest.TestCase):
|
||||
build_conversations.gradle = ['free']
|
||||
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')
|
||||
self.assertTrue(os.path.isfile(os.path.join(
|
||||
@ -183,7 +183,7 @@ class UpdateTest(unittest.TestCase):
|
||||
os.chdir(tmptestsdir)
|
||||
|
||||
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()
|
||||
correctlocales = [
|
||||
@ -211,7 +211,7 @@ class UpdateTest(unittest.TestCase):
|
||||
|
||||
apps = fdroidserver.metadata.read_metadata(xref=True)
|
||||
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']
|
||||
app = apps[packageName]
|
||||
self.assertEqual('android@piwigo.org', app['authorEmail'])
|
||||
|
Loading…
Reference in New Issue
Block a user