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