Subject: [PATCH 04/19] build: Require Guile-SQLite3.

From: Ludovic Courtès <[email-masked]>
Date: Fri, 8 Jun 2018 11:34:36 +0200

The next commits make (sqlite3) an indirect dependency of (gnu build
install), which is itself used by (guix scripts system), hence this new
requirement.

* configure.ac: Error out when $guix_cv_have_recent_guile_sqlite3 is
false.  Remove HAVE_GUILE_SQLITE3 Automake conditional.
* Makefile.am (MODULES, SCM_TESTS): Remove HAVE_GUILE_SQLITE3 conditions.
* doc/guix.texi (Requirements): Add Guile-SQLite3.
* README: Ditto.
* gnu/packages/package-management.scm (guix)[propagated-inputs]: Add
GUILE-SQLITE3.
[arguments]: In 'wrap-program' phase, take guile-sqlite3 into account.
---
 Makefile.am                         | 16 +++-------------
 README                              |  3 ++-
 configure.ac                        |  5 +++--
 doc/guix.texi                       |  3 +++
 gnu/packages/package-management.scm |  4 +++-
 5 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 102f5a2e7..d6403c02e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -262,11 +262,7 @@ STORE_MODULES =					\
   guix/store/database.scm			\
   guix/store/deduplication.scm
 
-if HAVE_GUILE_SQLITE3
 MODULES += $(STORE_MODULES)
-else
-MODULES_NOT_COMPILED += $(STORE_MODULES)
-endif !HAVE_GUILE_SQLITE3
 
 # Internal modules with test suite support.
 dist_noinst_DATA = guix/tests.scm guix/tests/http.scm
@@ -379,7 +375,9 @@ SCM_TESTS =					\
   tests/scripts-build.scm			\
   tests/containers.scm				\
   tests/pack.scm				\
-  tests/import-utils.scm
+  tests/import-utils.scm			\
+  tests/store-database.scm			\
+  tests/store-deduplication.scm
 
 if HAVE_GUILE_JSON
 
@@ -391,14 +389,6 @@ SCM_TESTS += 					\
 
 endif
 
-if HAVE_GUILE_SQLITE3
-
-SCM_TESTS +=					\
-  tests/store-database.scm			\
-  tests/store-deduplication.scm
-
-endif
-
 SH_TESTS =					\
   tests/guix-build.sh				\
   tests/guix-download.sh			\
diff --git a/README b/README
index 243a6c058..e1d62763d 100644
--- a/README
+++ b/README
@@ -23,7 +23,8 @@ GNU Guix currently depends on the following packages:
   - [[https://gnu.org/software/guile/][GNU Guile 2.2.x or 2.0.x]], version 2.0.13 or later
   - [[https://gnupg.org/][GNU libgcrypt]]
   - [[https://www.gnu.org/software/make/][GNU Make]]
-  - [[https://www.gnutls.org][GnuTLS]] compiled with guile support enabled.
+  - [[https://www.gnutls.org][GnuTLS]] compiled with guile support enabled
+  - [[https://notabug.org/civodul/guile-sqlite3][Guile-SQLite3]]
   - [[https://gitlab.com/guile-git/guile-git][Guile-Git]]
   - [[http://www.zlib.net/][zlib]]
   - optionally [[https://savannah.nongnu.org/projects/guile-json/][Guile-JSON]], for the 'guix import pypi' command
diff --git a/configure.ac b/configure.ac
index d338bfda5..b866e91b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,8 +126,9 @@ AM_CONDITIONAL([HAVE_GUILE_JSON], [test "x$have_guile_json" = "xyes"])
 
 dnl Guile-Sqlite3 is used by the (guix store ...) modules.
 GUIX_CHECK_GUILE_SQLITE3
-AM_CONDITIONAL([HAVE_GUILE_SQLITE3],
-  [test "x$guix_cv_have_recent_guile_sqlite3" = "xyes"])
+if test "x$guix_cv_have_recent_guile_sqlite3" != "xyes"; then
+  AC_MSG_ERROR([A recent Guile-SQLite3 could not be found; please install it.])
+fi
 
 dnl Make sure we have a full-fledged Guile.
 GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
diff --git a/doc/guix.texi b/doc/guix.texi
index 77bdaa50e..f73eb9c2c 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -615,6 +615,9 @@ later, including 2.2.x;
 Guile,, gnutls-guile, GnuTLS-Guile});
 @item
 @c FIXME: Specify a version number once a release has been made.
+@uref{https://notabug.org/civodul/guile-sqlite3, Guile-SQLite3};
+@item
+@c FIXME: Specify a version number once a release has been made.
 @uref{https://gitlab.com/guile-git/guile-git, Guile-Git}, from August
 2017 or later;
 @item @url{http://zlib.net, zlib};
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 1356480b8..b8c14ee5d 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -207,12 +207,13 @@
                         (let* ((out    (assoc-ref outputs "out"))
                                (guile  (assoc-ref inputs "guile"))
                                (json   (assoc-ref inputs "guile-json"))
+                               (sqlite (assoc-ref inputs "guile-sqlite3"))
                                (git    (assoc-ref inputs "guile-git"))
                                (bs     (assoc-ref inputs
                                                   "guile-bytestructures"))
                                (ssh    (assoc-ref inputs "guile-ssh"))
                                (gnutls (assoc-ref inputs "gnutls"))
-                               (deps   (list json gnutls git bs ssh))
+                               (deps   (list json sqlite gnutls git bs ssh))
                                (effective
                                 (read-line
                                  (open-pipe* OPEN_READ
@@ -269,6 +270,7 @@
       (propagated-inputs
        `(("gnutls" ,gnutls)
          ("guile-json" ,guile-json)
+         ("guile-sqlite3" ,guile-sqlite3)
          ("guile-ssh" ,guile-ssh)
          ("guile-git" ,guile-git)))
 
-- 
2.17.1