configure.ac: Make gpgme a hard dependency

In anticipation of API enhancements for GPG signature verification, which
would otherwise require a non-functional stub version were GPGME excluded.

GPGME is a pretty lightweight dependency, and the motivation to exclude
it is not clear.
This commit is contained in:
Matthew Barnes 2015-03-11 11:34:59 -04:00
parent 8724adc193
commit 187e8d632e
7 changed files with 11 additions and 64 deletions

View File

@ -94,6 +94,8 @@ libostree_1_la_SOURCES = \
src/libostree/ostree-repo-static-delta-compilation.c \ src/libostree/ostree-repo-static-delta-compilation.c \
src/libostree/ostree-repo-static-delta-compilation-analysis.c \ src/libostree/ostree-repo-static-delta-compilation-analysis.c \
src/libostree/ostree-repo-static-delta-private.h \ src/libostree/ostree-repo-static-delta-private.h \
src/libostree/ostree-gpg-verifier.c \
src/libostree/ostree-gpg-verifier.h \
$(NULL) $(NULL)
if USE_LIBARCHIVE if USE_LIBARCHIVE
libostree_1_la_SOURCES += src/libostree/ostree-libarchive-input-stream.h \ libostree_1_la_SOURCES += src/libostree/ostree-libarchive-input-stream.h \
@ -106,17 +108,11 @@ libostree_1_la_SOURCES += \
src/libostree/ostree-tls-cert-interaction.h \ src/libostree/ostree-tls-cert-interaction.h \
$(NULL) $(NULL)
endif endif
if USE_GPGME
libostree_1_la_SOURCES += \
src/libostree/ostree-gpg-verifier.c \
src/libostree/ostree-gpg-verifier.h \
$(NULL)
endif
libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/bsdiff -I$(srcdir)/libglnx -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree \ libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/bsdiff -I$(srcdir)/libglnx -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree \
$(OT_INTERNAL_GIO_UNIX_CFLAGS) $(OT_DEP_LZMA_CFLAGS) $(OT_DEP_ZLIB_CFLAGS) $(OT_INTERNAL_GIO_UNIX_CFLAGS) $(OT_DEP_LZMA_CFLAGS) $(OT_DEP_ZLIB_CFLAGS)
libostree_1_la_LDFLAGS = -version-number 1:0:0 -Bsymbolic-functions -export-symbols-regex '^ostree_' libostree_1_la_LDFLAGS = -version-number 1:0:0 -Bsymbolic-functions -export-symbols-regex '^ostree_'
libostree_1_la_LIBADD = libotutil.la libbupsplit.la libglnx.la libbsdiff.la libostree-kernel-args.la $(OT_INTERNAL_GIO_UNIX_LIBS) $(OT_DEP_LZMA_LIBS) $(OT_DEP_ZLIB_LIBS) libostree_1_la_LIBADD = libotutil.la libbupsplit.la libglnx.la libbsdiff.la libostree-kernel-args.la $(OT_INTERNAL_GIO_UNIX_LIBS) $(OT_DEP_LZMA_LIBS) $(OT_DEP_ZLIB_LIBS) $(GPGME_LIBS)
if USE_LIBARCHIVE if USE_LIBARCHIVE
libostree_1_la_CFLAGS += $(OT_DEP_LIBARCHIVE_CFLAGS) libostree_1_la_CFLAGS += $(OT_DEP_LIBARCHIVE_CFLAGS)
@ -157,13 +153,9 @@ endif
pkgconfig_DATA += src/libostree/ostree-1.pc pkgconfig_DATA += src/libostree/ostree-1.pc
if USE_GPGME
libostree_1_la_LIBADD += $(GPGME_LIBS)
gpgreadme_DATA = src/libostree/README-gpg gpgreadme_DATA = src/libostree/README-gpg
gpgreadmedir = $(pkgdatadir)/trusted.gpg.d gpgreadmedir = $(pkgdatadir)/trusted.gpg.d
EXTRA_DIST += src/libostree/README-gpg src/libostree/bupsplit.h EXTRA_DIST += src/libostree/README-gpg src/libostree/bupsplit.h
endif
install-mkdir-remotes-d-hook: install-mkdir-remotes-d-hook:
mkdir -p $(DESTDIR)$(sysconfdir)/ostree/remotes.d mkdir -p $(DESTDIR)$(sysconfdir)/ostree/remotes.d

