Files
Sergei Trofimovich 0dc8b49db1 cvise: fix tarball hash
Without the change the re-fetch of original source fails as:

```
$ nix build --no-link -f. cvise.src --rebuild
error: hash mismatch in fixed-output derivation '/nix/store/rd0vycm33x3hfwsa6iljj1229f9035am-source.drv':
         specified: sha256-UaWOHjgTiSVvpKKw6VFAeRAYkYp4y0Dnamzr7yhH0vQ=
            got:    sha256-ObnhFe7hAKUoUxNJ+9jo0Q4AE6jQqDgI1Ta/jsumqpI=
```

This happens because the `github` tarball generation is dependent on
abbreviated hash length of `cvise` source:

```
$ diffoscope before/ after/
--- before/
+++ after/
│   --- before/CMakeLists.txt
├── +++ after/CMakeLists.txt
│ @@ -84,15 +84,15 @@
│
│  # Determine the short git hash for the source tree.
│  #
│  ## METHOD 1: The source tree is the result of `git archive'.
│  # `git archive' inserts the abbreviated hash of the archive's commit into this
│  # file.  (See the `.gitattributes' file.)
│  #
│ -set(GIT_HASH "2d0889e7")
│ +set(GIT_HASH "2d0889e73")
```

Intially noticed the hash instability when enabled
`config.fetchedSourceNameDefault` locally. Ideally the upstream tarball
should be fixed by https://github.com/marxin/cvise/pull/506.
Meanwhile let's update the hash.
2026-06-20 08:39:52 +01:00

96 lines
1.9 KiB
Nix

{
lib,
python3Packages,
fetchFromGitHub,
clang-tools,
colordiff,
flex,
libclang,
llvm,
unifdef,
testers,
cvise,
}:
python3Packages.buildPythonApplication rec {
pname = "cvise";
version = "2.12.0";
pyproject = false;
src = fetchFromGitHub {
owner = "marxin";
repo = "cvise";
tag = "v${version}";
hash = "sha256-ObnhFe7hAKUoUxNJ+9jo0Q4AE6jQqDgI1Ta/jsumqpI=";
};
patches = [
# Refer to unifdef by absolute path.
./unifdef.patch
];
postPatch = ''
# Avoid blanket -Werror to evade build failures on less
# tested compilers.
substituteInPlace CMakeLists.txt \
--replace-fail " -Werror " " "
substituteInPlace cvise/utils/testing.py \
--replace-fail "'colordiff --version'" "'${colordiff}/bin/colordiff --version'" \
--replace-fail "'colordiff'" "'${colordiff}/bin/colordiff'"
'';
nativeBuildInputs = [
python3Packages.cmake # TODO: swap this out for the non-python cmake
flex
llvm.dev
];
buildInputs = [
libclang
llvm
llvm.dev
unifdef
];
propagatedBuildInputs = with python3Packages; [
chardet
pebble
psutil
];
nativeCheckInputs = [
python3Packages.pytestCheckHook
unifdef
];
cmakeFlags = [
# By default `cvise` looks it up in `llvm` bin directory. But
# `nixpkgs` moves it into a separate derivation.
"-DCLANG_FORMAT_PATH=${clang-tools}/bin/clang-format"
];
disabledTests = [
# Needs gcc, fails when run noninteractively (without tty).
"test_simple_reduction"
];
passthru = {
tests = {
# basic syntax check
help-output = testers.testVersion {
package = cvise;
command = "cvise --version";
};
};
};
meta = {
homepage = "https://github.com/marxin/cvise";
description = "Super-parallel Python port of C-Reduce";
license = lib.licenses.ncsa;
maintainers = [ ];
platforms = lib.platforms.linux;
};
}