Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ebb7e37c8e4c
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 43900fa7755e
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Nov 19, 2017

  1. nixos/tests: add couchdb test

    (cherry picked from commit 71b8437)
    fpletz committed Nov 19, 2017

    Unverified

    This user has not yet uploaded their public signing key.
    Copy the full SHA
    9cd4379 View commit details
  2. Unverified

    This user has not yet uploaded their public signing key.
    Copy the full SHA
    507b88f View commit details
  3. Copy the full SHA
    43900fa View commit details
Showing with 66 additions and 20 deletions.
  1. +1 −0 nixos/release.nix
  2. +56 −0 nixos/tests/couchdb.nix
  3. +4 −3 pkgs/servers/http/couchdb/2.0.0.nix
  4. +5 −17 pkgs/servers/http/couchdb/default.nix
1 change: 1 addition & 0 deletions nixos/release.nix
Original file line number Diff line number Diff line change
@@ -234,6 +234,7 @@ in rec {
tests.containers-tmpfs = callTest tests/containers-tmpfs.nix {};
tests.containers-hosts = callTest tests/containers-hosts.nix {};
tests.containers-macvlans = callTest tests/containers-macvlans.nix {};
tests.couchdb = callTest tests/couchdb.nix {};
tests.docker = hydraJob (import tests/docker.nix { system = "x86_64-linux"; });
tests.dovecot = callTest tests/dovecot.nix {};
tests.dnscrypt-proxy = callTest tests/dnscrypt-proxy.nix { system = "x86_64-linux"; };
56 changes: 56 additions & 0 deletions nixos/tests/couchdb.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import ./make-test.nix ({ pkgs, lib, ...}:

with lib;

{
name = "couchdb";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ fpletz ];
};

nodes = {
couchdb1 =
{ pkgs, config, ... }:

{ environment.systemPackages = with pkgs; [ jq ];
services.couchdb.enable = true;
};

couchdb2 =
{ pkgs, config, ... }:

{ environment.systemPackages = with pkgs; [ jq ];
services.couchdb.enable = true;
services.couchdb.package = pkgs.couchdb2;
};
};

testScript = let
curlJqCheck = action: path: jqexpr: result:
pkgs.writeScript "curl-jq-check-${action}-${path}.sh" ''
RESULT=$(curl -X ${action} http://127.0.0.1:5984/${path} | jq -r '${jqexpr}')
echo $RESULT >&2
if [ "$RESULT" != "${result}" ]; then
exit 1
fi
'';
in ''
startAll;
$couchdb1->waitForUnit("couchdb.service");
$couchdb1->waitUntilSucceeds("${curlJqCheck "GET" "" ".couchdb" "Welcome"}");
$couchdb1->waitUntilSucceeds("${curlJqCheck "GET" "_all_dbs" ". | length" "2"}");
$couchdb1->succeed("${curlJqCheck "PUT" "foo" ".ok" "true"}");
$couchdb1->succeed("${curlJqCheck "GET" "_all_dbs" ". | length" "3"}");
$couchdb1->succeed("${curlJqCheck "DELETE" "foo" ".ok" "true"}");
$couchdb1->succeed("${curlJqCheck "GET" "_all_dbs" ". | length" "2"}");
$couchdb2->waitForUnit("couchdb.service");
$couchdb2->waitUntilSucceeds("${curlJqCheck "GET" "" ".couchdb" "Welcome"}");
$couchdb2->waitUntilSucceeds("${curlJqCheck "GET" "_all_dbs" ". | length" "0"}");
$couchdb2->succeed("${curlJqCheck "PUT" "foo" ".ok" "true"}");
$couchdb2->succeed("${curlJqCheck "GET" "_all_dbs" ". | length" "1"}");
$couchdb2->succeed("${curlJqCheck "DELETE" "foo" ".ok" "true"}");
$couchdb2->succeed("${curlJqCheck "GET" "_all_dbs" ". | length" "0"}");
'';
})
7 changes: 4 additions & 3 deletions pkgs/servers/http/couchdb/2.0.0.nix
Original file line number Diff line number Diff line change
@@ -3,14 +3,15 @@

stdenv.mkDerivation rec {
name = "couchdb-${version}";
version = "2.0.0";
version = "2.1.1";

src = fetchurl {
url = "mirror://apache/couchdb/source/${version}/apache-${name}.tar.gz";
sha256 = "1jkfx6g9anrgmkhrkcn50axcamragranwsciw1rhmi86rglkrbyc";
sha256 = "1k3v9v05417087b6fcj5yv03wl6i61xqrrhp0prl9b3ir2mmbwnm";
};

buildInputs = [ erlang icu openssl spidermonkey makeWrapper ];
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ erlang icu openssl spidermonkey ];

patches = [ ./jsapi.patch ];
postPatch = ''
22 changes: 5 additions & 17 deletions pkgs/servers/http/couchdb/default.nix
Original file line number Diff line number Diff line change
@@ -3,30 +3,18 @@

stdenv.mkDerivation rec {
name = "couchdb-${version}";
version = "1.6.1";
version = "1.7.1";

src = fetchurl {
url = "mirror://apache/couchdb/source/${version}/apache-${name}.tar.gz";
sha256 = "09w6ijj9l5jzh81nvc3hrlqp345ajg3haj353g9kxkik6wbinq2s";
sha256 = "1b9cbdrmh1i71mrwvhm17v4cf7lckpil1vvq7lpmxyn6zfk0l84i";
};

buildInputs = [ erlang icu openssl spidermonkey curl help2man sphinx which
file pkgconfig ];

/* This patch removes the `-Werror` flag as there are warnings due to
* _BSD_SOURCE being deprecated in glibc >= 2.20
*/
patchPhase = ''
patch src/couchdb/priv/Makefile.in <<EOF
392c392
< couchjs_CFLAGS = -g -Wall -Werror -D_BSD_SOURCE \$(CURL_CFLAGS) \$(JS_CFLAGS)
---
> couchjs_CFLAGS = -g -Wall -D_BSD_SOURCE \$(CURL_CFLAGS) \$(JS_CFLAGS)
EOF
'';
nativeBuildInputs = [ help2man which file pkgconfig sphinx ];
buildInputs = [ erlang icu openssl spidermonkey curl ];

postInstall = ''
sed -i -e "s|\`getopt|\`${getopt}/bin/getopt|" $out/bin/couchdb
substituteInPlace $out/bin/couchdb --replace getopt "${getopt}/bin/getopt"
'';

/*