summary refs log tree commit diff
path: root/gnu/packages/databases.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/databases.scm')
-rw-r--r--gnu/packages/databases.scm329
1 files changed, 248 insertions, 81 deletions
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index a2bd284659..b37bb255a4 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -32,7 +32,7 @@
 ;;; Copyright © 2017 Kristofer Buffington <kristoferbuffington@gmail.com>
 ;;; Copyright © 2018 Amirouche Boubekki <amirouche@hypermove.net>
 ;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
-;;; Copyright © 2018, 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2018, 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2019 Jack Hill <jackhill@jackhill.us>
 ;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
 ;;; Copyright © 2019 Gábor Boskovits <boskovits@gmail.com>
@@ -59,6 +59,7 @@
 ;;; Copyright © 2022 muradm <mail@muradm.net>
 ;;; Copyright © 2022 Thomas Albers Raviola <thomas@thomaslabs.org>
 ;;; Copyright © 2021, 2022 jgart <jgart@dismail.de>
+;;; Copyright © 2023 Felix Gruber <felgru@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -132,6 +133,7 @@
   #:use-module (gnu packages perl-web)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages popt)
+  #:use-module (gnu packages pretty-print)
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-build)
@@ -899,7 +901,7 @@ Language.")
 (define-public mariadb
   (package
     (name "mariadb")
-    (version "10.5.12")
+    (version "10.10.2")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://downloads.mariadb.com/MariaDB"
@@ -907,21 +909,11 @@ Language.")
                                   version ".tar.gz"))
               (sha256
                (base32
-                "1gg4h9ahmk78cx01zyw0fqr6hhd78fsyhs0s34p3gi9hkak1qkxb"))
+                "1ciw7y08wms9g3hzhyria49r1b9n5wpbhkndazv95d925c8x1jsp"))
               (modules '((guix build utils)))
               (snippet
                '(begin
-                  ;; Delete bundled snappy and xz.
-                  (delete-file-recursively "storage/tokudb/PerconaFT/third_party")
-                  (substitute* "storage/tokudb/PerconaFT/CMakeLists.txt"
-                    ;; This file checks that the bundled sources are present and
-                    ;; declares build procedures for them.
-                    (("^include\\(TokuThirdParty\\)") ""))
-                  (substitute* "storage/tokudb/PerconaFT/ft/CMakeLists.txt"
-                    ;; Don't attempt to use the procedures we just removed.
-                    ((" build_lzma build_snappy") ""))
-
-                  ;; Preserve CMakeLists.txt for these.
+                  ;; Delete bundled libraries, but preserve CMakeLists.txt.
                   (for-each (lambda (file)
                               (unless (string-suffix? "CMakeLists.txt" file)
                                 (delete-file file)))
@@ -933,21 +925,10 @@ Language.")
      `(#:configure-flags
        (list
          "-DBUILD_CONFIG=mysql_release"
-         ;; Linking with libarchive fails, like this:
-
-         ;; ld: /gnu/store/...-libarchive-3.2.2/lib/libarchive.a(archive_entry.o):
-         ;; relocation R_X86_64_32 against `.bss' can not be used when
-         ;; making a shared object; recompile with -fPIC
-
-         ;; For now, disable the features that that use libarchive (xtrabackup).
-         "-DWITH_LIBARCHIVE=OFF"
-
-         ;; Disable the TokuDB engine, because its test suite frequently fails,
-         ;; and loading it crashes the server: <https://bugs.gnu.org/35521>.
-         "-DTOKUDB_OK=OFF"
 
          ;; Ensure the system libraries are used.
          "-DWITH_JEMALLOC=yes"
+         "-DWITH_LIBFMT=system"
          "-DWITH_PCRE=system"
          "-DWITH_SSL=system"
          "-DWITH_ZLIB=system"
@@ -987,14 +968,6 @@ Language.")
        #:parallel-tests? ,(target-x86-64?)
        #:phases
        (modify-phases %standard-phases
-         ,@(if (target-ppc32?)
-             `((add-after 'unpack 'apply-libatomics-patch
-                 (lambda* (#:key inputs #:allow-other-keys)
-                   (let ((patch-file
-                           (assoc-ref inputs
-                                               "mariadb-link-libatomic.patch")))
-                     (invoke "patch" "-p1" "-i" patch-file)))))
-             '())
          (add-after 'unpack 'adjust-output-references
            (lambda _
              ;; The build system invariably prepends $CMAKE_INSTALL_PREFIX
@@ -1030,6 +1003,9 @@ Language.")
                       "main.explain_non_select"
                       "main.upgrade_MDEV-19650"
                       "roles.acl_statistics"
+                      "main.stat_tables_innodb"
+                      "main.stat_tables"
+                      "main.mysql_upgrade"
 
                       ;; Probably same as above, test failure reported upstream:
                       ;; <https://jira.mariadb.org/browse/MDEV-26320>.
@@ -1056,36 +1032,19 @@ Language.")
                          disabled-tests)
                (close-port unstable-tests)
 
-               ;; XXX: These fail because they expect a latin1 charset and
-               ;; collation.  See <https://jira.mariadb.org/browse/MDEV-21264>.
-               (substitute* '("mysql-test/main/gis_notembedded.result"
-                              "mysql-test/main/system_mysql_db.result")
-                 (("latin1_swedish_ci") "utf8_general_ci")
-                 (("\tlatin1") "\tutf8"))
-
                (substitute* "mysql-test/suite/binlog/t/binlog_mysqlbinlog_stop_never.test"
                  (("/bin/bash")
                   (which "bash")))
 
-               (substitute* "mysql-test/mysql-test-run.pl"
+               (substitute* "mysql-test/mariadb-test-run.pl"
                  (("/bin/ls") (which "ls"))
                  (("/bin/sh") (which "sh"))))))
-         (add-before 'configure 'disable-plugins
-           (lambda _
-             (let ((disable-plugin (lambda (name)
-                                     (call-with-output-file
-                                         (string-append "plugin/" name
-                                                        "/CMakeLists.txt")
-                                       (lambda (port)
-                                         (format port "\n")))))
-                   (disabled-plugins '(;; XXX: Causes a test failure.
-                                       "disks")))
-               (for-each disable-plugin disabled-plugins))))
          (replace 'check
            (lambda* (#:key (tests? #t) parallel-tests? #:allow-other-keys)
              (if tests?
                  (with-directory-excursion "mysql-test"
-                   (invoke "./mtr" "--verbose"
+                   (invoke "./mariadb-test-run"
+                           "--verbose"
                            "--retry=3"
                            "--suite=main"
                            "--testcase-timeout=40"
@@ -1099,13 +1058,12 @@ Language.")
                            "--skip-rpl"
                            "--skip-test-list=unstable-tests"))
                  (format #t "test suite not run~%"))))
-         (add-after
-          'install 'post-install
-          (lambda* (#:key inputs outputs #:allow-other-keys)
-            (let* ((out     (assoc-ref outputs "out"))
+         (add-after 'install 'post-install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((out     (assoc-ref outputs "out"))
                    (dev     (assoc-ref outputs "dev"))
                    (lib     (assoc-ref outputs "lib"))
-                   (openssl (assoc-ref inputs "openssl")))
+                   (openssl (dirname (search-input-file inputs "lib/libssl.so"))))
               (substitute* (list (string-append out "/bin/mariadb-install-db")
                                  (string-append out "/bin/mysql_install_db"))
                 (("basedir=\"\"")
@@ -1132,7 +1090,7 @@ Language.")
               (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")
+              (rename-file (string-append out "/bin/mariadb_config")
                            (string-append dev "/bin/mariadb_config"))
               (rename-file (string-append out "/bin/mysql_config")
                            (string-append dev "/bin/mysql_config"))
@@ -1143,25 +1101,20 @@ Language.")
               (substitute* (list (string-append dev "/bin/mysql_config")
                                  (string-append dev "/lib/pkgconfig/mariadb.pc"))
                 (("-lssl -lcrypto" all)
-                 (string-append "-L" openssl "/lib " all)))))))))
+                 (string-append "-L" openssl " " all)))))))))
     (native-inputs
-     (if (target-ppc32?)
-       `(("mariadb-link-libatomic.patch"
-          ,(search-patch "mariadb-link-libatomic.patch"))
-         ("patch" ,patch)
-         ("bison" ,bison)
-         ("perl" ,perl))
-       (list bison perl)))
+     (list bison perl))
     (inputs
-     `(("jemalloc" ,jemalloc)
-       ("libaio" ,libaio)
-       ("libxml2" ,libxml2)
-       ("ncurses" ,ncurses)
-       ("openssl" ,openssl-1.1)
-       ("pam" ,linux-pam)
-       ("pcre2" ,pcre2)
-       ("xz" ,xz)
-       ("zlib" ,zlib)))
+     (list fmt
+           jemalloc
+           libaio
+           libxml2
+           ncurses
+           openssl
+           linux-pam
+           pcre2
+           xz
+           zlib))
     ;; The test suite is very resource intensive and can take more than three
     ;; hours on a x86_64 system.  Give slow and busy machines some leeway.
     (properties '((timeout . 64800)))        ;18 hours
@@ -1287,14 +1240,14 @@ pictures, sounds, or video.")
   (package
     (inherit postgresql-15)
     (name "postgresql")
-    (version "14.4")
+    (version "14.6")
     (source (origin
               (inherit (package-source postgresql-15))
               (uri (string-append "https://ftp.postgresql.org/pub/source/v"
                                   version "/postgresql-" version ".tar.bz2"))
               (sha256
                (base32
-                "0slg7ld5mldmv3pn1wxxwglm4s3xc6c91ixx24apj713qlvn4fy2"))))))
+                "08nzkq321fzfi8ba8gck9zxxg7xvv8vz3mbl4avrmlq933y4122h"))))))
 
 (define-public postgresql-13
   (package
@@ -2520,6 +2473,66 @@ protocol is supported.")
     (home-page "https://github.com/redis/hiredis")
     (license license:bsd-3)))
 
+(define-public ruby-hiredis
+  (package
+    (name "ruby-hiredis")
+    (version "0.6.3")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/redis/hiredis-rb")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "05y4g7frhym59m9x208zpvg2qvqvfjlgqmygxj8sqgl07n0ww1ks"))
+              (patches (search-patches
+                        "ruby-hiredis-use-system-hiredis.patch"))))
+    (build-system ruby-build-system)
+    (arguments
+     (list
+      #:tests? #f                       ;require native extension
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-hiredis-include-directory
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "ext/hiredis_ext/extconf.rb"
+                ;; Adjust the hiredis include directory.
+                (("\\$CFLAGS << \" -I/usr/include/hiredis\"")
+                 (format #f "$CFLAGS << \" -I~a\""
+                         (search-input-directory inputs "include/hiredis"))))))
+          (add-after 'unpack 'disable-building-c-extension
+            (lambda _
+              ;; FIXME: The produced native extension appears to segfault when
+              ;; run; disable building it until a solution is found (see:
+              ;; https://github.com/redis/hiredis-rb/issues/93).
+              (substitute* "ext/hiredis_ext/extconf.rb"
+                (("build_hiredis = true")
+                 "build_hiredis = false"))))
+          ;; FIXME: Un-comment phase after the extension can be made to run
+          ;; without crashing (see above).
+          ;; (add-after 'build 'build-ext
+          ;;   (lambda _
+          ;;     (setenv "CC" #$(cc-for-target))
+          ;;     (invoke "rake" "compile")))
+          (add-before 'check 'start-redis
+            (lambda _
+              (invoke "redis-server" "--daemonize" "yes")))
+          (add-after 'install 'delete-mkmf.log
+            (lambda _
+              ;; This build log captures non-deterministic file names (see:
+              ;; https://github.com/rubygems/rubygems/issues/6259).
+              (for-each delete-file (find-files #$output "^mkmf\\.log$")))))))
+    (native-inputs (list redis ruby-rake-compiler))
+    (inputs (list hiredis))
+    (synopsis "Ruby wrapper for hiredis")
+    (description "@code{hiredis-rb} is a Ruby extension that wraps
+@code{hiredis}, a minimalist C client for Redis.  Both the synchronous
+connection API and a separate protocol reader are supported.  It is primarily
+intended to speed up parsing multi bulk replies.")
+    (home-page "https://github.com/redis/hiredis-rb")
+    (license license:bsd-3)))
+
 (define-public ruby-redis
   (package
     (name "ruby-redis")
@@ -3561,6 +3574,79 @@ this library provides functions to facilitate such comparisons.")
 SQLAlchemy Database Toolkit for Python.")
     (license license:expat)))
 
+(define-public python-sqlite-fts4
+  (package
+    (name "python-sqlite-fts4")
+    (version "1.0.3")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "sqlite-fts4" version))
+              (sha256
+               (base32
+                "034kx0ac556sywy1p4qcrc36l24w3q0xwswqv2z9s3k8yvm5xc3q"))))
+    (build-system python-build-system)
+    (native-inputs (list python-pytest))
+    (home-page "https://github.com/simonw/sqlite-fts4")
+    (synopsis "Python functions for working with SQLite FTS4 search")
+    (description "This package provides custom SQLite functions written
+in Python for ranking documents indexed using the SQLite's FTS4 full
+text search extension.")
+    (license license:asl2.0)))
+
+(define-public python-sqlite-utils
+  (package
+    (name "python-sqlite-utils")
+    (version "3.30")
+    (source (origin
+              (method git-fetch)        ;for tests
+              (uri (git-reference
+                    (url "https://github.com/simonw/sqlite-utils")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1a58syvh5jp40vi5libsxkqy99z75kj4ckxqmylbhd342ppfy1wp"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list #:phases #~(modify-phases %standard-phases
+                        (add-after 'unpack 'relax-requirements
+                          (lambda _
+                            (substitute* "setup.py"
+                              ;; This is a variant designed to have a binary
+                              ;; wheel made available on PyPI, which is not a
+                              ;; concern to Guix.
+                              (("click-default-group-wheel")
+                               "click-default-group")))))))
+    (propagated-inputs (list python-click python-click-default-group
+                             python-dateutil python-sqlite-fts4
+                             python-tabulate))
+    (native-inputs (list python-pytest))
+    (home-page "https://github.com/simonw/sqlite-utils")
+    (synopsis
+     "CLI tool and Python utility functions for manipulating SQLite databases")
+    (description
+     "This package provides a CLI tool and Python utility functions for
+manipulating SQLite databases.  It's main features are:
+@itemize
+@item
+Pipe JSON (or CSV or TSV) directly into a new SQLite database file,
+automatically creating a table with the appropriate schema.
+@item
+Run in-memory SQL queries, including joins, directly against data in
+CSV, TSV or JSON files and view the results.
+@item
+Configure SQLite full-text search against your database tables and run
+search queries against them, ordered by relevance.
+@item
+Run transformations against your tables to make schema changes that
+SQLite ALTER TABLE does not directly support, such as changing the type
+of a column.
+@item
+Extract columns into separate tables to better normalize your existing
+data.
+@end itemize")
+    (license license:asl2.0)))
+
 (define-public python-pickleshare
   (package
     (name "python-pickleshare")
@@ -3972,7 +4058,7 @@ reasonable substitute.")
 (define-public python-redis
   (package
     (name "python-redis")
-    (version "4.5.2")
+    (version "4.5.4")
     (source (origin
               ;; The PyPI archive lacks some test resources such as the TLS
               ;; certificates under docker/stunnel/keys.
@@ -3983,7 +4069,7 @@ reasonable substitute.")
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0cz3gji3rb1h5dczyl11hm42wgsbz5v896cgbi14dij160b7m35i"))))
+                "0s5pswykjcyqbx471ib3gwy29xxa5ckgch9hy476x2s4pvhkbgmr"))))
     (build-system pyproject-build-system)
     (arguments
      (list
@@ -5019,3 +5105,84 @@ generic interface to caching backends of any variety, and additionally
 provides API hooks which integrate these cache backends with the locking
 mechanism of @code{dogpile}.")
     (license license:expat)))
+
+(define-public datasette
+  (package
+    (name "datasette")
+    (version "0.64.2")
+    (source (origin
+              (method git-fetch)        ;for tests
+              (uri (git-reference
+                    (url "https://github.com/simonw/datasette")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1c8ajdaraynrjvsb8xxxnkb7zgm5fwq60qczaz00n465ki80j4h3"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:test-flags
+      ;; There are multiple unexplained test failures (see:
+      ;; https://github.com/simonw/datasette/issues/2048).
+      #~(list "-k" (string-append
+                    "not (test_database_page_for_database_with_dot_in_name"
+                    " or test_row_strange_table_name"
+                    " or test_database_with_space_in_name"
+                    " or test_tilde_encoded_database_names"
+                    " or test_weird_database_names"
+                    " or test_css_classes_on_body"
+                    " or test_templates_considered"
+                    " or test_row_html_compound_primary_key"
+                    " or test_edit_sql_link_on_canned_queries"
+                    " or test_alternate_url_json"
+                    " or test_table_with_slashes_in_name"
+                    " or test_searchable"
+                    " or test_custom_query_with_unicode_characters"
+                    " or test_searchmode)")
+              "-n" (number->string (parallel-job-count))
+              "-m" "not serial")        ;cannot run in parallel
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'relax-requirements
+            (lambda _
+              ;; The package needlessly specifies exact versions
+              ;; of dependencies, when it works fine with others.
+              (substitute* "setup.py"
+                (("(black)==[0-9\\.]+" _ package)
+                 package)
+                (("click-default-group-wheel")
+                 "click-default-group")))))))
+    (propagated-inputs
+     (list python-aiofiles
+           python-asgi-csrf
+           python-asgiref
+           python-click
+           python-click-default-group
+           python-httpx
+           python-hupper
+           python-itsdangerous
+           python-janus
+           python-jinja2
+           python-mergedeep
+           python-pint
+           python-pluggy-next
+           python-pyyaml
+           python-uvicorn))
+    (native-inputs
+     (list python-beautifulsoup4
+           python-black
+           python-cogapp
+           python-pytest-7.1
+           python-pytest-asyncio
+           python-pytest-runner
+           python-pytest-timeout
+           python-pytest-xdist
+           python-setuptools
+           python-trustme))
+    (home-page "https://datasette.io/")
+    (synopsis "Multi-tool for exploring and publishing data")
+    (description "Datasette is a tool for exploring and publishing data.
+It helps people take data of any shape or size and publish that as an
+interactive, explorable website and accompanying API.")
+    (license license:asl2.0)))