Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkgs/development/python-modules/binwalk/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
pycrypto,
pyqtgraph,
pyqt5,
pythonOlder,
visualizationSupport ? false,
}:

Expand All @@ -44,6 +45,12 @@ buildPythonPackage rec {
includes = [ "testing/tests/test_firmware_zip.py" ];
revert = true;
})
# binwalk incompatible with Python 3.12
# https://github.com/ReFirmLabs/binwalk/pull/668
(fetchpatch {
url = "https://github.com/ReFirmLabs/binwalk/commit/3e5c6887e840643fdbe7358de4bb31d726d0ce1b.patch";
sha256 = "sha256-QhPIC2BKYeeCn2dNm9NeWpyUcIL1S+C/B3F55/nxrjw=";
})
];

propagatedBuildInputs =
Expand Down Expand Up @@ -75,6 +82,8 @@ buildPythonPackage rec {
echo '__version__ = "${version}"' > src/binwalk/core/version.py
'';

doCheck = pythonOlder "3.12"; # nose requires imp module

# binwalk wants to access ~/.config/binwalk/magic
preCheck = ''
HOME=$(mktemp -d)
Expand Down
41 changes: 41 additions & 0 deletions pkgs/tools/misc/diffoscope/binwalk-python3.12.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
From e27965ac94a74d908213e37b6d529827cc1ee902 Mon Sep 17 00:00:00 2001
From: Philip Taron <philip.taron@gmail.com>
Date: Mon, 8 Jul 2024 11:58:15 -0700
Subject: [PATCH] tests/comparators/test_binwalk.py: binwalk on Python 3.12
produces more output

In particular, here is the difference array:

```
[
<Difference .cpio file embedded at offset 0 -- .cpio file embedded at offset 0 [<Difference file list -- file list []>, <Difference dir/link -- dir/link []>, <Difference dir/text -- dir/text []>]>,
<Difference .cpio file embedded at offset 600 -- .cpio file embedded at offset 600 [<Difference file list -- file list []>, <Difference dir/link -- dir/link []>, <Difference dir/text -- dir/text []>]>,
<Difference .cpio file embedded at offset 670 -- .cpio file embedded at offset 670 [<Difference file list -- file list []>, <Difference dir/link -- dir/link []>, <Difference dir/text -- dir/text []>]>,
<Difference .cpio file embedded at offset 6E4 -- .cpio file embedded at offset 6E4 [<Difference file list -- file list []>, <Difference dir/link -- dir/link []>, <Difference dir/text -- dir/text []>]>,
<Difference .cpio file embedded at offset 70 -- .cpio file embedded at offset 70 [<Difference file list -- file list []>, <Difference dir/link -- dir/link []>, <Difference dir/text -- dir/text []>]>,
<Difference .cpio file embedded at offset E4 -- .cpio file embedded at offset E4 [<Difference file list -- file list []>, <Difference dir/link -- dir/link []>, <Difference dir/text -- dir/text []>]>,
<Difference .cpio file embedded at offset 164 -- .cpio file embedded at offset 16C [<Difference file list -- file list []>, <Difference dir/text -- dir/text []>]>,
<Difference .cpio file embedded at offset 39C -- .cpio file embedded at offset 484 []>,
<Difference .cpio file embedded at offset 76C -- .cpio file embedded at offset 764 [<Difference file list -- file list []>, <Difference dir/text -- dir/text []>]>
]
```
---
tests/comparators/test_binwalk.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/comparators/test_binwalk.py b/tests/comparators/test_binwalk.py
index ba0b1bd4..c85b5934 100644
--- a/tests/comparators/test_binwalk.py
+++ b/tests/comparators/test_binwalk.py
@@ -57,7 +57,7 @@ def comparison(binwalk1, binwalk2):
@skip_unless_module_exists("binwalk")
def test_listing(comparison):
differences = comparison.details
- assert comparison.comments == ["comprises of 2 embedded members"]
+ assert comparison.comments == ["comprises of 10 embedded members"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this by design i.e. a number that we can rely on to continue to be 10? or might this change in the future?

assert differences[0].source1 == ".cpio file embedded at offset 0"
assert differences[1].source2 == ".cpio file embedded at offset 600"

--
2.45.1

3 changes: 3 additions & 0 deletions pkgs/tools/misc/diffoscope/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ python.pkgs.buildPythonApplication rec {
patches = [
./ignore_links.patch
./openssh-no-dsa.patch # https://salsa.debian.org/reproducible-builds/diffoscope/-/merge_requests/139
] ++ lib.optionals (python.pythonAtLeast "3.12") [
# `binwalk` with Python 3.12 produces more output
./binwalk-python3.12.patch
];

postPatch = ''
Expand Down