View File

@ -20,7 +20,6 @@ include Makefile-decls.am
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
AM_CPPFLAGS += -DDATADIR='"$(datadir)"' -DLIBEXECDIR='"$(libexecdir)"' \ AM_CPPFLAGS += -DDATADIR='"$(datadir)"' -DLIBEXECDIR='"$(libexecdir)"' \
-DLOCALEDIR=\"$(datadir)/locale\" -DSYSCONFDIR=\"$(sysconfdir)\" \ -DLOCALEDIR=\"$(datadir)/locale\" -DSYSCONFDIR=\"$(sysconfdir)\" \
-DGPGVPATH=\"$(GPGVPATH)\" \
-DOSTREE_FEATURES='"$(OSTREE_FEATURES)"' \ -DOSTREE_FEATURES='"$(OSTREE_FEATURES)"' \
-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40 \ -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40 \
-DSOUP_VERSION_MIN_REQUIRED=SOUP_VERSION_2_40 -DSOUP_VERSION_MAX_ALLOWED=SOUP_VERSION_2_48 -DSOUP_VERSION_MIN_REQUIRED=SOUP_VERSION_2_40 -DSOUP_VERSION_MAX_ALLOWED=SOUP_VERSION_2_48

View File

@ -100,30 +100,15 @@ AM_CONDITIONAL(BUILDOPT_INTROSPECTION, test "x$found_introspection" = xyes)
LIBGPGME_DEPENDENCY="1.1.8" LIBGPGME_DEPENDENCY="1.1.8"
AC_ARG_WITH(gpgme, m4_ifdef([AM_PATH_GPGME], [
AS_HELP_STRING([--without-gpgme], [Do not use gpgme]), AM_PATH_GPGME($LIBGPGME_DEPENDENCY, have_gpgme=yes, have_gpgme=no)
:, with_gpgme=maybe) ],[ have_gpgme=no ])
AS_IF([ test x$have_gpgme = xno ], [
AC_MSG_ERROR([
AS_IF([ test x$with_gpgme != xno ], [ Need GPGME version $LIBGPGME_DEPENDENCY or later
AC_MSG_CHECKING([for $LIBGPGME_DEPENDENCY]) ])])
m4_ifdef([AM_PATH_GPGME], [ OSTREE_FEATURES="$OSTREE_FEATURES +gpgme"
AM_PATH_GPGME($LIBGPGME_DEPENDENCY, have_gpgme=yes, have_gpgme=no)
],[
AM_CONDITIONAL([have_gpgme],[false])
])
AC_MSG_RESULT([$have_gpgme])
AS_IF([ test x$have_gpgme = xno && test x$with_gpgme != xmaybe ], [
AC_MSG_ERROR([gpgme is enabled but could not be found])
])
AS_IF([ test x$have_gpgme = xyes], [
AC_DEFINE([HAVE_GPGME], 1, [Define if we have gpgme])
with_gpgme=yes
AC_PATH_PROG(GPGVPATH, [gpgv2 gpgv])
AC_SUBST(GPGVPATH)
], [ with_gpgme=no ])
], [ with_gpgme=no ])
if test x$with_gpgme != xno; then OSTREE_FEATURES="$OSTREE_FEATURES +gpgme"; fi
AM_CONDITIONAL(USE_GPGME, test $with_gpgme != no)
LIBARCHIVE_DEPENDENCY="libarchive >= 2.8.0" LIBARCHIVE_DEPENDENCY="libarchive >= 2.8.0"
@ -248,7 +233,6 @@ echo "
libsoup TLS client certs: $have_libsoup_client_certs libsoup TLS client certs: $have_libsoup_client_certs
SELinux: $with_selinux SELinux: $with_selinux
libarchive (parse tar files directly): $with_libarchive libarchive (parse tar files directly): $with_libarchive
gpgme (sign commits): $with_gpgme
static deltas: $enable_static_deltas static deltas: $enable_static_deltas
documentation: $enable_gtk_doc documentation: $enable_gtk_doc
gjs-based tests: $have_gjs gjs-based tests: $have_gjs

