diff --git a/app/xdg-app-builtins-build-export.c b/app/xdg-app-builtins-build-export.c
index 345f93b6..d4b26e9d 100644
--- a/app/xdg-app-builtins-build-export.c
+++ b/app/xdg-app-builtins-build-export.c
@@ -33,6 +33,7 @@
static char *opt_subject;
static char *opt_body;
+static char *opt_arch;
static gboolean opt_runtime;
static gboolean opt_update_appstream;
static char **opt_gpg_key_ids;
@@ -45,6 +46,7 @@ static char *opt_metadata;
static GOptionEntry options[] = {
{ "subject", 's', 0, G_OPTION_ARG_STRING, &opt_subject, "One line subject", "SUBJECT" },
{ "body", 'b', 0, G_OPTION_ARG_STRING, &opt_body, "Full description", "BODY" },
+ { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, "Architecture to export for (must be host compatible)", "ARCH" },
{ "runtime", 'r', 0, G_OPTION_ARG_NONE, &opt_runtime, "Commit runtime (/usr), not /app" },
{ "update-appstream", 0, 0, G_OPTION_ARG_NONE, &opt_runtime, "Update the appstream branch" },
{ "files", 0, 0, G_OPTION_ARG_STRING, &opt_files, "Use alternative directory for the files", "SUBDIR"},
@@ -65,6 +67,12 @@ metadata_get_arch (GFile *file, char **out_arch, GError **error)
g_autofree char *runtime = NULL;
g_auto(GStrv) parts = NULL;
+ if (opt_arch != NULL)
+ {
+ *out_arch = g_strdup (opt_arch);
+ return TRUE;
+ }
+
keyfile = g_key_file_new ();
path = g_file_get_path (file);
if (!g_key_file_load_from_file (keyfile, path, G_KEY_FILE_NONE, error))
diff --git a/builder/xdg-app-builder-main.c b/builder/xdg-app-builder-main.c
index 21073472..60574580 100644
--- a/builder/xdg-app-builder-main.c
+++ b/builder/xdg-app-builder-main.c
@@ -98,8 +98,9 @@ usage (GOptionContext *context, const char *message)
static const char skip_arg[] = "skip";
static gboolean
-do_export (GError **error,
- gboolean runtime,
+do_export (BuilderContext *build_context,
+ GError **error,
+ gboolean runtime,
...)
{
va_list ap;
@@ -113,6 +114,8 @@ do_export (GError **error,
g_ptr_array_add (args, g_strdup ("xdg-app"));
g_ptr_array_add (args, g_strdup ("build-export"));
+ g_ptr_array_add (args, g_strdup_printf ("--arch=%s", builder_context_get_arch (build_context)));
+
if (runtime)
g_ptr_array_add (args, g_strdup ("--runtime"));
@@ -369,7 +372,7 @@ main (int argc,
g_print ("exporting %s to repo\n", builder_manifest_get_id (manifest));
- if (!do_export (&error,
+ if (!do_export (build_context, &error,
builder_context_get_build_runtime (build_context),
"--exclude=/lib/debug/*",
"--include=/lib/debug/app",
@@ -402,7 +405,7 @@ main (int argc,
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/", NULL);
- if (!do_export (&error, TRUE,
+ if (!do_export (build_context, &error, TRUE,
metadata_arg,
files_arg,
opt_repo, app_dir_path, builder_manifest_get_branch (manifest), NULL))
@@ -418,7 +421,7 @@ main (int argc,
{
g_print ("exporting %s.Debug to repo\n", builder_manifest_get_id (manifest));
- if (!do_export (&error, TRUE,
+ if (!do_export (build_context, &error, TRUE,
"--metadata=metadata.debuginfo",
builder_context_get_build_runtime (build_context) ? "--files=usr/lib/debug" : "--files=files/lib/debug",
opt_repo, app_dir_path, builder_manifest_get_branch (manifest), NULL))
@@ -435,7 +438,7 @@ main (int argc,
{
g_print ("exporting %s to repo\n", platform_id);
- if (!do_export (&error, TRUE,
+ if (!do_export (build_context, &error, TRUE,
"--metadata=metadata.platform",
"--files=platform",
builder_context_get_separate_locales (build_context) ? "--exclude=/share/runtime/locale/*/*" : skip_arg,
@@ -467,7 +470,7 @@ main (int argc,
metadata_arg = g_strdup_printf ("--metadata=%s", name);
files_arg = g_strconcat ("--files=platform/share/runtime/locale/", NULL);
- if (!do_export (&error, TRUE,
+ if (!do_export (build_context, &error, TRUE,
metadata_arg,
files_arg,
opt_repo, app_dir_path, builder_manifest_get_branch (manifest), NULL))
diff --git a/doc/xdg-app-build-export.xml b/doc/xdg-app-build-export.xml
index 155d0145..5b32a313 100644
--- a/doc/xdg-app-build-export.xml
+++ b/doc/xdg-app-build-export.xml
@@ -102,6 +102,14 @@
+
+
+
+
+ Specify the architecture component of the branch to export. Only host compatible architectures can be specified.
+
+
+