commit:     007e07a4303222a860b2ea144aa952702c20fab7
Author:     Mario Haustein <mario.haustein <AT> hrz <DOT> tu-chemnitz <DOT> de>
AuthorDate: Thu Oct  9 18:43:51 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct  9 21:38:44 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=007e07a4

app-forensics/yara-x: add 1.8.1

Signed-off-by: Mario Haustein <mario.haustein <AT> hrz.tu-chemnitz.de>
Part-of: https://github.com/gentoo/gentoo/pull/43877
Closes: https://github.com/gentoo/gentoo/pull/43877
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-forensics/yara-x/Manifest                      |  2 +
 .../yara-x/files/yara-x-1.8.1-tests.patch          | 27 ++++++
 app-forensics/yara-x/yara-x-1.8.1.ebuild           | 96 ++++++++++++++++++++++
 3 files changed, 125 insertions(+)

diff --git a/app-forensics/yara-x/Manifest b/app-forensics/yara-x/Manifest
index 7a44eabe09ce..0dd59982ce7d 100644
--- a/app-forensics/yara-x/Manifest
+++ b/app-forensics/yara-x/Manifest
@@ -2,3 +2,5 @@ DIST yara-x-1.4.0-crates.tar.xz 45877576 BLAKE2B 
f620fbb99531e78d4626dbe55067024
 DIST yara-x-1.4.0.tar.gz 44550390 BLAKE2B 
feb6d275ee46478328f981c1ac4f085e01a5c484f063eeadb8523a9b6e831398f6deb839d70469432af00627f0fb0d766facdfb400bd3e0572248214d38cae5f
 SHA512 
258cac3ca9de1f3b61f86253ea83776b294d6f3c10af27b2c18f654de3b7c85660bb6e59628762e7a177c43c739086e76c0e7b4802da611d043afe94680ada39
 DIST yara-x-1.6.0-crates.tar.xz 45679348 BLAKE2B 
c38efdb7753d9507d02b0251337e476c8bf04dcd01de4baba5ef08aae4fe1f12beebfa534e0253f17848f0a7ee873c569b2885df3a8b42767acad16fc89af03c
 SHA512 
556259b0c64cf9aa731adc7c5065a8de9e356ef823551ff9eb7a29b2ee5a62e14198fd346318403856da4264ad594474f8abe06c2c09491329a4b6da760a371e
 DIST yara-x-1.6.0.tar.gz 45682006 BLAKE2B 
cc9f7fa2ac31ea82c863295dad9a6764f0ce02a70e084e160c1e635977f1be55de789c706485c0cf3b574a38d40af705c3887100f32367065106085652f1a0e9
 SHA512 
cefe0bdbf46eff475d92af9e04bb5a275abfc64ab6ad530aabcff0bfd270237a895cb73f94a554fb6d5749b4a574c9a3843917c77e9702c723cf6f67c686b185
+DIST yara-x-1.8.1-crates.tar.xz 43611272 BLAKE2B 
bc655cf47eef9cba45fdf72013c686cbbf57e9a57fe24a1bb493cfb2f783b7d8cb49d6f92c82d0ff1856485c8eb474401e3a8a4a028b202e75c320d774f359e6
 SHA512 
4dc52b80f15220cd225edb18ffee31ed59088e083eb1fb00cb4c19b38fcf7d0fbe2cd957d7ffac288335334ae76b5425dc8745443f2c89adac6bc9aa4befb499
+DIST yara-x-1.8.1.tar.gz 45705548 BLAKE2B 
bf7efca80ff666a654ba53f3b5936a8d8eb60ee30f4a024772f071a4f4617d15a44e894b430b23f9a9740b07201b6fb0be460958c79f27e8ed1e29377d51cdb4
 SHA512 
26c01d8f36347d68664e872ca353749bb70b4916eb41f0a21f312d74e16fbba061f208246b32ac6f51a52272f41ad62730531bb71e44bb027bc4a49b2dd40233

