mirror of
https://github.com/ostreedev/ostree.git
synced 2024-12-22 17:35:55 +03:00
show: add option --gpg-homedir
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
f37cbe1fc9
commit
cd93780d97
@ -104,6 +104,14 @@ Boston, MA 02111-1307, USA.
|
||||
Show raw variant data.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--gpg-homedir</option>="HOMEDIR"</term>
|
||||
|
||||
<listitem><para>
|
||||
GPG home directory to use when looking for keyrings (if have GPGME - GNU Privacy Guard Made Easy).
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
|
@ -33,6 +33,7 @@ static char* opt_print_variant_type;
|
||||
static char* opt_print_metadata_key;
|
||||
static char* opt_print_detached_metadata_key;
|
||||
static gboolean opt_raw;
|
||||
static char *opt_gpg_homedir;
|
||||
|
||||
static GOptionEntry options[] = {
|
||||
{ "print-related", 0, 0, G_OPTION_ARG_NONE, &opt_print_related, "Show the \"related\" commits", NULL },
|
||||
@ -40,6 +41,7 @@ static GOptionEntry options[] = {
|
||||
{ "print-metadata-key", 0, 0, G_OPTION_ARG_STRING, &opt_print_metadata_key, "Print string value of metadata key", "KEY" },
|
||||
{ "print-detached-metadata-key", 0, 0, G_OPTION_ARG_STRING, &opt_print_detached_metadata_key, "Print string value of detached metadata key", "KEY" },
|
||||
{ "raw", 0, 0, G_OPTION_ARG_NONE, &opt_raw, "Show raw variant data" },
|
||||
{ "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, "GPG Homedir to use when looking for keyrings", "HOMEDIR"},
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@ -169,9 +171,10 @@ print_object (OstreeRepo *repo,
|
||||
{
|
||||
gs_unref_object OstreeGpgVerifyResult *result = NULL;
|
||||
GError *local_error = NULL;
|
||||
gs_unref_object GFile *gpg_homedir = opt_gpg_homedir ? g_file_new_for_path (opt_gpg_homedir) : NULL;
|
||||
|
||||
result = ostree_repo_verify_commit_ext (repo, checksum,
|
||||
NULL, NULL, NULL,
|
||||
gpg_homedir, NULL, NULL,
|
||||
&local_error);
|
||||
|
||||
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
|
@ -37,6 +37,9 @@ ${OSTREE} show test2 | grep -o 'Found [[:digit:]] signature' > test2-show
|
||||
# tests will actually do verification
|
||||
assert_file_has_content test2-show 'Found 1 signature'
|
||||
|
||||
${OSTREE} show --gpg-homedir=${TEST_GPG_KEYHOME} test2 | grep -o 'Found [[:digit:]] signature' > test2-show
|
||||
assert_file_has_content test2-show 'Found 1 signature'
|
||||
|
||||
# Now sign a commit with 3 different keys
|
||||
cd ${test_tmpdir}
|
||||
${OSTREE} commit -b test2 -s "A GPG signed commit" -m "Signed commit body" --gpg-sign=${TEST_GPG_KEYID_1} --gpg-sign=${TEST_GPG_KEYID_2} --gpg-sign=${TEST_GPG_KEYID_3} --gpg-homedir=${TEST_GPG_KEYHOME} --tree=dir=files
|
||||
|
Loading…
Reference in New Issue
Block a user