dub: 1.5.0 -> 1.6.0

- Enable unittests by using a fixed-output derivation
- Remove substitutions because they are fixed upstream now
This commit is contained in:
Thomas Mader 2017-11-25 19:27:49 +01:00
parent 5233333265
commit 48dcf2620d

View file

@ -1,14 +1,18 @@
{ stdenv, fetchFromGitHub, curl, dmd, libevent, rsync }: { stdenv, fetchFromGitHub, curl, dmd, libevent, rsync }:
stdenv.mkDerivation rec { let
name = "dub-${version}";
version = "1.5.0"; dubBuild = stdenv.mkDerivation rec {
name = "dubBuild-${version}";
version = "1.6.0";
enableParallelBuilding = true;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "dlang"; owner = "dlang";
repo = "dub"; repo = "dub";
rev = "v${version}"; rev = "v${version}";
sha256 = "0kmirx4ijhzirjwdqmnwqhngg38zdaydpvny2p0yj3afqgkj6vq5"; sha256 = "1xjr5pp263lbcd4harxy1ybh7q0kzj9iyy63ji6pn66fizrgm7zk";
}; };
postPatch = '' postPatch = ''
@ -16,19 +20,7 @@ stdenv.mkDerivation rec {
substituteInPlace build.sh \ substituteInPlace build.sh \
--replace source/dub/version_.d /dev/null --replace source/dub/version_.d /dev/null
substituteInPlace build.sh \ patchShebangs .
--replace MACOSX_DEPLOYMENT_TARGET MACOSX_DEPLOYMENT_TARGET_
patchShebangs build.sh
patchShebangs test
# Remove unittest which is not working for now (upstream already fixed: https://github.com/dlang/dub/issues/1224)
rm test/interactive-remove.sh
# Fix test as long as there is no upstream solution. (see https://github.com/dlang/dub/pull/1227)
substituteInPlace test/issue884-init-defer-file-creation.sh \
--replace "< /dev/stdin" "<(while :; do sleep 1; done)" \
--replace "sleep 1" ""
''; '';
nativeBuildInputs = [ dmd libevent rsync ]; nativeBuildInputs = [ dmd libevent rsync ];
@ -39,15 +31,6 @@ stdenv.mkDerivation rec {
./build.sh ./build.sh
''; '';
doCheck = false;
checkPhase = ''
export DUB=$PWD/bin/dub
export DC=${dmd.out}/bin/dmd
export HOME=$TMP
./test/run-unittest.sh
'';
installPhase = '' installPhase = ''
mkdir $out mkdir $out
mkdir $out/bin mkdir $out/bin
@ -59,7 +42,55 @@ stdenv.mkDerivation rec {
homepage = http://code.dlang.org/; homepage = http://code.dlang.org/;
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; [ ThomasMader ]; maintainers = with maintainers; [ ThomasMader ];
platforms = platforms.unix; platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
}; };
};
# Need to test in a fixed-output derivation, otherwise the
# network tests would fail if sandbox mode is enabled.
dubUnittests = 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;
postPatch = dubBuild.postPatch;
nativeBuildInputs = dubBuild.nativeBuildInputs;
buildInputs = dubBuild.buildInputs;
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 DC=${dmd.out}/bin/dmd
export HOME=$TMP
./test/run-unittest.sh
'';
installPhase = ''
echo -n $inputString > $out
'';
};
in
stdenv.mkDerivation rec {
inherit dubUnittests;
name = "dub-${dubBuild.version}";
phases = "installPhase";
installPhase = ''
mkdir $out
cp -r --symbolic-link ${dubBuild}/* $out/
'';
} }