Project import generated by Copybara.
GitOrigin-RevId: ff377a78794d412a35245e05428c8f95fef3951f
This commit is contained in:
parent
391e4a2fe6
commit
3a47dd4636
1 changed files with 66 additions and 35 deletions
|
@ -7,6 +7,7 @@
|
|||
, highlightSupport ? fullBuild
|
||||
, ApplicationServices
|
||||
# test dependencies
|
||||
, runCommand
|
||||
, unzip
|
||||
, which
|
||||
, sqlite
|
||||
|
@ -39,15 +40,6 @@ let
|
|||
} else null;
|
||||
cargoRoot = if rustSupport then "rust" else null;
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs .
|
||||
|
||||
for f in **/*.{py,c,t}; do
|
||||
# not only used in shebangs
|
||||
substituteAllInPlace "$f" '/bin/sh' '${stdenv.shell}'
|
||||
done
|
||||
'';
|
||||
|
||||
propagatedBuildInputs = lib.optional re2Support fb-re2
|
||||
++ lib.optional gitSupport pygit2
|
||||
++ lib.optional highlightSupport pygments;
|
||||
|
@ -63,30 +55,6 @@ let
|
|||
makeFlags = [ "PREFIX=$(out)" ]
|
||||
++ lib.optional rustSupport "PURE=--rust";
|
||||
|
||||
doCheck = stdenv.isLinux; # tests seem unstable on Darwin
|
||||
checkInputs = [
|
||||
unzip
|
||||
which
|
||||
sqlite
|
||||
git
|
||||
gnupg
|
||||
];
|
||||
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; # needed for git
|
||||
checkPhase = ''
|
||||
cat << EOF > tests/blacklists/nix
|
||||
# tests enforcing "/usr/bin/env" shebangs, which are patched for nix
|
||||
test-run-tests.t
|
||||
test-check-shbang.t
|
||||
|
||||
# git tests, which are somewhat unstable (native git support is very experimental)
|
||||
test-git-interop.t
|
||||
EOF
|
||||
|
||||
# extended timeout necessary for tests to pass on the busy CI workers
|
||||
export HGTESTFLAGS="--blacklist blacklists/nix --timeout 600"
|
||||
make check
|
||||
'';
|
||||
|
||||
postInstall = (lib.optionalString guiSupport ''
|
||||
mkdir -p $out/etc/mercurial
|
||||
cp contrib/hgk $out/bin
|
||||
|
@ -114,18 +82,81 @@ let
|
|||
--zsh contrib/zsh_completion
|
||||
'';
|
||||
|
||||
passthru.tests = {};
|
||||
passthru.tests = {
|
||||
mercurial-tests = makeTests { flags = "--with-hg=$MERCURIAL_BASE/bin/hg"; };
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "A fast, lightweight SCM system for very large distributed projects";
|
||||
homepage = "https://www.mercurial-scm.org";
|
||||
downloadPage = "https://www.mercurial-scm.org/release/";
|
||||
license = licenses.gpl2Plus;
|
||||
maintainers = with maintainers; [ eelco lukegb ];
|
||||
maintainers = with maintainers; [ eelco lukegb pacien ];
|
||||
updateWalker = true;
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
};
|
||||
|
||||
makeTests = { mercurial ? self, nameSuffix ? "", flags ? "" }: runCommand "${mercurial.pname}${nameSuffix}-tests" {
|
||||
inherit (mercurial) src;
|
||||
|
||||
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; # needed for git
|
||||
MERCURIAL_BASE = mercurial;
|
||||
nativeBuildInputs = [
|
||||
python
|
||||
unzip
|
||||
which
|
||||
sqlite
|
||||
git
|
||||
gnupg
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs .
|
||||
|
||||
for f in **/*.{py,c,t}; do
|
||||
# not only used in shebangs
|
||||
substituteAllInPlace "$f" '/bin/sh' '${stdenv.shell}'
|
||||
done
|
||||
|
||||
for f in **/*.t; do
|
||||
substituteInPlace 2>/dev/null "$f" \
|
||||
--replace '*/hg:' '*/*hg*:' \${/* paths emitted by our wrapped hg look like ..hg-wrapped-wrapped */""}
|
||||
--replace '"$PYTHON" "$BINDIR"/hg' '"$BINDIR"/hg' ${/* 'hg' is a wrapper; don't run using python directly */""}
|
||||
done
|
||||
'';
|
||||
|
||||
# This runs Mercurial _a lot_ of times.
|
||||
requiredSystemFeatures = [ "big-parallel" ];
|
||||
|
||||
# Don't run tests if not-Linux or if cross-compiling.
|
||||
meta.broken = !stdenv.hostPlatform.isLinux || stdenv.buildPlatform != stdenv.hostPlatform;
|
||||
} ''
|
||||
addToSearchPathWithCustomDelimiter : PYTHONPATH "${mercurial}/${python.sitePackages}"
|
||||
|
||||
unpackPhase
|
||||
cd "$sourceRoot"
|
||||
patchPhase
|
||||
|
||||
cat << EOF > tests/blacklists/nix
|
||||
# tests enforcing "/usr/bin/env" shebangs, which are patched for nix
|
||||
test-run-tests.t
|
||||
test-check-shbang.t
|
||||
|
||||
# unstable experimental/unsupported features
|
||||
# https://bz.mercurial-scm.org/show_bug.cgi?id=6633#c1
|
||||
test-git-interop.t
|
||||
|
||||
# doesn't like the extra setlocale warnings emitted by our bash wrappers
|
||||
test-locale.t
|
||||
EOF
|
||||
|
||||
export HGTEST_REAL_HG="${mercurial}/bin/hg"
|
||||
# extended timeout necessary for tests to pass on the busy CI workers
|
||||
export HGTESTFLAGS="--blacklist blacklists/nix --timeout 1800 -j$NIX_BUILD_CORES ${flags}"
|
||||
make check
|
||||
touch $out
|
||||
'';
|
||||
in
|
||||
self.overridePythonAttrs (origAttrs: {
|
||||
passthru = origAttrs.passthru // rec {
|
||||
|
|
Loading…
Reference in a new issue