repo: Introspect _sign_commit() and _verify_commit()
We can't use #ifdef in the headers, since then g-ir-scanner won't pick up the functions (unless we included config.h). Let's instead always have the symbols, but just set an error if we were built without support for it, just like how pull works.
This commit is contained in:
parent
a58d3d079c
commit
9adbc165e7
|
|
@ -1478,7 +1478,6 @@ ostree_repo_pull (OstreeRepo *self,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GPGME
|
||||
gboolean
|
||||
ostree_repo_sign_commit (OstreeRepo *self,
|
||||
const gchar *commit_checksum,
|
||||
|
|
@ -1487,6 +1486,7 @@ ostree_repo_sign_commit (OstreeRepo *self,
|
|||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
#ifdef HAVE_GPGME
|
||||
gboolean ret = FALSE;
|
||||
gs_unref_object GFile *commit_path = NULL;
|
||||
gs_unref_variant GVariant *metadata = NULL;
|
||||
|
|
@ -1648,6 +1648,11 @@ out:
|
|||
if (signature_file)
|
||||
g_mapped_file_unref (signature_file);
|
||||
return ret;
|
||||
#else
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
"This version of ostree was compiled without GPG support");
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1670,6 +1675,7 @@ ostree_repo_verify_commit (OstreeRepo *self,
|
|||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
#ifdef HAVE_GPGME
|
||||
gboolean ret = FALSE;
|
||||
gs_unref_object OstreeGpgVerifier *verifier = NULL;
|
||||
gs_unref_variant GVariant *commit_variant = NULL;
|
||||
|
|
@ -1778,6 +1784,9 @@ out:
|
|||
if (commit_tmp_path)
|
||||
(void) gs_file_unlink (commit_tmp_path, NULL, NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#else
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
"This version of ostree was compiled without GPG support");
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -466,7 +466,6 @@ gboolean ostree_repo_pull (OstreeRepo *self,
|
|||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
#ifdef HAVE_GPGME
|
||||
gboolean ostree_repo_sign_commit (OstreeRepo *self,
|
||||
const gchar *commit_checksum,
|
||||
const gchar *key_id,
|
||||
|
|
@ -480,7 +479,6 @@ gboolean ostree_repo_verify_commit (OstreeRepo *self,
|
|||
GFile *extra_keyring,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue