sby: Fix description. Remove duplicated inputs. --replace-fail instead of --replace. Be specific about which files patchShebangs is applied to. Run hooks in installPhase. Use btor2tools as input now that is updated

This commit is contained in:
Roland Coeurjoly 2024-08-23 13:00:30 +02:00 committed by Austin Seipp
parent 796a57ce81
commit 480b64bd98

View File

@ -9,6 +9,7 @@
boolector, boolector,
z3, z3,
aiger, aiger,
btor2tools,
python3Packages, python3Packages,
nix-update-script, nix-update-script,
}: }:
@ -36,49 +37,53 @@ stdenv.mkDerivation rec {
yices yices
z3 z3
aiger aiger
btor2tools
]; ];
patchPhase = '' postPatch = ''
patchShebangs . patchShebangs docs/source/conf.py \
docs/source/conf.diff \
tests/autotune/*.sh \
tests/keepgoing/*.sh \
tests/junit/*.sh
# Fix up Yosys imports # Fix up Yosys imports
substituteInPlace sbysrc/sby.py \ substituteInPlace sbysrc/sby.py \
--replace "##yosys-sys-path##" \ --replace-fail "##yosys-sys-path##" \
"sys.path += [p + \"/share/yosys/python3/\" for p in [\"$out\", \"${yosys}\"]]" "sys.path += [p + \"/share/yosys/python3/\" for p in [\"$out\", \"${yosys}\"]]"
# Fix various executable references # Fix various executable references
substituteInPlace sbysrc/sby_core.py \ substituteInPlace sbysrc/sby_core.py \
--replace '"/usr/bin/env", "bash"' '"${bash}/bin/bash"' \ --replace-fail '"/usr/bin/env", "bash"' '"${bash}/bin/bash"' \
--replace ', "btormc"' ', "${boolector}/bin/btormc"' \ --replace-fail ', "btormc"' ', "${boolector}/bin/btormc"' \
--replace ', "aigbmc"' ', "${aiger}/bin/aigbmc"' --replace-fail ', "aigbmc"' ', "${aiger}/bin/aigbmc"'
substituteInPlace sbysrc/sby_core.py \ substituteInPlace sbysrc/sby_core.py \
--replace '##yosys-program-prefix##' '"${yosys}/bin/"' --replace-fail '##yosys-program-prefix##' '"${yosys}/bin/"'
substituteInPlace sbysrc/sby.py \ substituteInPlace sbysrc/sby.py \
--replace '/usr/bin/env python3' '${pythonEnv}/bin/python' --replace-fail '/usr/bin/env python3' '${pythonEnv}/bin/python'
substituteInPlace sbysrc/sby_autotune.py \
--replace-fail '["btorsim", "--vcd"]' '["${btor2tools}/bin/btorsim", "--vcd"]'
substituteInPlace tests/make/required_tools.py \
--replace-fail '["btorsim", "--vcd"]' '["${btor2tools}/bin/btorsim", "--vcd"]'
''; '';
buildPhase = "true"; dontBuild = true;
installPhase = '' installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/share/yosys/python3 mkdir -p $out/bin $out/share/yosys/python3
cp sbysrc/sby_*.py $out/share/yosys/python3/ cp sbysrc/sby_*.py $out/share/yosys/python3/
cp sbysrc/sby.py $out/bin/sby cp sbysrc/sby.py $out/bin/sby
chmod +x $out/bin/sby chmod +x $out/bin/sby
runHook postInstall
''; '';
doCheck = true; doCheck = true;
nativeCheckInputs = [
pythonEnv
yosys
boolector
yices
z3
aiger
];
checkPhase = '' checkPhase = ''
runHook preCheck runHook preCheck
make test make test
@ -93,7 +98,7 @@ stdenv.mkDerivation rec {
}; };
meta = { meta = {
description = "SymbiYosys (sby) -- Front-end for Yosys-based formal verification flows"; description = "SymbiYosys, a front-end for Yosys-based formal verification flows";
homepage = "https://symbiyosys.readthedocs.io/"; homepage = "https://symbiyosys.readthedocs.io/";
license = lib.licenses.isc; license = lib.licenses.isc;
maintainers = with lib.maintainers; [ maintainers = with lib.maintainers; [