[ostree] show: add option --gpg-homedir



commit cd93780d974866069793932c8437ba4cf83ec3a7
Author: Giuseppe Scrivano <gscrivan redhat com>
Date:   Mon Apr 27 11:15:40 2015 +0200

    show: add option --gpg-homedir
    
    Signed-off-by: Giuseppe Scrivano <gscrivan redhat com>

 doc/ostree-show.xml             |    8 ++++++++
 src/ostree/ot-builtin-show.c    |    5 ++++-
 tests/test-gpg-signed-commit.sh |    3 +++
 3 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/doc/ostree-show.xml b/doc/ostree-show.xml
index 8b012e5..f449b51 100644
--- a/doc/ostree-show.xml
+++ b/doc/ostree-show.xml
@@ -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>
 
diff --git a/src/ostree/ot-builtin-show.c b/src/ostree/ot-builtin-show.c
index e471ced..1729f91 100644
--- a/src/ostree/ot-builtin-show.c
+++ b/src/ostree/ot-builtin-show.c
@@ -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))
diff --git a/tests/test-gpg-signed-commit.sh b/tests/test-gpg-signed-commit.sh
index 49fb490..ba361c7 100644
--- a/tests/test-gpg-signed-commit.sh
+++ b/tests/test-gpg-signed-commit.sh
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]