gnu: mesa: Update to 18.1.8.
[jackhill/guix/guix.git] / gnu / packages / storage.scm
CommitLineData
dcfe44cb 1;;; GNU Guix --- Functional package management for GNU
5b0b520e 2;;; Copyright © 2017, 2018 Marius Bakke <mbakke@fastmail.com>
5bf306f9 3;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
dcfe44cb
MB
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (gnu packages storage)
21 #:use-module (guix download)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix packages)
24 #:use-module (guix utils)
25 #:use-module (guix build-system cmake)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages admin)
28 #:use-module (gnu packages assembly)
29 #:use-module (gnu packages bdw-gc)
30 #:use-module (gnu packages boost)
ac257f12 31 #:use-module (gnu packages check)
dcfe44cb
MB
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages crypto)
34 #:use-module (gnu packages cryptsetup)
35 #:use-module (gnu packages curl)
36 #:use-module (gnu packages databases)
37 #:use-module (gnu packages disk)
38 #:use-module (gnu packages gnuzilla)
5b0b520e 39 #:use-module (gnu packages gperf)
dcfe44cb
MB
40 #:use-module (gnu packages jemalloc)
41 #:use-module (gnu packages linux)
42 #:use-module (gnu packages lua)
43 #:use-module (gnu packages openldap)
44 #:use-module (gnu packages perl)
45 #:use-module (gnu packages pkg-config)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages tls)
48 #:use-module (gnu packages web)
49 #:use-module (gnu packages xml))
50
51(define-public ceph
52 (package
53 (name "ceph")
3743e132 54 (version "12.2.5")
dcfe44cb
MB
55 (source (origin
56 (method url-fetch)
57 (uri (string-append "https://download.ceph.com/tarballs/ceph-"
58 version ".tar.gz"))
59 (sha256
60 (base32
3743e132 61 "1ydc3mfvc0vpnpfnfmissvsrsj4jyxgzc2pcl1a4vdr3bwkcglp3"))
dcfe44cb
MB
62 (patches
63 (search-patches "ceph-skip-unittest_blockdev.patch"
64 "ceph-skip-collect-sys-info-test.patch"
5b0b520e 65 "ceph-rocksdb-compat.patch"
dcfe44cb
MB
66 "ceph-disable-cpu-optimizations.patch"))
67 (modules '((guix build utils)))
68 (snippet
69 '(begin
70 (for-each delete-file-recursively
71 '(;; TODO: Unbundle these:
72 ;"src/isa-l"
73 ;"src/lua"
74 ;"src/googletest"
75 ;"src/xxHash"
76 ;"src/zstd"
77 ;"src/civetweb"
dcfe44cb
MB
78 "src/test/downloads"
79 "src/dpdk"
80 "src/spdk"
81 "src/rocksdb"
82 "src/boost"))
83 #t))))
84 (build-system cmake-build-system)
85 (arguments
86 `(#:configure-flags
87 (let* ((out (assoc-ref %outputs "out"))
88 (lib (assoc-ref %outputs "lib"))
89 (libdir (string-append lib "/lib")))
90 (list (string-append "-DCMAKE_INSTALL_PREFIX=" out)
91 (string-append "-DCMAKE_INSTALL_LIBDIR=" libdir)
92 ;; We need both libdir and libdir/ceph in RUNPATH.
93 (string-append "-DCMAKE_INSTALL_RPATH="
94 libdir ";" libdir "/ceph")
95 (string-append "-DCMAKE_INSTALL_SYSCONFDIR=" out "/etc")
96 (string-append "-DCMAKE_INSTALL_MANDIR=" out "/share/man")
97 (string-append "-DCMAKE_INSTALL_DOCDIR=" out "/share/ceph/doc")
98 (string-append "-DCMAKE_INSTALL_LIBEXECDIR=" out "/libexec")
99 (string-append "-DKEYUTILS_INCLUDE_DIR="
100 (assoc-ref %build-inputs "keyutils") "/include")
101 "-DCMAKE_INSTALL_LOCALSTATEDIR=/var"
102 "-DENABLE_SHARED=ON"
103 "-DWITH_EMBEDDED=OFF"
104 "-DWITH_SYSTEM_ROCKSDB=ON"
105 "-DWITH_SYSTEM_BOOST=ON"
106 "-DWITH_PYTHON3=ON"
107 ;; TODO: Enable these when available in Guix.
5b0b520e 108 "-DWITH_BABELTRACE=OFF"
dcfe44cb
MB
109 "-DWITH_LTTNG=OFF"
110 "-DWITH_XFS=OFF"
111 "-DWITH_XIO=OFF"
112 ;; Use jemalloc instead of tcmalloc.
113 "-DALLOCATOR=jemalloc"))
5bf306f9
RH
114 ;; FIXME: Some of the tests leak Btrfs subvolumes on Btrfs. See
115 ;; <https://bugs.gnu.org/29674> for details. Disable tests until
116 ;; resolved.
117 #:tests? #f
dcfe44cb
MB
118 #:phases
119 (modify-phases %standard-phases
120 (add-after 'unpack 'patch-source
121 (lambda* (#:key outputs #:allow-other-keys)
122 (let ((out (assoc-ref outputs "out"))
123 (lib (assoc-ref outputs "lib")))
124
125 ;; Make header files follow the dynamic libraries.
126 (substitute* "src/include/CMakeLists.txt"
127 (("DESTINATION include")
128 (string-append "DESTINATION " lib "/include")))
129
130 (substitute* "cmake/modules/Distutils.cmake"
131 ;; Prevent creation of Python eggs.
132 (("setup.py install")
133 "setup.py install --single-version-externally-managed --root=/"))
134
135 (substitute* (find-files "src/pybind" "^setup\\.py$")
136 ;; Here we inject an extra line to the `setup.py' of the
137 ;; Python C libraries so RUNPATH gets set up correctly.
138 (("^([[:blank:]]+)extra_compile_args=(.*)$" _ indent args)
139 (string-append indent "extra_compile_args=" args
140 indent "extra_link_args=['-Wl,-rpath="
141 lib "/lib'],\n")))
142
143 (substitute* "src/ceph-disk/tox.ini"
144 ;; Disable flake8 test since it complains about too long lines.
145 (("envlist = flake8,py27") "envlist = py27"))
146
147 (substitute* "src/ceph-detect-init/tox.ini"
148 ;; Disable python3 tests until we at least get py2 working.
149 (("envlist = pep8,py27,py3") "envlist = pep8,py27"))
150
151 (substitute* "src/key_value_store/kv_flat_btree_async.cc"
152 (("/usr/include/") ""))
153
154 (substitute* "src/test/test_subprocess.cc"
155 (("/bin/sh") (which "sh")))
5b0b520e 156 (substitute* "qa/standalone/special/ceph_objectstore_tool.py"
dcfe44cb
MB
157 (("/bin/rm") (which "rm")))
158 (substitute* "src/ceph-disk/ceph_disk/main.py"
159 (("/bin/mount") "mount")
160 (("/bin/umount") "umount")
161 (("/sbin/blkid") (which "blkid"))
5b0b520e 162 (("'cryptsetup'") (string-append "'" (which "cryptsetup") "'"))
dcfe44cb
MB
163 (("'sgdisk'") (string-append "'" (which "sgdisk") "'"))
164 (("'parted'") (string-append "'" (which "parted") "'"))
165 (("'udevadm'") (string-append "'" (which "udevadm") "'")))
166
dcfe44cb
MB
167 (substitute* "udev/50-rbd.rules"
168 (("/usr/bin/ceph-rbdnamer")
169 (string-append out "/bin/ceph-rbdnamer")))
170 (substitute* "udev/60-ceph-by-parttypeuuid.rules"
171 (("/sbin/blkid") (which "blkid")))
172 (substitute* "udev/95-ceph-osd.rules"
173 (("/usr/sbin/ceph-disk")
174 (string-append out "/bin/ceph-disk")))
175
176 (substitute* "src/test/run-cli-tests"
177 ;; Use our python-cram instead of the (un)bundled one.
178 (("CRAM_BIN=.*$")
179 (string-append "CRAM_BIN=" (which "cram") "\n")))
180
181 ;; Disable tests that are known to fail.
182 ;; TODO: The majority of these fail because
183 ;; 'qa/workunits/ceph-helpers.sh' expects to find
184 ;; /tmp/ceph-disk-virtualenv/bin/ceph-disk, but somehow
185 ;; src/ceph-disk/CMakeLists.txt fails to create it.
186 (substitute* "src/test/CMakeLists.txt"
187 ;; FIXME: "create cannot load compressor of type zlib"
188 ;; "libceph_zlib.so: undefined symbol: isal_deflate"
189 (("^add_subdirectory\\(compressor\\)") "")
190 ;; FIXME: These tests fails because `ceph-disk'
191 ;; is not available.
192 (("^add_ceph_test\\(test-ceph-helpers\\.sh.*$") "\n")
193 (("^add_ceph_test\\(test_pidfile\\.sh.*$") "\n")
194 ;; XXX Why does this fail.
195 (("^add_ceph_test\\(cephtool-test-mon\\.sh.*$") "\n")
196 ;; This fails due to missing '/etc/fstab'.
197 (("^add_ceph_test\\(cephtool-test-rados\\.sh.*$") "\n")
198 ;; `Bad messages to stderr: OSD has the store locked'
199 (("^add_ceph_test\\(ceph_objectstore_tool\\.py.*$") "\n")
200 ;; The bundled python-cram fork needs patching to work on
201 ;; guix, and the system version does not support --error-dir.
202 ;; https://bitbucket.org/brodie/cram/issues/9
203 (("^add_ceph_test\\(run-cli-tests.*$") "\n")
204 ;; FIXME: tox/virtualenv/pip does not discover the
205 ;; required packages and tries to go online.
206 (("^add_test\\(NAME run-tox-ceph-disk.*$") "\n")
207 (("^add_test\\(NAME run-tox-ceph-detect-init.*$") "\n")
208 ;; Also remove from the set_property block.
209 (("run-tox-ceph-disk") "")
210 (("run-tox-ceph-detect-init") ""))
c3c25082
MB
211 ;; TODO: This also seems to fail because of /etc/os-release.
212 ;; How to make src/common/util.cc behave without it.
213 (substitute* "src/test/crush/CMakeLists.txt"
214 (("^add_ceph_test\\(crush-classes\\.sh.*$") "\n"))
dcfe44cb
MB
215 ;; More 'ceph-disk' issues here.. :-(
216 (substitute* "src/test/erasure-code/CMakeLists.txt"
217 (("^add_ceph_test\\(test-erasure-code-plugins\\.sh.*$") "\n")
218 (("^add_ceph_test\\(test-erasure-code\\.sh.*$") "\n")
219 (("^add_ceph_test\\(test-erasure-eio\\.sh.*$") "\n"))
220 (substitute* "src/test/libradosstriper/CMakeLists.txt"
221 (("^add_ceph_test\\(rados-striper\\.sh.*$") "\n"))
222 (substitute* "src/test/mon/CMakeLists.txt"
223 (("^add_ceph_test\\(osd-crush\\.sh.*$") "\n")
224 (("^add_ceph_test\\(test_pool_quota\\.sh.*$") "\n")
225 (("^add_ceph_test\\(osd-pool-create\\.sh.*$") "\n"))
226 (substitute* "src/test/osd/CMakeLists.txt"
227 (("^add_ceph_test\\(osd-bench\\.sh.*$") "\n")
228 (("^add_ceph_test\\(osd-config\\.sh.*$") "\n")
ce09f04e 229 (("add_ceph_test\\(osd-dup\\.sh.*$") "\n")
dcfe44cb
MB
230 (("^add_ceph_test\\(osd-markdown\\.sh.*$") "\n")
231 (("^add_ceph_test\\(osd-reactivate\\.sh.*$") "\n")
232 (("^add_ceph_test\\(osd-reuse-id\\.sh.*$") "\n")
233 (("^add_ceph_test\\(osd-scrub-repair\\.sh.*$") "\n")
234 (("^add_ceph_test\\(osd-scrub-snaps\\.sh.*$") "\n")
235 (("^add_ceph_test\\(osd-copy-from\\.sh.*$") "\n")
236 (("^add_ceph_test\\(osd-fast-mark-down\\.sh.*$") "\n"))
237 #t)))
238 (add-before 'check 'set-check-environment
239 (lambda _
240 ;; Run tests in parallel.
241 (setenv "CTEST_PARALLEL_LEVEL"
242 (number->string (parallel-job-count)))
243 ;; `pip' requires write access in $HOME.
244 (setenv "HOME" "/tmp")
245 #t))
246 (add-before 'install 'set-install-environment
247 (lambda* (#:key outputs #:allow-other-keys)
248 (let* ((out (assoc-ref outputs "out"))
249 (py2sitedir
250 (string-append out "/lib/python2.7/site-packages"))
251 (py3sitedir
252 (string-append out "/lib/python"
253 ,(version-major+minor
254 (package-version python))
255 "/site-packages")))
256 ;; The Python install scripts refuses to function if
257 ;; the install directory is not on PYTHONPATH.
258 (setenv "PYTHONPATH"
259 (string-append py2sitedir ":" py3sitedir ":"
260 (getenv "PYTHONPATH")))
261 #t)))
262 (add-after 'install 'wrap-python-scripts
5b0b520e 263 (lambda* (#:key inputs outputs #:allow-other-keys)
dcfe44cb 264 (let* ((out (assoc-ref outputs "out"))
5b0b520e 265 (ceph (string-append out "/bin/ceph"))
dcfe44cb
MB
266 (ceph-disk (string-append out "/bin/ceph-disk"))
267 (ceph-detect-init (string-append
268 out "/bin/ceph-detect-init"))
dcfe44cb 269
5b0b520e
MB
270 (prettytable (assoc-ref inputs "python2-prettytable"))
271
272 (sitedir (lambda (package)
273 (string-append package
274 "/lib/python2.7/site-packages")))
275 (PYTHONPATH (string-append
276 (sitedir out) ":"
277 (sitedir prettytable))))
dcfe44cb
MB
278 (for-each (lambda (executable)
279 (wrap-program executable
280 `("PYTHONPATH" ":" prefix (,PYTHONPATH))))
5b0b520e 281 (list ceph ceph-disk ceph-detect-init))
dcfe44cb
MB
282 #t))))))
283 (outputs
284 '("out" "lib"))
285 (native-inputs
5b0b520e
MB
286 `(("gperf" ,gperf)
287 ("pkg-config" ,pkg-config)
dcfe44cb
MB
288 ("python-cython" ,python-cython)
289 ("python-sphinx" ,python-sphinx)
290 ("yasm" ,yasm)
291
292 ;; For tests.
293 ("inetutils" ,inetutils)
294 ("jq" ,jq)
295 ("perl" ,perl)
296 ("xmlstarlet" ,xmlstarlet)
297 ("python2-cram" ,python2-cram)
298 ("python2-virtualenv" ,python2-virtualenv)
299
300 ;; These dependencies are taken from test-requirements.txt
301 ;; of ceph-disk and ceph-detect-init. The latter can also
302 ;; test against python3, but let's try to get python2 tests
303 ;; working first since that is the default.
304 ("python2-configobj" ,python2-configobj)
305 ("python2-coverage" ,python2-coverage)
306 ("python2-discover" ,python2-discover)
307 ("python2-fixtures" ,python2-fixtures)
308 ("python2-flake8" ,python2-flake8)
309 ("python2-mock" ,python2-mock)
310 ("python2-nose" ,python2-nose)
311 ("python2-pip" ,python2-pip)
312 ("python2-pytest" ,python2-pytest)
313 ("python2-subunit" ,python2-subunit)
314 ("python2-testrepository" ,python2-testrepository)
315 ("python2-testtools" ,python2-testtools)
316 ("python2-tox" ,python2-tox)))
317 (inputs
058ad040 318 `(("boost" ,boost)
dcfe44cb
MB
319 ("curl" ,curl)
320 ("cryptsetup" ,cryptsetup)
321 ("expat" ,expat)
322 ("fcgi" ,fcgi)
323 ("fuse" ,fuse)
324 ("gptfdisk" ,gptfdisk)
325 ("jemalloc" ,jemalloc)
326 ("keyutils" ,keyutils)
327 ("leveldb" ,leveldb)
328 ("libaio" ,libaio)
329 ("libatomic-ops" ,libatomic-ops)
330 ("lua" ,lua)
331 ("lz4" ,lz4)
332 ("openldap" ,openldap)
333 ("openssl" ,openssl)
334 ("nss" ,nss)
335 ("parted" ,parted)
336 ("python@2" ,python-2)
5b0b520e 337 ("python2-prettytable" ,python2-prettytable) ;used by ceph_daemon.py
dcfe44cb
MB
338 ("python@3" ,python-3)
339 ("rocksdb" ,rocksdb)
340 ("snappy" ,snappy)
341 ("udev" ,eudev)
342 ("util-linux" ,util-linux)
343 ("zlib" ,zlib)))
344 (home-page "https://ceph.com/")
345 (synopsis "Distributed object store and file system")
346 (description
347 "Ceph is a distributed storage system designed for reliability and
348performance. It provides network-based block devices (RBD), a POSIX
162a1374 349compliant file system (CephFS), and offers compatibility with various
dcfe44cb
MB
350storage protocols (S3, NFS, and others) through the RADOS gateway.")
351 ;; The Ceph libraries are LGPL2.1 and most of the utilities fall under
352 ;; GPL2. The installed erasure code plugins are BSD-3 licensed and do
353 ;; not use the GPL code. The source archive includes a number of files
354 ;; carrying other licenses; consult COPYING for more information. Note
355 ;; that COPYING does not cover third-party bundled software.
356 (license (list license:lgpl2.1 license:gpl2 ;some files are 'or later'
357 license:cc-by-sa3.0 ;documentation
358 license:bsd-3 ;isa-l,jerasure,++
359 license:expat)))) ;civetweb,java bindings