diff options
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/tools/filesystems/ceph')
3 files changed, 296 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/tools/filesystems/ceph/0000-fix-SPDK-build-env.patch b/infra/libkookie/nixpkgs/pkgs/tools/filesystems/ceph/0000-fix-SPDK-build-env.patch new file mode 100644 index 000000000000..a117408b000f --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/tools/filesystems/ceph/0000-fix-SPDK-build-env.patch @@ -0,0 +1,11 @@ +--- a/cmake/modules/BuildSPDK.cmake ++++ b/cmake/modules/BuildSPDK.cmake +@@ -35,7 +35,7 @@ macro(build_spdk) + # unset $CFLAGS, otherwise it will interfere with how SPDK sets + # its include directory. + # unset $LDFLAGS, otherwise SPDK will fail to mock some functions. +- BUILD_COMMAND env -i PATH=$ENV{PATH} CC=${CMAKE_C_COMPILER} ${make_cmd} EXTRA_CFLAGS="${spdk_CFLAGS}" ++ BUILD_COMMAND env -i PATH=$ENV{PATH} CC=${CMAKE_C_COMPILER} ${make_cmd} EXTRA_CFLAGS="${spdk_CFLAGS}" C_OPT="-mssse3" + BUILD_IN_SOURCE 1 + INSTALL_COMMAND "true") + unset(make_cmd) diff --git a/infra/libkookie/nixpkgs/pkgs/tools/filesystems/ceph/ceph-glibc-2-32-sigdescr_np.patch b/infra/libkookie/nixpkgs/pkgs/tools/filesystems/ceph/ceph-glibc-2-32-sigdescr_np.patch new file mode 100644 index 000000000000..f78c7af9e35a --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/tools/filesystems/ceph/ceph-glibc-2-32-sigdescr_np.patch @@ -0,0 +1,63 @@ +From b9b6faf66ae67648626470cb4fc3f0850ac4d842 Mon Sep 17 00:00:00 2001 +From: David Disseldorp <ddiss@suse.de> +Date: Tue, 1 Sep 2020 13:49:21 +0200 +Subject: [PATCH] cmake: detect and use sigdescr_np() if available + +sys_siglist is deprecated with glibc 2.32. A new thread-safe and +async-signal safe sigdescr_np() function is provided, so use it if +available. + +Fixes: https://tracker.ceph.com/issues/47187 +Signed-off-by: David Disseldorp <ddiss@suse.de> +--- + cmake/modules/CephChecks.cmake | 1 + + src/global/signal_handler.h | 8 +++++--- + src/include/config-h.in.cmake | 3 +++ + 3 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/cmake/modules/CephChecks.cmake b/cmake/modules/CephChecks.cmake +index 23687283a7c6..ca86dcbc73de 100644 +--- a/cmake/modules/CephChecks.cmake ++++ b/cmake/modules/CephChecks.cmake +@@ -24,6 +24,7 @@ check_function_exists(strerror_r HAVE_Strerror_R) + check_function_exists(name_to_handle_at HAVE_NAME_TO_HANDLE_AT) + check_function_exists(pipe2 HAVE_PIPE2) + check_function_exists(accept4 HAVE_ACCEPT4) ++check_function_exists(sigdescr_np HAVE_SIGDESCR_NP) + + include(CMakePushCheckState) + cmake_push_check_state(RESET) +diff --git a/src/global/signal_handler.h b/src/global/signal_handler.h +index 476724201aa9..c101b2e28733 100644 +--- a/src/global/signal_handler.h ++++ b/src/global/signal_handler.h +@@ -20,10 +20,12 @@ + + typedef void (*signal_handler_t)(int); + +-#ifndef HAVE_REENTRANT_STRSIGNAL +-# define sig_str(signum) sys_siglist[signum] +-#else ++#ifdef HAVE_SIGDESCR_NP ++# define sig_str(signum) sigdescr_np(signum) ++#elif HAVE_REENTRANT_STRSIGNAL + # define sig_str(signum) strsignal(signum) ++#else ++# define sig_str(signum) sys_siglist[signum] + #endif + + void install_sighandler(int signum, signal_handler_t handler, int flags); +diff --git a/src/include/config-h.in.cmake b/src/include/config-h.in.cmake +index 1ea3703f620c..59bd4273511a 100644 +--- a/src/include/config-h.in.cmake ++++ b/src/include/config-h.in.cmake +@@ -220,6 +220,9 @@ + /* Define to 1 if you have sched.h. */ + #cmakedefine HAVE_SCHED 1 + ++/* Define to 1 if you have sigdescr_np. */ ++#cmakedefine HAVE_SIGDESCR_NP 1 ++ + /* Support SSE (Streaming SIMD Extensions) instructions */ + #cmakedefine HAVE_SSE + diff --git a/infra/libkookie/nixpkgs/pkgs/tools/filesystems/ceph/default.nix b/infra/libkookie/nixpkgs/pkgs/tools/filesystems/ceph/default.nix new file mode 100644 index 000000000000..b75a902681e5 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/tools/filesystems/ceph/default.nix @@ -0,0 +1,222 @@ +{ stdenv, runCommand, fetchurl +, fetchpatch +, ensureNewerSourcesHook +, cmake, pkgconfig +, which, git +, boost, python3Packages +, libxml2, zlib, lz4 +, openldap, lttng-ust +, babeltrace, gperf +, gtest +, cunit, snappy +, rocksdb, makeWrapper +, leveldb, oathToolkit +, libnl, libcap_ng +, rdkafka + +# Optional Dependencies +, yasm ? null, fcgi ? null, expat ? null +, curl ? null, fuse ? null +, libedit ? null, libatomic_ops ? null +, libs3 ? null + +# Mallocs +, jemalloc ? null, gperftools ? null + +# Crypto Dependencies +, cryptopp ? null +, nss ? null, nspr ? null + +# Linux Only Dependencies +, linuxHeaders, util-linux, libuuid, udev, keyutils, rdma-core, rabbitmq-c +, libaio ? null, libxfs ? null, zfs ? null +, ... +}: + +# We must have one crypto library +assert cryptopp != null || (nss != null && nspr != null); + +with stdenv; with stdenv.lib; +let + shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null; + + optYasm = shouldUsePkg yasm; + optFcgi = shouldUsePkg fcgi; + optExpat = shouldUsePkg expat; + optCurl = shouldUsePkg curl; + optFuse = shouldUsePkg fuse; + optLibedit = shouldUsePkg libedit; + optLibatomic_ops = shouldUsePkg libatomic_ops; + optLibs3 = shouldUsePkg libs3; + + optJemalloc = shouldUsePkg jemalloc; + optGperftools = shouldUsePkg gperftools; + + optCryptopp = shouldUsePkg cryptopp; + optNss = shouldUsePkg nss; + optNspr = shouldUsePkg nspr; + + optLibaio = shouldUsePkg libaio; + optLibxfs = shouldUsePkg libxfs; + optZfs = shouldUsePkg zfs; + + hasRadosgw = optFcgi != null && optExpat != null && optCurl != null && optLibedit != null; + + + # Malloc implementation (can be jemalloc, tcmalloc or null) + malloc = if optJemalloc != null then optJemalloc else optGperftools; + + # We prefer nss over cryptopp + cryptoStr = if optNss != null && optNspr != null then "nss" else + if optCryptopp != null then "cryptopp" else "none"; + + cryptoLibsMap = { + nss = [ optNss optNspr ]; + cryptopp = [ optCryptopp ]; + none = [ ]; + }; + + getMeta = description: { + homepage = "https://ceph.com/"; + inherit description; + license = with licenses; [ lgpl21 gpl2 bsd3 mit publicDomain ]; + maintainers = with maintainers; [ adev ak johanot krav ]; + platforms = [ "x86_64-linux" ]; + }; + + ceph-common = python3Packages.buildPythonPackage rec{ + pname = "ceph-common"; + inherit src version; + + sourceRoot = "ceph-${version}/src/python-common"; + + checkInputs = [ python3Packages.pytest ]; + propagatedBuildInputs = with python3Packages; [ pyyaml six ]; + + meta = getMeta "Ceph common module for code shared by manager modules"; + }; + + ceph-python-env = python3Packages.python.withPackages (ps: [ + ps.sphinx + ps.flask + ps.cython + ps.setuptools + ps.virtualenv + # Libraries needed by the python tools + ps.Mako + ceph-common + ps.cherrypy + ps.dateutil + ps.jsonpatch + ps.pecan + ps.prettytable + ps.pyjwt + ps.webob + ps.bcrypt + # scipy > 1.3 breaks diskprediction_local, leading to mgr hang on startup + # Bump (and get rid of scipy_1_3) once these issues are resolved: + # https://tracker.ceph.com/issues/42764 https://tracker.ceph.com/issues/45147 + ps.scipy_1_3 + ps.six + ps.pyyaml + ]); + sitePackages = ceph-python-env.python.sitePackages; + + version = "15.2.6"; + src = fetchurl { + url = "http://download.ceph.com/tarballs/ceph-${version}.tar.gz"; + sha256 = "093pphgqrkrbv3484ayl0vac6a6s53zxa01yad0cbvnx0kyj55hh"; + }; +in rec { + ceph = stdenv.mkDerivation { + pname = "ceph"; + inherit src version; + + patches = [ + ./0000-fix-SPDK-build-env.patch + ./ceph-glibc-2-32-sigdescr_np.patch + ]; + + nativeBuildInputs = [ + cmake + pkgconfig which git python3Packages.wrapPython makeWrapper + python3Packages.python # for the toPythonPath function + (ensureNewerSourcesHook { year = "1980"; }) + ]; + + buildInputs = cryptoLibsMap.${cryptoStr} ++ [ + boost ceph-python-env libxml2 optYasm optLibatomic_ops optLibs3 + malloc zlib openldap lttng-ust babeltrace gperf gtest cunit + snappy rocksdb lz4 oathToolkit leveldb libnl libcap_ng rdkafka + ] ++ optionals stdenv.isLinux [ + linuxHeaders util-linux libuuid udev keyutils optLibaio optLibxfs optZfs + # ceph 14 + rdma-core rabbitmq-c + ] ++ optionals hasRadosgw [ + optFcgi optExpat optCurl optFuse optLibedit + ]; + + pythonPath = [ ceph-python-env "${placeholder "out"}/${ceph-python-env.sitePackages}" ]; + + preConfigure ='' + substituteInPlace src/common/module.c --replace "/sbin/modinfo" "modinfo" + substituteInPlace src/common/module.c --replace "/sbin/modprobe" "modprobe" + + # for pybind/rgw to find internal dep + export LD_LIBRARY_PATH="$PWD/build/lib''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" + # install target needs to be in PYTHONPATH for "*.pth support" check to succeed + # set PYTHONPATH, so the build system doesn't silently skip installing ceph-volume and others + export PYTHONPATH=${ceph-python-env}/${sitePackages}:$lib/${sitePackages}:$out/${sitePackages} + patchShebangs src/script src/spdk src/test src/tools + ''; + + cmakeFlags = [ + "-DWITH_PYTHON3=ON" + "-DWITH_SYSTEM_ROCKSDB=OFF" + "-DCMAKE_INSTALL_DATADIR=${placeholder "lib"}/lib" + + + "-DWITH_SYSTEM_BOOST=ON" + "-DWITH_SYSTEM_ROCKSDB=ON" + "-DWITH_SYSTEM_GTEST=ON" + "-DMGR_PYTHON_VERSION=${ceph-python-env.python.pythonVersion}" + "-DWITH_SYSTEMD=OFF" + "-DWITH_TESTS=OFF" + # TODO breaks with sandbox, tries to download stuff with npm + "-DWITH_MGR_DASHBOARD_FRONTEND=OFF" + ]; + + postFixup = '' + wrapPythonPrograms + wrapProgram $out/bin/ceph-mgr --prefix PYTHONPATH ":" "$(toPythonPath ${placeholder "out"}):$(toPythonPath ${ceph-python-env})" + + # Test that ceph-volume exists since the build system has a tendency to + # silently drop it with misconfigurations. + test -f $out/bin/ceph-volume + ''; + + enableParallelBuilding = true; + + outputs = [ "out" "lib" "dev" "doc" "man" ]; + + doCheck = false; # uses pip to install things from the internet + + meta = getMeta "Distributed storage system"; + + passthru.version = version; + }; + + ceph-client = runCommand "ceph-client-${version}" { + meta = getMeta "Tools needed to mount Ceph's RADOS Block Devices"; + } '' + mkdir -p $out/{bin,etc,${sitePackages},share/bash-completion/completions} + cp -r ${ceph}/bin/{ceph,.ceph-wrapped,rados,rbd,rbdmap} $out/bin + cp -r ${ceph}/bin/ceph-{authtool,conf,dencoder,rbdnamer,syn} $out/bin + cp -r ${ceph}/bin/rbd-replay* $out/bin + cp -r ${ceph}/${sitePackages} $out/${sitePackages} + cp -r ${ceph}/etc/bash_completion.d $out/share/bash-completion/completions + # wrapPythonPrograms modifies .ceph-wrapped, so lets just update its paths + substituteInPlace $out/bin/ceph --replace ${ceph} $out + substituteInPlace $out/bin/.ceph-wrapped --replace ${ceph} $out + ''; +} |