summary refs log tree commit diff
path: root/pkgs/development/tools/build-managers/dub/default.nix
diff options
context:
space:
mode:
authorThomas Mader <thomas.mader@gmail.com>2019-02-17 10:48:59 +0100
committerThomas Mader <thomas.mader@gmail.com>2019-02-22 07:22:11 +0100
commit0e88d17fb1eca54ec7464a8194cd1314db3f7f7e (patch)
tree6e8d9b962384bfdd06b3a9abcd2d5aca61178e35 /pkgs/development/tools/build-managers/dub/default.nix
parentf8165d0d0190fd3bb6f7874582639c3f3a8421f2 (diff)
dub: Disable network tests because they add impurities
Diffstat (limited to 'pkgs/development/tools/build-managers/dub/default.nix')
-rw-r--r--pkgs/development/tools/build-managers/dub/default.nix151
1 files changed, 59 insertions, 92 deletions
diff --git a/pkgs/development/tools/build-managers/dub/default.nix b/pkgs/development/tools/build-managers/dub/default.nix
index 18c6eff76e1f4..024c57201e120 100644
--- a/pkgs/development/tools/build-managers/dub/default.nix
+++ b/pkgs/development/tools/build-managers/dub/default.nix
@@ -1,109 +1,76 @@
 { stdenv, fetchFromGitHub, curl, dmd, libevent, rsync }:
 
-let
-
-  dubBuild = stdenv.mkDerivation rec {
-    name = "dubBuild-${version}";
-    version = "1.13.0";
-
-    enableParallelBuilding = true;
-
-    src = fetchFromGitHub {
-      owner = "dlang";
-      repo = "dub";
-      rev = "v${version}";
-      sha256 = "1wd5pdnbaafj33bbg188w0iz28ps4cyjangb12g2s9dyic29zjqv";
-    };
-
-    postUnpack = ''
-        patchShebangs .
-    '';
-
-    # Can be removed with https://github.com/dlang/dub/pull/1368
-    dubvar = "\\$DUB";
-    postPatch = ''
-        substituteInPlace test/fetchzip.sh \
-            --replace "dub remove" "\"${dubvar}\" remove"
-    '';
-
-    nativeBuildInputs = [ dmd libevent rsync ];
-    buildInputs = [ curl ];
-
-    buildPhase = ''
-      export DMD=${dmd.out}/bin/dmd
-      ./build.sh
-    '';
+stdenv.mkDerivation rec {
+  name = "dub-${version}";
+  version = "1.13.0";
 
-    installPhase = ''
-      mkdir $out
-      mkdir $out/bin
-      cp bin/dub $out/bin
-    '';
+  enableParallelBuilding = true;
 
-    meta = with stdenv.lib; {
-      description = "Package and build manager for D applications and libraries";
-      homepage = http://code.dlang.org/;
-      license = licenses.mit;
-      maintainers = with maintainers; [ ThomasMader ];
-      platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
-    };
+  src = fetchFromGitHub {
+    owner = "dlang";
+    repo = "dub";
+    rev = "v${version}";
+    sha256 = "1wd5pdnbaafj33bbg188w0iz28ps4cyjangb12g2s9dyic29zjqv";
   };
 
-  # Need to test in a fixed-output derivation, otherwise the
-  # network tests would fail if sandbox mode is enabled.
-  # Disable tests on Darwin for now because they don't work
-  # reliably there.
-  dubUnittests = if !stdenv.hostPlatform.isDarwin then
-    stdenv.mkDerivation rec {
-      name = "dubUnittests-${version}";
-      version = dubBuild.version;
-
-      enableParallelBuilding = dubBuild.enableParallelBuilding;
-      preferLocalBuild = true;
-      inputString = dubBuild.outPath;
-      outputHashAlgo = "sha256";
-      outputHash = builtins.hashString "sha256" inputString;
-
-      src = dubBuild.src;
-      
-      postUnpack = dubBuild.postUnpack;
-      postPatch = dubBuild.postPatch;
-
-      nativeBuildInputs = dubBuild.nativeBuildInputs;
-      buildInputs = dubBuild.buildInputs;
+  postUnpack = ''
+      patchShebangs .
+  '';
 
-      buildPhase = ''
-        # Can't use dub from dubBuild directly because one unittest 
-        # (issue895-local-configuration) needs to generate a config 
-        # file under ../etc relative to the dub location.
-        cp ${dubBuild}/bin/dub bin/
-        export DUB=$NIX_BUILD_TOP/source/bin/dub
-        export PATH=$PATH:$NIX_BUILD_TOP/source/bin/
-        export DC=${dmd.out}/bin/dmd
-        export HOME=$TMP
-        ./test/run-unittest.sh
-      '';
+  # Can be removed with https://github.com/dlang/dub/pull/1368
+  dubvar = "\\$DUB";
+  postPatch = ''
+      substituteInPlace test/fetchzip.sh \
+          --replace "dub remove" "\"${dubvar}\" remove"
+  '';
 
-      installPhase = ''
-          echo -n $inputString > $out
-      '';
-    }
-  else
-    "";
+  nativeBuildInputs = [ dmd libevent rsync ];
+  buildInputs = [ curl ];
 
-in
+  buildPhase = ''
+    export DMD=${dmd.out}/bin/dmd
+    ./build.sh
+  '';
 
-stdenv.mkDerivation rec {
-  inherit dubUnittests;
-  name = "dub-${dubBuild.version}";
-  phases = "installPhase";
-  buildInputs = dubBuild.buildInputs;
+  doCheck = true;
+
+  checkPhase = ''
+    export DUB=$NIX_BUILD_TOP/source/bin/dub
+    export PATH=$PATH:$NIX_BUILD_TOP/source/bin/
+    export DC=${dmd.out}/bin/dmd
+    export HOME=$TMP
+
+    rm -rf test/issue502-root-import
+    rm test/issue990-download-optional-selected.sh
+    rm test/timeout.sh
+    rm test/issue674-concurrent-dub.sh
+    rm test/issue672-upgrade-optional.sh
+    rm test/issue1574-addcommand.sh
+    rm test/issue1524-maven-upgrade-dependency-tree.sh
+    rm test/issue1416-maven-repo-pkg-supplier.sh
+    rm test/issue1037-better-dependency-messages.sh
+    rm test/interactive-remove.sh
+    rm test/fetchzip.sh
+    rm test/feat663-search.sh
+    rm test/ddox.sh
+    rm test/0-init-multi.sh
+    rm test/0-init-multi-json.sh
+
+    ./test/run-unittest.sh
+  '';
 
   installPhase = ''
     mkdir $out
-    cp -r --symbolic-link ${dubBuild}/* $out/
+    mkdir $out/bin
+    cp bin/dub $out/bin
   '';
 
-  meta = dubBuild.meta;
+  meta = with stdenv.lib; {
+    description = "Package and build manager for D applications and libraries";
+    homepage = http://code.dlang.org/;
+    license = licenses.mit;
+    maintainers = with maintainers; [ ThomasMader ];
+    platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
+  };
 }