build-export: Add support for signing build

tingping/wmclass
Alexander Larsson 2015-10-05 11:13:36 +02:00
parent dda045d808
commit 7791ea130f
2 changed files with 38 additions and 0 deletions

View File

@ -33,10 +33,14 @@
static char *opt_subject;
static char *opt_body;
static char **opt_key_ids;
static char *opt_gpg_homedir;
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" },
{ "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"},
{ NULL }
};
@ -251,6 +255,24 @@ xdg_app_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
&commit_checksum, cancellable, error))
goto out;
if (opt_key_ids)
{
char **iter;
for (iter = opt_key_ids; iter && *iter; iter++)
{
const char *keyid = *iter;
if (!ostree_repo_sign_commit (repo,
commit_checksum,
keyid,
opt_gpg_homedir,
cancellable,
error))
goto out;
}
}
ostree_repo_transaction_set_ref (repo, NULL, full_branch, commit_checksum);
if (!ostree_repo_commit_transaction (repo, &stats, cancellable, error))

View File

@ -102,6 +102,22 @@
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--gpg-sign=KEYID</option></term>
<listitem><para>
Sign the commit with this GPG key
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--gpg-homedir=PATH</option></term>
<listitem><para>
GPG Homedir to use when looking for keyrings
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-v</option></term>
<term><option>--verbose</option></term>