[packages/binwalk] Up to 3.1.0
arekm
arekm at pld-linux.org
Wed Mar 11 23:11:58 CET 2026
commit 92be837d19f2876134ca57adb31bf796a98fd7ff
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Wed Mar 11 23:11:50 2026 +0100
Up to 3.1.0
binwalk-python.patch | 20 -------------
binwalk.spec | 81 ++++++++++++++++++++++++++++++++++++++--------------
2 files changed, 59 insertions(+), 42 deletions(-)
---
diff --git a/binwalk.spec b/binwalk.spec
index 85cce78..518feec 100644
--- a/binwalk.spec
+++ b/binwalk.spec
@@ -1,28 +1,52 @@
-# TODO:
-# - split library into subpackage?
-# (but 3.x versions are rewritten in rust, so python module is gone)
-#
+%define crates_ver 3.1.0
+
Summary: Binary image analyze tool
Summary(pl.UTF-8): Narzędzie do analizy modułów binarnych
Name: binwalk
-Version: 2.3.4
+Version: 3.1.0
Release: 1
License: MIT
Group: Development
#Source0Download: https://github.com/ReFirmLabs/binwalk/releases
-Source0: https://github.com/ReFirmLabs/binwalk/archive/v%{version}/%{name}-%{version}.tar.gz
-# Source0-md5: 182a4e0d99600e30f06007910bcd037d
-Patch0: %{name}-python.patch
+Source0: https://github.com/ReFirmLabs/binwalk/archive/refs/tags/v%{version}.tar.gz
+# Source0-md5: 9ad2d4fc217150e2a881c0d794b12c1d
+# cargo vendor-filterer --platform='*-unknown-linux-*' --tier=2
+# tar cJf %%{name}-crates-%%{crates_ver}.tar.xz vendor Cargo.lock
+Source1: %{name}-crates-%{crates_ver}.tar.xz
+# Source1-md5: 4f39b3594d590443ff2ee6f851460aca
URL: https://github.com/ReFirmLabs/binwalk
-BuildRequires: python3-modules >= 1:3.2
-BuildRequires: python3-setuptools
-BuildRequires: rpm-pythonprov
-BuildArch: noarch
+Suggests: bzip2
+Suggests: cabextract
+Suggests: dmg2img
+Suggests: dtc
+Suggests: gzip
+Suggests: lz4
+Suggests: lzop
+Suggests: p7zip
+Suggests: python3-ubi-reader
+Suggests: sleuthkit
+Suggests: srecord
+Suggests: tar
+Suggests: unrar
+Suggests: xz
+Suggests: zstd
+# Suggests: 7zip # provides 7zzs (APFS extractor)
+# Suggests: jefferson # provides jefferson
+# Suggests: sasquatch # provides sasquatch/sasquatch-v4be
+# Suggests: uefi-firmware-parser # provides uefi-firmware-parser
+# Suggests: vmlinux-to-elf # provides vmlinux-to-elf
+# Suggests: yaffshiv # provides unyaffs/yaffshiv tools
+# Suggests: dumpifs # provides dumpifs
+BuildRequires: cargo
+BuildRequires: rpm-build >= 4.6
+BuildRequires: rpmbuild(macros) >= 2.050
+BuildRequires: rust
+BuildRequires: tar >= 1:1.22
+BuildRequires: xz
+%{?rust_req}
+ExclusiveArch: %{rust_arches}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-# rpm tries to strip as ELF, but it's not ELF
-%define _noautostrip .*/binwalk/magic/executables
-
%description
Binwalk is a tool for searching a given binary image for embedded
files and executable code. Specifically, it is designed for
@@ -49,23 +73,36 @@ obrazach firmware'u, takimi jak pliki skompresowane albo archiwa,
nagłówki firmware'u, jądra Linuksa, bootloadery, systemy plików itp.
%prep
-%setup -q
-%patch -P0 -p1
+%setup -q -n %{name}-%{version} -a1
+
+export CARGO_HOME="$(pwd)/.cargo"
+
+mkdir -p "$CARGO_HOME"
+cat >.cargo/config.toml <<EOF
+[source.crates-io]
+registry = 'https://github.com/rust-lang/crates.io-index'
+replace-with = 'vendored-sources'
+
+[source.vendored-sources]
+directory = '$PWD/vendor'
+EOF
%build
-%py3_build
+export CARGO_HOME="$(pwd)/.cargo"
+
+%cargo_build --frozen --locked
%install
rm -rf $RPM_BUILD_ROOT
-%py3_install
+export CARGO_HOME="$(pwd)/.cargo"
+
+%cargo_install --frozen --locked --root $RPM_BUILD_ROOT%{_prefix} --path $PWD
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc API.md README.md
+%doc CARGO_README.md README.md
%attr(755,root,root) %{_bindir}/binwalk
-%{py3_sitescriptdir}/binwalk
-%{py3_sitescriptdir}/binwalk-2.3.3-py*.egg-info
diff --git a/binwalk-python.patch b/binwalk-python.patch
deleted file mode 100644
index 09a1994..0000000
--- a/binwalk-python.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- binwalk-2.3.4/src/binwalk/modules/extractor.py.orig 2023-02-01 17:15:53.000000000 +0100
-+++ binwalk-2.3.4/src/binwalk/modules/extractor.py 2025-03-23 10:05:37.924531273 +0100
-@@ -966,7 +966,7 @@ class Extractor(Module):
-
- # Fork a child process
- child_pid = os.fork()
-- if child_pid is 0:
-+ if child_pid == 0:
- # Switch to the run-as user privileges, if one has been set
- if self.runas_uid is not None and self.runas_gid is not None:
- os.setgid(self.runas_uid)
-@@ -981,7 +981,7 @@ class Extractor(Module):
- rval = subprocess.call(shlex.split(command), stdout=tmp, stderr=tmp)
-
- # A true child process should exit with the subprocess exit value
-- if child_pid is 0:
-+ if child_pid == 0:
- sys.exit(rval)
- # If no os.fork() happened, just return the subprocess exit value
- elif child_pid is None:
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/binwalk.git/commitdiff/92be837d19f2876134ca57adb31bf796a98fd7ff
More information about the pld-cvs-commit
mailing list