2021-04-22 02:08:21 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, cffi
|
|
|
|
, fetchFromGitHub
|
|
|
|
, minidump
|
|
|
|
, nose
|
|
|
|
, pefile
|
|
|
|
, pyelftools
|
|
|
|
, pytestCheckHook
|
|
|
|
, pythonOlder
|
|
|
|
, pyvex
|
|
|
|
, pyxbe
|
2022-09-30 11:47:45 +00:00
|
|
|
, setuptools
|
2021-04-22 02:08:21 +00:00
|
|
|
, sortedcontainers
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
# The binaries are following the argr projects release cycle
|
2023-02-16 17:41:37 +00:00
|
|
|
version = "9.2.38";
|
2021-04-22 02:08:21 +00:00
|
|
|
|
|
|
|
# Binary files from https://github.com/angr/binaries (only used for testing and only here)
|
|
|
|
binaries = fetchFromGitHub {
|
|
|
|
owner = "angr";
|
|
|
|
repo = "binaries";
|
|
|
|
rev = "v${version}";
|
2022-06-26 10:26:21 +00:00
|
|
|
hash = "sha256-LpYi5Ty6OBcW0zokCliMDhujJ7tPPl1XdPs5ad1tv5s=";
|
2021-04-22 02:08:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cle";
|
|
|
|
inherit version;
|
2022-04-27 09:35:20 +00:00
|
|
|
format = "pyproject";
|
2022-01-19 23:45:15 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
disabled = pythonOlder "3.8";
|
2021-04-22 02:08:21 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "angr";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2023-02-16 17:41:37 +00:00
|
|
|
hash = "sha256-3B62NMlAGv4Q6HOkACafBETbOj4QsWsvfrTAM+5b9NY=";
|
2021-04-22 02:08:21 +00:00
|
|
|
};
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
2021-04-22 02:08:21 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
cffi
|
|
|
|
minidump
|
|
|
|
pefile
|
|
|
|
pyelftools
|
|
|
|
pyvex
|
|
|
|
pyxbe
|
|
|
|
sortedcontainers
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-04-22 02:08:21 +00:00
|
|
|
nose
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
# Place test binaries in the right location (location is hard-coded in the tests)
|
|
|
|
preCheck = ''
|
|
|
|
export HOME=$TMPDIR
|
|
|
|
cp -r ${binaries} $HOME/binaries
|
|
|
|
'';
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# PPC tests seems to fails
|
|
|
|
"test_ppc_rel24_relocation"
|
|
|
|
"test_ppc_addr16_ha_relocation"
|
|
|
|
"test_ppc_addr16_lo_relocation"
|
2021-04-25 03:57:28 +00:00
|
|
|
"test_plt_full_relro"
|
2021-12-06 16:07:01 +00:00
|
|
|
# Test fails
|
|
|
|
"test_tls_pe_incorrect_tls_data_start"
|
2022-04-27 09:35:20 +00:00
|
|
|
# The required parts is not present on Nix
|
|
|
|
"test_remote_file_map"
|
2021-04-22 02:08:21 +00:00
|
|
|
];
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"cle"
|
|
|
|
];
|
2021-04-22 02:08:21 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python loader for many binary formats";
|
|
|
|
homepage = "https://github.com/angr/cle";
|
|
|
|
license = with licenses; [ bsd2 ];
|
|
|
|
maintainers = with maintainers; [ fab ];
|
|
|
|
};
|
|
|
|
}
|