gnu: redis: Unbundle jemalloc & reinstate most of the tests
[jackhill/guix/guix.git] / gnu / packages / databases.scm
index f26deb4..6c1bb7b 100644 (file)
@@ -44,6 +44,8 @@
 ;;; Copyright © 2020 Lars-Dominik Braun <ldb@leibniz-psychology.org>
 ;;; Copyright © 2020 Guy Fleury Iteriteka <gfleury@disroot.org>
 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
+;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module (gnu packages guile)
   #:use-module (gnu packages time)
   #:use-module (gnu packages golang)
+  #:use-module (gnu packages icu4c)
   #:use-module (gnu packages jemalloc)
   #:use-module (gnu packages language)
+  #:use-module (gnu packages libedit)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages logging)
   #:use-module (gnu packages man)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages onc-rpc)
   #:use-module (gnu packages parallel)
   #:use-module (guix download)
   #:use-module (guix bzr-download)
   #:use-module (guix git-download)
+  #:use-module (guix hg-download)
   #:use-module (guix build-system emacs)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
@@ -232,7 +238,7 @@ standard Go idioms.")
 (define-public ephemeralpg
   (package
     (name "ephemeralpg")
-    (version "3.0")
+    (version "3.1")
     (source
      (origin
        (method url-fetch)
@@ -240,10 +246,10 @@ standard Go idioms.")
              "https://eradman.com/ephemeralpg/code/ephemeralpg-"
              version ".tar.gz"))
        (sha256
-        (base32 "1j0g7g114ma7y7sadbng5p1ss1zsm9zpicm77qspym6565733vvh"))))
+        (base32 "1ap22ki8yz6agd0qybcjgs4b9izw1rwwcgpxn3jah2ccfyax34s6"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:make-flags (list "CC=gcc"
+     `(#:make-flags (list (string-append "CC=" ,(cc-for-target))
                           (string-append "PREFIX=" %output))
        #:phases
        (modify-phases %standard-phases
@@ -306,6 +312,183 @@ ElasticSearch server")
     (home-page "https://github.com/patientslikeme/es_dump_restore")
     (license license:expat)))
 
+(define-public firebird
+  (package
+    (name "firebird")
+    (version "3.0.7")
+    (source
+     (let ((revision "33374-0"))
+       (origin
+         (method url-fetch)
+         (uri (string-append "https://github.com/FirebirdSQL/"
+                             "firebird/releases/download/R"
+                             (string-replace-substring version "." "_") "/"
+                             "Firebird-" version "." revision ".tar.bz2"))
+         (sha256
+          (base32 "0xpy1bncz36c6n28y7kllm1dkrdkn4vb4gw2n43f2351mznmrf5c"))
+         (modules '((guix build utils)))
+         (snippet
+          `(begin
+             (for-each
+              delete-file-recursively
+              (list "extern/btyacc/test" ; TODO: package and remove entirely
+                    "extern/editline"
+                    "extern/icu"
+                    "extern/libtommath"
+                    "extern/zlib"
+                    "src/include/firebird/impl/boost"
+
+                    ;; Missing licence.
+                    "builds/install/arch-specific/solaris"
+                    "extern/SfIO"
+                    "src/msgs/templates.sql"
+
+                    ;; Generated files missing sources.
+                    "doc/Firebird-3-QuickStart.pdf"
+                    (string-append "doc/Firebird-" ,version
+                                   "-ReleaseNotes.pdf")
+                    "doc/README.SecureRemotePassword.html"))
+             #t)))))
+    (build-system gnu-build-system)
+    (outputs (list "debug" "out"))
+    (arguments
+     `(#:configure-flags
+       (let ((out (assoc-ref %outputs "out")))
+         (list (string-append "--with-fbsbin=" out "/sbin")
+               (string-append "--with-fbdoc=" out "/share/doc/"
+                              ,name "-" ,version)
+               (string-append "--with-fbconf=" out "/lib/firebird")
+               (string-append "--with-fbintl=" out "/lib/firebird/intl")
+               (string-append "--with-fbmisc=" out "/lib/firebird/misc")
+               (string-append "--with-fbmsg=" out "/lib/firebird")
+               (string-append "--with-fbplugins=" out "/lib/firebird/plugins")
+               (string-append "--with-fbudf=" out "/lib/firebird/UDF")
+               "--with-fbglock=/run/firebird"
+               "--with-fblog=/var/log/firebird"
+               "--with-fbhelp=/var/lib/firebird/system"
+               "--with-fbsecure-db=/var/lib/firebird/secure"
+               "--without-fbsample"
+               "--without-fbsample-db"
+               "--with-system-editline"))
+       #:make-flags
+       (list (string-append "CC=" ,(cc-for-target))
+             ;; The plugins/ can't find libfbclient otherwise.
+             (string-append "LDFLAGS=-Wl,-rpath="
+                            (assoc-ref %outputs "out") "/lib"))
+       #:tests? #f                      ; no test suite
+       #:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (srfi srfi-26))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'use-system-boost
+           (lambda _
+             (substitute* "src/include/firebird/Message.h"
+               (("\"\\./impl/boost/preprocessor/seq/for_each_i\\.hpp\"")
+                "<boost/preprocessor/seq/for_each_i.hpp>")
+               (("FB_BOOST_") "BOOST_"))
+             #t))
+         (add-after 'unpack 'patch-installation
+           (lambda _
+             (substitute*
+                 "builds/install/arch-specific/linux/makeInstallImage.sh.in"
+               (("/bin/sh") (which "bash"))
+               ;; Remove shell script helpers from $PATH.
+               (("(addLibs|cp) .*\\.sh .*@FB_SBINDIR@") ":")
+               ;; Put files where Guix users expect them.
+               (("(License\\.txt.*)@FB_CONFDIR" match)
+                (string-append match "@FB_DOCDIR@"))
+               (("@FB_CONFDIR@(.*License\\.txt.*)" match)
+                (string-append "@FB_DOCDIR@" match))
+               (("(cp .*/doc/.*)@FB_CONFDIR@(.*)" _ head tail)
+                (string-append head "@FB_DOCDIR@" tail "\n")))
+             (substitute*
+                 (list "builds/install/posix-common/changeServerMode.sh.in"
+                       "builds/install/posix-common/install.sh.in")
+               ;; Skip phases that (could) cause problems in Guix.
+               (("check(InstallUser|IfServerRunning|Libraries)|addFirebirdUser")
+                ":")
+               ;; Skip phases that are merely pointless on Guix.
+               (("buildUninstallFile|installInitdScript|startFirebird") ":")
+               ;; Omit randomly generated password with bonus timestamp.
+               (("setDBAPassword") ":"))
+
+             ;; These promote proprietary workflows not relevant on Guix.
+             (for-each delete-file-recursively
+                       (find-files "doc" "README\\.(build\\.msvc|NT|Win)"))
+             #t))
+         (add-after 'configure 'delete-init-scripts
+           (lambda _
+             (delete-file-recursively "gen/install/misc")
+             #t))
+         (add-before 'build 'set-build-environment-variables
+           (lambda _
+             ;; ‘isql’ needs to run & find libfbclient.so during the build.
+             ;; This doubles as a rudimentary test in lieu of a test suite.
+             (setenv "LD_LIBRARY_PATH"
+                     (string-append (assoc-ref %build-inputs "icu4c") "/lib"))
+             #t))
+         (add-before 'install 'keep-embedded-debug-symbols
+           (lambda _
+             ;; Let the gnu-build-system separate & deal with them later.
+             ;; XXX Upstream would use ‘--strip-unneeded’, shaving a whole
+             ;; megabyte off Guix's 7.7M libEngine12.so, for example.
+             (substitute* "gen/Makefile.install"
+               (("readelf") "false"))
+             #t))
+         (add-after 'install 'prune-undesirable-files
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (with-directory-excursion out
+                 ;; Remove example binaries.
+                 (for-each delete-file-recursively
+                           (find-files "." "example"))
+                 ;; Delete (now-)empty directories.
+                 (for-each rmdir
+                           (list "include/firebird/impl"
+                                 "lib/firebird/plugins/udr"))
+                 #t)))))))
+    (inputs
+     `(("boost" ,boost)
+       ("editline" ,editline)
+       ("icu4c" ,icu4c-67)
+       ("libtommath" ,libtommath)
+       ("ncurses" ,ncurses)
+       ("zlib" ,zlib)))
+    (home-page "https://www.firebirdsql.org")
+    (synopsis "Relational database with many ANSI SQL standard features")
+    (description
+     "Firebird is an SQL @acronym{RDBMS, relational database management system}
+with rich support for ANSI SQL (e.g., @code{INSERT...RETURNING}) including
+@acronym{UDFs, user-defined functions} and PSQL stored procedures, cursors, and
+triggers.  Transactions provide full ACID-compliant referential integrity.
+
+The database requires very little manual maintenance once set up, making it
+ideal for small business or embedded use.
+
+When installed as a traditional local or remote (network) database server,
+Firebird can grow to terabyte scale with proper tuning---although PostgreSQL
+may be a better choice for such very large environments.
+
+Firebird can also be embedded into stand-alone applications that don't want or
+need a full client & server.  Used in this manner, it offers richer SQL support
+than SQLite as well as the option to seamlessly migrate to a client/server
+database later.")
+    (properties
+     `((lint-hidden-cve . ("CVE-2017-6369"))))
+    (license
+     ;; See doc/license/README.license.usage.txt for rationale & details.
+     (list license:bsd-3                ; src/common/sha2/
+           license:bsd-4                ; src/common/enc.cpp
+           license:gpl2+                ; builds/posix/make.defaults
+           (license:non-copyleft "file:///builds/install/misc/IPLicense.txt"
+                                 "InterBase Public License v1.0")
+           (license:non-copyleft "file:///builds/install/misc/IDPLicense.txt"
+                                 "Initial Developer's Public License v1.0")
+           license:lgpl2.1           ; exception for OSI-compatible licences
+           license:mpl1.1            ; examples/interfaces/0{6,8}*.cpp
+           license:public-domain)))) ; including files without explicit licence
+
 (define-public leveldb
   (package
     (name "leveldb")
@@ -334,14 +517,14 @@ mapping from string keys to string values.")
 (define-public memcached
   (package
     (name "memcached")
-    (version "1.5.20")
+    (version "1.6.9")
     (source
      (origin
        (method url-fetch)
        (uri (string-append
              "https://memcached.org/files/memcached-" version ".tar.gz"))
        (sha256
-        (base32 "1r511qr95q0ywdaql3pdjiwzkfqxhhfzb13ilvl7mznfm4iv1myg"))))
+        (base32 "1lcjy1b9krnb2gk72qd1fvivlfiyfvknfi3wngyvyk9ifzijr9nm"))))
     (build-system gnu-build-system)
     (inputs
      `(("libevent" ,libevent)
@@ -716,7 +899,7 @@ Language.")
 (define-public mariadb
   (package
     (name "mariadb")
-    (version "10.1.45")
+    (version "10.5.6")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://downloads.mariadb.com/MariaDB"
@@ -724,8 +907,7 @@ Language.")
                                   version ".tar.gz"))
               (sha256
                (base32
-                "1mfs0x4c0z7d306n128dxdawk3llk25vxif5zwl20fv1z5qhz3wx"))
-              (patches (search-patches "mariadb-client-test-32bit.patch"))
+                "1i257h0zdypdfj5wkg6ck9pxlkph0jvjs92k22pjr6gnx5lxs1gz"))
               (modules '((guix build utils)))
               (snippet
                '(begin
@@ -743,8 +925,8 @@ Language.")
                   (for-each (lambda (file)
                               (unless (string-suffix? "CMakeLists.txt" file)
                                 (delete-file file)))
-                            (append (find-files "extra/yassl")
-                                    (find-files "pcre") (find-files "zlib")))
+                            (append (find-files "extra/wolfssl")
+                                    (find-files "zlib")))
                   #t))))
     (build-system cmake-build-system)
     (outputs '("out" "lib" "dev"))
@@ -798,29 +980,20 @@ Language.")
          "-DINSTALL_SHAREDIR=share")
        #:phases
        (modify-phases %standard-phases
-         ,@(if (string-prefix? "arm" (%current-system))
-               ;; XXX: Because of the GCC 5 input, we need to hide GCC 7 from
-               ;; CPLUS_INCLUDE_PATH so that its headers do not shadow GCC 5.
-               '((add-after 'set-paths 'hide-default-gcc
-                   (lambda* (#:key inputs #:allow-other-keys)
-                     (let ((gcc (assoc-ref inputs "gcc")))
-                       (setenv "CPLUS_INCLUDE_PATH"
-                               (string-join
-                                (delete (string-append gcc "/include/c++")
-                                        (string-split (getenv "CPLUS_INCLUDE_PATH")
-                                                      #\:))
-                                ":"))
-                       #t))))
-               '())
-         (add-after 'unpack 'fix-pcre-detection
+         (add-after 'unpack 'adjust-output-references
            (lambda _
-             ;; The bundled PCRE in MariaDB has a patch that was upstreamed
-             ;; in version 8.34.  Unfortunately the upstream patch behaves
-             ;; slightly differently and the build system fails to detect it.
-             ;; See <https://bugs.exim.org/show_bug.cgi?id=2173>.
-             ;; XXX: Consider patching PCRE instead.
-             (substitute* "cmake/pcre.cmake"
-               ((" OR NOT PCRE_STACK_SIZE_OK") ""))
+             ;; The build system invariably prepends $CMAKE_INSTALL_PREFIX
+             ;; to other variables such as $INSTALL_INCLUDEDIR, which does
+             ;; not work when the latter uses an absolute file name.
+             (substitute* "libmariadb/mariadb_config/mariadb_config.c.in"
+               (("@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDEDIR@")
+                "@INSTALL_INCLUDEDIR@"))
+             (substitute* "libmariadb/mariadb_config/libmariadb.pc.in"
+               (("\\$\\{prefix\\}/@INSTALL_INCLUDEDIR@")
+                "@INSTALL_INCLUDEDIR@"))
+             (substitute* "include/CMakeLists.txt"
+               (("\\\\\\$\\{CMAKE_INSTALL_PREFIX\\}/\\$\\{INSTALL_INCLUDEDIR\\}")
+                "${INSTALL_INCLUDEDIR}"))
              #t))
          (add-after 'unpack 'adjust-tests
            (lambda _
@@ -828,6 +1001,7 @@ Language.")
                     '(;; These fail because root@hostname == root@localhost in
                       ;; the build environment, causing a user count mismatch.
                       ;; See <https://jira.mariadb.org/browse/MDEV-7761>.
+                      "funcs_1.is_columns_mysql"
                       "main.join_cache"
                       "main.explain_non_select"
                       "main.stat_tables"
@@ -836,20 +1010,7 @@ Language.")
 
                       ;; This file contains a time bomb which makes it fail after
                       ;; 2030-12-31.  See <https://bugs.gnu.org/34351> for details.
-                      "main.mysqldump"
-
-                      ;; FIXME: This test fails on i686:
-                      ;; -myisampack: Can't create/write to file (Errcode: 17 "File exists")
-                      ;; +myisampack: Can't create/write to file (Errcode: 17 "File exists)
-                      ;; When running "myisampack --join=foo/t3 foo/t1 foo/t2"
-                      ;; (all three tables must exist and be identical)
-                      ;; in a loop it produces the same error around 1/240 times.
-                      ;; montywi on #maria suggested removing the real_end check in
-                      ;; "strings/my_vsnprintf.c" on line 503, yet it still does not
-                      ;; reach the ending quote occasionally.  Disable it for now.
-                      "main.myisampack"
-                      ;; FIXME: This test fails on armhf-linux:
-                      "mroonga/storage.index_read_multiple_double"))
+                      "main.mysqldump"))
 
                    ;; This file contains a list of known-flaky tests for this
                    ;; release.  Append our own items.
@@ -860,9 +1021,10 @@ Language.")
                          disabled-tests)
                (close-port unstable-tests)
 
-               ;; XXX: This test fails because it expects a latin1 charset and
+               ;; XXX: These fail because they expect a latin1 charset and
                ;; collation.  See <https://jira.mariadb.org/browse/MDEV-21264>.
-               (substitute* "mysql-test/r/gis_notembedded.result"
+               (substitute* '("mysql-test/main/gis_notembedded.result"
+                              "mysql-test/main/system_mysql_db.result")
                  (("latin1_swedish_ci") "utf8_general_ci")
                  (("\tlatin1") "\tutf8"))
 
@@ -895,6 +1057,10 @@ Language.")
                            "--testcase-timeout=40"
                            "--suite-timeout=600"
                            "--parallel" (number->string (parallel-job-count))
+                           ;; Skip the replication tests: they are very I/O
+                           ;; intensive and frequently causes indeterministic
+                           ;; failures even on powerful hardware.
+                           "--skip-rpl"
                            "--skip-test-list=unstable-tests"))
                  (format #t "test suite not run~%"))
              #t))
@@ -905,56 +1071,57 @@ Language.")
                    (dev     (assoc-ref outputs "dev"))
                    (lib     (assoc-ref outputs "lib"))
                    (openssl (assoc-ref inputs "openssl")))
-              (substitute* (string-append out "/bin/mysql_install_db")
+              (substitute* (list (string-append out "/bin/mariadb-install-db")
+                                 (string-append out "/bin/mysql_install_db"))
                 (("basedir=\"\"")
-                 (string-append "basedir=\"" out "\"")))
+                 (string-append "basedir=\"" out "\""))
+                (("\\$basedir/share/mysql")
+                 (string-append lib "/share/mysql")))
+
               ;; Remove unneeded files for testing.
               (with-directory-excursion lib
                 (for-each delete-file-recursively
-                          '("data" "mysql-test" "sql-bench"))
+                          '("mysql-test" "sql-bench"))
                 ;; And static libraries.
                 (for-each delete-file (find-files "lib" "\\.a$")))
               (with-directory-excursion out
                 (delete-file "share/man/man1/mysql-test-run.pl.1")
                 ;; Delete huge and unnecessary executables.
-                (for-each delete-file (find-files "bin" "(test|embedded)")))
+                (for-each delete-file (find-files "bin" "test$")))
               (mkdir-p (string-append dev "/share"))
               (mkdir-p (string-append dev "/bin"))
+              (rename-file (string-append lib "/bin/mariadbd")
+                           (string-append out "/bin/mariadbd"))
               (rename-file (string-append lib "/bin/mysqld")
                            (string-append out "/bin/mysqld"))
-              (rename-file (string-append lib "/share/pkgconfig")
-                           (string-append dev "/share/pkgconfig"))
+              (mkdir-p (string-append dev "/lib"))
+              (rename-file (string-append lib "/lib/pkgconfig")
+                           (string-append dev "/lib/pkgconfig"))
+              (rename-file (string-append lib "/bin/mariadb_config")
+                           (string-append dev "/bin/mariadb_config"))
               (rename-file (string-append out "/bin/mysql_config")
                            (string-append dev "/bin/mysql_config"))
 
-
-              (substitute*  (string-append out "/bin/mysql_install_db")
-                (("\\$basedir/share/mysql")
-                 (string-append lib "/share/mysql")))
-
               ;; Embed an absolute reference to OpenSSL in mysql_config
               ;; and the pkg-config file to avoid propagation.
+              ;; XXX: how to do this for mariadb_config.c.in?
               (substitute* (list (string-append dev "/bin/mysql_config")
-                                 (string-append dev "/share/pkgconfig/mariadb.pc"))
+                                 (string-append dev "/lib/pkgconfig/mariadb.pc"))
                 (("-lssl -lcrypto" all)
                  (string-append "-L" openssl "/lib " all)))
 
               #t))))))
     (native-inputs
      `(("bison" ,bison)
-       ;; XXX: On armhf, use GCC 5 to work around <https://bugs.gnu.org/37605>.
-       ,@(if (string-prefix? "armhf" (%current-system))
-             `(("gcc@5", gcc-5))
-             '())
        ("perl" ,perl)))
     (inputs
      `(("jemalloc" ,jemalloc)
        ("libaio" ,libaio)
        ("libxml2" ,libxml2)
        ("ncurses" ,ncurses)
-       ("openssl" ,openssl-1.0)
+       ("openssl" ,openssl)
        ("pam" ,linux-pam)
-       ("pcre" ,pcre)
+       ("pcre2" ,pcre2)
        ("xz" ,xz)
        ("zlib" ,zlib)))
     ;; The test suite is very resource intensive and can take more than three
@@ -970,16 +1137,16 @@ as a drop-in replacement of MySQL.")
 (define-public mariadb-connector-c
   (package
     (name "mariadb-connector-c")
-    (version "3.1.9")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append
-                    "https://downloads.mariadb.org/f/connector-c-"
-                    version "/mariadb-connector-c-"
-                    version "-src.tar.gz"))
-              (sha256
-               (base32
-                "1izjzf7yzjqzlk8dkp327fa9lawsv2hnnlnr7g5lshyx5azrk38h"))))
+    (version "3.1.11")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://downloads.mariadb.org/f/connector-c-" version
+             "/mariadb-connector-c-" version "-src.tar.gz"
+             "/from/https%3A//mirrors.ukfast.co.uk/sites/mariadb/?serve"))
+       (sha256
+        (base32 "03svzahdf7czjlm695c11r4bfd04qdqgx8r1vkpr1zlkjhwnqvry"))))
     (inputs
      `(("openssl" ,openssl)))
     (build-system cmake-build-system)
@@ -1038,6 +1205,20 @@ TIMESTAMP.  It also supports storage of binary large objects, including
 pictures, sounds, or video.")
     (license (license:x11-style "file://COPYRIGHT"))))
 
+(define-public postgresql-10 postgresql)
+
+(define-public postgresql-13
+  (package
+    (inherit postgresql)
+    (version "13.1")
+    (source (origin
+              (inherit (package-source postgresql))
+              (uri (string-append "https://ftp.postgresql.org/pub/source/v"
+                                  version "/postgresql-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "07z6zwr58dckaa97yl9ml240z83d1lhgaxw9aq49i8lsp21mqd0j"))))))
+
 (define-public postgresql-11
   (package
     (inherit postgresql)
@@ -1139,13 +1320,13 @@ organized in a hash table or B+ tree.")
 
     (native-inputs `(("bc" ,bc)
                      ("bash:include" ,bash "include")
-                     ("check" ,check)
-                     ("libuuid" ,util-linux)
+                     ("check" ,check-0.14)
                      ("pkg-config" ,pkg-config)))
 
     ;; TODO: Add more optional inputs.
     (inputs `(("curl" ,curl)
-              ("libgcrypt" ,libgcrypt)))
+              ("libgcrypt" ,libgcrypt)
+              ("libuuid" ,util-linux "lib")))
     (synopsis "Manipulate plain text files as databases")
     (description
      "GNU Recutils is a set of tools and libraries for creating and
@@ -1202,6 +1383,7 @@ including field and record folding.")))
      `(#:make-flags (list "CC=gcc" "V=1"
                           ;; Ceph requires that RTTI is enabled.
                           "USE_RTTI=1"
+                          "date=1970-01-01" ; build reproducibly
                           (string-append "INSTALL_PATH="
                                          (assoc-ref %outputs "out"))
 
@@ -1741,7 +1923,7 @@ columns, primary keys, unique constraints and relationships.")
 (define-public perl-dbd-sqlite
   (package
     (name "perl-dbd-sqlite")
-    (version "1.64")
+    (version "1.66")
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -1749,7 +1931,7 @@ columns, primary keys, unique constraints and relationships.")
                     version ".tar.gz"))
               (sha256
                (base32
-                "00gz5aw3xrr92lf9nfk0dhmy7a8jzmxhznddd9b0a8w4a1xqzbpl"))))
+                "1zljln5nh61gj3k22a1fv2vhx5l83waizmarwkh77hk6kzzmvrw9"))))
     (build-system perl-build-system)
     (inputs `(("sqlite" ,sqlite)))
     (propagated-inputs `(("perl-dbi" ,perl-dbi)))
@@ -1780,7 +1962,7 @@ module, and nothing else.")
     (synopsis "Parse and utilize MySQL's /etc/my.cnf and ~/.my.cnf files")
     (description
      "@code{MySQL::Config} emulates the @code{load_defaults} function from
-libmysqlclient.  It will fill an aray with long options, ready to be parsed by
+libmysqlclient.  It will fill an array with long options, ready to be parsed by
 @code{Getopt::Long}.")
     (license license:perl-license)))
 
@@ -1901,7 +2083,7 @@ valid SQL query.")
 (define-public unixodbc
   (package
    (name "unixodbc")
-   (version "2.3.7")
+   (version "2.3.9")
    (source (origin
             (method url-fetch)
             (uri
@@ -1909,7 +2091,7 @@ valid SQL query.")
               "ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-"
               version ".tar.gz"))
             (sha256
-             (base32 "0xry3sg497wly8f7715a7gwkn2k36bcap0mvzjw74jj53yx6kwa5"))))
+             (base32 "01xj65d02i3yjy7p9z08y9jakcs5szmz4rask868n7387nn3x0sj"))))
    (build-system gnu-build-system)
    (synopsis "Data source abstraction library")
    (description "Unixodbc is a library providing an API with which to access
@@ -1948,19 +2130,43 @@ similar to BerkeleyDB, LevelDB, etc.")
 (define-public redis
   (package
     (name "redis")
-    (version "5.0.7")
+    (version "6.0.9")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://download.redis.io/releases/redis-"
                                   version".tar.gz"))
               (sha256
                (base32
-                "0ax8sf3vw0yadr41kzc04917scrg5wir1d94zmbz00b8pzm79nv1"))))
+                "1pc6gyiylrcazlc559dp5mxqj733pk9qabnirw4ry3k23kwdqayw"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Delete bundled jemalloc, as the package will use the libc one
+               '(begin (delete-file-recursively "deps/jemalloc")
+                       #t))))
     (build-system gnu-build-system)
+    (native-inputs
+     `(("procps" ,procps) ; for tests
+       ("tcl" ,tcl)))     ; for tests
     (arguments
-     '(#:tests? #f ; tests related to master/slave and replication fail
-       #:phases (modify-phases %standard-phases
-                  (delete 'configure))
+     '(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-after 'unpack 'use-correct-tclsh
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "runtest"
+               (("^TCLSH=.*")
+                (string-append "TCLSH="
+                               (assoc-ref inputs "tcl")
+                               "/bin/tclsh")))
+             #t))
+         (add-after 'unpack 'adjust-tests
+           (lambda _
+             ;; Disable failing tests
+             (substitute* "tests/test_helper.tcl"
+               (("    integration/replication[^-]") "")
+               (("    integration/replication-4") "")
+               (("    integration/replication-psync") ""))
+             #t)))
        #:make-flags `("CC=gcc"
                       "MALLOC=libc"
                       "LDFLAGS=-ldl"
@@ -2123,14 +2329,14 @@ database.")
 (define-public perl-db-file
  (package
   (name "perl-db-file")
-  (version "1.853")
+  (version "1.855")
   (source
     (origin
       (method url-fetch)
       (uri (string-append "mirror://cpan/authors/id/P/PM/PMQS/DB_File-"
                           version ".tar.gz"))
       (sha256
-        (base32 "1y967si45vj0skip1hnhicbv9da29fv6qcfwnsbnvj06n36mkj6h"))))
+        (base32 "0q599h7g4jkzks5dxf1zifx9k7l9vif26r2dlgkzxkg6bfif5zyr"))))
   (build-system perl-build-system)
   (inputs `(("bdb" ,bdb)))
   (native-inputs `(("perl-test-pod" ,perl-test-pod)))
@@ -2143,8 +2349,7 @@ database.")
                        (("/usr/local/BerkeleyDB") (assoc-ref inputs "bdb")))
                      #t)))))
   (home-page "https://metacpan.org/release/DB_File")
-  (synopsis
-    "Perl5 access to Berkeley DB version 1.x")
+  (synopsis "Perl5 access to Berkeley DB version 1.x")
   (description
     "The DB::File module provides Perl bindings to the Berkeley DB version 1.x.")
   (license license:perl-license)))
@@ -2152,7 +2357,7 @@ database.")
 (define-public lmdb
   (package
     (name "lmdb")
-    (version "0.9.26")
+    (version "0.9.27")
     (source
      (origin
        (method git-fetch)
@@ -2161,7 +2366,7 @@ database.")
              (commit (string-append "LMDB_" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0323xwb2rqyrr9vr6gbxc2kl89drhqw0ifmyh9pg9qgqmymyhxdx"))))
+        (base32 "09xqqm8yjsf1gv4gd4llal48sms76hfhxadx6rik1j2g5v3d3f1k"))))
     (build-system gnu-build-system)
     (arguments
      `(#:test-target "test"
@@ -2172,7 +2377,25 @@ database.")
              (chdir "libraries/liblmdb")
              (substitute* "Makefile"
                (("/usr/local") (assoc-ref outputs "out")))
-            #t)))))
+            #t))
+         (add-after 'install 'create-pkg-config-file
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (mkdir-p (string-append out "/lib/pkgconfig"))
+               (with-output-to-file (string-append out "/lib/pkgconfig/liblmdb.pc")
+                 (lambda _
+                   (format #t "prefix=~a~@
+                           exec_prefix=~a~@
+                           libdir=~a/lib~@
+                           includedir=~a/include~@
+                           ~@
+                           Name: liblmdb~@
+                           Version: ~a~@
+                           Description: Lightning Memory-Mapped Database library~@
+                           Libs: -L${libdir} -llmdb~@
+                           Cflags: -I${includedir}~%"
+                           out out out out ,version)))
+                 #t))))))
     (home-page "https://symas.com/lmdb/")
     (synopsis "Lightning Memory-Mapped Database library")
     (description
@@ -2253,17 +2476,18 @@ on another machine, accessed via TCP/IP.")
 (define-public python-peewee
   (package
     (name "python-peewee")
-    (version "3.9.6")
-      (source
-        (origin
-        (method url-fetch)
-        (uri (pypi-uri "peewee" version))
-        (sha256
-         (base32
-          "1j4sh946k0736m7pd54z0y6i2hjhgg3kdllx1pwq8xkzzcgrx1xw"))))
+    (version "3.14.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "peewee" version))
+       (sha256
+        (base32 "1yl49gxrg0c2x3n3r60z3lixw9am8b61s0477l9vjabhhx1yziar"))))
     (build-system python-build-system)
     (arguments
-     `(#:tests? #f)) ; Fails to import test data
+     `(#:tests? #f))                    ; fails to import test data
+    (inputs
+     `(("sqlite" ,sqlite)))
     (native-inputs
      `(("python-cython" ,python-cython)))
     (home-page "https://github.com/coleifer/peewee/")
@@ -2453,13 +2677,13 @@ etc., and an SQL engine for performing simple SQL queries.")
 (define-public python-lmdb
   (package
     (name "python-lmdb")
-    (version "0.99")
+    (version "1.0.0")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "lmdb" version))
               (sha256
                (base32
-                "12fwlzfd82471ss9xzbqwcqc6f5miy51y72y2yya9j5cm9589szr"))
+                "1di1gj2agbxwqqwrpk4w58dpfah0kl10ha20s63dlqdd1bgzydj1"))
               (modules '((guix build utils)))
               (snippet
                ;; Delete bundled lmdb source files.
@@ -2478,6 +2702,7 @@ etc., and an SQL engine for performing simple SQL queries.")
          (add-before 'build 'use-system-lmdb
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((lmdb (assoc-ref inputs "lmdb")))
+               (setenv "LMDB_PURE" "set") ; don't apply env-copy-txn.patch
                (setenv "LMDB_FORCE_SYSTEM" "set")
                (setenv "LMDB_INCLUDEDIR" (string-append lmdb "/include"))
                (setenv "LMDB_LIBDIR" (string-append lmdb "/lib"))
@@ -2635,13 +2860,13 @@ Database API 2.0T.")
 (define-public python-sqlalchemy
   (package
     (name "python-sqlalchemy")
-    (version "1.3.18")
+    (version "1.3.20")
     (source
      (origin
       (method url-fetch)
       (uri (pypi-uri "SQLAlchemy" version))
       (sha256
-       (base32 "1rwc6ss1cnz3kxx0p9p6xw0w79r8qw03lcc29k31yb3rcigvfbys"))))
+       (base32 "18b9am7bsqc4nj3d2h5r93i002apczxfvpfpcqbd6f0385zmrwnj"))))
     (build-system python-build-system)
     (native-inputs
      `(("python-cython" ,python-cython) ; for C extensions
@@ -2759,13 +2984,13 @@ this library provides functions to facilitate such comparisons.")
 (define-public python-alembic
   (package
     (name "python-alembic")
-    (version "1.4.2")
+    (version "1.4.3")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "alembic" version))
        (sha256
-        (base32 "1gsdrzx9h7wfva200qvvsc9sn4w79mk2vs0bbnzjhxi1jw2b0nh3"))))
+        (base32 "0if2dgb088clk738p26bwk50735h6jpd2kacdgc5capv2hiz6d2k"))))
     (build-system python-build-system)
     (arguments
      '(#:phases (modify-phases %standard-phases
@@ -2992,27 +3217,51 @@ database).")
 (define-public python2-sadisplay
   (package-with-python2 python-sadisplay))
 
+(define-public yoyo-migrations
+  (package
+    (name "yoyo-migrations")
+    (version "7.2.0")
+    (source
+     (origin
+       ;; We use the upstream repository, as the tests are not included in the
+       ;; PyPI releases.
+       (method hg-fetch)
+       (uri (hg-reference
+             (url "https://hg.sr.ht/~olly/yoyo")
+             (changeset (string-append "v" version "-release"))))
+       (file-name (string-append name "-" version "-checkout"))
+       (sha256
+        (base32 "0q2z9bgdj3wyix7yvqsayfs21grp5av8ilh411lgmjhigszkvhcq"))))
+    (build-system python-build-system)
+    (arguments
+     ;; XXX: Tests require a connection to some pgsql database and psycopg
+     ;; fails to connect to it.
+     '(#:tests? #f))
+    (propagated-inputs
+     `(("python-sqlparse" ,python-sqlparse)
+       ("python-tabulate" ,python-tabulate)))
+    (home-page "https://ollycope.com/software/yoyo/latest/")
+    (synopsis "Database migrations with SQL")
+    (description
+     "Yoyo is a database schema migration tool.  Migrations are written as SQL
+files or Python scripts that define a list of migration steps.")
+    (license license:asl2.0)))
+
 (define-public python-mysqlclient
   (package
     (name "python-mysqlclient")
-    (version "1.3.13")
+    (version "2.0.1")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "mysqlclient" version))
        (sha256
         (base32
-         "0kv4a1icwdav8jpl7qvnr931lw5h3v22ids6lwq6qpi1hjzf33pz"))))
+         "1rf5l8hazs3v18hmcrm90z3hi9wxv553ipwd5l6kj8j7l6p7abzv"))))
     (build-system python-build-system)
-    (native-inputs
-     `(("nose" ,python-nose)
-       ("mock" ,python-mock)
-       ("py.test" ,python-pytest)))
+    (arguments '(#:tests? #f))          ;XXX: requires a live database
     (inputs
-     `(("mysql" ,mariadb "lib")
-       ("mysql-dev" ,mariadb "dev")
-       ("libz" ,zlib)
-       ("openssl" ,openssl)))
+     `(("mysql-dev" ,mariadb "dev")))
     (home-page "https://github.com/PyMySQL/mysqlclient-python")
     (synopsis "MySQLdb is an interface to the popular MySQL database server for Python")
     (description "MySQLdb is an interface to the popular MySQL database server
@@ -3024,9 +3273,6 @@ for Python.  The design goals are:
 @end enumerate")
     (license license:gpl2)))
 
-(define-public python2-mysqlclient
-  (package-with-python2 python-mysqlclient))
-
 (define-public python-hiredis
   (package
     (name "python-hiredis")
@@ -3111,7 +3357,7 @@ reasonable substitute.")
 (define-public python-rq
   (package
     (name "python-rq")
-    (version "1.5.1")
+    (version "1.5.2")
     (source
      (origin
        (method git-fetch)
@@ -3120,7 +3366,7 @@ reasonable substitute.")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0i7yyw828wdvl7ap4gb7jhm4p94502is3xxrgrdgwwp0l1rac004"))))
+        (base32 "0ikqmpq0g1qiqwd7ar1286l4hqjb6aj2wr844gihhb8ijzwhp8va"))))
     (build-system python-build-system)
     (arguments
      '(#:phases (modify-phases %standard-phases
@@ -3266,7 +3512,7 @@ transforms idiomatic python function calls to well-formed SQL queries.")
 (define-public python-pypika
   (package
     (name "python-pypika")
-    (version "0.37.2")
+    (version "0.44.0")
     (source
      (origin (method git-fetch)
              (uri (git-reference
@@ -3275,7 +3521,7 @@ transforms idiomatic python function calls to well-formed SQL queries.")
              (file-name (git-file-name name version))
              (sha256
               (base32
-               "089z1c778q1fwhzsc88ws8j5gm2hgxknibabn4wpax8rz2bfs3ck"))))
+               "0mpddrw9z1pzcc40j3pzhd583hlgjx96aa8ak6m9zzhpm4bv3ard"))))
     (build-system python-build-system)
     (native-inputs
      `(("python-parameterized" ,python-parameterized)))
@@ -3680,7 +3926,7 @@ The drivers officially supported by @code{libdbi} are:
 (define-public soci
   (package
     (name "soci")
-    (version "4.0.0")
+    (version "4.0.1")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -3689,24 +3935,21 @@ The drivers officially supported by @code{libdbi} are:
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "06faswdxd2frqr9xnx6bxc7zwarlzsbdi3bqpz7kwdxsjvq41rnb"))))
+                "14x2gjblkgpflv75wl144cyjp1sis5rbxnr9r2gj3yw16v2av0bp"))))
     (build-system cmake-build-system)
     (inputs
-     `(("postgresql" ,postgresql)
+     `(("firebird" ,firebird)
+       ("postgresql" ,postgresql)
        ("sqlite" ,sqlite)
        ("odbc" ,unixodbc)
        ("boost" ,boost)
-       ("mariadb:dev" ,mariadb "dev")
-       ("mariadb:lib" ,mariadb "lib")))
+       ("mariadb:dev" ,mariadb "dev")))
     (arguments
-     `(#:tests? #f ; Tests may require running database management systems.
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'fix-lib-path
-           (lambda _
-             (substitute* "CMakeLists.txt"
-               (("set\\(SOCI_LIBDIR \"lib64\"\\)") ""))
-             #t)))))
+     `(#:configure-flags
+       ;; C++11 (-DSOCI_CXX11) is OFF by default.  hyperledger-iroha needs it.
+       (list "-DCMAKE_CXX_STANDARD=17"
+             "-DSOCI_LIBDIR=lib")
+       #:tests? #f))         ; may require running database management systems
     (synopsis "C++ Database Access Library")
     (description
      "SOCI is an abstraction layer for several database backends, including