From 6ac4bbd007fd3774034ab0d26d2020576e418b21 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Mon, 20 Apr 2015 11:42:55 -0700 Subject: [PATCH] ceph: Refactor into a generic expression --- pkgs/tools/filesystems/ceph/0.94.nix | 11 ++++ .../ceph/0001-Cleanup-boost-optionals.patch | 42 ------------ pkgs/tools/filesystems/ceph/default.nix | 62 +---------------- pkgs/tools/filesystems/ceph/dev.nix | 1 + pkgs/tools/filesystems/ceph/generic.nix | 66 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 5 ++ 6 files changed, 84 insertions(+), 103 deletions(-) create mode 100644 pkgs/tools/filesystems/ceph/0.94.nix delete mode 100644 pkgs/tools/filesystems/ceph/0001-Cleanup-boost-optionals.patch mode change 100644 => 120000 pkgs/tools/filesystems/ceph/default.nix create mode 120000 pkgs/tools/filesystems/ceph/dev.nix create mode 100644 pkgs/tools/filesystems/ceph/generic.nix diff --git a/pkgs/tools/filesystems/ceph/0.94.nix b/pkgs/tools/filesystems/ceph/0.94.nix new file mode 100644 index 000000000000..c6a394d783ad --- /dev/null +++ b/pkgs/tools/filesystems/ceph/0.94.nix @@ -0,0 +1,11 @@ +{ callPackage, fetchgit, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "0.94.1"; + + src = fetchgit { + url = "git://github.com/ceph/ceph.git"; + rev = "refs/tags/v${version}"; + sha256 = "0rrl10vda4xv22al2c5ccd8v8drs26186dvkrxndvqz8p9999cjx"; + }; +}) diff --git a/pkgs/tools/filesystems/ceph/0001-Cleanup-boost-optionals.patch b/pkgs/tools/filesystems/ceph/0001-Cleanup-boost-optionals.patch deleted file mode 100644 index a99e16ddc266..000000000000 --- a/pkgs/tools/filesystems/ceph/0001-Cleanup-boost-optionals.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 2507ab33236f0da12899fbcdd36535f7c7b68a06 Mon Sep 17 00:00:00 2001 -From: "William A. Kennington III" -Date: Sat, 20 Sep 2014 22:52:31 -0700 -Subject: [PATCH] Cleanup boost optionals - ---- - src/osd/ECBackend.cc | 2 +- - src/osd/ReplicatedPG.cc | 5 ++++- - 2 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc -index a87b5b4..c386900 100644 ---- a/src/osd/ECBackend.cc -+++ b/src/osd/ECBackend.cc -@@ -81,7 +81,7 @@ ostream &operator<<(ostream &lhs, const ECBackend::read_result_t &rhs) - lhs << "read_result_t(r=" << rhs.r - << ", errors=" << rhs.errors; - if (rhs.attrs) { -- lhs << ", attrs=" << rhs.attrs; -+ lhs << ", attrs=" << rhs.attrs.get(); - } else { - lhs << ", noattrs"; - } -diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc -index 5e5510d..79e8616 100644 ---- a/src/osd/ReplicatedPG.cc -+++ b/src/osd/ReplicatedPG.cc -@@ -5259,7 +5259,10 @@ void ReplicatedPG::do_osd_op_effects(OpContext *ctx) - for (list::iterator p = ctx->notify_acks.begin(); - p != ctx->notify_acks.end(); - ++p) { -- dout(10) << "notify_ack " << make_pair(p->watch_cookie, p->notify_id) << dendl; -+ if (p->watch_cookie) -+ dout(10) << "notify_ack " << make_pair(p->watch_cookie.get(), p->notify_id) << dendl; -+ else -+ dout(10) << "notify_ack " << make_pair("NULL", p->notify_id) << dendl; - for (map, WatchRef>::iterator i = - ctx->obc->watchers.begin(); - i != ctx->obc->watchers.end(); --- -2.1.0 - diff --git a/pkgs/tools/filesystems/ceph/default.nix b/pkgs/tools/filesystems/ceph/default.nix deleted file mode 100644 index 2e329b55e9fb..000000000000 --- a/pkgs/tools/filesystems/ceph/default.nix +++ /dev/null @@ -1,61 +0,0 @@ -{ stdenv, fetchgit, autoconf, automake, makeWrapper, pkgconfig, libtool, which -, boost, btrfsProgs, cryptopp, curl, expat, fcgi, fuse, gperftools, keyutils -, leveldb, libaio, libatomic_ops, libedit, libuuid, linuxHeaders, openssl -, python, snappy, udev, xfsprogs, xz -, zfs ? null -}: - -with stdenv.lib; -let - wrapArgs = "--prefix PYTHONPATH : \"$(toPythonPath $out)\"" - + " --prefix PYTHONPATH : \"$(toPythonPath ${python.modules.readline})\"" - + " --prefix PATH : \"$out/bin\"" - + " --prefix LD_LIBRARY_PATH : \"$out/lib\""; -in -stdenv.mkDerivation rec { - name="ceph-${version}"; - version="0.94.1"; - - src = fetchgit { - url = "git://github.com/ceph/ceph.git"; - rev = "refs/tags/v${version}"; - sha256 = "0rrl10vda4xv22al2c5ccd8v8drs26186dvkrxndvqz8p9999cjx"; - }; - - patches = [ - ./0001-Makefile-env-Don-t-force-sbin.patch - ]; - - nativeBuildInputs = [ autoconf automake makeWrapper pkgconfig libtool which ]; - buildInputs = [ - boost btrfsProgs cryptopp curl expat fcgi fuse gperftools keyutils - libatomic_ops leveldb libaio libedit libuuid linuxHeaders openssl python - snappy udev xfsprogs.lib xz zfs - ]; - - preConfigure = '' - ./autogen.sh - ''; - - configureFlags = [ - "--exec_prefix=$(out)" - ] ++ optional (zfs != null) "--with-zfs=${zfs}"; - - postInstall = '' - wrapProgram $out/bin/ceph ${wrapArgs} - wrapProgram $out/bin/ceph-brag ${wrapArgs} - wrapProgram $out/bin/ceph-rest-api ${wrapArgs} - wrapProgram $out/sbin/ceph-create-keys ${wrapArgs} - wrapProgram $out/sbin/ceph-disk ${wrapArgs} - ''; - - enableParallelBuilding = true; - - meta = { - homepage = http://ceph.com/; - description = "Distributed storage system"; - license = licenses.lgpl21; - maintainers = with maintainers; [ ak wkennington ]; - platforms = with platforms; linux; - }; -} diff --git a/pkgs/tools/filesystems/ceph/default.nix b/pkgs/tools/filesystems/ceph/default.nix new file mode 120000 index 000000000000..31d5e95359c2 --- /dev/null +++ b/pkgs/tools/filesystems/ceph/default.nix @@ -0,0 +1 @@ +0.94.nix \ No newline at end of file diff --git a/pkgs/tools/filesystems/ceph/dev.nix b/pkgs/tools/filesystems/ceph/dev.nix new file mode 120000 index 000000000000..31d5e95359c2 --- /dev/null +++ b/pkgs/tools/filesystems/ceph/dev.nix @@ -0,0 +1 @@ +0.94.nix \ No newline at end of file diff --git a/pkgs/tools/filesystems/ceph/generic.nix b/pkgs/tools/filesystems/ceph/generic.nix new file mode 100644 index 000000000000..d4f4e9466b85 --- /dev/null +++ b/pkgs/tools/filesystems/ceph/generic.nix @@ -0,0 +1,66 @@ +{ stdenv, autoconf, automake, makeWrapper, pkgconfig, libtool, which +, boost, btrfsProgs, cryptopp, curl, expat, fcgi, fuse, gperftools, keyutils +, leveldb, libaio, libatomic_ops, libedit, libuuid, linuxHeaders, openssl +, python, snappy, udev, xfsprogs, xz +, zfs ? null + +# Version specific arguments +, version, src +, ... +}: + +with stdenv.lib; +let + wrapArgs = "--prefix PYTHONPATH : \"$(toPythonPath $out)\"" + + " --prefix PYTHONPATH : \"$(toPythonPath ${python.modules.readline})\"" + + " --prefix PATH : \"$out/bin\"" + + " --prefix LD_LIBRARY_PATH : \"$out/lib\""; +in +stdenv.mkDerivation rec { + name="ceph-${version}"; + + inherit src; + + patches = [ + ./0001-Makefile-env-Don-t-force-sbin.patch + ]; + + nativeBuildInputs = [ autoconf automake makeWrapper pkgconfig libtool which ]; + buildInputs = [ + boost btrfsProgs cryptopp curl expat fcgi fuse gperftools keyutils + libatomic_ops leveldb libaio libedit libuuid linuxHeaders openssl python + snappy udev xfsprogs.lib xz zfs + ]; + + preConfigure = '' + ./autogen.sh + ''; + + configureFlags = [ + "--exec_prefix=\${out}" + "--sysconfdir=/etc" + "--localstatedir=/var" + ] ++ optional (zfs != null) "--with-zfs=${zfs}"; + + installFlags = [ "sysconfdir=\${out}/etc" ]; + + postInstall = '' + wrapProgram $out/bin/ceph ${wrapArgs} + wrapProgram $out/bin/ceph-brag ${wrapArgs} + wrapProgram $out/bin/ceph-rest-api ${wrapArgs} + wrapProgram $out/sbin/ceph-create-keys ${wrapArgs} + wrapProgram $out/sbin/ceph-disk ${wrapArgs} + ''; + + enableParallelBuilding = true; + + meta = { + homepage = http://ceph.com/; + description = "Distributed storage system"; + license = licenses.lgpl21; + maintainers = with maintainers; [ ak wkennington ]; + platforms = with platforms; linux; + }; + + passthru.version = version; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7bc300859301..f0b960735a6e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -934,7 +934,12 @@ let cdrkit = callPackage ../tools/cd-dvd/cdrkit { }; + # Only ever add ceph LTS releases + # The default should always be symlinked to the latest LTS + # Dev should always point to the latest versioned release + ceph-0_94 = callPackage ../tools/filesystems/ceph/0.94.nix { }; ceph = callPackage ../tools/filesystems/ceph { }; + ceph-dev = callPackage ../tools/filesystems/ceph/dev.nix { }; cfdg = builderDefsPackage ../tools/graphics/cfdg { inherit libpng bison flex ffmpeg;