@@ -71,6 +71,7 @@ static char *opt_repo;
7171static char * opt_subject ;
7272static char * opt_body ;
7373static char * opt_collection_id = NULL ;
74+ static int opt_token_type = -1 ;
7475static char * opt_gpg_homedir ;
7576static char * * opt_key_ids ;
7677static char * * opt_sources_dirs ;
@@ -118,6 +119,7 @@ static GOptionEntry entries[] = {
118119 { "subject" , 's' , 0 , G_OPTION_ARG_STRING , & opt_subject , "One line subject (passed to build-export)" , "SUBJECT" },
119120 { "body" , 'b' , 0 , G_OPTION_ARG_STRING , & opt_body , "Full description (passed to build-export)" , "BODY" },
120121 { "collection-id" , 0 , 0 , G_OPTION_ARG_STRING , & opt_collection_id , "Collection ID (passed to build-export)" , "COLLECTION-ID" },
122+ { "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" },
121123 { "gpg-sign" , 0 , 0 , G_OPTION_ARG_STRING_ARRAY , & opt_key_ids , "GPG Key ID to sign the commit with" , "KEY-ID" },
122124 { "gpg-homedir" , 0 , 0 , G_OPTION_ARG_STRING , & opt_gpg_homedir , "GPG Homedir to use when looking for keyrings" , "HOMEDIR" },
123125 { "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,
199201 char * * exclude_dirs ,
200202 const gchar * branch ,
201203 const gchar * collection_id ,
204+ gint32 token_type ,
202205 ...)
203206{
204207 va_list ap ;
@@ -231,8 +234,11 @@ do_export (BuilderContext *build_context,
231234 if (collection_id )
232235 g_ptr_array_add (args , g_strdup_printf ("--collection-id=%s" , collection_id ));
233236
237+ if (token_type >= 0 )
238+ g_ptr_array_add (args , g_strdup_printf ("--token-type=%d" , token_type ));
239+
234240 /* Additional flags. */
235- va_start (ap , collection_id );
241+ va_start (ap , token_type );
236242 while ((arg = va_arg (ap , const gchar * )))
237243 if (arg != skip_arg )
238244 g_ptr_array_add (args , g_strdup ((gchar * ) arg ));
@@ -501,6 +507,16 @@ main (int argc,
501507 return 1 ;
502508 }
503509
510+ if (opt_token_type < -1
511+ #if G_MAXINT > 0x7fffffff
512+ || opt_token_type > G_MAXINT32
513+ #endif
514+ )
515+ {
516+ g_printerr ("--token-type value must be a 32 bit integer >= 0\n" );
517+ return 1 ;
518+ }
519+
504520 if (app_dir_path )
505521 app_dir = g_file_new_for_path (app_dir_path );
506522 cwd = g_get_current_dir ();
@@ -669,6 +685,9 @@ main (int argc,
669685 if (opt_collection_id )
670686 builder_manifest_set_default_collection_id (manifest , opt_collection_id );
671687
688+ if (opt_token_type >= 0 )
689+ builder_manifest_set_default_token_type (manifest , (gint32 )opt_token_type );
690+
672691 if (is_run && argc == 3 )
673692 return usage (context , "Program to run must be specified" );
674693
@@ -993,6 +1012,7 @@ main (int argc,
9931012 flatpak_file_get_path_cached (export_repo ),
9941013 app_dir_path , exclude_dirs , builder_manifest_get_branch (manifest , build_context ),
9951014 builder_manifest_get_collection_id (manifest ),
1015+ builder_manifest_get_token_type (manifest ),
9961016 "--exclude=/lib/debug/*" ,
9971017 "--include=/lib/debug/app" ,
9981018 builder_context_get_separate_locales (build_context ) ? "--exclude=/share/runtime/locale/*/*" : skip_arg ,
@@ -1027,6 +1047,7 @@ main (int argc,
10271047 flatpak_file_get_path_cached (export_repo ),
10281048 app_dir_path , NULL , builder_manifest_get_branch (manifest , build_context ),
10291049 builder_manifest_get_collection_id (manifest ),
1050+ builder_manifest_get_token_type (manifest ),
10301051 metadata_arg ,
10311052 files_arg ,
10321053 NULL ))
@@ -1047,6 +1068,7 @@ main (int argc,
10471068 flatpak_file_get_path_cached (export_repo ),
10481069 app_dir_path , NULL , builder_manifest_get_branch (manifest , build_context ),
10491070 builder_manifest_get_collection_id (manifest ),
1071+ builder_manifest_get_token_type (manifest ),
10501072 "--metadata=metadata.debuginfo" ,
10511073 builder_context_get_build_runtime (build_context ) ? "--files=usr/lib/debug" : "--files=files/lib/debug" ,
10521074 NULL ))
@@ -1078,6 +1100,7 @@ main (int argc,
10781100 flatpak_file_get_path_cached (export_repo ),
10791101 app_dir_path , NULL , builder_manifest_get_branch (manifest , build_context ),
10801102 builder_manifest_get_collection_id (manifest ),
1103+ builder_manifest_get_token_type (manifest ),
10811104 metadata_arg , files_arg ,
10821105 NULL ))
10831106 {
@@ -1097,6 +1120,7 @@ main (int argc,
10971120 flatpak_file_get_path_cached (export_repo ),
10981121 app_dir_path , NULL , builder_manifest_get_branch (manifest , build_context ),
10991122 builder_manifest_get_collection_id (manifest ),
1123+ builder_manifest_get_token_type (manifest ),
11001124 "--metadata=metadata.sources" ,
11011125 "--files=sources" ,
11021126 NULL ))
@@ -1117,6 +1141,7 @@ main (int argc,
11171141 flatpak_file_get_path_cached (export_repo ),
11181142 app_dir_path , NULL , builder_manifest_get_branch (manifest , build_context ),
11191143 builder_manifest_get_collection_id (manifest ),
1144+ builder_manifest_get_token_type (manifest ),
11201145 "--metadata=metadata.platform" ,
11211146 "--files=platform" ,
11221147 builder_context_get_separate_locales (build_context ) ? "--exclude=/share/runtime/locale/*/*" : skip_arg ,
@@ -1151,6 +1176,7 @@ main (int argc,
11511176 flatpak_file_get_path_cached (export_repo ),
11521177 app_dir_path , NULL , builder_manifest_get_branch (manifest , build_context ),
11531178 builder_manifest_get_collection_id (manifest ),
1179+ builder_manifest_get_token_type (manifest ),
11541180 metadata_arg ,
11551181 files_arg ,
11561182 NULL ))
0 commit comments