diff --git a/app-forensics/yara-x/files/yara-x-1.8.1-tests.patch 
b/app-forensics/yara-x/files/yara-x-1.8.1-tests.patch
new file mode 100644
index 000000000000..b96f94ebb0c2
--- /dev/null
+++ b/app-forensics/yara-x/files/yara-x-1.8.1-tests.patch
@@ -0,0 +1,27 @@
+From 0ac56cc6a18bdb2062d2a7e41289ae07f62f32f7 Mon Sep 17 00:00:00 2001
+From: "Victor M. Alvarez" <[email protected]>
+Date: Thu, 9 Oct 2025 16:32:55 +0200
+Subject: [PATCH] tests: increase the number of iterations in test case for
+ timeouts
+Upstream: https://github.com/VirusTotal/yara-x/issues/471
+
+The current rule was too fast in some hardware.
+
+Closes #471
+---
+ lib/src/scanner/blocks.rs | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/src/scanner/blocks.rs b/lib/src/scanner/blocks.rs
+index cc8a0b5f..c067a8c2 100644
+--- a/lib/src/scanner/blocks.rs
++++ b/lib/src/scanner/blocks.rs
+@@ -474,7 +474,7 @@ mod tests {
+             r#"
+             rule slow {
+                 condition: 
+-                    for any i in (0..10000000) : (
++                    for any i in (0..1000000000) : (
+                          uint8(i) == 0xCC
+                     )
+             }"#,

diff --git a/app-forensics/yara-x/yara-x-1.8.1.ebuild 
b/app-forensics/yara-x/yara-x-1.8.1.ebuild
new file mode 100644
index 000000000000..cc758a360d6b
--- /dev/null
+++ b/app-forensics/yara-x/yara-x-1.8.1.ebuild
@@ -0,0 +1,96 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=maturin
+DISTUTILS_OPTIONAL=1
+PYTHON_COMPAT=( python3_{10..13} )
+RUST_MIN_VER="1.87.0"
+
+CRATES=""
+
+inherit cargo distutils-r1
+
+DESCRIPTION="A malware identification and classification tool"
+HOMEPAGE="https://virustotal.github.io/yara-x/";
+SRC_URI="https://github.com/VirusTotal/yara-x/archive/refs/tags/v${PV}.tar.gz 
-> ${P}.tar.gz"
+SRC_URI+=" 
https://github.com/gentoo-crate-dist/${PN}/releases/download/v${PV}/${P}-crates.tar.xz";
+
+LICENSE="BSD"
+# Dependent crate licenses
+LICENSE+="
+       Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD CC0-1.0 EPL-2.0 ISC
+       MIT MPL-2.0 Unicode-3.0 Unicode-DFS-2016 WTFPL-2 ZLIB
+"
+
+SLOT="0"
+# Note: cranelift dependency only supports amd64, arm64, s390, and riscv64 as 
of 2025
+KEYWORDS="~amd64"
+IUSE="python"
+REQUIRED_USE="
+       python? ( ${PYTHON_REQUIRED_USE} )
+"
+
+RDEPEND="
+       python? ( ${PYTHON_DEPS} )
+"
+BDEPEND="
+       python? (
+               ${PYTHON_DEPS}
+               ${DISTUTILS_DEPS}
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}/${P}-tests.patch"
+)
+
+wrap_python() {
+       local phase=$1
+       shift
+
+       if use python; then
+               pushd py >/dev/null || die
+               distutils-r1_${phase} "$@"
+               popd >/dev/null || die
+       fi
+}
+
+# https://bugs.gentoo.org/933231, https://bugs.gentoo.org/933232
+QA_FLAGS_IGNORED="usr/bin/yr"
+
+pkg_setup() {
+       # https://bugs.gentoo.org/933233
+       QA_SONAME="usr/$(get_libdir)/libyara_x.*\\.so 
usr/lib.*/py.*/site-packages/yara_x/yara_x.*\\.so"
+
+       rust_pkg_setup
+}
+
+src_prepare() {
+       default
+       wrap_python ${FUNCNAME}
+}
+
+src_compile() {
+       cargo_src_compile --workspace
+       wrap_python ${FUNCNAME}
+}
+
+python_test() {
+       epytest
+}
+
+src_test() {
+       export RUST_BACKTRACE=full
+       cargo_src_test
+       wrap_python ${FUNCNAME}
+}
+
+src_install() {
+       dobin "$(cargo_target_dir)"/yr
+       dolib.so "$(cargo_target_dir)"/*.so
+
+       wrap_python ${FUNCNAME}
+}

Reply via email to