forked from Mirrors/flatpak-builder
Support passing --token-type to build-export
Provide a --token-type command line option and a token-type manifest property that allows passing the token type to build-export. The manifest property takes precendence over the CLI option. In either case, the value will be passed to build-export if it's >= 0. This requires flatpak >= 1.6 to use the --token-type option in build-export.master
parent
3fda50c199
commit
aec06b3945
|
@ -428,6 +428,19 @@
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>--token-type=VAL</option></term>
|
||||||
|
|
||||||
|
<listitem><para>
|
||||||
|
Set type of token needed to install this commit.
|
||||||
|
Setting this to a value greater than 0 implies that
|
||||||
|
authentication will be needed to install the
|
||||||
|
flatpak. A <option>token-type</option> property set
|
||||||
|
in the manifest takes precedence over this option.
|
||||||
|
Used when exporting the build results.
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>--gpg-sign=KEYID</option></term>
|
<term><option>--gpg-sign=KEYID</option></term>
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,13 @@
|
||||||
locations for the same extension point defined with different tags
|
locations for the same extension point defined with different tags
|
||||||
then an error will occur.</para></listitem>
|
then an error will occur.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>token-type</option> (integer)</term>
|
||||||
|
<listitem><para>The type of token needed to install
|
||||||
|
this commit. Setting this to a value greater than 0
|
||||||
|
implies that authentication will be needed to
|
||||||
|
install the flatpak.</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>runtime</option> (string)</term>
|
<term><option>runtime</option> (string)</term>
|
||||||
<listitem><para>The name of the runtime that the application uses.</para></listitem>
|
<listitem><para>The name of the runtime that the application uses.</para></listitem>
|
||||||
|
|
|
@ -71,6 +71,7 @@ static char *opt_repo;
|
||||||
static char *opt_subject;
|
static char *opt_subject;
|
||||||
static char *opt_body;
|
static char *opt_body;
|
||||||
static char *opt_collection_id = NULL;
|
static char *opt_collection_id = NULL;
|
||||||
|
static int opt_token_type = -1;
|
||||||
static char *opt_gpg_homedir;
|
static char *opt_gpg_homedir;
|
||||||
static char **opt_key_ids;
|
static char **opt_key_ids;
|
||||||
static char **opt_sources_dirs;
|
static char **opt_sources_dirs;
|
||||||
|
@ -118,6 +119,7 @@ static GOptionEntry entries[] = {
|
||||||
{ "subject", 's', 0, G_OPTION_ARG_STRING, &opt_subject, "One line subject (passed to build-export)", "SUBJECT" },
|
{ "subject", 's', 0, G_OPTION_ARG_STRING, &opt_subject, "One line subject (passed to build-export)", "SUBJECT" },
|
||||||
{ "body", 'b', 0, G_OPTION_ARG_STRING, &opt_body, "Full description (passed to build-export)", "BODY" },
|
{ "body", 'b', 0, G_OPTION_ARG_STRING, &opt_body, "Full description (passed to build-export)", "BODY" },
|
||||||
{ "collection-id", 0, 0, G_OPTION_ARG_STRING, &opt_collection_id, "Collection ID (passed to build-export)", "COLLECTION-ID" },
|
{ "collection-id", 0, 0, G_OPTION_ARG_STRING, &opt_collection_id, "Collection ID (passed to build-export)", "COLLECTION-ID" },
|
||||||
|
{ "token-type", 0, 0, G_OPTION_ARG_INT, &opt_token_type, "Set type of token needed to install this commit (passed to build-export)", "VAL" },
|
||||||
{ "gpg-sign", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_key_ids, "GPG Key ID to sign the commit with", "KEY-ID"},
|
{ "gpg-sign", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_key_ids, "GPG Key ID to sign the commit with", "KEY-ID"},
|
||||||
{ "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, "GPG Homedir to use when looking for keyrings", "HOMEDIR"},
|
{ "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, "GPG Homedir to use when looking for keyrings", "HOMEDIR"},
|
||||||
{ "force-clean", 0, 0, G_OPTION_ARG_NONE, &opt_force_clean, "Erase previous contents of DIRECTORY", NULL },
|
{ "force-clean", 0, 0, G_OPTION_ARG_NONE, &opt_force_clean, "Erase previous contents of DIRECTORY", NULL },
|
||||||
|
@ -199,6 +201,7 @@ do_export (BuilderContext *build_context,
|
||||||
char **exclude_dirs,
|
char **exclude_dirs,
|
||||||
const gchar *branch,
|
const gchar *branch,
|
||||||
const gchar *collection_id,
|
const gchar *collection_id,
|
||||||
|
gint32 token_type,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -231,8 +234,11 @@ do_export (BuilderContext *build_context,
|
||||||
if (collection_id)
|
if (collection_id)
|
||||||
g_ptr_array_add (args, g_strdup_printf ("--collection-id=%s", collection_id));
|
g_ptr_array_add (args, g_strdup_printf ("--collection-id=%s", collection_id));
|
||||||
|
|
||||||
|
if (token_type >= 0)
|
||||||
|
g_ptr_array_add (args, g_strdup_printf ("--token-type=%d", token_type));
|
||||||
|
|
||||||
/* Additional flags. */
|
/* Additional flags. */
|
||||||
va_start (ap, collection_id);
|
va_start (ap, token_type);
|
||||||
while ((arg = va_arg (ap, const gchar *)))
|
while ((arg = va_arg (ap, const gchar *)))
|
||||||
if (arg != skip_arg)
|
if (arg != skip_arg)
|
||||||
g_ptr_array_add (args, g_strdup ((gchar *) arg));
|
g_ptr_array_add (args, g_strdup ((gchar *) arg));
|
||||||
|
@ -501,6 +507,16 @@ main (int argc,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opt_token_type < -1
|
||||||
|
#if G_MAXINT > 0x7fffffff
|
||||||
|
|| opt_token_type > G_MAXINT32
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
{
|
||||||
|
g_printerr ("--token-type value must be a 32 bit integer >= 0\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (app_dir_path)
|
if (app_dir_path)
|
||||||
app_dir = g_file_new_for_path (app_dir_path);
|
app_dir = g_file_new_for_path (app_dir_path);
|
||||||
cwd = g_get_current_dir ();
|
cwd = g_get_current_dir ();
|
||||||
|
@ -669,6 +685,9 @@ main (int argc,
|
||||||
if (opt_collection_id)
|
if (opt_collection_id)
|
||||||
builder_manifest_set_default_collection_id (manifest, opt_collection_id);
|
builder_manifest_set_default_collection_id (manifest, opt_collection_id);
|
||||||
|
|
||||||
|
if (opt_token_type >= 0)
|
||||||
|
builder_manifest_set_default_token_type (manifest, (gint32)opt_token_type);
|
||||||
|
|
||||||
if (is_run && argc == 3)
|
if (is_run && argc == 3)
|
||||||
return usage (context, "Program to run must be specified");
|
return usage (context, "Program to run must be specified");
|
||||||
|
|
||||||
|
@ -993,6 +1012,7 @@ main (int argc,
|
||||||
flatpak_file_get_path_cached (export_repo),
|
flatpak_file_get_path_cached (export_repo),
|
||||||
app_dir_path, exclude_dirs, builder_manifest_get_branch (manifest, build_context),
|
app_dir_path, exclude_dirs, builder_manifest_get_branch (manifest, build_context),
|
||||||
builder_manifest_get_collection_id (manifest),
|
builder_manifest_get_collection_id (manifest),
|
||||||
|
builder_manifest_get_token_type (manifest),
|
||||||
"--exclude=/lib/debug/*",
|
"--exclude=/lib/debug/*",
|
||||||
"--include=/lib/debug/app",
|
"--include=/lib/debug/app",
|
||||||
builder_context_get_separate_locales (build_context) ? "--exclude=/share/runtime/locale/*/*" : skip_arg,
|
builder_context_get_separate_locales (build_context) ? "--exclude=/share/runtime/locale/*/*" : skip_arg,
|
||||||
|
@ -1027,6 +1047,7 @@ main (int argc,
|
||||||
flatpak_file_get_path_cached (export_repo),
|
flatpak_file_get_path_cached (export_repo),
|
||||||
app_dir_path, NULL, builder_manifest_get_branch (manifest, build_context),
|
app_dir_path, NULL, builder_manifest_get_branch (manifest, build_context),
|
||||||
builder_manifest_get_collection_id (manifest),
|
builder_manifest_get_collection_id (manifest),
|
||||||
|
builder_manifest_get_token_type (manifest),
|
||||||
metadata_arg,
|
metadata_arg,
|
||||||
files_arg,
|
files_arg,
|
||||||
NULL))
|
NULL))
|
||||||
|
@ -1047,6 +1068,7 @@ main (int argc,
|
||||||
flatpak_file_get_path_cached (export_repo),
|
flatpak_file_get_path_cached (export_repo),
|
||||||
app_dir_path, NULL, builder_manifest_get_branch (manifest, build_context),
|
app_dir_path, NULL, builder_manifest_get_branch (manifest, build_context),
|
||||||
builder_manifest_get_collection_id (manifest),
|
builder_manifest_get_collection_id (manifest),
|
||||||
|
builder_manifest_get_token_type (manifest),
|
||||||
"--metadata=metadata.debuginfo",
|
"--metadata=metadata.debuginfo",
|
||||||
builder_context_get_build_runtime (build_context) ? "--files=usr/lib/debug" : "--files=files/lib/debug",
|
builder_context_get_build_runtime (build_context) ? "--files=usr/lib/debug" : "--files=files/lib/debug",
|
||||||
NULL))
|
NULL))
|
||||||
|
@ -1078,6 +1100,7 @@ main (int argc,
|
||||||
flatpak_file_get_path_cached (export_repo),
|
flatpak_file_get_path_cached (export_repo),
|
||||||
app_dir_path, NULL, builder_manifest_get_branch (manifest, build_context),
|
app_dir_path, NULL, builder_manifest_get_branch (manifest, build_context),
|
||||||
builder_manifest_get_collection_id (manifest),
|
builder_manifest_get_collection_id (manifest),
|
||||||
|
builder_manifest_get_token_type (manifest),
|
||||||
metadata_arg, files_arg,
|
metadata_arg, files_arg,
|
||||||
NULL))
|
NULL))
|
||||||
{
|
{
|
||||||
|
@ -1097,6 +1120,7 @@ main (int argc,
|
||||||
flatpak_file_get_path_cached (export_repo),
|
flatpak_file_get_path_cached (export_repo),
|
||||||
app_dir_path, NULL, builder_manifest_get_branch (manifest, build_context),
|
app_dir_path, NULL, builder_manifest_get_branch (manifest, build_context),
|
||||||
builder_manifest_get_collection_id (manifest),
|
builder_manifest_get_collection_id (manifest),
|
||||||
|
builder_manifest_get_token_type (manifest),
|
||||||
"--metadata=metadata.sources",
|
"--metadata=metadata.sources",
|
||||||
"--files=sources",
|
"--files=sources",
|
||||||
NULL))
|
NULL))
|
||||||
|
@ -1117,6 +1141,7 @@ main (int argc,
|
||||||
flatpak_file_get_path_cached (export_repo),
|
flatpak_file_get_path_cached (export_repo),
|
||||||
app_dir_path, NULL, builder_manifest_get_branch (manifest, build_context),
|
app_dir_path, NULL, builder_manifest_get_branch (manifest, build_context),
|
||||||
builder_manifest_get_collection_id (manifest),
|
builder_manifest_get_collection_id (manifest),
|
||||||
|
builder_manifest_get_token_type (manifest),
|
||||||
"--metadata=metadata.platform",
|
"--metadata=metadata.platform",
|
||||||
"--files=platform",
|
"--files=platform",
|
||||||
builder_context_get_separate_locales (build_context) ? "--exclude=/share/runtime/locale/*/*" : skip_arg,
|
builder_context_get_separate_locales (build_context) ? "--exclude=/share/runtime/locale/*/*" : skip_arg,
|
||||||
|
@ -1151,6 +1176,7 @@ main (int argc,
|
||||||
flatpak_file_get_path_cached (export_repo),
|
flatpak_file_get_path_cached (export_repo),
|
||||||
app_dir_path, NULL, builder_manifest_get_branch (manifest, build_context),
|
app_dir_path, NULL, builder_manifest_get_branch (manifest, build_context),
|
||||||
builder_manifest_get_collection_id (manifest),
|
builder_manifest_get_collection_id (manifest),
|
||||||
|
builder_manifest_get_token_type (manifest),
|
||||||
metadata_arg,
|
metadata_arg,
|
||||||
files_arg,
|
files_arg,
|
||||||
NULL))
|
NULL))
|
||||||
|
|
|
@ -63,6 +63,7 @@ struct BuilderManifest
|
||||||
char *branch;
|
char *branch;
|
||||||
char *default_branch;
|
char *default_branch;
|
||||||
char *collection_id;
|
char *collection_id;
|
||||||
|
gint32 token_type;
|
||||||
char *extension_tag;
|
char *extension_tag;
|
||||||
char *type;
|
char *type;
|
||||||
char *runtime;
|
char *runtime;
|
||||||
|
@ -167,6 +168,7 @@ enum {
|
||||||
PROP_ADD_EXTENSIONS,
|
PROP_ADD_EXTENSIONS,
|
||||||
PROP_ADD_BUILD_EXTENSIONS,
|
PROP_ADD_BUILD_EXTENSIONS,
|
||||||
PROP_EXTENSION_TAG,
|
PROP_EXTENSION_TAG,
|
||||||
|
PROP_TOKEN_TYPE,
|
||||||
LAST_PROP
|
LAST_PROP
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -470,6 +472,10 @@ builder_manifest_get_property (GObject *object,
|
||||||
g_value_set_string (value, self->extension_tag);
|
g_value_set_string (value, self->extension_tag);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_TOKEN_TYPE:
|
||||||
|
g_value_set_int (value, (int)self->token_type);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
}
|
}
|
||||||
|
@ -729,6 +735,10 @@ builder_manifest_set_property (GObject *object,
|
||||||
self->extension_tag = g_value_dup_string (value);
|
self->extension_tag = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_TOKEN_TYPE:
|
||||||
|
self->token_type = (gint32)g_value_get_int (value);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
}
|
}
|
||||||
|
@ -1070,11 +1080,22 @@ builder_manifest_class_init (BuilderManifestClass *klass)
|
||||||
"",
|
"",
|
||||||
NULL,
|
NULL,
|
||||||
G_PARAM_READWRITE));
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_TOKEN_TYPE,
|
||||||
|
g_param_spec_int ("token-type",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
-1,
|
||||||
|
G_MAXINT32,
|
||||||
|
-1,
|
||||||
|
G_PARAM_READWRITE));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
builder_manifest_init (BuilderManifest *self)
|
builder_manifest_init (BuilderManifest *self)
|
||||||
{
|
{
|
||||||
|
self->token_type = -1;
|
||||||
self->appstream_compose = TRUE;
|
self->appstream_compose = TRUE;
|
||||||
self->separate_locales = TRUE;
|
self->separate_locales = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1426,6 +1447,20 @@ builder_manifest_set_default_collection_id (BuilderManifest *self,
|
||||||
self->collection_id = g_strdup (default_collection_id);
|
self->collection_id = g_strdup (default_collection_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gint32
|
||||||
|
builder_manifest_get_token_type (BuilderManifest *self)
|
||||||
|
{
|
||||||
|
return self->token_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
builder_manifest_set_default_token_type (BuilderManifest *self,
|
||||||
|
gint32 default_token_type)
|
||||||
|
{
|
||||||
|
if (self->token_type == -1)
|
||||||
|
self->token_type = default_token_type;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
builder_manifest_add_tags (BuilderManifest *self,
|
builder_manifest_add_tags (BuilderManifest *self,
|
||||||
const char **add_tags)
|
const char **add_tags)
|
||||||
|
|
|
@ -62,9 +62,12 @@ GList * builder_manifest_get_add_build_extensions (BuilderManifest *self
|
||||||
const char * builder_manifest_get_branch (BuilderManifest *self,
|
const char * builder_manifest_get_branch (BuilderManifest *self,
|
||||||
BuilderContext *context);
|
BuilderContext *context);
|
||||||
const char * builder_manifest_get_collection_id (BuilderManifest *self);
|
const char * builder_manifest_get_collection_id (BuilderManifest *self);
|
||||||
|
gint32 builder_manifest_get_token_type (BuilderManifest *self);
|
||||||
const char * builder_manifest_get_extension_tag (BuilderManifest *self);
|
const char * builder_manifest_get_extension_tag (BuilderManifest *self);
|
||||||
void builder_manifest_set_default_collection_id (BuilderManifest *self,
|
void builder_manifest_set_default_collection_id (BuilderManifest *self,
|
||||||
const char *default_collection_id);
|
const char *default_collection_id);
|
||||||
|
void builder_manifest_set_default_token_type (BuilderManifest *self,
|
||||||
|
gint32 default_token_type);
|
||||||
|
|
||||||
void builder_manifest_add_tags (BuilderManifest *self,
|
void builder_manifest_add_tags (BuilderManifest *self,
|
||||||
const char **add_tags);
|
const char **add_tags);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
"sdk": "org.test.Sdk",
|
"sdk": "org.test.Sdk",
|
||||||
"command": "hello2.sh",
|
"command": "hello2.sh",
|
||||||
"tags": ["test"],
|
"tags": ["test"],
|
||||||
|
"token-type": 0,
|
||||||
"finish-args": [
|
"finish-args": [
|
||||||
"--share=network"
|
"--share=network"
|
||||||
],
|
],
|
||||||
|
|
|
@ -3,6 +3,7 @@ runtime: org.test.Platform
|
||||||
sdk: org.test.Sdk
|
sdk: org.test.Sdk
|
||||||
command: hello2.sh
|
command: hello2.sh
|
||||||
tags: [test]
|
tags: [test]
|
||||||
|
token-type: 0
|
||||||
finish-args:
|
finish-args:
|
||||||
- --share=network
|
- --share=network
|
||||||
build-options:
|
build-options:
|
||||||
|
|
Loading…
Reference in New Issue