View File

@ -960,7 +960,6 @@ scan_commit_object (OtPullData *pull_data,
GINT_TO_POINTER (depth)); GINT_TO_POINTER (depth));
} }
#ifdef HAVE_GPGME
if (pull_data->gpg_verify) if (pull_data->gpg_verify)
{ {
if (!ostree_repo_verify_commit (pull_data->repo, if (!ostree_repo_verify_commit (pull_data->repo,
@ -971,7 +970,6 @@ scan_commit_object (OtPullData *pull_data,
error)) error))
goto out; goto out;
} }
#endif
if (!ostree_repo_load_variant (pull_data->repo, OSTREE_OBJECT_TYPE_COMMIT, checksum, if (!ostree_repo_load_variant (pull_data->repo, OSTREE_OBJECT_TYPE_COMMIT, checksum,
&commit, error)) &commit, error))
@ -1698,14 +1696,10 @@ ostree_repo_pull_with_options (OstreeRepo *self,
{ {
pull_data->remote_name = g_strdup (remote_name_or_baseurl); pull_data->remote_name = g_strdup (remote_name_or_baseurl);
#ifdef HAVE_GPGME
if (!_ostree_repo_get_remote_boolean_option (self, if (!_ostree_repo_get_remote_boolean_option (self,
remote_name_or_baseurl, "gpg-verify", remote_name_or_baseurl, "gpg-verify",
TRUE, &pull_data->gpg_verify, error)) TRUE, &pull_data->gpg_verify, error))
goto out; goto out;
#else
pull_data->gpg_verify = FALSE;
#endif
} }
pull_data->phase = OSTREE_PULL_PHASE_FETCHING_REFS; pull_data->phase = OSTREE_PULL_PHASE_FETCHING_REFS;

View File

@ -34,11 +34,9 @@
#include "ostree-repo-file-enumerator.h" #include "ostree-repo-file-enumerator.h"
#include "ostree-gpg-verifier.h" #include "ostree-gpg-verifier.h"
#ifdef HAVE_GPGME
#include <locale.h> #include <locale.h>
#include <gpgme.h> #include <gpgme.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#endif
/** /**
* SECTION:libostree-repo * SECTION:libostree-repo
@ -2937,7 +2935,6 @@ sign_data (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
#ifdef HAVE_GPGME
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_object GFile *tmp_signature_file = NULL; gs_unref_object GFile *tmp_signature_file = NULL;
gs_unref_object GOutputStream *tmp_signature_output = NULL; gs_unref_object GOutputStream *tmp_signature_output = NULL;
@ -3061,11 +3058,6 @@ out:
if (signature_file) if (signature_file)
g_mapped_file_unref (signature_file); g_mapped_file_unref (signature_file);
return ret; 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
} }
/** /**
@ -3204,7 +3196,6 @@ _ostree_repo_gpg_verify_file_with_metadata (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
#ifdef HAVE_GPGME
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_object OstreeGpgVerifier *verifier = NULL; gs_unref_object OstreeGpgVerifier *verifier = NULL;
gs_unref_variant GVariant *signaturedata = NULL; gs_unref_variant GVariant *signaturedata = NULL;
@ -3278,11 +3269,6 @@ _ostree_repo_gpg_verify_file_with_metadata (OstreeRepo *self,
ret = TRUE; ret = TRUE;
out: out:
return ret; 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
} }
/** /**

View File

@ -41,9 +41,7 @@ static OstreeCommand commands[] = {
{ "config", ostree_builtin_config }, { "config", ostree_builtin_config },
{ "diff", ostree_builtin_diff }, { "diff", ostree_builtin_diff },
{ "fsck", ostree_builtin_fsck }, { "fsck", ostree_builtin_fsck },
#ifdef HAVE_GPGME
{ "gpg-sign", ostree_builtin_gpg_sign }, { "gpg-sign", ostree_builtin_gpg_sign },
#endif
{ "init", ostree_builtin_init }, { "init", ostree_builtin_init },
{ "log", ostree_builtin_log }, { "log", ostree_builtin_log },
{ "ls", ostree_builtin_ls }, { "ls", ostree_builtin_ls },

View File

@ -43,10 +43,8 @@ static char **opt_trees;
static gint opt_owner_uid = -1; static gint opt_owner_uid = -1;
static gint opt_owner_gid = -1; static gint opt_owner_gid = -1;
static gboolean opt_table_output; static gboolean opt_table_output;
#ifdef HAVE_GPGME
static char **opt_key_ids; static char **opt_key_ids;
static char *opt_gpg_homedir; static char *opt_gpg_homedir;
#endif
static gboolean opt_generate_sizes; static gboolean opt_generate_sizes;
static gboolean opt_disable_fsync; static gboolean opt_disable_fsync;
@ -81,10 +79,8 @@ static GOptionEntry options[] = {
{ "skip-if-unchanged", 0, 0, G_OPTION_ARG_NONE, &opt_skip_if_unchanged, "If the contents are unchanged from previous commit, do nothing", NULL }, { "skip-if-unchanged", 0, 0, G_OPTION_ARG_NONE, &opt_skip_if_unchanged, "If the contents are unchanged from previous commit, do nothing", NULL },
{ "statoverride", 0, 0, G_OPTION_ARG_FILENAME, &opt_statoverride_file, "File containing list of modifications to make to permissions", "PATH" }, { "statoverride", 0, 0, G_OPTION_ARG_FILENAME, &opt_statoverride_file, "File containing list of modifications to make to permissions", "PATH" },
{ "table-output", 0, 0, G_OPTION_ARG_NONE, &opt_table_output, "Output more information in a KEY: VALUE format", NULL }, { "table-output", 0, 0, G_OPTION_ARG_NONE, &opt_table_output, "Output more information in a KEY: VALUE format", NULL },
#ifdef HAVE_GPGME
{ "gpg-sign", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_key_ids, "GPG Key ID to sign the commit with", "KEY-ID"}, { "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"}, { "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, "GPG Homedir to use when looking for keyrings", "HOMEDIR"},
#endif
{ "generate-sizes", 0, 0, G_OPTION_ARG_NONE, &opt_generate_sizes, "Generate size information along with commit metadata", NULL }, { "generate-sizes", 0, 0, G_OPTION_ARG_NONE, &opt_generate_sizes, "Generate size information along with commit metadata", NULL },
{ "disable-fsync", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &opt_disable_fsync, "Do not invoke fsync()", NULL }, { "disable-fsync", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &opt_disable_fsync, "Do not invoke fsync()", NULL },
{ "fsync", 0, 0, G_OPTION_ARG_CALLBACK, parse_fsync_cb, "Specify how to invoke fsync()", "POLICY" }, { "fsync", 0, 0, G_OPTION_ARG_CALLBACK, parse_fsync_cb, "Specify how to invoke fsync()", "POLICY" },
@ -501,7 +497,6 @@ ostree_builtin_commit (int argc, char **argv, GCancellable *cancellable, GError
goto out; goto out;
} }
#ifdef HAVE_GPGME
if (opt_key_ids) if (opt_key_ids)
{ {
char **iter; char **iter;
@ -519,7 +514,6 @@ ostree_builtin_commit (int argc, char **argv, GCancellable *cancellable, GError
goto out; goto out;
} }
} }
#endif
ostree_repo_transaction_set_ref (repo, NULL, opt_branch, commit_checksum); ostree_repo_transaction_set_ref (repo, NULL, opt_branch, commit_checksum);