mirror of
https://github.com/flatpak/flatpak.git
synced 2026-10-26 17:39:41 -04:00
builder: Build single every-locale extension
This is useful for testing, as well as makes building derived runtimes easier.
This commit is contained in:
1 parent
1b1e8c26a2
commit
b3f9da3648
2 files changed
+64
-11
No files matched your search
@@ -1617,6 +1617,7 @@ builder_manifest_finish (BuilderManifest *self,
|
||||
g_autofree char *extension_contents = NULL;
|
||||
g_autoptr(GFileEnumerator) dir_enum = NULL;
|
||||
g_autoptr(GFileOutputStream) output = NULL;
|
||||
gboolean found_locale = FALSE;
|
||||
GFileInfo *next;
|
||||
|
||||
metadata_file = g_file_get_child (app_dir, "metadata");
|
||||
@@ -1662,10 +1663,28 @@ builder_manifest_finish (BuilderManifest *self,
|
||||
G_FILE_CREATE_REPLACE_DESTINATION,
|
||||
NULL, NULL, error))
|
||||
return FALSE;
|
||||
found_locale = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (found_locale)
|
||||
{
|
||||
g_autoptr(GFile) metadata_locale_file = NULL;
|
||||
g_autofree char *metadata_contents = NULL;
|
||||
|
||||
metadata_locale_file = g_file_get_child (app_dir, "metadata.locale");
|
||||
metadata_contents = g_strdup_printf("[Runtime]\n"
|
||||
"name=%s.Locale\n", self->id);
|
||||
if (!g_file_replace_contents (metadata_locale_file,
|
||||
metadata_contents, strlen (metadata_contents),
|
||||
NULL, FALSE,
|
||||
G_FILE_CREATE_REPLACE_DESTINATION,
|
||||
NULL, NULL, error))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (g_file_query_exists (debuginfo_dir, NULL))
|
||||
{
|
||||
g_autoptr(GFile) metadata_file = NULL;
|
||||
@@ -1886,6 +1905,7 @@ builder_manifest_create_platform (BuilderManifest *self,
|
||||
g_autoptr(GFileOutputStream) output = NULL;
|
||||
g_autoptr(GFile) locale_parent_dir = NULL;
|
||||
GFileInfo *next;
|
||||
gboolean found_locale = FALSE;
|
||||
|
||||
metadata_file = g_file_get_child (app_dir, "metadata.platform");
|
||||
|
||||
@@ -1931,8 +1951,27 @@ builder_manifest_create_platform (BuilderManifest *self,
|
||||
G_FILE_CREATE_REPLACE_DESTINATION,
|
||||
NULL, NULL, error))
|
||||
return FALSE;
|
||||
|
||||
found_locale = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (found_locale)
|
||||
{
|
||||
g_autoptr(GFile) metadata_locale_file = NULL;
|
||||
g_autofree char *metadata_contents = NULL;
|
||||
|
||||
metadata_locale_file = g_file_get_child (app_dir, "metadata.platform.locale");
|
||||
metadata_contents = g_strdup_printf("[Runtime]\n"
|
||||
"name=%s.Locale\n", self->id_platform);
|
||||
if (!g_file_replace_contents (metadata_locale_file,
|
||||
metadata_contents, strlen (metadata_contents),
|
||||
NULL, FALSE,
|
||||
G_FILE_CREATE_REPLACE_DESTINATION,
|
||||
NULL, NULL, error))
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!builder_cache_commit (cache, "Created platform", error))
|
||||
|
||||
@@ -369,20 +369,27 @@ main (int argc,
|
||||
{
|
||||
g_autoptr(GFileInfo) child_info = next;
|
||||
const char *name = g_file_info_get_name (child_info);
|
||||
const char *language;
|
||||
const char *language = NULL;
|
||||
g_autofree char *metadata_arg = NULL;
|
||||
g_autofree char *files_arg = NULL;
|
||||
|
||||
if (!g_str_has_prefix (name, "metadata.locale."))
|
||||
continue;
|
||||
language = name + strlen ("metadata.locale.");
|
||||
if (strcmp (name, "metadata.locale") == 0)
|
||||
{
|
||||
g_print ("exporting %s.Locale to repo\n", builder_manifest_get_id (manifest));
|
||||
language = NULL;
|
||||
}
|
||||
else if (g_str_has_prefix (name, "metadata.locale."))
|
||||
{
|
||||
language = name + strlen ("metadata.locale.");
|
||||
|
||||
g_print ("exporting %s.Locale.%s to repo\n", builder_manifest_get_id (manifest), language);
|
||||
g_print ("exporting %s.Locale.%s to repo\n", builder_manifest_get_id (manifest), language);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
metadata_arg = g_strdup_printf ("--metadata=%s", name);
|
||||
files_arg = g_strconcat (builder_context_get_build_runtime (build_context) ? "--files=usr" : "--files=files",
|
||||
"/share/runtime/locale/",
|
||||
language, NULL);
|
||||
"/share/runtime/locale/", language, NULL);
|
||||
if (!do_export (&error, TRUE,
|
||||
metadata_arg,
|
||||
files_arg,
|
||||
@@ -440,11 +447,18 @@ main (int argc,
|
||||
g_autofree char *metadata_arg = NULL;
|
||||
g_autofree char *files_arg = NULL;
|
||||
|
||||
if (!g_str_has_prefix (name, "metadata.platform.locale."))
|
||||
if (strcmp (name, "metadata.platform.locale") == 0)
|
||||
{
|
||||
g_print ("exporting %s.Locale to repo\n", platform_id);
|
||||
language = NULL;
|
||||
}
|
||||
else if (g_str_has_prefix (name, "metadata.platform.locale."))
|
||||
{
|
||||
language = name + strlen ("metadata.platform.locale.");
|
||||
g_print ("exporting %s.Locale.%s to repo\n", platform_id, language);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
language = name + strlen ("metadata.platform.locale.");
|
||||
|
||||
g_print ("exporting %s.Locale.%s to repo\n", platform_id, language);
|
||||
|
||||
metadata_arg = g_strdup_printf ("--metadata=%s", name);
|
||||
files_arg = g_strconcat ("--files=platform/share/runtime/locale/", language, NULL);
|
||||
|
||||
Reference in new issue
Block a user