Subject: [PATCH 1/6] gnu: rocksdb: Update to 5.10.3.

From: Marius Bakke <[email-masked]>
Date: Sat, 24 Feb 2018 20:03:44 +0100

* gnu/packages/databases.scm (rocksdb): Update to 5.10.3.
[arguments]: Set #:test-target.  Add "USE_RTTI=1" to #:make-flags.  Use INVOKE
instead of SYSTEM*.  Replace 'check' phase and enable fixed test.
[license]: Update for changes in 5.5.4.
---
 gnu/packages/databases.scm | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 29b6ca169..9f183b93e 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -17,7 +17,7 @@
 ;;; Copyright © 2016 Jan Nieuwenhuizen <[email-masked]>
 ;;; Copyright © 2016 Andy Patterson <[email-masked]>
 ;;; Copyright © 2016 Danny Milosavljevic <[email-masked]>
-;;; Copyright © 2016, 2017 Marius Bakke <[email-masked]>
+;;; Copyright © 2016, 2017, 2018 Marius Bakke <[email-masked]>
 ;;; Copyright © 2017 Julien Lepiller <[email-masked]>
 ;;; Copyright © 2017 Thomas Danckaert <[email-masked]>
 ;;; Copyright © 2017 Jelle Licht <[email-masked]>
@@ -840,7 +840,7 @@ types are supported, as is encryption.")
 (define-public rocksdb
   (package
     (name "rocksdb")
-    (version "5.2.1")
+    (version "5.10.3")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://github.com/facebook/rocksdb"
@@ -848,7 +848,7 @@ types are supported, as is encryption.")
               (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "1v2q05bl56sfp51m09z7g6489hkfq4vf6b4qgfg3d96ylgmay9yb"))
+                "0kx3mn2ifl9wfqg49msgzpvmr0x8mbhfglf78639xwrdyi2f90ya"))
               (modules '((guix build utils)))
               (snippet
                '(begin
@@ -858,6 +858,8 @@ types are supported, as is encryption.")
     (build-system gnu-build-system)
     (arguments
      `(#:make-flags (list "CC=gcc"
+                          ;; Ceph requires that RTTI is enabled.
+                          "USE_RTTI=1"
                           (string-append "INSTALL_PATH="
                                          (assoc-ref %outputs "out")))
        ;; Many tests fail on 32-bit platforms. There are multiple reports about
@@ -888,20 +890,28 @@ types are supported, as is encryption.")
          (add-before 'check 'disable-failing-tests
            (lambda _
              (substitute* "Makefile"
-               ;; This test fails with GCC-5 and is unmaintained.
-               ;; https://github.com/facebook/rocksdb/issues/2148
-               (("^[[:blank:]]+spatial_db_test[[:blank:]]+\\\\") "\\")
                ;; These tests reliably fail due to "Too many open files".
                (("^[[:blank:]]+env_test[[:blank:]]+\\\\") "\\")
                (("^[[:blank:]]+persistent_cache_test[[:blank:]]+\\\\") "\\"))
              #t))
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             ;; Running the full test suite takes hours and require
+             ;; a lot of disk space.  Instead we only run a subset
+             ;; like the CI runners (see .travis.yml).
+             (if tests?
+                 (invoke "make" "V=1" "ROCKSDBTESTS_END=db_block_cache_test"
+                         "CC=gcc" "-j" (number->string (parallel-job-count))
+                         "all_but_some_tests" "check_some")
+                 (display "no test, no problem!\n"))
+             #t))
          (add-after 'check 'build-release-libraries
            ;; The default build target is a debug build for tests. The
            ;; install target depends on "shared_lib" and "static_lib"
            ;; targets for release builds so we build them here for clarity.
            ;; TODO: Add debug output.
            (lambda* (#:key (make-flags '()) #:allow-other-keys)
-             (zero? (apply system* "make" "shared_lib" make-flags)))))))
+             (apply invoke "make" "V=1" "shared_lib" make-flags))))))
     (native-inputs
      `(("parallel" ,parallel)
        ("perl" ,perl)
@@ -925,8 +935,9 @@ between @dfn{Write-Amplification-Factor} (WAF), @dfn{Read-Amplification-Factor}
 (RAF) and @dfn{Space-Amplification-Factor} (SAF).  It has multi-threaded
 compactions, making it specially suitable for storing multiple terabytes of
 data in a single database.  RocksDB is partially based on @code{LevelDB}.")
-    ;; RocksDB is BSD-3 and the JNI adapter is Apache 2.0.
-    (license (list license:bsd-3 license:asl2.0))))
+    ;; RocksDB is dual licensed under GPL2 and ASL 2.0.  Some header
+    ;; files carry the 3-clause BSD license.
+    (license (list license:gpl2 license:asl2.0 license:bsd-3))))
 
 (define-public sparql-query
   (package
-- 
2.16.2