unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#69074] [PATCH] Add python-angr.
@ 2024-02-12 14:55 soeren
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-itanium-demangle soeren
                   ` (22 more replies)
  0 siblings, 23 replies; 78+ messages in thread
From: soeren @ 2024-02-12 14:55 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

This patchset adds a package for angr <https://angr.io/>.  angr is a
binary analysis framework that implements different binary analysis
techniques, such as symbolic execution.  Symbolic execution is an active
area of computer science research.  This package is part of an ongoing
effort to package symbolic execution tools in Guix, thereby easing the
creation of computational environments for reproducible research in this
domain [1], [2], [3].

angr comes with an extensive test suite, which takes a while to run.
However, I would argue that enabling this test suite is worthwhile as it
allowed me to discover two upstream bugs in capstone and angr which I
fixed and backported as port of the patchset [4], [5].  angr also
requires unicorn 2.X hence I've included (and revised) an existing patch
updating unicorn [6].

Feedback is more than welcome!

[1]: https://issues.guix.gnu.org/68908
[2]: https://issues.guix.gnu.org/68296
[3]: https://github.com/nmeum/guix-symex
[4]: https://github.com/angr/angr/pull/4443
[5]: https://github.com/capstone-engine/capstone/pull/2240
[6]: https://issues.guix.gnu.org/63442

Sören Tempel (13):
  gnu: Add python-itanium-demangle.
  gnu: Add python-keystone-engine.
  gnu: Add python-mulpyplexer.
  gnu: Add python-nampa.
  gnu: Add python-rpyc.
  gnu: Add python-pysmt.
  gnu: Add python-claripy.
  gnu: Add python-archinfo.
  gnu: Add python-pyvex.
  gnu: Add python-cle.
  gnu: Add python-ailment.
  gnu: capstone: Backport upstream fix for Python bindings.
  gnu: Add python-angr.

c4droid (1):
  gnu: unicorn: Update to 2.0.1.post1.

 gnu/local.mk                                  |   6 +
 gnu/packages/emulators.scm                    | 119 +-----
 gnu/packages/engineering.scm                  |   2 +
 .../python-angr-addition-type-error.patch     |  18 +
 .../patches/python-angr-check-exec-deps.patch |  93 ++++
 ...python-capstone-fix-python-constants.patch |  84 ++++
 .../python-pysmt-fix-pow-return-type.patch    | 258 +++++++++++
 ...-pysmt-fix-smtlib-serialization-test.patch |  86 ++++
 .../python-pyvex-remove-angr-dependency.patch |  80 ++++
 gnu/packages/python-xyz.scm                   | 400 ++++++++++++++++++
 10 files changed, 1047 insertions(+), 99 deletions(-)
 create mode 100644 gnu/packages/patches/python-angr-addition-type-error.patch
 create mode 100644 gnu/packages/patches/python-angr-check-exec-deps.patch
 create mode 100644 gnu/packages/patches/python-capstone-fix-python-constants.patch
 create mode 100644 gnu/packages/patches/python-pysmt-fix-pow-return-type.patch
 create mode 100644 gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch
 create mode 100644 gnu/packages/patches/python-pyvex-remove-angr-dependency.patch


base-commit: 179bb57d2532ee6b81791e078b0f782cbf88cb84




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] gnu: Add python-itanium-demangle.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
@ 2024-02-12 14:58 ` soeren
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-keystone-engine soeren
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-02-12 14:58 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-itanium-demangle): New variable.
---
 gnu/packages/python-xyz.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index c68b17b0ab..e630bdb6a6 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -146,6 +146,7 @@
 ;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2023 Attila Lendvai <attila@lendvai.name>
 ;;; Copyright © 2023, 2024 Troy Figiel <troy@troyfigiel.com>
+;;; Copyright © 2024 Sören Tempel <soeren@soeren-tempel.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -32302,6 +32303,36 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-itanium-demangle
+  (package
+    (name "python-itanium-demangle")
+    (version "1.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/whitequark/python-itanium_demangler")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1q47aqm5z3db6pasdzw05d6236vnb8hnapfy88fcmn9dr5ym98r3"))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (home-page "https://github.com/whitequark/python-itanium_demangler")
+    (synopsis "Pure Python Itanium C++ ABI demangler")
+    (description
+     "This Python module provides an implementation of the Itanium C++
+ABI symbol mangling language.  The demangler generates an abstract
+syntax tree from mangled symbols, which can be used for directly
+extracting type information.")
+    (license license:bsd-0)))
+
 (define-public python-peachpy
   ;; There is no tag in this repo.
   (let ((commit "913d74c35a6b1d330e90bfc055208ce5b06b35a0")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] gnu: Add python-keystone-engine.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-itanium-demangle soeren
@ 2024-02-12 14:58 ` soeren
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-mulpyplexer soeren
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-02-12 14:58 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-keystone-engine): New variable.
---
 gnu/packages/python-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index e630bdb6a6..e4f6483f70 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32303,6 +32303,28 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-keystone-engine
+  (package
+    (name "python-keystone-engine")
+    (version "0.9.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "keystone-engine" version))
+       (sha256
+        (base32 "1xahdr6bh3dw5swrc2r8kqa8ljhqlb7k2kxv5mrw5rhcmcnzcyig"))))
+    (native-inputs (list cmake))
+    (build-system pyproject-build-system)
+    (home-page "https://www.keystone-engine.org")
+    (synopsis
+     "Lightweight multi-platform, multi-architecture assembler framework")
+    (description
+     "Keystone is a lightweight multi-platform, multi-architecture
+assembler framework.  It supports a wide-range of different architectures
+and offers an intuitive architecture-neutral API for interacting with
+assembly for these architectures.")
+    (license license:gpl2)))
+
 (define-public python-itanium-demangle
   (package
     (name "python-itanium-demangle")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] gnu: Add python-mulpyplexer.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-itanium-demangle soeren
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-keystone-engine soeren
@ 2024-02-12 14:58 ` soeren
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-nampa soeren
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-02-12 14:58 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-mulpyplexer): New variable.
---
 gnu/packages/python-xyz.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index e4f6483f70..20b7a17fd2 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32303,6 +32303,26 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-mulpyplexer
+  (package
+    (name "python-mulpyplexer")
+    (version "0.09")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "mulpyplexer" version))
+       (sha256
+        (base32 "0c5xzci1djy1yi9hxxh8g67l6ms8r7ad7ja20pv8hfbdysdrwkhl"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:tests? #f)) ;no tests
+    (home-page "https://github.com/zardus/mulpyplexer/")
+    (synopsis "Multiplexes interactions with lists of Python objects")
+    (description "This module provides utilities for multiplexing
+interactions with lists of Python objects.")
+    (license license:bsd-3)))
+
 (define-public python-keystone-engine
   (package
     (name "python-keystone-engine")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] gnu: Add python-nampa.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (2 preceding siblings ...)
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-mulpyplexer soeren
@ 2024-02-12 14:58 ` soeren
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-rpyc soeren
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-02-12 14:58 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-nampa): New variable.
---
 gnu/packages/python-xyz.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 20b7a17fd2..f94b0056f0 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32303,6 +32303,26 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-nampa
+  (package
+    (name "python-nampa")
+    (version "0.1.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "nampa" version))
+       (sha256
+        (base32 "0k6cq2gflpkm40qhgqbbcjmq5lq589c15bmk567qyh3d08062hvd"))))
+    (build-system pyproject-build-system)
+    (propagated-inputs (list python-future))
+    (home-page "https://github.com/thebabush/nampa")
+    (synopsis "Python implementation of IDA Pro's FLIRT technology")
+    (description
+     "This Python module implements the Fast Library Identification
+and Recognition Technology (FLIRT).  This technology is useful for identifying
+common library subroutines in disassembled binaries.")
+    (license license:lgpl3)))
+
 (define-public python-mulpyplexer
   (package
     (name "python-mulpyplexer")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] gnu: Add python-rpyc.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (3 preceding siblings ...)
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-nampa soeren
@ 2024-02-12 14:58 ` soeren
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-pysmt soeren
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-02-12 14:58 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-rpyc): New variable.
---
 gnu/packages/python-xyz.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index f94b0056f0..5fe5c0d60a 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32303,6 +32303,32 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-rpyc
+  (package
+    (name "python-rpyc")
+    (version "5.3.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "rpyc" version))
+       (sha256
+        (base32 "0lmzrxc6f0sg6k0yvi6f2z44dkhiankdadv44sp1ibwzhxs328zj"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:tests? #f)) ;tests require network
+    (propagated-inputs (list python-hatchling python-plumbum))
+    (home-page "https://github.com/tomerfiliba-org/rpyc")
+    (synopsis
+     "Remote Python Call (RPyC) is a symmetric distributed computing library")
+    (description
+     "This Python module enables remote procedure calls, clustering, and
+distributed-computing.  For this purpose, it makes use of object-proxying, a technique
+that employs python's dynamic nature, to overcome the physical boundaries between
+processes and computers, so that remote objects can be manipulated as if they
+were local.")
+    (license license:expat)))
+
 (define-public python-nampa
   (package
     (name "python-nampa")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] gnu: Add python-pysmt.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (4 preceding siblings ...)
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-rpyc soeren
@ 2024-02-12 14:58 ` soeren
  2024-02-12 14:58 ` Troy Figiel
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-02-12 14:58 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-pysmt): New variable.
---
 gnu/local.mk                                  |   2 +
 .../python-pysmt-fix-pow-return-type.patch    | 258 ++++++++++++++++++
 ...-pysmt-fix-smtlib-serialization-test.patch |  86 ++++++
 gnu/packages/python-xyz.scm                   |  34 +++
 4 files changed, 380 insertions(+)
 create mode 100644 gnu/packages/patches/python-pysmt-fix-pow-return-type.patch
 create mode 100644 gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index fbdb285695..1946fdcbb6 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1925,6 +1925,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-pyan3-fix-absolute-path-bug.patch \
   %D%/packages/patches/python-pyan3-fix-positional-arguments.patch \
   %D%/packages/patches/python-pygpgme-fix-pinentry-tests.patch	\
+  %D%/packages/patches/python-pysmt-fix-pow-return-type.patch	\
+  %D%/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch	\
   %D%/packages/patches/python-pytorch-runpath.patch		\
   %D%/packages/patches/python-pytorch-system-libraries.patch	\
   %D%/packages/patches/python-pytorch-1.9.0-system-libraries.patch \
diff --git a/gnu/packages/patches/python-pysmt-fix-pow-return-type.patch b/gnu/packages/patches/python-pysmt-fix-pow-return-type.patch
new file mode 100644
index 0000000000..0ec2d41b3c
--- /dev/null
+++ b/gnu/packages/patches/python-pysmt-fix-pow-return-type.patch
@@ -0,0 +1,258 @@
+Backport of an upstream patch which fixes a test failure with our
+packaged version of the Z3 SMT solver.
+
+Taken from: https://github.com/pysmt/pysmt/commit/f522e8cd8f3e75ff85f5eae29b427e18a6701859
+
+diff --git a/pysmt/formula.py b/pysmt/formula.py
+index ea4b46c..6cb9cbf 100644
+--- a/pysmt/formula.py
++++ b/pysmt/formula.py
+@@ -252,11 +252,7 @@ class FormulaManager(object):
+ 
+         if base.is_constant():
+             val = base.constant_value() ** exponent.constant_value()
+-            if base.is_constant(types.REAL):
+-                return self.Real(val)
+-            else:
+-                assert base.is_constant(types.INT)
+-                return self.Int(val)
++            return self.Real(val)
+         return self.create_node(node_type=op.POW, args=(base, exponent))
+ 
+     def Div(self, left, right):
+diff --git a/pysmt/logics.py b/pysmt/logics.py
+index ef88dd6..9dc45b1 100644
+--- a/pysmt/logics.py
++++ b/pysmt/logics.py
+@@ -495,6 +495,12 @@ QF_NRA = Logic(name="QF_NRA",
+                real_arithmetic=True,
+                linear=False)
+ 
++QF_NIRA = Logic(name="QF_NIRA",
++                description="""Quantifier-free integer and real arithmetic.""",
++                quantifier_free=True,
++                integer_arithmetic=True,
++                real_arithmetic=True,
++                linear=False)
+ 
+ QF_RDL = Logic(name="QF_RDL",
+                description=\
+@@ -619,41 +625,41 @@ QF_AUFBVLIRA = Logic(name="QF_AUFBVLIRA",
+ AUTO = Logic(name="Auto",
+              description="Special logic used to indicate that the logic to be used depends on the formula.")
+ 
+-SMTLIB2_LOGICS = frozenset([ AUFLIA,
+-                             AUFLIRA,
+-                             AUFNIRA,
+-                             ALIA,
+-                             LRA,
+-                             LIA,
+-                             NIA,
+-                             NRA,
+-                             UFLRA,
+-                             UFNIA,
+-                             UFLIRA,
+-                             QF_ABV,
+-                             QF_AUFBV,
+-                             QF_AUFLIA,
+-                             QF_ALIA,
+-                             QF_AX,
+-                             QF_BV,
+-                             QF_IDL,
+-                             QF_LIA,
+-                             QF_LRA,
+-                             QF_NIA,
+-                             QF_NRA,
+-                             QF_RDL,
+-                             QF_UF,
+-                             QF_UFBV ,
+-                             QF_UFIDL,
+-                             QF_UFLIA,
+-                             QF_UFLRA,
+-                             QF_UFNRA,
+-                             QF_UFNIA,
+-                             QF_UFLIRA,
+-                             QF_SLIA
+-                         ])
+-
+-LOGICS = SMTLIB2_LOGICS | frozenset([ QF_BOOL, BOOL, QF_AUFBVLIRA])
++SMTLIB2_LOGICS = frozenset([AUFLIA,
++                            AUFLIRA,
++                            AUFNIRA,
++                            ALIA,
++                            LRA,
++                            LIA,
++                            NIA,
++                            NRA,
++                            UFLRA,
++                            UFNIA,
++                            UFLIRA,
++                            QF_ABV,
++                            QF_AUFBV,
++                            QF_AUFLIA,
++                            QF_ALIA,
++                            QF_AX,
++                            QF_BV,
++                            QF_IDL,
++                            QF_LIA,
++                            QF_LRA,
++                            QF_NIA,
++                            QF_NRA,
++                            QF_RDL,
++                            QF_UF,
++                            QF_UFBV,
++                            QF_UFIDL,
++                            QF_UFLIA,
++                            QF_UFLRA,
++                            QF_UFNRA,
++                            QF_UFNIA,
++                            QF_UFLIRA,
++                            QF_SLIA
++                            ])
++
++LOGICS = SMTLIB2_LOGICS | frozenset([QF_BOOL, BOOL, QF_AUFBVLIRA, QF_NIRA])
+ 
+ QF_LOGICS = frozenset(_l for _l in LOGICS if _l.quantifier_free)
+ 
+@@ -668,8 +674,8 @@ PYSMT_LOGICS = frozenset([QF_BOOL, QF_IDL, QF_LIA, QF_LRA, QF_RDL, QF_UF, QF_UFI
+                           QF_BV, QF_UFBV,
+                           QF_ABV, QF_AUFBV, QF_AUFLIA, QF_ALIA, QF_AX,
+                           QF_AUFBVLIRA,
+-                          QF_NRA, QF_NIA, UFBV, BV,
+-                      ])
++                          QF_NRA, QF_NIA, QF_NIRA, UFBV, BV,
++                          ])
+ 
+ # PySMT Logics includes additional features:
+ #  - constant arrays: QF_AUFBV  becomes QF_AUFBV*
+@@ -697,7 +703,6 @@ for l in PYSMT_LOGICS:
+         ext_logics.add(nl)
+ 
+ 
+-
+ LOGICS = LOGICS | frozenset(ext_logics)
+ PYSMT_LOGICS = PYSMT_LOGICS | frozenset(ext_logics)
+ 
+diff --git a/pysmt/solvers/z3.py b/pysmt/solvers/z3.py
+index 3fb42b9..210b771 100644
+--- a/pysmt/solvers/z3.py
++++ b/pysmt/solvers/z3.py
+@@ -595,6 +595,8 @@ class Z3Converter(Converter, DagWalker):
+                                              None, None,
+                                              0, None,
+                                              expr.ast)
++        print("Z3: SMTLIB")
++        print(s)
+         stream_in = StringIO(s)
+         r = parser.get_script(stream_in).get_last_formula(self.mgr)
+         key = (askey(expr), None)
+diff --git a/pysmt/test/examples.py b/pysmt/test/examples.py
+index 73455ee..b653185 100644
+--- a/pysmt/test/examples.py
++++ b/pysmt/test/examples.py
+@@ -898,12 +898,12 @@ def get_full_example_formulae(environment=None):
+                     logic=pysmt.logics.QF_NRA
+                 ),
+ 
+-            Example(hr="((p ^ 2) = 0)",
+-                    expr=Equals(Pow(p, Int(2)), Int(0)),
++            Example(hr="((p ^ 2) = 0.0)",
++                    expr=Equals(Pow(p, Int(2)), Real(0)),
+                     is_valid=False,
+                     is_sat=True,
+-                    logic=pysmt.logics.QF_NIA
+-                ),
++                    logic=pysmt.logics.QF_NIRA
++                    ),
+ 
+             Example(hr="((r ^ 2.0) = 0.0)",
+                     expr=Equals(Pow(r, Real(2)), Real(0)),
+diff --git a/pysmt/test/test_back.py b/pysmt/test/test_back.py
+index bceb45b..7a0ad63 100644
+--- a/pysmt/test/test_back.py
++++ b/pysmt/test/test_back.py
+@@ -55,10 +55,10 @@ class TestBasic(TestCase):
+         res = msat.converter.back(term)
+         self.assertFalse(f == res)
+ 
+-    def do_back(self, solver_name, z3_string_buffer=False):
++    def do_back(self, solver_name, via_smtlib=False):
+         for formula, _, _, logic in get_example_formulae():
+             if logic.quantifier_free:
+-                if logic.theory.custom_type and z3_string_buffer:
++                if logic.theory.custom_type and via_smtlib:
+                     # Printing of declare-sort from Z3 is not conformant
+                     # with the SMT-LIB. We might consider extending our
+                     # parser.
+@@ -67,7 +67,7 @@ class TestBasic(TestCase):
+                     s = Solver(name=solver_name, logic=logic)
+                     term = s.converter.convert(formula)
+                     if solver_name == "z3":
+-                        if z3_string_buffer:
++                        if via_smtlib:
+                             res = s.converter.back_via_smtlib(term)
+                         else:
+                             res = s.converter.back(term)
+@@ -84,8 +84,8 @@ class TestBasic(TestCase):
+ 
+     @skipIfSolverNotAvailable("z3")
+     def test_z3_back_formulae(self):
+-        self.do_back("z3", z3_string_buffer=False)
+-        self.do_back("z3", z3_string_buffer=True)
++        self.do_back("z3", via_smtlib=True)
++        self.do_back("z3", via_smtlib=False)
+ 
+ 
+ if __name__ == '__main__':
+diff --git a/pysmt/type_checker.py b/pysmt/type_checker.py
+index b700fcf..7ce05aa 100644
+--- a/pysmt/type_checker.py
++++ b/pysmt/type_checker.py
+@@ -33,6 +33,8 @@ class SimpleTypeChecker(walkers.DagWalker):
+ 
+     def __init__(self, env=None):
+         walkers.DagWalker.__init__(self, env=env)
++        # Return None if the type cannot be computed rather than
++        # raising an exception.
+         self.be_nice = False
+ 
+     def _get_key(self, formula, **kwargs):
+@@ -42,7 +44,7 @@ class SimpleTypeChecker(walkers.DagWalker):
+         """ Returns the pysmt.types type of the formula """
+         res = self.walk(formula)
+         if not self.be_nice and res is None:
+-            raise PysmtTypeError("The formula '%s' is not well-formed" \
++            raise PysmtTypeError("The formula '%s' is not well-formed"
+                                  % str(formula))
+         return res
+ 
+@@ -114,7 +116,7 @@ class SimpleTypeChecker(walkers.DagWalker):
+ 
+     def walk_bv_comp(self, formula, args, **kwargs):
+         # We check that all children are BV and the same size
+-        a,b = args
++        a, b = args
+         if a != b or (not a.is_bv_type()):
+             return None
+         return BVType(1)
+@@ -187,7 +189,7 @@ class SimpleTypeChecker(walkers.DagWalker):
+         if args[0].is_bool_type():
+             raise PysmtTypeError("The formula '%s' is not well-formed."
+                                  "Equality operator is not supported for Boolean"
+-                                 " terms. Use Iff instead." \
++                                 " terms. Use Iff instead."
+                                  % str(formula))
+         elif args[0].is_bv_type():
+             return self.walk_bv_to_bool(formula, args)
+@@ -324,10 +326,7 @@ class SimpleTypeChecker(walkers.DagWalker):
+     def walk_pow(self, formula, args, **kwargs):
+         if args[0] != args[1]:
+             return None
+-        # Exponent must be positive for INT
+-        if args[0].is_int_type() and formula.arg(1).constant_value() < 0 :
+-            return None
+-        return args[0]
++        return REAL
+ 
+ # EOC SimpleTypeChecker
+ 
diff --git a/gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch b/gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch
new file mode 100644
index 0000000000..eee555f807
--- /dev/null
+++ b/gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch
@@ -0,0 +1,86 @@
+Backport of an upstream patch fixing a test suite failure.
+
+Taken from: https://github.com/pysmt/pysmt/commit/a246669a487aff69f5da34570ef867841d18508a
+
+diff --git a/pysmt/test/smtlib/test_parser_examples.py b/pysmt/test/smtlib/test_parser_examples.py
+index cca4194..c0852be 100644
+--- a/pysmt/test/smtlib/test_parser_examples.py
++++ b/pysmt/test/smtlib/test_parser_examples.py
+@@ -29,6 +29,7 @@ from pysmt.shortcuts import Iff
+ from pysmt.shortcuts import read_smtlib, write_smtlib, get_env
+ from pysmt.exceptions import PysmtSyntaxError
+ 
++
+ class TestSMTParseExamples(TestCase):
+ 
+     def test_parse_examples(self):
+@@ -41,7 +42,6 @@ class TestSMTParseExamples(TestCase):
+             buf = StringIO()
+             script_out = smtlibscript_from_formula(f_out)
+             script_out.serialize(outstream=buf)
+-            #print(buf)
+ 
+             buf.seek(0)
+             parser = SmtLibParser()
+@@ -49,7 +49,6 @@ class TestSMTParseExamples(TestCase):
+             f_in = script_in.get_last_formula()
+             self.assertEqual(f_in.simplify(), f_out.simplify())
+ 
+-
+     @skipIfNoSolverForLogic(logics.QF_BV)
+     def test_parse_examples_bv(self):
+         """For BV we represent a superset of the operators defined in SMT-LIB.
+@@ -108,7 +107,18 @@ class TestSMTParseExamples(TestCase):
+             self.assertValid(Iff(f_in, f_out), f_in.serialize())
+ 
+     def test_dumped_logic(self):
+-        # Dumped logic matches the logic in the example
++        # Dumped logic matches the logic in the example.
++        #
++        # There are a few cases where we use a logic
++        # that does not exist in SMT-LIB, and the SMT-LIB
++        # serialization logic will find a logic that
++        # is more expressive. We need to adjust the test
++        # for those cases (see rewrite dict below).
++        rewrite = {
++            logics.QF_BOOL: logics.QF_UF,
++            logics.BOOL: logics.LRA,
++            logics.QF_NIRA: logics.AUFNIRA,
++        }
+         fs = get_example_formulae()
+ 
+         for (f_out, _, _, logic) in fs:
+@@ -121,14 +131,9 @@ class TestSMTParseExamples(TestCase):
+             for cmd in script_in:
+                 if cmd.name == "set-logic":
+                     logic_in = cmd.args[0]
+-                    if logic == logics.QF_BOOL:
+-                        self.assertEqual(logic_in, logics.QF_UF)
+-                    elif logic == logics.BOOL:
+-                        self.assertEqual(logic_in, logics.LRA)
+-                    else:
+-                        self.assertEqual(logic_in, logic, script_in)
++                    self.assertEqual(logic_in, rewrite.get(logic, logic))
+                     break
+-            else: # Loops exited normally
++            else:  # Loops exited normally
+                 print("-"*40)
+                 print(script_in)
+ 
+@@ -136,7 +141,7 @@ class TestSMTParseExamples(TestCase):
+         fs = get_example_formulae()
+ 
+         fdi, tmp_fname = mkstemp()
+-        os.close(fdi) # Close initial file descriptor
++        os.close(fdi)  # Close initial file descriptor
+         for (f_out, _, _, _) in fs:
+             write_smtlib(f_out, tmp_fname)
+             # with open(tmp_fname) as fin:
+@@ -197,7 +202,6 @@ class TestSMTParseExamples(TestCase):
+         f_in = script.get_last_formula()
+         self.assertSat(f_in)
+ 
+-
+     def test_int_promotion_define_fun(self):
+         script = """
+         (define-fun x () Int 8)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 5fe5c0d60a..055f7ea553 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32303,6 +32303,40 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-pysmt
+  (package
+    (name "python-pysmt")
+    (version "0.9.5")
+    (source
+     (origin
+       (method git-fetch)
+       (patches (search-patches "python-pysmt-fix-pow-return-type.patch"
+                 "python-pysmt-fix-smtlib-serialization-test.patch"))
+       (uri (git-reference
+             (url "https://github.com/pysmt/pysmt")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0hrxv23y5ip4ijfx5pvbwc2fq4zg9jz42wc9zqgqm0g0mjc9ckvh"))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (setenv "PYSMT_SOLVER" "z3")
+                        (invoke "python" "-m" "pytest" "pysmt" "-v")))))))
+    (native-inputs (list python-pytest))
+    (propagated-inputs (list z3))
+    (home-page "https://github.com/pysmt/pysmt")
+    (synopsis
+     "Solver-agnostic library for SMT formula manipulation and solving")
+    (description
+     "This Python module provides a solver-agnostic abstraction for
+working with Satisfiability Modulo Theory (SMT) formulas  For example,
+it allows manipulation and solving such formulas.")
+    (license license:asl2.0)))
+
 (define-public python-rpyc
   (package
     (name "python-rpyc")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] gnu: Add python-pysmt.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (5 preceding siblings ...)
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-pysmt soeren
@ 2024-02-12 14:58 ` Troy Figiel
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-claripy soeren
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 78+ messages in thread
From: Troy Figiel @ 2024-02-12 14:58 UTC (permalink / raw)
  To: 69074

Hi Sören, here an example for python-pysmt, taken from your commit. It might
be good to add a comment why you cannot stick to a fixed version like
0.9.5. Or ask upstream for a new version :-)

* gnu/packages/python-xyz.scm (python-pysmt): New variable.
---
 gnu/packages/python-xyz.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 5fe5c0d60a..bb58e3aaa8 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32303,6 +32303,39 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-pysmt
+  (let ((commit "f7b599c228ee8b429aab1b82ddf167bd956ea8a3")
+        (version "0.9.5")
+        (revision "0"))
+    (package
+      (name "python-pysmt")
+      (version (git-version version revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/pysmt/pysmt")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "05q70hk9rq3037f999ph5yi1ix4c91db29i17rxwcl6q24vlxiwg"))))
+      (build-system pyproject-build-system)
+      (arguments
+       '(#:phases (modify-phases %standard-phases
+                    (add-before 'check 'set-pysmt-solver
+                      (lambda _
+                        (setenv "PYSMT_SOLVER" "z3"))))))
+      (native-inputs (list python-pytest))
+      (propagated-inputs (list z3))
+      (home-page "https://github.com/pysmt/pysmt")
+      (synopsis
+       "Solver-agnostic library for SMT formula manipulation and solving")
+      (description
+       "This Python module provides a solver-agnostic abstraction for working
+with @acronym{SMT, Satisfiability Modulo Theory} formulas.  For example, it
+allows manipulation and solving such formulas.")
+      (license license:asl2.0))))
+
 (define-public python-rpyc
   (package
     (name "python-rpyc")
-- 
2.42.0





^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] gnu: Add python-claripy.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (6 preceding siblings ...)
  2024-02-12 14:58 ` Troy Figiel
@ 2024-02-12 14:58 ` soeren
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-archinfo soeren
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-02-12 14:58 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-claripy): New variable.
---
 gnu/packages/python-xyz.scm | 38 +++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 055f7ea553..6c73948dd8 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32303,6 +32303,44 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-claripy
+  (package
+    (name "python-claripy")
+    (version "9.2.46")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/angr/claripy")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0nmawpi1596d9plafrp2db36cjsidy2fagkzkja51jwlx2m1ngai"))
+       (modules '((guix build utils)))
+       (snippet '(begin
+                   (substitute* "setup.cfg"
+                     ;; Relax the z3 version constraint.
+                     ;; See https://github.com/angr/claripy/commit/d1fe2df
+                     (("z3-solver==4.10.2.0")
+                      ""))))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (propagated-inputs (list python-cachetools python-decorator python-pysmt
+                             z3))
+    (home-page "https://github.com/angr/claripy")
+    (synopsis "Abstraction layer for constraint solvers")
+    (description
+     "This Python module provides an abstraction layer for interacting
+with constraint solvers.  Specifically, it is intended to be used with
+SMT solvers and is built on top of the Z3 solver.")
+    (license license:bsd-2)))
+
 (define-public python-pysmt
   (package
     (name "python-pysmt")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] gnu: Add python-archinfo.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (7 preceding siblings ...)
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-claripy soeren
@ 2024-02-12 14:58 ` soeren
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-pyvex soeren
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-02-12 14:58 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-archinfo): New variable.
---
 gnu/packages/python-xyz.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 6c73948dd8..ba3e85fd2d 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -189,6 +189,7 @@ (define-module (gnu packages python-xyz)
   #:use-module (gnu packages djvu)
   #:use-module (gnu packages docker)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages engineering)
   #:use-module (gnu packages enchant)
   #:use-module (gnu packages file)
   #:use-module (gnu packages fonts)
@@ -32303,6 +32304,32 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-archinfo
+  (package
+    (name "python-archinfo")
+    (version "9.2.46")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "archinfo" version))
+       (sha256
+        (base32 "037xfq3wcf8ngayxz9623l4646m780v2102mfbygpzbkkjha1966"))))
+    (build-system pyproject-build-system)
+    (propagated-inputs (list python-capstone python-keystone-engine))
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (home-page "https://github.com/angr/archinfo")
+    (synopsis "Extract architecture-specific information from binaries")
+    (description
+     "Collection of classes that contain architecture-specific information
+information.  Useful for cross-architecture tools (such as @code{python-pyvex}).")
+    (license license:bsd-2)))
+
 (define-public python-claripy
   (package
     (name "python-claripy")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] gnu: Add python-pyvex.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (8 preceding siblings ...)
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-archinfo soeren
@ 2024-02-12 14:58 ` soeren
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-cle soeren
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-02-12 14:58 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-pyvex): New variable.
---
 gnu/local.mk                                  |  1 +
 .../python-pyvex-remove-angr-dependency.patch | 80 +++++++++++++++++++
 gnu/packages/python-xyz.scm                   | 35 ++++++++
 3 files changed, 116 insertions(+)
 create mode 100644 gnu/packages/patches/python-pyvex-remove-angr-dependency.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 1946fdcbb6..ecbae4bb53 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1930,6 +1930,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-pytorch-runpath.patch		\
   %D%/packages/patches/python-pytorch-system-libraries.patch	\
   %D%/packages/patches/python-pytorch-1.9.0-system-libraries.patch \
+  %D%/packages/patches/python-pyvex-remove-angr-dependency.patch	\
   %D%/packages/patches/python-robotframework-atest.patch	\
   %D%/packages/patches/python-robotframework-source-date-epoch.patch \
   %D%/packages/patches/python-robotframework-sshlibrary-rf5-compat.patch \
diff --git a/gnu/packages/patches/python-pyvex-remove-angr-dependency.patch b/gnu/packages/patches/python-pyvex-remove-angr-dependency.patch
new file mode 100644
index 0000000000..dccf22bbc6
--- /dev/null
+++ b/gnu/packages/patches/python-pyvex-remove-angr-dependency.patch
@@ -0,0 +1,80 @@
+This patch removes the angr dependency from the pyvex these, thus
+resolving a circular dependency (as angr depends on pyvex). This
+patch has been taken from upstream.
+
+This patch is a squashed version of the following upstream patches:
+
+* https://github.com/angr/pyvex/commit/61fb26f223a8d8a276b702d2448a12e02c5c9c6b
+* https://github.com/angr/pyvex/commit/a1fb2a4d0826b0e43bd8bbdd00b6db032643ec95
+
+diff --git a/tests/test_spotter.py b/tests/test_spotter.py
+index 9271ccd..bed7dd4 100644
+--- a/tests/test_spotter.py
++++ b/tests/test_spotter.py
+@@ -1,6 +1,5 @@
+ import os
+ 
+-import angr
+ import archinfo
+ 
+ import pyvex
+@@ -98,53 +97,28 @@ class CortexSpotter(GymratLifter):
+ register(CortexSpotter, "ARMEL")
+ 
+ 
+-def test_full_binary():
+-    p = angr.Project(
+-        os.path.join(test_location, "armel", "RTOSDemo.axf.issue_685"),
+-        arch="ARMEL",
+-        auto_load_libs=False,
+-    )
+-    st = p.factory.call_state(0x000013CE + 1)
+-    b = st.block().vex
+-    simgr = p.factory.simulation_manager(st)
+-    simgr.step()
+-    assert b.jumpkind == "Ijk_Sys_syscall"
+-    assert simgr.active[0].regs.ip_at_syscall.args[0] == 0x13FB
+-
+-
+ def test_tmrs():
+-    test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../binaries/tests"))
+-    p = angr.Project(
+-        os.path.join(test_location, "armel", "helloworld"),
+-        arch="ARMEL",
+-        auto_load_libs=False,
+-    )
++    arch = archinfo.arch_from_id("ARMEL")
+     ins = b"\xef\xf3\x08\x82"
+-    b = pyvex.block.IRSB(ins, 1, p.arch)
++    b = pyvex.block.IRSB(ins, 1, arch)
+     assert b.jumpkind == "Ijk_Boring"
+     assert type(b.statements[1].data) == pyvex.expr.Get
+-    assert p.arch.register_names.get(b.statements[1].data.offset, "") == "sp"
++    assert arch.register_names.get(b.statements[1].data.offset, "") == "sp"
+     assert type(b.statements[2]) == pyvex.stmt.Put
+ 
+ 
+ def test_tmsr():
+-    test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../binaries/tests"))
+-    p = angr.Project(
+-        os.path.join(test_location, "armel", "helloworld"),
+-        arch="ARMEL",
+-        auto_load_libs=False,
+-    )
++    arch = archinfo.arch_from_id("ARMEL")
+     inss = b"\x82\xf3\x08\x88"
+-    b = pyvex.block.IRSB(inss, 1, p.arch, opt_level=3)
++    b = pyvex.block.IRSB(inss, 1, arch, opt_level=3)
+     assert b.jumpkind == "Ijk_Boring"
+     assert type(b.statements[1].data) == pyvex.expr.Get
+-    assert p.arch.register_names.get(b.statements[1].data.offset, "") == "r2"
++    assert arch.register_names.get(b.statements[1].data.offset, "") == "r2"
+     assert type(b.statements[2]) == pyvex.stmt.Put
+ 
+ 
+ if __name__ == "__main__":
+     test_basic()
+     test_embedded()
+-    test_full_binary()
+     test_tmrs()
+     test_tmsr()
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index ba3e85fd2d..d46963c481 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32304,6 +32304,41 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-pyvex
+  (package
+    (name "python-pyvex")
+    (version "9.2.46")
+    (source
+     (origin
+       (method url-fetch)
+       (patches (search-patches "python-pyvex-remove-angr-dependency.patch"))
+       (uri (pypi-uri "pyvex" version))
+       (sha256
+        (base32 "1v64rn7gxy6fg065bgsy38z6r494k5ri5r6sn4g08hjj32ihx1ka"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:phases #~(modify-phases %standard-phases
+                   (replace 'check
+                     (lambda* (#:key tests? #:allow-other-keys)
+                       (when tests?
+                         (with-directory-excursion "tests"
+                           (invoke "python" "-m" "unittest")))))
+
+                   (add-before 'build 'set-cc-native
+                     (lambda _
+                       (setenv "CC" "gcc")
+                       (setenv "CC_NATIVE" "gcc"))))))
+    (propagated-inputs (list python-archinfo python-bitstring python-cffi))
+    (home-page "https://github.com/angr/pyvex")
+    (synopsis "Python interface to libVEX and VEX IR")
+    (description
+     "This package provides a Python interface the libVEX and VEX IR.
+VEX is the intermediate representation (also known as intermediate
+language) used by the Valgrind analysis tool.  As such, VEX is designed
+to enable all kinds of binary analysis tasks.")
+    (license license:bsd-2)))
+
 (define-public python-archinfo
   (package
     (name "python-archinfo")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] gnu: Add python-cle.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (9 preceding siblings ...)
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-pyvex soeren
@ 2024-02-12 14:58 ` soeren
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-ailment soeren
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-02-12 14:58 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-cle): New variable.
---
 gnu/packages/python-xyz.scm | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index d46963c481..6ab83b7dc7 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32304,6 +32304,31 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-cle
+  (package
+    (name "python-cle")
+    (version "9.2.46")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "cle" version))
+       (sha256
+        (base32 "0mswv9gd2p2ws7zfsshqv5ybbj27wkdwakdcknq4vsrx9ry9k4yc"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:tests? #f))
+    (propagated-inputs (list python-pefile python-pyelftools python-pyvex
+                             python-sortedcontainers))
+    (native-inputs (list python-cffi))
+    (home-page "https://github.com/angr/cle")
+    (synopsis "Python loader for binaries and their associated libraries")
+    (description
+     "CLE loads binaries and their associated libraries, resolves
+imports and provides an abstraction of process memory the same way as if
+it was loader by the operating system's loader.")
+    (license license:bsd-2)))
+
 (define-public python-pyvex
   (package
     (name "python-pyvex")
@@ -32325,7 +32350,7 @@ (define-public python-pyvex
                          (with-directory-excursion "tests"
                            (invoke "python" "-m" "unittest")))))
 
-                   (add-before 'build 'set-cc-native
+                   (add-before 'build 'set-cc
                      (lambda _
                        (setenv "CC" "gcc")
                        (setenv "CC_NATIVE" "gcc"))))))




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] gnu: Add python-ailment.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (10 preceding siblings ...)
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-cle soeren
@ 2024-02-12 14:58 ` soeren
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: unicorn: Update to 2.0.1.post1 soeren
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-02-12 14:58 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-ailment): New variable.
---
 gnu/packages/python-xyz.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 6ab83b7dc7..92c08020fb 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32304,6 +32304,32 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-ailment
+  (package
+    (name "python-ailment")
+    (version "9.2.46")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "ailment" version))
+       (sha256
+        (base32 "073fcssbjis1ckwv2w0dcz2dfl6715bj4d4qdhspajj911mvng2f"))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (home-page "https://github.com/angr/ailment")
+    (synopsis "The angr intermediate language")
+    (description
+     "This Python module implements an @acronym{IL, Intermediate Language},
+also known as @acronym{IR, Intermediate Representation}, used by the angr
+binary analysis platform.")
+    (license license:bsd-2)))
+
 (define-public python-cle
   (package
     (name "python-cle")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] gnu: unicorn: Update to 2.0.1.post1.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (11 preceding siblings ...)
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-ailment soeren
@ 2024-02-12 14:58 ` soeren
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: capstone: Backport upstream fix for Python bindings soeren
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-02-12 14:58 UTC (permalink / raw)
  To: 69074

From: c4droid <c4droid@foxmail.com>

* gnu/packages/emulators.scm (unicorn) Update to 2.0.1.post1.

Co-authored-by: Sören Tempel <soeren@soeren-tempel.net>
---
 gnu/packages/emulators.scm | 119 +++++++------------------------------
 1 file changed, 20 insertions(+), 99 deletions(-)

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index cde3ee052c..df6ca235d7 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -21,6 +21,7 @@
 ;;; Copyright © 2023 Yovan Naumovski <yovan@gorski.stream>
 ;;; Copyright © 2023 Hendursaga <hendursaga@aol.com>
 ;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2024 Sören Tempel <soeren@soeren-tempel.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -61,6 +62,7 @@ (define-module (gnu packages emulators)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages cdrom)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages containers)
   #:use-module (gnu packages cross-base)
@@ -113,6 +115,7 @@ (define-module (gnu packages emulators)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system python)
+  #:use-module (guix build-system pyproject)
   #:use-module (guix build-system qt))
 
 (define-public vice
@@ -2191,106 +2194,24 @@ (define-public bsnes
 performance, features, and ease of use.")
     (license license:gpl3)))
 
-;; python-pwntools requires a -rc release of unicorn
 (define-public unicorn
-  (let ((unless-x86
-          (lambda (code)
-            (if (member (%current-system) '("x86_64-linux" "i686-linux"))
-              '()
-              code))))
-    (package
-      (name "unicorn")
-      (version "1.0.2-rc4")
-      ;; NOTE: unicorn ships a bundled QEMU, but with a lot of custom modifications.
-      (source
-       (origin
-         (method git-fetch)
-         (uri (git-reference
-               (url "https://github.com/unicorn-engine/unicorn")
-               (commit version)))
-         (file-name (git-file-name name version))
-         (sha256
-          (base32
-           "17nyccgk7hpc4hab24yn57f1xnmr7kq4px98zbp2bkwcrxny8gwy"))))
-      (outputs '("out" "python"))
-      ;; The main library is not written in Python, but the build process has
-      ;; little in common with any defined build system, so we might as well
-      ;; build on top of python-build-system and make use of all
-      ;; the Python-specific phases that can be reused.
-      (build-system python-build-system)
-      (arguments
-       `(#:modules ((srfi srfi-26)
-                    (guix build python-build-system)
-                    (guix build utils))
-         #:phases
-         (modify-phases %standard-phases
-           (add-before 'build 'build-library
-             (lambda* (#:key inputs #:allow-other-keys)
-               (invoke "make"
-                       "-j" (number->string (parallel-job-count))
-                       "UNICORN_STATIC=no"
-                       "CC=gcc")))
-           (add-after 'build-library 'install-library
-             (lambda* (#:key outputs #:allow-other-keys)
-               (invoke "make" "install"
-                       "UNICORN_STATIC=no"
-                       (string-append
-                        "PREFIX="
-                        (assoc-ref outputs "out")))))
-           (add-before 'build 'prepare-bindings
-             (lambda* (#:key outputs #:allow-other-keys)
-               (chdir "bindings/python")
-               ;; Set this environment variable so that the Python bindings
-               ;; don't build their own copy of the shared object, but use
-               ;; a dummy value such that the bindings test suite uses the
-               ;; same mechanism for loading the library as any other user.
-               (setenv "LIBUNICORN_PATH" "1")
-               (substitute* "unicorn/unicorn.py"
-                 (("_path_list = \\[.*")
-                  (string-append
-                   "_path_list = [\""
-                   (assoc-ref outputs "out")
-                   ;; eat the rest of the list
-                   "/lib\"] + 0*[")))
-               #t))
-           (add-before 'check 'check-library
-             (lambda* (#:key outputs #:allow-other-keys)
-               (for-each
-                 (lambda (suite)
-                   (with-directory-excursion
-                     (string-append "../../tests/" suite)
-                     (invoke "make" "test" "CC=gcc"
-                             ,@(unless-x86
-                                '("AS=i686-unknown-linux-gnu-as"
-                                  "OBJCOPY=i686-unknown-linux-gnu-objcopy")))))
-                 '("unit" "regress"))
-               #t))
-           (add-after 'install 'install-samples
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let* ((python-samples (find-files "." "sample_.*"))
-                      (c-samples (find-files "../../samples" ".*\\.c"))
-                      (python-docdir
-                        (string-append (assoc-ref outputs "python")
-                                       "/share/doc/unicorn/samples"))
-                      (c-docdir
-                        (string-append (assoc-ref outputs "out")
-                                       "/share/doc/unicorn/samples")))
-                 (for-each (cut install-file <> c-docdir) c-samples)
-                 (for-each (cut install-file <> python-docdir) python-samples)
-                 #t))))))
-      (native-inputs
-       ;; NOTE: cross-binutils needs to be wrapped with unless-x86, as otherwise
-       ;; the linker provided by the package will be used, circumventing the ld-wrapper.
-       `(,@(unless-x86
-            `(("assembler-for-tests" ,(cross-binutils "i686-unknown-linux-gnu"))))
-         ("cmocka" ,cmocka)
-         ("hexdump-for-tests" ,util-linux)))
-      (home-page "https://www.unicorn-engine.org")
-      (synopsis "Unicorn CPU emulator framework")
-      (description
-       "Unicorn is a lightweight, multi-platform, multi-architecture CPU emulator
-framework based on QEMU.")
-      (license license:gpl2+))))
+  (package
+    (name "unicorn")
+    (version "2.0.1.post1")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri name version))
+              (sha256
+               (base32
+                 "0mlfs8qfi0clyncfkbxp6in0cpl747510i6bqymwid43xcirbikz"))))
+    (build-system pyproject-build-system)
+    (native-inputs (list cmake pkg-config))
+    (home-page "https://www.unicorn-engine.org")
+    (synopsis "Generic CPU emulator framework")
+    (description
+      "Uniforn is a lightweight, multi-platform, multi-architecture CPU
+emulator framework based on QEMU.")
+    (license license:gpl2+)))
 
 (define-public ppsspp
   (package




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] gnu: capstone: Backport upstream fix for Python bindings.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (12 preceding siblings ...)
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: unicorn: Update to 2.0.1.post1 soeren
@ 2024-02-12 14:58 ` soeren
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-angr Troy Figiel
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-02-12 14:58 UTC (permalink / raw)
  To: 69074

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/engineering.scm (capstone): New patch.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/engineering.scm                  |  2 +
 ...python-capstone-fix-python-constants.patch | 84 +++++++++++++++++++
 3 files changed, 87 insertions(+)
 create mode 100644 gnu/packages/patches/python-capstone-fix-python-constants.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index ecbae4bb53..ce0f1994c5 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1901,6 +1901,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-3-hurd-configure.patch		\
   %D%/packages/patches/python-aionotify-0.2.0-py3.8.patch	\
   %D%/packages/patches/python-argcomplete-1.11.1-fish31.patch	\
+  %D%/packages/patches/python-capstone-fix-python-constants.patch	\
   %D%/packages/patches/python-cross-compile.patch		\
   %D%/packages/patches/python-configobj-setuptools.patch	\
   %D%/packages/patches/python-dateutil-pytest-compat.patch	\
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 16f572909c..336c8b0e38 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -39,6 +39,7 @@
 ;;; Copyright © 2023 Theofilos Pechlivanis <theofilos.pechlivanis@gmail.com>
 ;;; Copyright © 2023 Sharlatan Hellseher <sharlatanus@gmail.com>
 ;;; Copyright © 2023 pinoaffe <pinoaffe@gmail.com>
+;;; Copyright © 2024 Sören Tempel <soeren@soeren-tempel.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1815,6 +1816,7 @@ (define-public capstone
     (version "5.0.1")
     (source (origin
               (method git-fetch)
+              (patches (search-patches "python-capstone-fix-python-constants.patch"))
               (uri (git-reference
                     (url "https://github.com/capstone-engine/capstone")
                     (commit version)))
diff --git a/gnu/packages/patches/python-capstone-fix-python-constants.patch b/gnu/packages/patches/python-capstone-fix-python-constants.patch
new file mode 100644
index 0000000000..75100c6652
--- /dev/null
+++ b/gnu/packages/patches/python-capstone-fix-python-constants.patch
@@ -0,0 +1,84 @@
+Backport upstream patch fixing various constants in the Python bindings.
+
+Taken from: https://github.com/capstone-engine/capstone/commit/f180e176de3efb060db62820ff981d0291ea8525
+
+diff --git a/bindings/python/capstone/__init__.py b/bindings/python/capstone/__init__.py
+index bda2fdb6..52353c28 100755
+--- a/bindings/python/capstone/__init__.py
++++ b/bindings/python/capstone/__init__.py
+@@ -113,7 +113,6 @@ __all__ = [
+     'CS_OPT_SYNTAX_NOREGNAME',
+     'CS_OPT_SYNTAX_MASM',
+     'CS_OPT_SYNTAX_MOTOROLA',
+-    'CS_OPT_SYNTAX_CS_REG_ALIAS',
+ 
+     'CS_OPT_DETAIL',
+     'CS_OPT_MODE',
+@@ -152,19 +151,6 @@ __all__ = [
+     'CS_OP_REG',
+     'CS_OP_IMM',
+     'CS_OP_FP',
+-    'CS_OP_PRED',
+-    'CS_OP_RESERVED_5',
+-    'CS_OP_RESERVED_6',
+-    'CS_OP_RESERVED_7',
+-    'CS_OP_RESERVED_8',
+-    'CS_OP_RESERVED_9',
+-    'CS_OP_RESERVED_10',
+-    'CS_OP_RESERVED_11',
+-    'CS_OP_RESERVED_12',
+-    'CS_OP_RESERVED_13',
+-    'CS_OP_RESERVED_14',
+-    'CS_OP_RESERVED_15',
+-    'CS_OP_SPECIAL',
+     'CS_OP_MEM',
+ 
+     'CS_GRP_INVALID',
+@@ -298,26 +284,13 @@ CS_OPT_NO_BRANCH_OFFSET = 9  # ARM, prints branch immediates without offset.
+ 
+ # Capstone option value
+ CS_OPT_OFF = 0             # Turn OFF an option - default option of CS_OPT_DETAIL
+-CS_OPT_ON = 1 << 0              # Turn ON an option (CS_OPT_DETAIL)
++CS_OPT_ON = 3              # Turn ON an option (CS_OPT_DETAIL)
+ 
+ # Common instruction operand types - to be consistent across all architectures.
+ CS_OP_INVALID = 0  # uninitialized/invalid operand.
+ CS_OP_REG = 1  # Register operand.
+ CS_OP_IMM = 2  # Immediate operand.
+ CS_OP_FP  = 3  # Floating-Point operand.
+-CS_OP_PRED = 4  # Predicate operand.
+-CS_OP_RESERVED_5 = 5
+-CS_OP_RESERVED_6 = 6
+-CS_OP_RESERVED_7 = 7
+-CS_OP_RESERVED_8 = 8
+-CS_OP_RESERVED_9 = 9
+-CS_OP_RESERVED_10 = 10
+-CS_OP_RESERVED_11 = 11
+-CS_OP_RESERVED_12 = 12
+-CS_OP_RESERVED_13 = 13
+-CS_OP_RESERVED_14 = 14
+-CS_OP_RESERVED_15 = 15
+-CS_OP_SPECIAL = 0x10  # Special operands from archs
+ CS_OP_MEM = 0x80  # Memory operand. Can be ORed with another operand type.
+ 
+ # Common instruction groups - to be consistent across all architectures.
+@@ -336,13 +309,12 @@ CS_AC_READ     = (1 << 0) # Operand that is read from.
+ CS_AC_WRITE    = (1 << 1) # Operand that is written to.
+ 
+ # Capstone syntax value
+-CS_OPT_SYNTAX_DEFAULT = 1 << 1  # Default assembly syntax of all platforms (CS_OPT_SYNTAX)
+-CS_OPT_SYNTAX_INTEL = 1 << 2  # Intel X86 asm syntax - default syntax on X86 (CS_OPT_SYNTAX, CS_ARCH_X86)
+-CS_OPT_SYNTAX_ATT = 1 << 3  # ATT asm syntax (CS_OPT_SYNTAX, CS_ARCH_X86)
+-CS_OPT_SYNTAX_NOREGNAME = 1 << 4  # Asm syntax prints register name with only number - (CS_OPT_SYNTAX, CS_ARCH_PPC, CS_ARCH_ARM)
+-CS_OPT_SYNTAX_MASM = 1 << 5  # MASM syntax (CS_OPT_SYNTAX, CS_ARCH_X86)
+-CS_OPT_SYNTAX_MOTOROLA = 1 << 6  # MOS65XX use $ as hex prefix
+-CS_OPT_SYNTAX_CS_REG_ALIAS = 1 << 7  # Prints common register alias which are not defined in LLVM (ARM: r9 = sb etc.)
++CS_OPT_SYNTAX_DEFAULT = 0    # Default assembly syntax of all platforms (CS_OPT_SYNTAX)
++CS_OPT_SYNTAX_INTEL = 1    # Intel X86 asm syntax - default syntax on X86 (CS_OPT_SYNTAX, CS_ARCH_X86)
++CS_OPT_SYNTAX_ATT = 2      # ATT asm syntax (CS_OPT_SYNTAX, CS_ARCH_X86)
++CS_OPT_SYNTAX_NOREGNAME = 3   # Asm syntax prints register name with only number - (CS_OPT_SYNTAX, CS_ARCH_PPC, CS_ARCH_ARM)
++CS_OPT_SYNTAX_MASM = 4      # MASM syntax (CS_OPT_SYNTAX, CS_ARCH_X86)
++CS_OPT_SYNTAX_MOTOROLA = 5 # MOS65XX use $ as hex prefix
+ 
+ # Capstone error type
+ CS_ERR_OK = 0      # No error: everything was fine




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] gnu: Add python-angr.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (14 preceding siblings ...)
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-angr Troy Figiel
@ 2024-02-12 14:58 ` soeren
  2024-02-12 22:53 ` [bug#69074] [PATCH] " Troy Figiel
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-02-12 14:58 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-angr): New variable.
---
 gnu/local.mk                                  |  2 +
 .../python-angr-addition-type-error.patch     | 18 ++++
 .../patches/python-angr-check-exec-deps.patch | 93 ++++++++++++++++++
 gnu/packages/python-xyz.scm                   | 96 +++++++++++++++++++
 4 files changed, 209 insertions(+)
 create mode 100644 gnu/packages/patches/python-angr-addition-type-error.patch
 create mode 100644 gnu/packages/patches/python-angr-check-exec-deps.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index ce0f1994c5..8bbf66cc1e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1899,6 +1899,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-3-search-paths.patch		\
   %D%/packages/patches/python-3-fix-tests.patch			\
   %D%/packages/patches/python-3-hurd-configure.patch		\
+  %D%/packages/patches/python-angr-addition-type-error.patch	\
+  %D%/packages/patches/python-angr-check-exec-deps.patch	\
   %D%/packages/patches/python-aionotify-0.2.0-py3.8.patch	\
   %D%/packages/patches/python-argcomplete-1.11.1-fish31.patch	\
   %D%/packages/patches/python-capstone-fix-python-constants.patch	\
diff --git a/gnu/packages/patches/python-angr-addition-type-error.patch b/gnu/packages/patches/python-angr-addition-type-error.patch
new file mode 100644
index 0000000000..7301d8b505
--- /dev/null
+++ b/gnu/packages/patches/python-angr-addition-type-error.patch
@@ -0,0 +1,18 @@
+This fixes failures of the test_ln_gcc_O2 and other related tests
+in the angr test suite.  The patch has been proposed upstream.
+
+Taken form: https://github.com/angr/angr/pull/4443
+
+diff --git a/angr/analyses/reassembler.py b/angr/analyses/reassembler.py
+index 7a2399a60..b09b3a8cb 100644
+--- a/angr/analyses/reassembler.py
++++ b/angr/analyses/reassembler.py
+@@ -730,7 +730,7 @@ class Instruction:
+             elif operand.type == capstone.CS_OP_MEM:
+                 operand_offsets.append(capstone_instr.disp_offset)
+             else:
+-                operand_offsets.append(None)
++                operand_offsets.append(0)
+ 
+         if self.addr is not None:
+             self._initialize(capstone_instr.operands, operand_offsets)
diff --git a/gnu/packages/patches/python-angr-check-exec-deps.patch b/gnu/packages/patches/python-angr-check-exec-deps.patch
new file mode 100644
index 0000000000..438f8ef183
--- /dev/null
+++ b/gnu/packages/patches/python-angr-check-exec-deps.patch
@@ -0,0 +1,93 @@
+The angr test suite performs analysis on several pre-compiled binaries
+to ensure its binary analysis capabilities are working as intended.
+Some of these binaries are also executed as part of the test suite to
+test if the simulation engine provided by angr results in the same
+output as native execution of the binary.
+
+For Guix, this files as the glibc shared objects cannot be found.
+Additionally, we don't really want to execute pre-compiled binaries
+on Guix, hence we disable those tests.
+
+diff --git a/tests/test_ctype_locale.py b/tests/test_ctype_locale.py
+index 08cb89836..2b9233558 100644
+--- a/tests/test_ctype_locale.py
++++ b/tests/test_ctype_locale.py
+@@ -14,7 +14,7 @@ test_location = os.path.dirname(os.path.abspath(__file__))
+ 
+ 
+ class TestCtypeLocale(unittest.TestCase):
+-    @skip_if_not_linux
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_ctype_b_loc(self):
+         """
+         test_ctype_locale.test_ctype_b_loc
+@@ -60,7 +60,7 @@ class TestCtypeLocale(unittest.TestCase):
+         output = subprocess.check_output(bin_path, shell=True)
+         assert result == output
+ 
+-    @skip_if_not_linux
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_ctype_tolower_loc(self):
+         """
+         test_ctype_locale.test_ctype_tolower_loc
+@@ -109,7 +109,7 @@ class TestCtypeLocale(unittest.TestCase):
+         output = subprocess.check_output(bin_path, shell=True)
+         assert result == output
+ 
+-    @skip_if_not_linux
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_ctype_toupper_loc(self):
+         """
+         test_ctype_locale.test_ctype_toupper_loc
+diff --git a/tests/test_signed_div.py b/tests/test_signed_div.py
+index 59cb9b8d1..994ed9c65 100644
+--- a/tests/test_signed_div.py
++++ b/tests/test_signed_div.py
+@@ -1,6 +1,7 @@
+ import angr
+ import subprocess
+ import sys
++import pytest
+ 
+ import logging
+ 
+@@ -13,7 +14,7 @@ import os
+ test_location = os.path.dirname(os.path.realpath(__file__))
+ 
+ 
+-@skipUnless(sys.platform.startswith("linux"), "linux only")
++@pytest.mark.skip(reason="test executes pre-compiled binaries")
+ def test_signed_div():
+     test_bin = os.path.join(test_location, "..", "..", "binaries", "tests", "x86_64", "test_signed_div")
+     b = angr.Project(test_bin, auto_load_libs=False)
+diff --git a/tests/test_sscanf.py b/tests/test_sscanf.py
+index 29d2c8403..ea799b310 100644
+--- a/tests/test_sscanf.py
++++ b/tests/test_sscanf.py
+@@ -1,3 +1,4 @@
++import pytest
+ import angr
+ import subprocess
+ import sys
+@@ -14,7 +15,7 @@ test_location = os.path.dirname(os.path.realpath(__file__))
+ 
+ 
+ class TestSscanf(unittest.TestCase):
+-    @unittest.skipUnless(sys.platform.startswith("linux"), "linux only")
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_sscanf(self):
+         test_bin = os.path.join(test_location, "..", "..", "binaries", "tests", "x86_64", "sscanf_test")
+         b = angr.Project(test_bin, auto_load_libs=False)
+diff --git a/tests/test_strtol.py b/tests/test_strtol.py
+index 6c29cab22..f36181407 100644
+--- a/tests/test_strtol.py
++++ b/tests/test_strtol.py
+@@ -11,7 +11,7 @@ class TestStrtol(unittest.TestCase):
+     # pylint: disable=no-self-use
+ 
+     @slow_test
+-    @unittest.skipUnless(sys.platform.startswith("linux"), "linux-only")
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_strtol(self, threads=None):
+         test_bin = os.path.join(bin_location, "tests", "x86_64", "strtol_test")
+         # disabling auto_load_libs increases the execution time of the test case.
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 92c08020fb..902312584a 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -189,6 +189,7 @@ (define-module (gnu packages python-xyz)
   #:use-module (gnu packages djvu)
   #:use-module (gnu packages docker)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages emulators)
   #:use-module (gnu packages engineering)
   #:use-module (gnu packages enchant)
   #:use-module (gnu packages file)
@@ -32390,6 +32391,101 @@ (define-public python-pyvex
 to enable all kinds of binary analysis tasks.")
     (license license:bsd-2)))
 
+(define-public python-angr
+  (package
+    (name "python-angr")
+    (version "9.2.46")
+    (source
+     (origin
+       (method git-fetch)
+       (patches (search-patches "python-angr-addition-type-error.patch"
+                                "python-angr-check-exec-deps.patch"))
+       (uri (git-reference
+             (url "https://github.com/angr/angr")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "18y9wyf7va7gvp9zd6lhw82j9a2x2ajsvbawh96xnxzml0jwlwjm"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'patch-tests
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       (let ((coreutils (assoc-ref inputs "coreutils")))
+                         (substitute* "tests/test_vault.py"
+                           (("/bin/false")
+                            (string-append coreutils "/bin/false")))
+                         (substitute* "tests/common.py"
+                           (("\\[\"cc\"\\]")
+                            "[\"gcc\"]")))))
+                   (replace 'check
+                     (lambda* (#:key inputs tests? #:allow-other-keys)
+                       (when tests?
+                         (copy-recursively (assoc-ref inputs "binaries")
+                                           "../binaries")
+                         (with-directory-excursion "tests"
+                           ;; test_mips32_missing_offset_in_instructions fails
+                           ;; with capstone 5 and passes with capstone 4. Might
+                           ;; be a capstone regressions, needs investigation.
+                           (invoke "pytest" "-vv" "-x" "--dist" "loadfile"
+                                   "-k" "not test_mips32_missing_offset_in_instructions"
+                                   "-n" (number->string (parallel-job-count)))))))
+                   (add-before 'build 'set-cc
+                     (lambda _
+                       (setenv "CC" "gcc"))))))
+    (propagated-inputs (list python-ailment
+                             python-archinfo
+                             python-cachetools
+                             python-capstone
+                             python-cffi
+                             python-claripy
+                             python-cle
+                             python-colorama
+                             python-cppheaderparser
+                             python-dpkt
+                             python-gitpython
+                             python-mulpyplexer
+                             python-nampa
+                             python-networkx
+                             python-protobuf
+                             python-psutil
+                             python-itanium-demangle
+                             python-pycparser
+                             python-pyvex
+                             python-progressbar2
+                             python-rpyc
+                             python-sortedcontainers
+                             python-sqlalchemy
+                             python-sympy
+                             unicorn))
+    (native-inputs `(("python-pytest" ,python-pytest)
+                     ("python-pytest-xdist" ,python-pytest-xdist)
+                     ("binaries"
+                      ;; This repository ships several binaries used only for testing
+                      ;; purpose.  The binaries are not executed and not part of the
+                      ;; angr distribution, they are only used to test angr's binary
+                      ;; analysis capabilities.  In the context of the GNU FSDG, these
+                      ;; files should be considered non-functional data.
+                      ,(origin
+                         (method git-fetch)
+                         (uri (git-reference (url
+                                              "https://github.com/angr/binaries")
+                                             (commit (string-append "v"
+                                                                    version))))
+                         (file-name (git-file-name "angr-binaries" version))
+                         (sha256 (base32
+                                  "1f286b2239zavxzwg1184hj1zs380cr9qr549mvy3vywvm8bsmgr"))))))
+    (home-page "https://github.com/angr/angr")
+    (synopsis "Multi-architecture binary analysis toolkit")
+    (description
+     "This package provides a versatile binary analysis platform with the
+ability to perform dynamic symbolic execution as well as various
+static analyses directly on binaries.  As such, it can be used for all
+kinds of reverse engineering, vulnerability discovery, exploit
+generation, and software testing purposes.")
+    (license license:bsd-2)))
+
 (define-public python-archinfo
   (package
     (name "python-archinfo")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] gnu: Add python-angr.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (13 preceding siblings ...)
  2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: capstone: Backport upstream fix for Python bindings soeren
@ 2024-02-12 14:58 ` Troy Figiel
  2024-02-12 14:58 ` soeren
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 78+ messages in thread
From: Troy Figiel @ 2024-02-12 14:58 UTC (permalink / raw)
  To: 69074

And here the patch for python-angr. I changed a couple of things:
- Used pytest test-flags
- Used (which "false")
- Used #$(this-package-native-inputs "binaries")
- Removed the "-x" flag in pytest. If it fails in the CI, it can be nice to see all tests that failed

* gnu/packages/python-xyz.scm (python-angr): New variable.
---
 gnu/local.mk                                  |  2 +
 .../python-angr-addition-type-error.patch     | 18 ++++
 .../patches/python-angr-check-exec-deps.patch | 93 ++++++++++++++++++
 gnu/packages/python-xyz.scm                   | 97 +++++++++++++++++++
 4 files changed, 210 insertions(+)
 create mode 100644 gnu/packages/patches/python-angr-addition-type-error.patch
 create mode 100644 gnu/packages/patches/python-angr-check-exec-deps.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 59e930ffb9..716bde347b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1899,6 +1899,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-3-search-paths.patch		\
   %D%/packages/patches/python-3-fix-tests.patch			\
   %D%/packages/patches/python-3-hurd-configure.patch		\
+  %D%/packages/patches/python-angr-addition-type-error.patch	\
+  %D%/packages/patches/python-angr-check-exec-deps.patch	\
   %D%/packages/patches/python-aionotify-0.2.0-py3.8.patch	\
   %D%/packages/patches/python-argcomplete-1.11.1-fish31.patch	\
   %D%/packages/patches/python-capstone-fix-python-constants.patch	\
diff --git a/gnu/packages/patches/python-angr-addition-type-error.patch b/gnu/packages/patches/python-angr-addition-type-error.patch
new file mode 100644
index 0000000000..7301d8b505
--- /dev/null
+++ b/gnu/packages/patches/python-angr-addition-type-error.patch
@@ -0,0 +1,18 @@
+This fixes failures of the test_ln_gcc_O2 and other related tests
+in the angr test suite.  The patch has been proposed upstream.
+
+Taken form: https://github.com/angr/angr/pull/4443
+
+diff --git a/angr/analyses/reassembler.py b/angr/analyses/reassembler.py
+index 7a2399a60..b09b3a8cb 100644
+--- a/angr/analyses/reassembler.py
++++ b/angr/analyses/reassembler.py
+@@ -730,7 +730,7 @@ class Instruction:
+             elif operand.type == capstone.CS_OP_MEM:
+                 operand_offsets.append(capstone_instr.disp_offset)
+             else:
+-                operand_offsets.append(None)
++                operand_offsets.append(0)
+ 
+         if self.addr is not None:
+             self._initialize(capstone_instr.operands, operand_offsets)
diff --git a/gnu/packages/patches/python-angr-check-exec-deps.patch b/gnu/packages/patches/python-angr-check-exec-deps.patch
new file mode 100644
index 0000000000..438f8ef183
--- /dev/null
+++ b/gnu/packages/patches/python-angr-check-exec-deps.patch
@@ -0,0 +1,93 @@
+The angr test suite performs analysis on several pre-compiled binaries
+to ensure its binary analysis capabilities are working as intended.
+Some of these binaries are also executed as part of the test suite to
+test if the simulation engine provided by angr results in the same
+output as native execution of the binary.
+
+For Guix, this files as the glibc shared objects cannot be found.
+Additionally, we don't really want to execute pre-compiled binaries
+on Guix, hence we disable those tests.
+
+diff --git a/tests/test_ctype_locale.py b/tests/test_ctype_locale.py
+index 08cb89836..2b9233558 100644
+--- a/tests/test_ctype_locale.py
++++ b/tests/test_ctype_locale.py
+@@ -14,7 +14,7 @@ test_location = os.path.dirname(os.path.abspath(__file__))
+ 
+ 
+ class TestCtypeLocale(unittest.TestCase):
+-    @skip_if_not_linux
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_ctype_b_loc(self):
+         """
+         test_ctype_locale.test_ctype_b_loc
+@@ -60,7 +60,7 @@ class TestCtypeLocale(unittest.TestCase):
+         output = subprocess.check_output(bin_path, shell=True)
+         assert result == output
+ 
+-    @skip_if_not_linux
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_ctype_tolower_loc(self):
+         """
+         test_ctype_locale.test_ctype_tolower_loc
+@@ -109,7 +109,7 @@ class TestCtypeLocale(unittest.TestCase):
+         output = subprocess.check_output(bin_path, shell=True)
+         assert result == output
+ 
+-    @skip_if_not_linux
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_ctype_toupper_loc(self):
+         """
+         test_ctype_locale.test_ctype_toupper_loc
+diff --git a/tests/test_signed_div.py b/tests/test_signed_div.py
+index 59cb9b8d1..994ed9c65 100644
+--- a/tests/test_signed_div.py
++++ b/tests/test_signed_div.py
+@@ -1,6 +1,7 @@
+ import angr
+ import subprocess
+ import sys
++import pytest
+ 
+ import logging
+ 
+@@ -13,7 +14,7 @@ import os
+ test_location = os.path.dirname(os.path.realpath(__file__))
+ 
+ 
+-@skipUnless(sys.platform.startswith("linux"), "linux only")
++@pytest.mark.skip(reason="test executes pre-compiled binaries")
+ def test_signed_div():
+     test_bin = os.path.join(test_location, "..", "..", "binaries", "tests", "x86_64", "test_signed_div")
+     b = angr.Project(test_bin, auto_load_libs=False)
+diff --git a/tests/test_sscanf.py b/tests/test_sscanf.py
+index 29d2c8403..ea799b310 100644
+--- a/tests/test_sscanf.py
++++ b/tests/test_sscanf.py
+@@ -1,3 +1,4 @@
++import pytest
+ import angr
+ import subprocess
+ import sys
+@@ -14,7 +15,7 @@ test_location = os.path.dirname(os.path.realpath(__file__))
+ 
+ 
+ class TestSscanf(unittest.TestCase):
+-    @unittest.skipUnless(sys.platform.startswith("linux"), "linux only")
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_sscanf(self):
+         test_bin = os.path.join(test_location, "..", "..", "binaries", "tests", "x86_64", "sscanf_test")
+         b = angr.Project(test_bin, auto_load_libs=False)
+diff --git a/tests/test_strtol.py b/tests/test_strtol.py
+index 6c29cab22..f36181407 100644
+--- a/tests/test_strtol.py
++++ b/tests/test_strtol.py
+@@ -11,7 +11,7 @@ class TestStrtol(unittest.TestCase):
+     # pylint: disable=no-self-use
+ 
+     @slow_test
+-    @unittest.skipUnless(sys.platform.startswith("linux"), "linux-only")
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_strtol(self, threads=None):
+         test_bin = os.path.join(bin_location, "tests", "x86_64", "strtol_test")
+         # disabling auto_load_libs increases the execution time of the test case.
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index e42cbde76e..b3a0f70bd2 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -189,6 +189,7 @@ (define-module (gnu packages python-xyz)
   #:use-module (gnu packages djvu)
   #:use-module (gnu packages docker)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages emulators)
   #:use-module (gnu packages engineering)
   #:use-module (gnu packages enchant)
   #:use-module (gnu packages file)
@@ -32390,6 +32391,102 @@ (define-public python-pyvex
 to enable all kinds of binary analysis tasks.")
     (license license:bsd-2)))
 
+(define-public python-angr
+  (package
+    (name "python-angr")
+    (version "9.2.46")
+    (source
+     (origin
+       (method git-fetch)
+       (patches (search-patches "python-angr-addition-type-error.patch"
+                                "python-angr-check-exec-deps.patch"))
+       (uri (git-reference
+             (url "https://github.com/angr/angr")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "18y9wyf7va7gvp9zd6lhw82j9a2x2ajsvbawh96xnxzml0jwlwjm"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:test-flags '(list "tests"
+                          "--dist"
+                          "loadfile"
+                          "-k"
+                          ;; test_mips32_missing_offset_in_instructions fails
+                          ;; with capstone 5 and passes with capstone 4. Might
+                          ;; be a capstone regressions, needs investigation.
+                          "not test_mips32_missing_offset_in_instructions"
+                          "-n"
+                          (number->string (parallel-job-count)))
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'patch-tests
+                     (lambda _
+                       (substitute* "tests/test_vault.py"
+                         (("/bin/false")
+                          (which "false")))
+                       (substitute* "tests/common.py"
+                         (("\\[\"cc\"\\]")
+                          "[\"gcc\"]"))))
+                   (add-before 'build 'set-cc
+                     (lambda _
+                       (setenv "CC" "gcc")))
+                   (add-before 'check 'copy-binaries
+                     (lambda _
+                       (copy-recursively #$(this-package-native-input
+                                            "binaries") "../binaries"))))))
+    (propagated-inputs (list python-ailment
+                             python-archinfo
+                             python-cachetools
+                             python-capstone
+                             python-cffi
+                             python-claripy
+                             python-cle
+                             python-colorama
+                             python-cppheaderparser
+                             python-dpkt
+                             python-gitpython
+                             python-mulpyplexer
+                             python-nampa
+                             python-networkx
+                             python-protobuf
+                             python-psutil
+                             python-itanium-demangle
+                             python-pycparser
+                             python-pyvex
+                             python-progressbar2
+                             python-rpyc
+                             python-sortedcontainers
+                             python-sqlalchemy
+                             python-sympy
+                             unicorn))
+    (native-inputs `(("python-pytest" ,python-pytest)
+                     ("python-pytest-xdist" ,python-pytest-xdist)
+                     ("binaries"
+                      ;; This repository ships several binaries used only for testing
+                      ;; purpose.  The binaries are not executed and not part of the
+                      ;; angr distribution, they are only used to test angr's binary
+                      ;; analysis capabilities.  In the context of the GNU FSDG, these
+                      ;; files should be considered non-functional data.
+                      ,(origin
+                         (method git-fetch)
+                         (uri (git-reference (url
+                                              "https://github.com/angr/binaries")
+                                             (commit (string-append "v"
+                                                                    version))))
+                         (file-name (git-file-name "angr-binaries" version))
+                         (sha256 (base32
+                                  "1f286b2239zavxzwg1184hj1zs380cr9qr549mvy3vywvm8bsmgr"))))))
+    (home-page "https://github.com/angr/angr")
+    (synopsis "Multi-architecture binary analysis toolkit")
+    (description
+     "This package provides a versatile binary analysis platform with the
+ability to perform dynamic symbolic execution as well as various
+static analyses directly on binaries.  As such, it can be used for all
+kinds of reverse engineering, vulnerability discovery, exploit
+generation, and software testing purposes.")
+    (license license:bsd-2)))
+
 (define-public python-archinfo
   (package
     (name "python-archinfo")
-- 
2.42.0





^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (15 preceding siblings ...)
  2024-02-12 14:58 ` soeren
@ 2024-02-12 22:53 ` Troy Figiel
  2024-02-13  9:53   ` [bug#69074] " Sören Tempel
  2024-03-01 12:02 ` Sören Tempel
                   ` (5 subsequent siblings)
  22 siblings, 1 reply; 78+ messages in thread
From: Troy Figiel @ 2024-02-12 22:53 UTC (permalink / raw)
  To: 69074

Hi Sören,

Just a small note, I had to switch the order of python-pysmt and
python-claripy to be able to apply this patch series. Somehow these are sent out of order.

This is not exhaustive, but a couple of things I noticed:

- python-mulpyplexer actually does have tests. The file mulpyplexer.py
  itself is the test.
- python-rpyc seems to have an extensive test suite. Do all of them need
  a network connection? It would be nicer to surgically remove the tests
  that cannot be run.
- python-ailment skips both tests it runs. This might need to be looked
  into or commented why this happens.
- python-angr does not build for me, because a test is failing. I think
  you might have some nondeterministic behaviour in your build:
  --8<---------------cut here---------------start------------->8---
  FAILED test_memory.py::test_concrete_memset - assert 5.379231691360474 <= 5
  --8<---------------cut here---------------end--------------->8---
- Would it make more sense to place python-archinfo and
  python-keystone-engine under engineering.scm? The current placement
  creates a direct import cycle engineering->python-xyz->engineering
- The changes to local.mk and the patches are not mentioned in the
  commit messages.

Best wishes,

Troy




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] Re: [bug#69074] [PATCH] Add python-angr.
  2024-02-12 22:53 ` [bug#69074] [PATCH] " Troy Figiel
@ 2024-02-13  9:53   ` Sören Tempel
  2024-02-13 11:52     ` Troy Figiel
  0 siblings, 1 reply; 78+ messages in thread
From: Sören Tempel @ 2024-02-13  9:53 UTC (permalink / raw)
  To: 69074; +Cc: troy

Hi Troy,

First of all, thanks for the quick feedback. Much appreciated!

> Just a small note, I had to switch the order of python-pysmt and
> python-claripy to be able to apply this patch series. Somehow these are
> sent out of order.

Sorry about that! I guess because I send 15 emails at once, the MTA
queued some of them and then just didn't send them in the original order
(which it isn't required to). I don't think there is much I can do about
it on my end. I suppose `git-format-patch --numbered` would help?

> - python-mulpyplexer actually does have tests. The file mulpyplexer.py
>   itself is the test.

Good catch! I will just enable those [0].

> - python-rpyc seems to have an extensive test suite. Do all of them need
>   a network connection? It would be nicer to surgically remove the tests
>   that cannot be run.

Sure, we can enable parts of the test suite [1].

> - python-ailment skips both tests it runs. This might need to be looked
>   into or commented why this happens.

The first test is skipped because it needs python-pyvex, the second is
skipped because it needs python-angr. The first also indirectly depends
on angr because the VEX converter within ailment needs it. Therefore,
we cannot enable these tests as they would would result in a cyclic
dependency (python-angr <-> python-ailment). I can add a comment.

> - python-angr does not build for me, because a test is failing. I think
>   you might have some nondeterministic behaviour in your build:

The test performs benchmark using time.time() and expects a minimum
timespan to be satisfied [2]. Therefore, it depends on the current load
and the host CPU. Never failed for me, but probably good to disable it?

> - Would it make more sense to place python-archinfo and
>   python-keystone-engine under engineering.scm? The current placement
>   creates a direct import cycle engineering->python-xyz->engineering

Sure, I can move them accordingly.

> - The changes to local.mk and the patches are not mentioned in the
>   commit messages.

Good find, I will fix this in the next revision of this patchset.

P.S: Should I resend the whole patch series with the updates or should
I only resend the patches that changed due to the outlined updates? Also
let me know if I should send a revision immediately or if you want me to
wait for further feedback.

Greetings
Sören

[0]: https://github.com/nmeum/guix-symex/commit/c16f563502595bd9c17f7eb05a5c30bc7712006b
[1]: https://github.com/nmeum/guix-symex/commit/9e36fbccb633392c34216b2deab73667f7769cc1
[2]: https://github.com/angr/angr/blob/76da4fcb17efbf2373b2e7dd600b0ee578df3dd7/tests/storage/test_memory.py#L566




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-02-13  9:53   ` [bug#69074] " Sören Tempel
@ 2024-02-13 11:52     ` Troy Figiel
  2024-02-15 21:39       ` Troy Figiel
  0 siblings, 1 reply; 78+ messages in thread
From: Troy Figiel @ 2024-02-13 11:52 UTC (permalink / raw)
  To: 69074

Hi Sören,

First off, thank you for the patches! I will have a second look myself
today or tomorrow, as I was not familiar with angr and I would love to
try it out / play around with it myself.

On 2024-02-13 10:53, Sören Tempel wrote:
> Sorry about that! I guess because I send 15 emails at once, the MTA
> queued some of them and then just didn't send them in the original order
> (which it isn't required to). I don't think there is much I can do about
> it on my end. I suppose `git-format-patch --numbered` would help?
> 

No worries, I'm just mentioning it for other reviewers/committers, as I
don't have commit rights myself.

> The first test is skipped because it needs python-pyvex, the second is
> skipped because it needs python-angr. The first also indirectly depends
> on angr because the VEX converter within ailment needs it. Therefore,
> we cannot enable these tests as they would would result in a cyclic
> dependency (python-angr <-> python-ailment). I can add a comment.
> 

Yes, I would cover this with a comment regarding the cyclical
dependency. In general, I prefer failing tests to be "surgically
removed" or clearly commented, since it acts as an entry point for
future developers.

> The test performs benchmark using time.time() and expects a minimum
> timespan to be satisfied [2]. Therefore, it depends on the current load
> and the host CPU. Never failed for me, but probably good to disable it?
> 

I've had the same problem with some Go packages. The default test
timeout is set to 10 minutes and due to this, I cannot build these
packages locally. My laptop used to be considered fast :-) It seems QA
passes fine though.

I would be in favour of removing benchmark tests, but a second opinion
would be good.

> P.S: Should I resend the whole patch series with the updates or should
> I only resend the patches that changed due to the outlined updates? Also
> let me know if I should send a revision immediately or if you want me to
> wait for further feedback.
> 

I think it would be good to wait for feedback from others and
incorporate everything into a second patch set.

Best wishes,

Troy




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-02-13 11:52     ` Troy Figiel
@ 2024-02-15 21:39       ` Troy Figiel
  2024-02-15 22:09         ` Troy Figiel
  0 siblings, 1 reply; 78+ messages in thread
From: Troy Figiel @ 2024-02-15 21:39 UTC (permalink / raw)
  To: 69074; +Cc: lars, marius, me, sharlatanus, jgart

Hi Sören,

A couple points regarding back ports and versions:

I see that you back ported some upstream patches. I tend to use patches
more as a last resort and whenever possible I stick to upstream
versions and commits (in that order of preference). I find this makes
the life of future developers easier, as back ports might not apply
cleanly to newer versions.

I will attach a new patch for python-pysmt as an example. It seems
everything still built successfully (please check whether this works as
expected). I fixed up the description a bit and set the env variables in
a separate phase as well.

I believe upgrading to a later commit might work for capstone,
python-angr and python-pyvex, which also have back ported patches. For
python-angr and python-pyvex, I noticed you set them to version 9.2.46,
but this is not the latest version. Is there a reason we cannot upgrade
past this version? Could you add a comment mentioning what prevents such
an upgrade if so?

The versions of all other angr packages you added are also set to
9.2.46. It looks like this is on purpose, or not? If they all need the
exact same versions to work, could you add a comment (for each package)
that says something like "python-ailment, python-angr, python-archinfo,
python-claripy, python-cle and python-pyvex need to be set to the same
version"?

Some minor points:

- AFAIK assoc-ref is the old way of referring to inputs. With G-exps you would, for example, replace (assoc-ref inputs "binaries") in python-angr by something like #$(this-package-native-input "binaries").
- You can clean up the check phase for python-angr using test flags. I will add a patch as an example as well.
- Regarding binaries, I am honestly not sure how these would be best handled. They are binaries, but without them there might not be much to test anyway... A second opinion would be good here.

Hope this helps! The rest LGTM. I will ping the Python team, so someone with commit rights can have a look.

Best wishes,

Troy




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-02-15 21:39       ` Troy Figiel
@ 2024-02-15 22:09         ` Troy Figiel
  0 siblings, 0 replies; 78+ messages in thread
From: Troy Figiel @ 2024-02-15 22:09 UTC (permalink / raw)
  To: 69074

Two more minor points:

- python-mulpyplexer actually has a BSD-2 license, not BSD-3
- In the description of python-namba, you can use @acronym for FLIRT as
I did in python-pysmt




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (16 preceding siblings ...)
  2024-02-12 22:53 ` [bug#69074] [PATCH] " Troy Figiel
@ 2024-03-01 12:02 ` Sören Tempel
  2024-03-10 20:09 ` [bug#69074] [PATCH v2 01/14] gnu: Add python-itanium-demangle soeren
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 78+ messages in thread
From: Sören Tempel @ 2024-03-01 12:02 UTC (permalink / raw)
  To: 69074; +Cc: troy

Hi Troy,

Sorry, for the late reply. I didn't receive your comments via email.
I think you might have to CC me. If I need to do something special
in order to have debbugs forward these mails to me let me know.

Nonetheless, thanks for your additional feedback! I will look into it in
more detail and hopefully address it with a new revision of my patchset.
I don't have time to do so this weekend, but I am hopeful that I get
around to it next weekend.

Greetings
Sören




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v2 01/14] gnu: Add python-itanium-demangle.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (17 preceding siblings ...)
  2024-03-01 12:02 ` Sören Tempel
@ 2024-03-10 20:09 ` soeren
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 02/14] gnu: Add python-keystone-engine soeren
                     ` (12 more replies)
  2024-03-10 20:12 ` [bug#69074] [PATCH] " Sören Tempel
                   ` (3 subsequent siblings)
  22 siblings, 13 replies; 78+ messages in thread
From: soeren @ 2024-03-10 20:09 UTC (permalink / raw)
  To: 69074
  Cc: troy, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-itanium-demangle): New variable.
---
 gnu/packages/python-xyz.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index c68b17b0ab..e630bdb6a6 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -146,6 +146,7 @@
 ;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2023 Attila Lendvai <attila@lendvai.name>
 ;;; Copyright © 2023, 2024 Troy Figiel <troy@troyfigiel.com>
+;;; Copyright © 2024 Sören Tempel <soeren@soeren-tempel.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -32302,6 +32303,36 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-itanium-demangle
+  (package
+    (name "python-itanium-demangle")
+    (version "1.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/whitequark/python-itanium_demangler")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1q47aqm5z3db6pasdzw05d6236vnb8hnapfy88fcmn9dr5ym98r3"))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (home-page "https://github.com/whitequark/python-itanium_demangler")
+    (synopsis "Pure Python Itanium C++ ABI demangler")
+    (description
+     "This Python module provides an implementation of the Itanium C++
+ABI symbol mangling language.  The demangler generates an abstract
+syntax tree from mangled symbols, which can be used for directly
+extracting type information.")
+    (license license:bsd-0)))
+
 (define-public python-peachpy
   ;; There is no tag in this repo.
   (let ((commit "913d74c35a6b1d330e90bfc055208ce5b06b35a0")

base-commit: 179bb57d2532ee6b81791e078b0f782cbf88cb84




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v2 02/14] gnu: Add python-keystone-engine.
  2024-03-10 20:09 ` [bug#69074] [PATCH v2 01/14] gnu: Add python-itanium-demangle soeren
@ 2024-03-10 20:09   ` soeren
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 03/14] gnu: Add python-mulpyplexer soeren
                     ` (11 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-03-10 20:09 UTC (permalink / raw)
  To: 69074; +Cc: troy

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/emulators.scm (python-keystone-engine): New variable.
---
 gnu/packages/emulators.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index cde3ee052c..43af9804e5 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -2597,6 +2597,28 @@ (define-public uxn
 stack-machine, written in ANSI C.  Graphical output is implemented using SDL2.")
       (license license:expat))))
 
+(define-public python-keystone-engine
+  (package
+    (name "python-keystone-engine")
+    (version "0.9.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "keystone-engine" version))
+       (sha256
+        (base32 "1xahdr6bh3dw5swrc2r8kqa8ljhqlb7k2kxv5mrw5rhcmcnzcyig"))))
+    (native-inputs (list cmake))
+    (build-system pyproject-build-system)
+    (home-page "https://www.keystone-engine.org")
+    (synopsis
+     "Lightweight multi-platform, multi-architecture assembler framework")
+    (description
+     "Keystone is a lightweight multi-platform, multi-architecture
+assembler framework.  It supports a wide-range of different architectures
+and offers an intuitive architecture-neutral API for interacting with
+assembly for these architectures.")
+    (license license:gpl2)))
+
 (define-public emu8051
   (let ((commit "5dc681275151c4a5d7b85ec9ff4ceb1b25abd5a8")
         (revision "1"))




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v2 03/14] gnu: Add python-mulpyplexer.
  2024-03-10 20:09 ` [bug#69074] [PATCH v2 01/14] gnu: Add python-itanium-demangle soeren
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 02/14] gnu: Add python-keystone-engine soeren
@ 2024-03-10 20:09   ` soeren
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 04/14] gnu: Add python-nampa soeren
                     ` (10 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-03-10 20:09 UTC (permalink / raw)
  To: 69074
  Cc: troy, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-mulpyplexer): New variable.
---
 gnu/packages/python-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index e630bdb6a6..ddb0224b53 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32303,6 +32303,29 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-mulpyplexer
+  (package
+    (name "python-mulpyplexer")
+    (version "0.09")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "mulpyplexer" version))
+       (sha256
+        (base32 "0c5xzci1djy1yi9hxxh8g67l6ms8r7ad7ja20pv8hfbdysdrwkhl"))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (invoke "python" "mulpyplexer.py")))))))
+    (home-page "https://github.com/zardus/mulpyplexer/")
+    (synopsis "Multiplexes interactions with lists of Python objects")
+    (description "This module provides utilities for multiplexing
+interactions with lists of Python objects.")
+    (license license:bsd-2)))
+
 (define-public python-itanium-demangle
   (package
     (name "python-itanium-demangle")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v2 04/14] gnu: Add python-nampa.
  2024-03-10 20:09 ` [bug#69074] [PATCH v2 01/14] gnu: Add python-itanium-demangle soeren
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 02/14] gnu: Add python-keystone-engine soeren
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 03/14] gnu: Add python-mulpyplexer soeren
@ 2024-03-10 20:09   ` soeren
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 05/14] gnu: Add python-rpyc soeren
                     ` (9 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-03-10 20:09 UTC (permalink / raw)
  To: 69074
  Cc: troy, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-nampa): New variable.
---
 gnu/packages/python-xyz.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index ddb0224b53..f713e27c64 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32303,6 +32303,26 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-nampa
+  (package
+    (name "python-nampa")
+    (version "0.1.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "nampa" version))
+       (sha256
+        (base32 "0k6cq2gflpkm40qhgqbbcjmq5lq589c15bmk567qyh3d08062hvd"))))
+    (build-system pyproject-build-system)
+    (propagated-inputs (list python-future))
+    (home-page "https://github.com/thebabush/nampa")
+    (synopsis "Python implementation of IDA Pro's FLIRT technology")
+    (description
+     "This Python module implements the @acronym{FLIRT, Fast Library Identification
+and Recognition Technology}.  This technology is useful for identifying
+common library subroutines in disassembled binaries.")
+    (license license:lgpl3)))
+
 (define-public python-mulpyplexer
   (package
     (name "python-mulpyplexer")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v2 05/14] gnu: Add python-rpyc.
  2024-03-10 20:09 ` [bug#69074] [PATCH v2 01/14] gnu: Add python-itanium-demangle soeren
                     ` (2 preceding siblings ...)
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 04/14] gnu: Add python-nampa soeren
@ 2024-03-10 20:09   ` soeren
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 06/14] gnu: Add python-pysmt soeren
                     ` (8 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-03-10 20:09 UTC (permalink / raw)
  To: 69074
  Cc: troy, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-rpyc): New variable.
---
 gnu/packages/python-xyz.scm | 39 +++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index f713e27c64..f9bd733ecd 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32303,6 +32303,45 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-rpyc
+  (package
+    (name "python-rpyc")
+    (version "5.3.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/tomerfiliba-org/rpyc")
+             (commit version)))
+       (sha256
+        (base32 "15mnp9qkyw3mmxmr5y4kf3xkvxyp00n892vqaqwznr7al35apgnr"))
+       (snippet '(begin
+                   ;; Disable deploy tests, these rely on OpenSSH and require
+                   ;; configuring the SSH client manually to accept the host key.
+                   (delete-file "tests/test_deploy.py")
+                   ;; Disable tests requiring network access.  These tests
+                   ;; presently fail with the error "Network is unreachable".
+                   (delete-file "tests/test_registry.py")))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (propagated-inputs (list python-hatchling python-plumbum))
+    (home-page "https://github.com/tomerfiliba-org/rpyc")
+    (synopsis
+     "Remote Python Call (RPyC) is a symmetric distributed computing library")
+    (description
+     "This Python module enables remote procedure calls, clustering, and
+distributed-computing.  For this purpose, it makes use of object-proxying, a technique
+that employs python's dynamic nature, to overcome the physical boundaries between
+processes and computers, so that remote objects can be manipulated as if they
+were local.")
+    (license license:expat)))
+
 (define-public python-nampa
   (package
     (name "python-nampa")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v2 06/14] gnu: Add python-pysmt.
  2024-03-10 20:09 ` [bug#69074] [PATCH v2 01/14] gnu: Add python-itanium-demangle soeren
                     ` (3 preceding siblings ...)
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 05/14] gnu: Add python-rpyc soeren
@ 2024-03-10 20:09   ` soeren
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 07/14] gnu: Add python-claripy soeren
                     ` (7 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-03-10 20:09 UTC (permalink / raw)
  To: 69074
  Cc: troy, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/patches/python-pysmt-fix-pow-return-type.patch:
New patch.
* gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch:
New patch.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/python-xyz.scm (python-pysmt): New variable.
---
 gnu/local.mk                                  |   2 +
 .../python-pysmt-fix-pow-return-type.patch    | 258 ++++++++++++++++++
 ...-pysmt-fix-smtlib-serialization-test.patch |  86 ++++++
 gnu/packages/python-xyz.scm                   |  32 +++
 4 files changed, 378 insertions(+)
 create mode 100644 gnu/packages/patches/python-pysmt-fix-pow-return-type.patch
 create mode 100644 gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index fbdb285695..1946fdcbb6 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1925,6 +1925,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-pyan3-fix-absolute-path-bug.patch \
   %D%/packages/patches/python-pyan3-fix-positional-arguments.patch \
   %D%/packages/patches/python-pygpgme-fix-pinentry-tests.patch	\
+  %D%/packages/patches/python-pysmt-fix-pow-return-type.patch	\
+  %D%/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch	\
   %D%/packages/patches/python-pytorch-runpath.patch		\
   %D%/packages/patches/python-pytorch-system-libraries.patch	\
   %D%/packages/patches/python-pytorch-1.9.0-system-libraries.patch \
diff --git a/gnu/packages/patches/python-pysmt-fix-pow-return-type.patch b/gnu/packages/patches/python-pysmt-fix-pow-return-type.patch
new file mode 100644
index 0000000000..0ec2d41b3c
--- /dev/null
+++ b/gnu/packages/patches/python-pysmt-fix-pow-return-type.patch
@@ -0,0 +1,258 @@
+Backport of an upstream patch which fixes a test failure with our
+packaged version of the Z3 SMT solver.
+
+Taken from: https://github.com/pysmt/pysmt/commit/f522e8cd8f3e75ff85f5eae29b427e18a6701859
+
+diff --git a/pysmt/formula.py b/pysmt/formula.py
+index ea4b46c..6cb9cbf 100644
+--- a/pysmt/formula.py
++++ b/pysmt/formula.py
+@@ -252,11 +252,7 @@ class FormulaManager(object):
+ 
+         if base.is_constant():
+             val = base.constant_value() ** exponent.constant_value()
+-            if base.is_constant(types.REAL):
+-                return self.Real(val)
+-            else:
+-                assert base.is_constant(types.INT)
+-                return self.Int(val)
++            return self.Real(val)
+         return self.create_node(node_type=op.POW, args=(base, exponent))
+ 
+     def Div(self, left, right):
+diff --git a/pysmt/logics.py b/pysmt/logics.py
+index ef88dd6..9dc45b1 100644
+--- a/pysmt/logics.py
++++ b/pysmt/logics.py
+@@ -495,6 +495,12 @@ QF_NRA = Logic(name="QF_NRA",
+                real_arithmetic=True,
+                linear=False)
+ 
++QF_NIRA = Logic(name="QF_NIRA",
++                description="""Quantifier-free integer and real arithmetic.""",
++                quantifier_free=True,
++                integer_arithmetic=True,
++                real_arithmetic=True,
++                linear=False)
+ 
+ QF_RDL = Logic(name="QF_RDL",
+                description=\
+@@ -619,41 +625,41 @@ QF_AUFBVLIRA = Logic(name="QF_AUFBVLIRA",
+ AUTO = Logic(name="Auto",
+              description="Special logic used to indicate that the logic to be used depends on the formula.")
+ 
+-SMTLIB2_LOGICS = frozenset([ AUFLIA,
+-                             AUFLIRA,
+-                             AUFNIRA,
+-                             ALIA,
+-                             LRA,
+-                             LIA,
+-                             NIA,
+-                             NRA,
+-                             UFLRA,
+-                             UFNIA,
+-                             UFLIRA,
+-                             QF_ABV,
+-                             QF_AUFBV,
+-                             QF_AUFLIA,
+-                             QF_ALIA,
+-                             QF_AX,
+-                             QF_BV,
+-                             QF_IDL,
+-                             QF_LIA,
+-                             QF_LRA,
+-                             QF_NIA,
+-                             QF_NRA,
+-                             QF_RDL,
+-                             QF_UF,
+-                             QF_UFBV ,
+-                             QF_UFIDL,
+-                             QF_UFLIA,
+-                             QF_UFLRA,
+-                             QF_UFNRA,
+-                             QF_UFNIA,
+-                             QF_UFLIRA,
+-                             QF_SLIA
+-                         ])
+-
+-LOGICS = SMTLIB2_LOGICS | frozenset([ QF_BOOL, BOOL, QF_AUFBVLIRA])
++SMTLIB2_LOGICS = frozenset([AUFLIA,
++                            AUFLIRA,
++                            AUFNIRA,
++                            ALIA,
++                            LRA,
++                            LIA,
++                            NIA,
++                            NRA,
++                            UFLRA,
++                            UFNIA,
++                            UFLIRA,
++                            QF_ABV,
++                            QF_AUFBV,
++                            QF_AUFLIA,
++                            QF_ALIA,
++                            QF_AX,
++                            QF_BV,
++                            QF_IDL,
++                            QF_LIA,
++                            QF_LRA,
++                            QF_NIA,
++                            QF_NRA,
++                            QF_RDL,
++                            QF_UF,
++                            QF_UFBV,
++                            QF_UFIDL,
++                            QF_UFLIA,
++                            QF_UFLRA,
++                            QF_UFNRA,
++                            QF_UFNIA,
++                            QF_UFLIRA,
++                            QF_SLIA
++                            ])
++
++LOGICS = SMTLIB2_LOGICS | frozenset([QF_BOOL, BOOL, QF_AUFBVLIRA, QF_NIRA])
+ 
+ QF_LOGICS = frozenset(_l for _l in LOGICS if _l.quantifier_free)
+ 
+@@ -668,8 +674,8 @@ PYSMT_LOGICS = frozenset([QF_BOOL, QF_IDL, QF_LIA, QF_LRA, QF_RDL, QF_UF, QF_UFI
+                           QF_BV, QF_UFBV,
+                           QF_ABV, QF_AUFBV, QF_AUFLIA, QF_ALIA, QF_AX,
+                           QF_AUFBVLIRA,
+-                          QF_NRA, QF_NIA, UFBV, BV,
+-                      ])
++                          QF_NRA, QF_NIA, QF_NIRA, UFBV, BV,
++                          ])
+ 
+ # PySMT Logics includes additional features:
+ #  - constant arrays: QF_AUFBV  becomes QF_AUFBV*
+@@ -697,7 +703,6 @@ for l in PYSMT_LOGICS:
+         ext_logics.add(nl)
+ 
+ 
+-
+ LOGICS = LOGICS | frozenset(ext_logics)
+ PYSMT_LOGICS = PYSMT_LOGICS | frozenset(ext_logics)
+ 
+diff --git a/pysmt/solvers/z3.py b/pysmt/solvers/z3.py
+index 3fb42b9..210b771 100644
+--- a/pysmt/solvers/z3.py
++++ b/pysmt/solvers/z3.py
+@@ -595,6 +595,8 @@ class Z3Converter(Converter, DagWalker):
+                                              None, None,
+                                              0, None,
+                                              expr.ast)
++        print("Z3: SMTLIB")
++        print(s)
+         stream_in = StringIO(s)
+         r = parser.get_script(stream_in).get_last_formula(self.mgr)
+         key = (askey(expr), None)
+diff --git a/pysmt/test/examples.py b/pysmt/test/examples.py
+index 73455ee..b653185 100644
+--- a/pysmt/test/examples.py
++++ b/pysmt/test/examples.py
+@@ -898,12 +898,12 @@ def get_full_example_formulae(environment=None):
+                     logic=pysmt.logics.QF_NRA
+                 ),
+ 
+-            Example(hr="((p ^ 2) = 0)",
+-                    expr=Equals(Pow(p, Int(2)), Int(0)),
++            Example(hr="((p ^ 2) = 0.0)",
++                    expr=Equals(Pow(p, Int(2)), Real(0)),
+                     is_valid=False,
+                     is_sat=True,
+-                    logic=pysmt.logics.QF_NIA
+-                ),
++                    logic=pysmt.logics.QF_NIRA
++                    ),
+ 
+             Example(hr="((r ^ 2.0) = 0.0)",
+                     expr=Equals(Pow(r, Real(2)), Real(0)),
+diff --git a/pysmt/test/test_back.py b/pysmt/test/test_back.py
+index bceb45b..7a0ad63 100644
+--- a/pysmt/test/test_back.py
++++ b/pysmt/test/test_back.py
+@@ -55,10 +55,10 @@ class TestBasic(TestCase):
+         res = msat.converter.back(term)
+         self.assertFalse(f == res)
+ 
+-    def do_back(self, solver_name, z3_string_buffer=False):
++    def do_back(self, solver_name, via_smtlib=False):
+         for formula, _, _, logic in get_example_formulae():
+             if logic.quantifier_free:
+-                if logic.theory.custom_type and z3_string_buffer:
++                if logic.theory.custom_type and via_smtlib:
+                     # Printing of declare-sort from Z3 is not conformant
+                     # with the SMT-LIB. We might consider extending our
+                     # parser.
+@@ -67,7 +67,7 @@ class TestBasic(TestCase):
+                     s = Solver(name=solver_name, logic=logic)
+                     term = s.converter.convert(formula)
+                     if solver_name == "z3":
+-                        if z3_string_buffer:
++                        if via_smtlib:
+                             res = s.converter.back_via_smtlib(term)
+                         else:
+                             res = s.converter.back(term)
+@@ -84,8 +84,8 @@ class TestBasic(TestCase):
+ 
+     @skipIfSolverNotAvailable("z3")
+     def test_z3_back_formulae(self):
+-        self.do_back("z3", z3_string_buffer=False)
+-        self.do_back("z3", z3_string_buffer=True)
++        self.do_back("z3", via_smtlib=True)
++        self.do_back("z3", via_smtlib=False)
+ 
+ 
+ if __name__ == '__main__':
+diff --git a/pysmt/type_checker.py b/pysmt/type_checker.py
+index b700fcf..7ce05aa 100644
+--- a/pysmt/type_checker.py
++++ b/pysmt/type_checker.py
+@@ -33,6 +33,8 @@ class SimpleTypeChecker(walkers.DagWalker):
+ 
+     def __init__(self, env=None):
+         walkers.DagWalker.__init__(self, env=env)
++        # Return None if the type cannot be computed rather than
++        # raising an exception.
+         self.be_nice = False
+ 
+     def _get_key(self, formula, **kwargs):
+@@ -42,7 +44,7 @@ class SimpleTypeChecker(walkers.DagWalker):
+         """ Returns the pysmt.types type of the formula """
+         res = self.walk(formula)
+         if not self.be_nice and res is None:
+-            raise PysmtTypeError("The formula '%s' is not well-formed" \
++            raise PysmtTypeError("The formula '%s' is not well-formed"
+                                  % str(formula))
+         return res
+ 
+@@ -114,7 +116,7 @@ class SimpleTypeChecker(walkers.DagWalker):
+ 
+     def walk_bv_comp(self, formula, args, **kwargs):
+         # We check that all children are BV and the same size
+-        a,b = args
++        a, b = args
+         if a != b or (not a.is_bv_type()):
+             return None
+         return BVType(1)
+@@ -187,7 +189,7 @@ class SimpleTypeChecker(walkers.DagWalker):
+         if args[0].is_bool_type():
+             raise PysmtTypeError("The formula '%s' is not well-formed."
+                                  "Equality operator is not supported for Boolean"
+-                                 " terms. Use Iff instead." \
++                                 " terms. Use Iff instead."
+                                  % str(formula))
+         elif args[0].is_bv_type():
+             return self.walk_bv_to_bool(formula, args)
+@@ -324,10 +326,7 @@ class SimpleTypeChecker(walkers.DagWalker):
+     def walk_pow(self, formula, args, **kwargs):
+         if args[0] != args[1]:
+             return None
+-        # Exponent must be positive for INT
+-        if args[0].is_int_type() and formula.arg(1).constant_value() < 0 :
+-            return None
+-        return args[0]
++        return REAL
+ 
+ # EOC SimpleTypeChecker
+ 
diff --git a/gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch b/gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch
new file mode 100644
index 0000000000..eee555f807
--- /dev/null
+++ b/gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch
@@ -0,0 +1,86 @@
+Backport of an upstream patch fixing a test suite failure.
+
+Taken from: https://github.com/pysmt/pysmt/commit/a246669a487aff69f5da34570ef867841d18508a
+
+diff --git a/pysmt/test/smtlib/test_parser_examples.py b/pysmt/test/smtlib/test_parser_examples.py
+index cca4194..c0852be 100644
+--- a/pysmt/test/smtlib/test_parser_examples.py
++++ b/pysmt/test/smtlib/test_parser_examples.py
+@@ -29,6 +29,7 @@ from pysmt.shortcuts import Iff
+ from pysmt.shortcuts import read_smtlib, write_smtlib, get_env
+ from pysmt.exceptions import PysmtSyntaxError
+ 
++
+ class TestSMTParseExamples(TestCase):
+ 
+     def test_parse_examples(self):
+@@ -41,7 +42,6 @@ class TestSMTParseExamples(TestCase):
+             buf = StringIO()
+             script_out = smtlibscript_from_formula(f_out)
+             script_out.serialize(outstream=buf)
+-            #print(buf)
+ 
+             buf.seek(0)
+             parser = SmtLibParser()
+@@ -49,7 +49,6 @@ class TestSMTParseExamples(TestCase):
+             f_in = script_in.get_last_formula()
+             self.assertEqual(f_in.simplify(), f_out.simplify())
+ 
+-
+     @skipIfNoSolverForLogic(logics.QF_BV)
+     def test_parse_examples_bv(self):
+         """For BV we represent a superset of the operators defined in SMT-LIB.
+@@ -108,7 +107,18 @@ class TestSMTParseExamples(TestCase):
+             self.assertValid(Iff(f_in, f_out), f_in.serialize())
+ 
+     def test_dumped_logic(self):
+-        # Dumped logic matches the logic in the example
++        # Dumped logic matches the logic in the example.
++        #
++        # There are a few cases where we use a logic
++        # that does not exist in SMT-LIB, and the SMT-LIB
++        # serialization logic will find a logic that
++        # is more expressive. We need to adjust the test
++        # for those cases (see rewrite dict below).
++        rewrite = {
++            logics.QF_BOOL: logics.QF_UF,
++            logics.BOOL: logics.LRA,
++            logics.QF_NIRA: logics.AUFNIRA,
++        }
+         fs = get_example_formulae()
+ 
+         for (f_out, _, _, logic) in fs:
+@@ -121,14 +131,9 @@ class TestSMTParseExamples(TestCase):
+             for cmd in script_in:
+                 if cmd.name == "set-logic":
+                     logic_in = cmd.args[0]
+-                    if logic == logics.QF_BOOL:
+-                        self.assertEqual(logic_in, logics.QF_UF)
+-                    elif logic == logics.BOOL:
+-                        self.assertEqual(logic_in, logics.LRA)
+-                    else:
+-                        self.assertEqual(logic_in, logic, script_in)
++                    self.assertEqual(logic_in, rewrite.get(logic, logic))
+                     break
+-            else: # Loops exited normally
++            else:  # Loops exited normally
+                 print("-"*40)
+                 print(script_in)
+ 
+@@ -136,7 +141,7 @@ class TestSMTParseExamples(TestCase):
+         fs = get_example_formulae()
+ 
+         fdi, tmp_fname = mkstemp()
+-        os.close(fdi) # Close initial file descriptor
++        os.close(fdi)  # Close initial file descriptor
+         for (f_out, _, _, _) in fs:
+             write_smtlib(f_out, tmp_fname)
+             # with open(tmp_fname) as fin:
+@@ -197,7 +202,6 @@ class TestSMTParseExamples(TestCase):
+         f_in = script.get_last_formula()
+         self.assertSat(f_in)
+ 
+-
+     def test_int_promotion_define_fun(self):
+         script = """
+         (define-fun x () Int 8)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index f9bd733ecd..0c6265f60e 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32303,6 +32303,38 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-pysmt
+  (package
+    (name "python-pysmt")
+    (version "0.9.5")
+    (source
+     (origin
+       (method git-fetch)
+       (patches (search-patches "python-pysmt-fix-pow-return-type.patch"
+                 "python-pysmt-fix-smtlib-serialization-test.patch"))
+       (uri (git-reference
+             (url "https://github.com/pysmt/pysmt")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0hrxv23y5ip4ijfx5pvbwc2fq4zg9jz42wc9zqgqm0g0mjc9ckvh"))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (add-before 'check 'set-pysmt-solver
+                    (lambda _
+                      (setenv "PYSMT_SOLVER" "z3"))))))
+    (native-inputs (list python-pytest))
+    (propagated-inputs (list z3))
+    (home-page "https://github.com/pysmt/pysmt")
+    (synopsis
+     "Solver-agnostic library for SMT formula manipulation and solving")
+    (description
+     "This Python module provides a solver-agnostic abstraction for
+working with @acronym{SMT, Satisfiability Modulo Theory} formulas.  For example,
+it allows manipulation and solving such formulas.")
+    (license license:asl2.0)))
+
 (define-public python-rpyc
   (package
     (name "python-rpyc")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v2 07/14] gnu: Add python-claripy.
  2024-03-10 20:09 ` [bug#69074] [PATCH v2 01/14] gnu: Add python-itanium-demangle soeren
                     ` (4 preceding siblings ...)
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 06/14] gnu: Add python-pysmt soeren
@ 2024-03-10 20:09   ` soeren
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 08/14] gnu: Add python-archinfo soeren
                     ` (6 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-03-10 20:09 UTC (permalink / raw)
  To: 69074
  Cc: troy, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-claripy): New variable.
---
 gnu/packages/python-xyz.scm | 39 +++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 0c6265f60e..58a6855850 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32303,6 +32303,45 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-claripy
+  (package
+    (name "python-claripy")
+    ;; Must be the same version as python-angr.
+    (version "9.2.46")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/angr/claripy")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0nmawpi1596d9plafrp2db36cjsidy2fagkzkja51jwlx2m1ngai"))
+       (modules '((guix build utils)))
+       (snippet '(begin
+                   (substitute* "setup.cfg"
+                     ;; Relax the z3 version constraint.
+                     ;; See https://github.com/angr/claripy/commit/d1fe2df
+                     (("z3-solver==4.10.2.0")
+                      ""))))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (propagated-inputs (list python-cachetools python-decorator python-pysmt
+                             z3))
+    (home-page "https://github.com/angr/claripy")
+    (synopsis "Abstraction layer for constraint solvers")
+    (description
+     "This Python module provides an abstraction layer for interacting
+with constraint solvers.  Specifically, it is intended to be used with
+SMT solvers and is built on top of the Z3 solver.")
+    (license license:bsd-2)))
+
 (define-public python-pysmt
   (package
     (name "python-pysmt")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v2 08/14] gnu: Add python-archinfo.
  2024-03-10 20:09 ` [bug#69074] [PATCH v2 01/14] gnu: Add python-itanium-demangle soeren
                     ` (5 preceding siblings ...)
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 07/14] gnu: Add python-claripy soeren
@ 2024-03-10 20:09   ` soeren
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 09/14] gnu: Add python-pyvex soeren
                     ` (5 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-03-10 20:09 UTC (permalink / raw)
  To: 69074; +Cc: troy

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/emulators.scm (python-archinfo): New variable.
---
 gnu/packages/emulators.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index 43af9804e5..28bb1ac3cf 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -66,6 +66,7 @@ (define-module (gnu packages emulators)
   #:use-module (gnu packages cross-base)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages digest)
+  #:use-module (gnu packages engineering)
   #:use-module (gnu packages elf)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fltk)
@@ -2619,6 +2620,33 @@ (define-public python-keystone-engine
 assembly for these architectures.")
     (license license:gpl2)))
 
+(define-public python-archinfo
+  (package
+    (name "python-archinfo")
+    ;; Must be the same version as python-angr.
+    (version "9.2.46")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "archinfo" version))
+       (sha256
+        (base32 "037xfq3wcf8ngayxz9623l4646m780v2102mfbygpzbkkjha1966"))))
+    (build-system pyproject-build-system)
+    (propagated-inputs (list python-capstone python-keystone-engine))
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (home-page "https://github.com/angr/archinfo")
+    (synopsis "Extract architecture-specific information from binaries")
+    (description
+     "Collection of classes that contain architecture-specific information
+information.  Useful for cross-architecture tools (such as @code{python-pyvex}).")
+    (license license:bsd-2)))
+
 (define-public emu8051
   (let ((commit "5dc681275151c4a5d7b85ec9ff4ceb1b25abd5a8")
         (revision "1"))




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v2 09/14] gnu: Add python-pyvex.
  2024-03-10 20:09 ` [bug#69074] [PATCH v2 01/14] gnu: Add python-itanium-demangle soeren
                     ` (6 preceding siblings ...)
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 08/14] gnu: Add python-archinfo soeren
@ 2024-03-10 20:09   ` soeren
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 10/14] gnu: Add python-cle soeren
                     ` (4 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-03-10 20:09 UTC (permalink / raw)
  To: 69074
  Cc: troy, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/patches/python-pyvex-remove-angr-dependency.patch:
New patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/python-xyz.scm (python-pyvex): New variable.
---
 gnu/local.mk                                  |  1 +
 .../python-pyvex-remove-angr-dependency.patch | 80 +++++++++++++++++++
 gnu/packages/python-xyz.scm                   | 37 +++++++++
 3 files changed, 118 insertions(+)
 create mode 100644 gnu/packages/patches/python-pyvex-remove-angr-dependency.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 1946fdcbb6..ecbae4bb53 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1930,6 +1930,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-pytorch-runpath.patch		\
   %D%/packages/patches/python-pytorch-system-libraries.patch	\
   %D%/packages/patches/python-pytorch-1.9.0-system-libraries.patch \
+  %D%/packages/patches/python-pyvex-remove-angr-dependency.patch	\
   %D%/packages/patches/python-robotframework-atest.patch	\
   %D%/packages/patches/python-robotframework-source-date-epoch.patch \
   %D%/packages/patches/python-robotframework-sshlibrary-rf5-compat.patch \
diff --git a/gnu/packages/patches/python-pyvex-remove-angr-dependency.patch b/gnu/packages/patches/python-pyvex-remove-angr-dependency.patch
new file mode 100644
index 0000000000..dccf22bbc6
--- /dev/null
+++ b/gnu/packages/patches/python-pyvex-remove-angr-dependency.patch
@@ -0,0 +1,80 @@
+This patch removes the angr dependency from the pyvex these, thus
+resolving a circular dependency (as angr depends on pyvex). This
+patch has been taken from upstream.
+
+This patch is a squashed version of the following upstream patches:
+
+* https://github.com/angr/pyvex/commit/61fb26f223a8d8a276b702d2448a12e02c5c9c6b
+* https://github.com/angr/pyvex/commit/a1fb2a4d0826b0e43bd8bbdd00b6db032643ec95
+
+diff --git a/tests/test_spotter.py b/tests/test_spotter.py
+index 9271ccd..bed7dd4 100644
+--- a/tests/test_spotter.py
++++ b/tests/test_spotter.py
+@@ -1,6 +1,5 @@
+ import os
+ 
+-import angr
+ import archinfo
+ 
+ import pyvex
+@@ -98,53 +97,28 @@ class CortexSpotter(GymratLifter):
+ register(CortexSpotter, "ARMEL")
+ 
+ 
+-def test_full_binary():
+-    p = angr.Project(
+-        os.path.join(test_location, "armel", "RTOSDemo.axf.issue_685"),
+-        arch="ARMEL",
+-        auto_load_libs=False,
+-    )
+-    st = p.factory.call_state(0x000013CE + 1)
+-    b = st.block().vex
+-    simgr = p.factory.simulation_manager(st)
+-    simgr.step()
+-    assert b.jumpkind == "Ijk_Sys_syscall"
+-    assert simgr.active[0].regs.ip_at_syscall.args[0] == 0x13FB
+-
+-
+ def test_tmrs():
+-    test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../binaries/tests"))
+-    p = angr.Project(
+-        os.path.join(test_location, "armel", "helloworld"),
+-        arch="ARMEL",
+-        auto_load_libs=False,
+-    )
++    arch = archinfo.arch_from_id("ARMEL")
+     ins = b"\xef\xf3\x08\x82"
+-    b = pyvex.block.IRSB(ins, 1, p.arch)
++    b = pyvex.block.IRSB(ins, 1, arch)
+     assert b.jumpkind == "Ijk_Boring"
+     assert type(b.statements[1].data) == pyvex.expr.Get
+-    assert p.arch.register_names.get(b.statements[1].data.offset, "") == "sp"
++    assert arch.register_names.get(b.statements[1].data.offset, "") == "sp"
+     assert type(b.statements[2]) == pyvex.stmt.Put
+ 
+ 
+ def test_tmsr():
+-    test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../binaries/tests"))
+-    p = angr.Project(
+-        os.path.join(test_location, "armel", "helloworld"),
+-        arch="ARMEL",
+-        auto_load_libs=False,
+-    )
++    arch = archinfo.arch_from_id("ARMEL")
+     inss = b"\x82\xf3\x08\x88"
+-    b = pyvex.block.IRSB(inss, 1, p.arch, opt_level=3)
++    b = pyvex.block.IRSB(inss, 1, arch, opt_level=3)
+     assert b.jumpkind == "Ijk_Boring"
+     assert type(b.statements[1].data) == pyvex.expr.Get
+-    assert p.arch.register_names.get(b.statements[1].data.offset, "") == "r2"
++    assert arch.register_names.get(b.statements[1].data.offset, "") == "r2"
+     assert type(b.statements[2]) == pyvex.stmt.Put
+ 
+ 
+ if __name__ == "__main__":
+     test_basic()
+     test_embedded()
+-    test_full_binary()
+     test_tmrs()
+     test_tmsr()
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 58a6855850..392df37f2b 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -189,6 +189,7 @@ (define-module (gnu packages python-xyz)
   #:use-module (gnu packages djvu)
   #:use-module (gnu packages docker)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages emulators)
   #:use-module (gnu packages enchant)
   #:use-module (gnu packages file)
   #:use-module (gnu packages fonts)
@@ -32303,6 +32304,42 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-pyvex
+  (package
+    (name "python-pyvex")
+    ;; Must be the same version as python-angr.
+    (version "9.2.46")
+    (source
+     (origin
+       (method url-fetch)
+       (patches (search-patches "python-pyvex-remove-angr-dependency.patch"))
+       (uri (pypi-uri "pyvex" version))
+       (sha256
+        (base32 "1v64rn7gxy6fg065bgsy38z6r494k5ri5r6sn4g08hjj32ihx1ka"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:phases #~(modify-phases %standard-phases
+                   (replace 'check
+                     (lambda* (#:key tests? #:allow-other-keys)
+                       (when tests?
+                         (with-directory-excursion "tests"
+                           (invoke "python" "-m" "unittest")))))
+
+                   (add-before 'build 'set-cc-native
+                     (lambda _
+                       (setenv "CC" #$(cc-for-target))
+                       (setenv "CC_NATIVE" "gcc"))))))
+    (propagated-inputs (list python-archinfo python-bitstring python-cffi))
+    (home-page "https://github.com/angr/pyvex")
+    (synopsis "Python interface to libVEX and VEX IR")
+    (description
+     "This package provides a Python interface the libVEX and VEX IR.
+VEX is the intermediate representation (also known as intermediate
+language) used by the Valgrind analysis tool.  As such, VEX is designed
+to enable all kinds of binary analysis tasks.")
+    (license license:bsd-2)))
+
 (define-public python-claripy
   (package
     (name "python-claripy")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v2 10/14] gnu: Add python-cle.
  2024-03-10 20:09 ` [bug#69074] [PATCH v2 01/14] gnu: Add python-itanium-demangle soeren
                     ` (7 preceding siblings ...)
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 09/14] gnu: Add python-pyvex soeren
@ 2024-03-10 20:09   ` soeren
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 11/14] gnu: Add python-ailment soeren
                     ` (3 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-03-10 20:09 UTC (permalink / raw)
  To: 69074
  Cc: troy, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-cle): New variable.
---
 gnu/packages/python-xyz.scm | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 392df37f2b..76f115f6d0 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32304,6 +32304,32 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-cle
+  (package
+    (name "python-cle")
+    ;; Must be the same version as python-angr.
+    (version "9.2.46")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "cle" version))
+       (sha256
+        (base32 "0mswv9gd2p2ws7zfsshqv5ybbj27wkdwakdcknq4vsrx9ry9k4yc"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:tests? #f))
+    (propagated-inputs (list python-pefile python-pyelftools python-pyvex
+                             python-sortedcontainers))
+    (native-inputs (list python-cffi))
+    (home-page "https://github.com/angr/cle")
+    (synopsis "Python loader for binaries and their associated libraries")
+    (description
+     "CLE loads binaries and their associated libraries, resolves
+imports and provides an abstraction of process memory the same way as if
+it was loader by the operating system's loader.")
+    (license license:bsd-2)))
+
 (define-public python-pyvex
   (package
     (name "python-pyvex")
@@ -32326,7 +32352,7 @@ (define-public python-pyvex
                          (with-directory-excursion "tests"
                            (invoke "python" "-m" "unittest")))))
 
-                   (add-before 'build 'set-cc-native
+                   (add-before 'build 'set-cc
                      (lambda _
                        (setenv "CC" #$(cc-for-target))
                        (setenv "CC_NATIVE" "gcc"))))))




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v2 11/14] gnu: Add python-ailment.
  2024-03-10 20:09 ` [bug#69074] [PATCH v2 01/14] gnu: Add python-itanium-demangle soeren
                     ` (8 preceding siblings ...)
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 10/14] gnu: Add python-cle soeren
@ 2024-03-10 20:09   ` soeren
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 12/14] gnu: unicorn: Update to 2.0.1.post1 soeren
                     ` (2 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-03-10 20:09 UTC (permalink / raw)
  To: 69074
  Cc: troy, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-ailment): New variable.
---
 gnu/packages/python-xyz.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 76f115f6d0..7c85404c2a 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32304,6 +32304,34 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-ailment
+  (package
+    (name "python-ailment")
+    ;; Must be the same version as python-angr.
+    (version "9.2.46")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "ailment" version))
+       (sha256
+        (base32 "073fcssbjis1ckwv2w0dcz2dfl6715bj4d4qdhspajj911mvng2f"))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    ;; Many tests are skipped due to cyclic dependencies.
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (home-page "https://github.com/angr/ailment")
+    (synopsis "The angr intermediate language")
+    (description
+     "This Python module implements an @acronym{IL, Intermediate Language},
+also known as @acronym{IR, Intermediate Representation}, used by the angr
+binary analysis platform.")
+    (license license:bsd-2)))
+
 (define-public python-cle
   (package
     (name "python-cle")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v2 12/14] gnu: unicorn: Update to 2.0.1.post1.
  2024-03-10 20:09 ` [bug#69074] [PATCH v2 01/14] gnu: Add python-itanium-demangle soeren
                     ` (9 preceding siblings ...)
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 11/14] gnu: Add python-ailment soeren
@ 2024-03-10 20:09   ` soeren
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 13/14] gnu: capstone: Backport upstream fix for Python bindings soeren
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 14/14] gnu: Add python-angr soeren
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-03-10 20:09 UTC (permalink / raw)
  To: 69074; +Cc: troy

From: c4droid <c4droid@foxmail.com>

* gnu/packages/emulators.scm (unicorn) Update to 2.0.1.post1.

Co-authored-by: Sören Tempel <soeren@soeren-tempel.net>
---
 gnu/packages/emulators.scm | 119 +++++++------------------------------
 1 file changed, 20 insertions(+), 99 deletions(-)

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index 28bb1ac3cf..90debdcf76 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -21,6 +21,7 @@
 ;;; Copyright © 2023 Yovan Naumovski <yovan@gorski.stream>
 ;;; Copyright © 2023 Hendursaga <hendursaga@aol.com>
 ;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2024 Sören Tempel <soeren@soeren-tempel.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -61,6 +62,7 @@ (define-module (gnu packages emulators)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages cdrom)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages containers)
   #:use-module (gnu packages cross-base)
@@ -114,6 +116,7 @@ (define-module (gnu packages emulators)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system python)
+  #:use-module (guix build-system pyproject)
   #:use-module (guix build-system qt))
 
 (define-public vice
@@ -2192,106 +2195,24 @@ (define-public bsnes
 performance, features, and ease of use.")
     (license license:gpl3)))
 
-;; python-pwntools requires a -rc release of unicorn
 (define-public unicorn
-  (let ((unless-x86
-          (lambda (code)
-            (if (member (%current-system) '("x86_64-linux" "i686-linux"))
-              '()
-              code))))
-    (package
-      (name "unicorn")
-      (version "1.0.2-rc4")
-      ;; NOTE: unicorn ships a bundled QEMU, but with a lot of custom modifications.
-      (source
-       (origin
-         (method git-fetch)
-         (uri (git-reference
-               (url "https://github.com/unicorn-engine/unicorn")
-               (commit version)))
-         (file-name (git-file-name name version))
-         (sha256
-          (base32
-           "17nyccgk7hpc4hab24yn57f1xnmr7kq4px98zbp2bkwcrxny8gwy"))))
-      (outputs '("out" "python"))
-      ;; The main library is not written in Python, but the build process has
-      ;; little in common with any defined build system, so we might as well
-      ;; build on top of python-build-system and make use of all
-      ;; the Python-specific phases that can be reused.
-      (build-system python-build-system)
-      (arguments
-       `(#:modules ((srfi srfi-26)
-                    (guix build python-build-system)
-                    (guix build utils))
-         #:phases
-         (modify-phases %standard-phases
-           (add-before 'build 'build-library
-             (lambda* (#:key inputs #:allow-other-keys)
-               (invoke "make"
-                       "-j" (number->string (parallel-job-count))
-                       "UNICORN_STATIC=no"
-                       "CC=gcc")))
-           (add-after 'build-library 'install-library
-             (lambda* (#:key outputs #:allow-other-keys)
-               (invoke "make" "install"
-                       "UNICORN_STATIC=no"
-                       (string-append
-                        "PREFIX="
-                        (assoc-ref outputs "out")))))
-           (add-before 'build 'prepare-bindings
-             (lambda* (#:key outputs #:allow-other-keys)
-               (chdir "bindings/python")
-               ;; Set this environment variable so that the Python bindings
-               ;; don't build their own copy of the shared object, but use
-               ;; a dummy value such that the bindings test suite uses the
-               ;; same mechanism for loading the library as any other user.
-               (setenv "LIBUNICORN_PATH" "1")
-               (substitute* "unicorn/unicorn.py"
-                 (("_path_list = \\[.*")
-                  (string-append
-                   "_path_list = [\""
-                   (assoc-ref outputs "out")
-                   ;; eat the rest of the list
-                   "/lib\"] + 0*[")))
-               #t))
-           (add-before 'check 'check-library
-             (lambda* (#:key outputs #:allow-other-keys)
-               (for-each
-                 (lambda (suite)
-                   (with-directory-excursion
-                     (string-append "../../tests/" suite)
-                     (invoke "make" "test" "CC=gcc"
-                             ,@(unless-x86
-                                '("AS=i686-unknown-linux-gnu-as"
-                                  "OBJCOPY=i686-unknown-linux-gnu-objcopy")))))
-                 '("unit" "regress"))
-               #t))
-           (add-after 'install 'install-samples
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let* ((python-samples (find-files "." "sample_.*"))
-                      (c-samples (find-files "../../samples" ".*\\.c"))
-                      (python-docdir
-                        (string-append (assoc-ref outputs "python")
-                                       "/share/doc/unicorn/samples"))
-                      (c-docdir
-                        (string-append (assoc-ref outputs "out")
-                                       "/share/doc/unicorn/samples")))
-                 (for-each (cut install-file <> c-docdir) c-samples)
-                 (for-each (cut install-file <> python-docdir) python-samples)
-                 #t))))))
-      (native-inputs
-       ;; NOTE: cross-binutils needs to be wrapped with unless-x86, as otherwise
-       ;; the linker provided by the package will be used, circumventing the ld-wrapper.
-       `(,@(unless-x86
-            `(("assembler-for-tests" ,(cross-binutils "i686-unknown-linux-gnu"))))
-         ("cmocka" ,cmocka)
-         ("hexdump-for-tests" ,util-linux)))
-      (home-page "https://www.unicorn-engine.org")
-      (synopsis "Unicorn CPU emulator framework")
-      (description
-       "Unicorn is a lightweight, multi-platform, multi-architecture CPU emulator
-framework based on QEMU.")
-      (license license:gpl2+))))
+  (package
+    (name "unicorn")
+    (version "2.0.1.post1")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri name version))
+              (sha256
+               (base32
+                 "0mlfs8qfi0clyncfkbxp6in0cpl747510i6bqymwid43xcirbikz"))))
+    (build-system pyproject-build-system)
+    (native-inputs (list cmake pkg-config))
+    (home-page "https://www.unicorn-engine.org")
+    (synopsis "Generic CPU emulator framework")
+    (description
+      "Uniforn is a lightweight, multi-platform, multi-architecture CPU
+emulator framework based on QEMU.")
+    (license license:gpl2+)))
 
 (define-public ppsspp
   (package




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v2 13/14] gnu: capstone: Backport upstream fix for Python bindings.
  2024-03-10 20:09 ` [bug#69074] [PATCH v2 01/14] gnu: Add python-itanium-demangle soeren
                     ` (10 preceding siblings ...)
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 12/14] gnu: unicorn: Update to 2.0.1.post1 soeren
@ 2024-03-10 20:09   ` soeren
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 14/14] gnu: Add python-angr soeren
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-03-10 20:09 UTC (permalink / raw)
  To: 69074; +Cc: troy

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/patches/python-capstone-fix-python-constants.patch:
New patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/engineering.scm (capstone): New patch.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/engineering.scm                  |  2 +
 ...python-capstone-fix-python-constants.patch | 84 +++++++++++++++++++
 3 files changed, 87 insertions(+)
 create mode 100644 gnu/packages/patches/python-capstone-fix-python-constants.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index ecbae4bb53..ce0f1994c5 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1901,6 +1901,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-3-hurd-configure.patch		\
   %D%/packages/patches/python-aionotify-0.2.0-py3.8.patch	\
   %D%/packages/patches/python-argcomplete-1.11.1-fish31.patch	\
+  %D%/packages/patches/python-capstone-fix-python-constants.patch	\
   %D%/packages/patches/python-cross-compile.patch		\
   %D%/packages/patches/python-configobj-setuptools.patch	\
   %D%/packages/patches/python-dateutil-pytest-compat.patch	\
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 16f572909c..336c8b0e38 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -39,6 +39,7 @@
 ;;; Copyright © 2023 Theofilos Pechlivanis <theofilos.pechlivanis@gmail.com>
 ;;; Copyright © 2023 Sharlatan Hellseher <sharlatanus@gmail.com>
 ;;; Copyright © 2023 pinoaffe <pinoaffe@gmail.com>
+;;; Copyright © 2024 Sören Tempel <soeren@soeren-tempel.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1815,6 +1816,7 @@ (define-public capstone
     (version "5.0.1")
     (source (origin
               (method git-fetch)
+              (patches (search-patches "python-capstone-fix-python-constants.patch"))
               (uri (git-reference
                     (url "https://github.com/capstone-engine/capstone")
                     (commit version)))
diff --git a/gnu/packages/patches/python-capstone-fix-python-constants.patch b/gnu/packages/patches/python-capstone-fix-python-constants.patch
new file mode 100644
index 0000000000..75100c6652
--- /dev/null
+++ b/gnu/packages/patches/python-capstone-fix-python-constants.patch
@@ -0,0 +1,84 @@
+Backport upstream patch fixing various constants in the Python bindings.
+
+Taken from: https://github.com/capstone-engine/capstone/commit/f180e176de3efb060db62820ff981d0291ea8525
+
+diff --git a/bindings/python/capstone/__init__.py b/bindings/python/capstone/__init__.py
+index bda2fdb6..52353c28 100755
+--- a/bindings/python/capstone/__init__.py
++++ b/bindings/python/capstone/__init__.py
+@@ -113,7 +113,6 @@ __all__ = [
+     'CS_OPT_SYNTAX_NOREGNAME',
+     'CS_OPT_SYNTAX_MASM',
+     'CS_OPT_SYNTAX_MOTOROLA',
+-    'CS_OPT_SYNTAX_CS_REG_ALIAS',
+ 
+     'CS_OPT_DETAIL',
+     'CS_OPT_MODE',
+@@ -152,19 +151,6 @@ __all__ = [
+     'CS_OP_REG',
+     'CS_OP_IMM',
+     'CS_OP_FP',
+-    'CS_OP_PRED',
+-    'CS_OP_RESERVED_5',
+-    'CS_OP_RESERVED_6',
+-    'CS_OP_RESERVED_7',
+-    'CS_OP_RESERVED_8',
+-    'CS_OP_RESERVED_9',
+-    'CS_OP_RESERVED_10',
+-    'CS_OP_RESERVED_11',
+-    'CS_OP_RESERVED_12',
+-    'CS_OP_RESERVED_13',
+-    'CS_OP_RESERVED_14',
+-    'CS_OP_RESERVED_15',
+-    'CS_OP_SPECIAL',
+     'CS_OP_MEM',
+ 
+     'CS_GRP_INVALID',
+@@ -298,26 +284,13 @@ CS_OPT_NO_BRANCH_OFFSET = 9  # ARM, prints branch immediates without offset.
+ 
+ # Capstone option value
+ CS_OPT_OFF = 0             # Turn OFF an option - default option of CS_OPT_DETAIL
+-CS_OPT_ON = 1 << 0              # Turn ON an option (CS_OPT_DETAIL)
++CS_OPT_ON = 3              # Turn ON an option (CS_OPT_DETAIL)
+ 
+ # Common instruction operand types - to be consistent across all architectures.
+ CS_OP_INVALID = 0  # uninitialized/invalid operand.
+ CS_OP_REG = 1  # Register operand.
+ CS_OP_IMM = 2  # Immediate operand.
+ CS_OP_FP  = 3  # Floating-Point operand.
+-CS_OP_PRED = 4  # Predicate operand.
+-CS_OP_RESERVED_5 = 5
+-CS_OP_RESERVED_6 = 6
+-CS_OP_RESERVED_7 = 7
+-CS_OP_RESERVED_8 = 8
+-CS_OP_RESERVED_9 = 9
+-CS_OP_RESERVED_10 = 10
+-CS_OP_RESERVED_11 = 11
+-CS_OP_RESERVED_12 = 12
+-CS_OP_RESERVED_13 = 13
+-CS_OP_RESERVED_14 = 14
+-CS_OP_RESERVED_15 = 15
+-CS_OP_SPECIAL = 0x10  # Special operands from archs
+ CS_OP_MEM = 0x80  # Memory operand. Can be ORed with another operand type.
+ 
+ # Common instruction groups - to be consistent across all architectures.
+@@ -336,13 +309,12 @@ CS_AC_READ     = (1 << 0) # Operand that is read from.
+ CS_AC_WRITE    = (1 << 1) # Operand that is written to.
+ 
+ # Capstone syntax value
+-CS_OPT_SYNTAX_DEFAULT = 1 << 1  # Default assembly syntax of all platforms (CS_OPT_SYNTAX)
+-CS_OPT_SYNTAX_INTEL = 1 << 2  # Intel X86 asm syntax - default syntax on X86 (CS_OPT_SYNTAX, CS_ARCH_X86)
+-CS_OPT_SYNTAX_ATT = 1 << 3  # ATT asm syntax (CS_OPT_SYNTAX, CS_ARCH_X86)
+-CS_OPT_SYNTAX_NOREGNAME = 1 << 4  # Asm syntax prints register name with only number - (CS_OPT_SYNTAX, CS_ARCH_PPC, CS_ARCH_ARM)
+-CS_OPT_SYNTAX_MASM = 1 << 5  # MASM syntax (CS_OPT_SYNTAX, CS_ARCH_X86)
+-CS_OPT_SYNTAX_MOTOROLA = 1 << 6  # MOS65XX use $ as hex prefix
+-CS_OPT_SYNTAX_CS_REG_ALIAS = 1 << 7  # Prints common register alias which are not defined in LLVM (ARM: r9 = sb etc.)
++CS_OPT_SYNTAX_DEFAULT = 0    # Default assembly syntax of all platforms (CS_OPT_SYNTAX)
++CS_OPT_SYNTAX_INTEL = 1    # Intel X86 asm syntax - default syntax on X86 (CS_OPT_SYNTAX, CS_ARCH_X86)
++CS_OPT_SYNTAX_ATT = 2      # ATT asm syntax (CS_OPT_SYNTAX, CS_ARCH_X86)
++CS_OPT_SYNTAX_NOREGNAME = 3   # Asm syntax prints register name with only number - (CS_OPT_SYNTAX, CS_ARCH_PPC, CS_ARCH_ARM)
++CS_OPT_SYNTAX_MASM = 4      # MASM syntax (CS_OPT_SYNTAX, CS_ARCH_X86)
++CS_OPT_SYNTAX_MOTOROLA = 5 # MOS65XX use $ as hex prefix
+ 
+ # Capstone error type
+ CS_ERR_OK = 0      # No error: everything was fine




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v2 14/14] gnu: Add python-angr.
  2024-03-10 20:09 ` [bug#69074] [PATCH v2 01/14] gnu: Add python-itanium-demangle soeren
                     ` (11 preceding siblings ...)
  2024-03-10 20:09   ` [bug#69074] [PATCH v2 13/14] gnu: capstone: Backport upstream fix for Python bindings soeren
@ 2024-03-10 20:09   ` soeren
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-03-10 20:09 UTC (permalink / raw)
  To: 69074
  Cc: troy, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/patches/python-angr-addition-type-error.patch:
New patch.
* gnu/packages/patches/python-angr-check-exec-deps.patch:
New patch.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/python-xyz.scm (python-angr): New variable.
---
 gnu/local.mk                                  |  2 +
 .../python-angr-addition-type-error.patch     | 18 ++++
 .../patches/python-angr-check-exec-deps.patch | 93 ++++++++++++++++++
 gnu/packages/python-xyz.scm                   | 96 +++++++++++++++++++
 4 files changed, 209 insertions(+)
 create mode 100644 gnu/packages/patches/python-angr-addition-type-error.patch
 create mode 100644 gnu/packages/patches/python-angr-check-exec-deps.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index ce0f1994c5..8bbf66cc1e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1899,6 +1899,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-3-search-paths.patch		\
   %D%/packages/patches/python-3-fix-tests.patch			\
   %D%/packages/patches/python-3-hurd-configure.patch		\
+  %D%/packages/patches/python-angr-addition-type-error.patch	\
+  %D%/packages/patches/python-angr-check-exec-deps.patch	\
   %D%/packages/patches/python-aionotify-0.2.0-py3.8.patch	\
   %D%/packages/patches/python-argcomplete-1.11.1-fish31.patch	\
   %D%/packages/patches/python-capstone-fix-python-constants.patch	\
diff --git a/gnu/packages/patches/python-angr-addition-type-error.patch b/gnu/packages/patches/python-angr-addition-type-error.patch
new file mode 100644
index 0000000000..7301d8b505
--- /dev/null
+++ b/gnu/packages/patches/python-angr-addition-type-error.patch
@@ -0,0 +1,18 @@
+This fixes failures of the test_ln_gcc_O2 and other related tests
+in the angr test suite.  The patch has been proposed upstream.
+
+Taken form: https://github.com/angr/angr/pull/4443
+
+diff --git a/angr/analyses/reassembler.py b/angr/analyses/reassembler.py
+index 7a2399a60..b09b3a8cb 100644
+--- a/angr/analyses/reassembler.py
++++ b/angr/analyses/reassembler.py
+@@ -730,7 +730,7 @@ class Instruction:
+             elif operand.type == capstone.CS_OP_MEM:
+                 operand_offsets.append(capstone_instr.disp_offset)
+             else:
+-                operand_offsets.append(None)
++                operand_offsets.append(0)
+ 
+         if self.addr is not None:
+             self._initialize(capstone_instr.operands, operand_offsets)
diff --git a/gnu/packages/patches/python-angr-check-exec-deps.patch b/gnu/packages/patches/python-angr-check-exec-deps.patch
new file mode 100644
index 0000000000..438f8ef183
--- /dev/null
+++ b/gnu/packages/patches/python-angr-check-exec-deps.patch
@@ -0,0 +1,93 @@
+The angr test suite performs analysis on several pre-compiled binaries
+to ensure its binary analysis capabilities are working as intended.
+Some of these binaries are also executed as part of the test suite to
+test if the simulation engine provided by angr results in the same
+output as native execution of the binary.
+
+For Guix, this files as the glibc shared objects cannot be found.
+Additionally, we don't really want to execute pre-compiled binaries
+on Guix, hence we disable those tests.
+
+diff --git a/tests/test_ctype_locale.py b/tests/test_ctype_locale.py
+index 08cb89836..2b9233558 100644
+--- a/tests/test_ctype_locale.py
++++ b/tests/test_ctype_locale.py
+@@ -14,7 +14,7 @@ test_location = os.path.dirname(os.path.abspath(__file__))
+ 
+ 
+ class TestCtypeLocale(unittest.TestCase):
+-    @skip_if_not_linux
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_ctype_b_loc(self):
+         """
+         test_ctype_locale.test_ctype_b_loc
+@@ -60,7 +60,7 @@ class TestCtypeLocale(unittest.TestCase):
+         output = subprocess.check_output(bin_path, shell=True)
+         assert result == output
+ 
+-    @skip_if_not_linux
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_ctype_tolower_loc(self):
+         """
+         test_ctype_locale.test_ctype_tolower_loc
+@@ -109,7 +109,7 @@ class TestCtypeLocale(unittest.TestCase):
+         output = subprocess.check_output(bin_path, shell=True)
+         assert result == output
+ 
+-    @skip_if_not_linux
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_ctype_toupper_loc(self):
+         """
+         test_ctype_locale.test_ctype_toupper_loc
+diff --git a/tests/test_signed_div.py b/tests/test_signed_div.py
+index 59cb9b8d1..994ed9c65 100644
+--- a/tests/test_signed_div.py
++++ b/tests/test_signed_div.py
+@@ -1,6 +1,7 @@
+ import angr
+ import subprocess
+ import sys
++import pytest
+ 
+ import logging
+ 
+@@ -13,7 +14,7 @@ import os
+ test_location = os.path.dirname(os.path.realpath(__file__))
+ 
+ 
+-@skipUnless(sys.platform.startswith("linux"), "linux only")
++@pytest.mark.skip(reason="test executes pre-compiled binaries")
+ def test_signed_div():
+     test_bin = os.path.join(test_location, "..", "..", "binaries", "tests", "x86_64", "test_signed_div")
+     b = angr.Project(test_bin, auto_load_libs=False)
+diff --git a/tests/test_sscanf.py b/tests/test_sscanf.py
+index 29d2c8403..ea799b310 100644
+--- a/tests/test_sscanf.py
++++ b/tests/test_sscanf.py
+@@ -1,3 +1,4 @@
++import pytest
+ import angr
+ import subprocess
+ import sys
+@@ -14,7 +15,7 @@ test_location = os.path.dirname(os.path.realpath(__file__))
+ 
+ 
+ class TestSscanf(unittest.TestCase):
+-    @unittest.skipUnless(sys.platform.startswith("linux"), "linux only")
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_sscanf(self):
+         test_bin = os.path.join(test_location, "..", "..", "binaries", "tests", "x86_64", "sscanf_test")
+         b = angr.Project(test_bin, auto_load_libs=False)
+diff --git a/tests/test_strtol.py b/tests/test_strtol.py
+index 6c29cab22..f36181407 100644
+--- a/tests/test_strtol.py
++++ b/tests/test_strtol.py
+@@ -11,7 +11,7 @@ class TestStrtol(unittest.TestCase):
+     # pylint: disable=no-self-use
+ 
+     @slow_test
+-    @unittest.skipUnless(sys.platform.startswith("linux"), "linux-only")
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_strtol(self, threads=None):
+         test_bin = os.path.join(bin_location, "tests", "x86_64", "strtol_test")
+         # disabling auto_load_libs increases the execution time of the test case.
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 7c85404c2a..f4b0501187 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -32577,6 +32577,102 @@ (define-public python-itanium-demangle
 extracting type information.")
     (license license:bsd-0)))
 
+(define-public python-angr
+  (package
+    (name "python-angr")
+    (version "9.2.46")
+    (source
+     (origin
+       (method git-fetch)
+       (patches (search-patches "python-angr-addition-type-error.patch"
+                                "python-angr-check-exec-deps.patch"))
+       (uri (git-reference
+             (url "https://github.com/angr/angr")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "18y9wyf7va7gvp9zd6lhw82j9a2x2ajsvbawh96xnxzml0jwlwjm"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'patch-tests
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       (let ((coreutils (assoc-ref inputs "coreutils")))
+                         (substitute* "tests/test_vault.py"
+                           (("/bin/false")
+                            (which "false")))
+                         (substitute* "tests/common.py"
+                           (("\\[\"cc\"\\]")
+                            "[\"gcc\"]")))))
+                   (replace 'check
+                     (lambda* (#:key inputs tests? #:allow-other-keys)
+                       (when tests?
+                         (copy-recursively #$(this-package-native-input "binaries")
+                                           "../binaries")
+                         (with-directory-excursion "tests"
+                           ;; test_mips32_missing_offset_in_instructions fails
+                           ;; with capstone 5 and passes with capstone 4. Might
+                           ;; be a capstone regressions, needs investigation.
+                           ;;
+                           ;; test_concrete_memset is a non-deterministic benchmark.
+                           (invoke "pytest" "-vv" "-x" "--dist" "loadfile"
+                                   "-k" "not test_mips32_missing_offset_in_instructions and not test_concrete_memset"
+                                   "-n" (number->string (parallel-job-count)))))))
+                   (add-before 'build 'set-cc
+                     (lambda _
+                       (setenv "CC" "gcc"))))))
+    (propagated-inputs (list python-ailment
+                             python-archinfo
+                             python-cachetools
+                             python-cffi
+                             python-claripy
+                             python-cle
+                             python-colorama
+                             python-cppheaderparser
+                             python-dpkt
+                             python-gitpython
+                             python-mulpyplexer
+                             python-nampa
+                             python-networkx
+                             python-protobuf
+                             python-psutil
+                             python-itanium-demangle
+                             python-pycparser
+                             python-pyvex
+                             python-progressbar2
+                             python-rpyc
+                             python-sortedcontainers
+                             python-sqlalchemy
+                             python-sympy
+                             unicorn))
+    (native-inputs `(("python-pytest" ,python-pytest)
+                     ("python-pytest-xdist" ,python-pytest-xdist)
+                     ("binaries"
+                      ;; This repository ships several binaries used only for testing
+                      ;; purpose.  The binaries are not executed and not part of the
+                      ;; angr distribution, they are only used to test angr's binary
+                      ;; analysis capabilities.  In the context of the GNU FSDG, these
+                      ;; files should be considered non-functional data.
+                      ,(origin
+                         (method git-fetch)
+                         (uri (git-reference (url
+                                              "https://github.com/angr/binaries")
+                                             (commit (string-append "v"
+                                                                    version))))
+                         (file-name (git-file-name "angr-binaries" version))
+                         (sha256 (base32
+                                  "1f286b2239zavxzwg1184hj1zs380cr9qr549mvy3vywvm8bsmgr"))))))
+    (home-page "https://github.com/angr/angr")
+    (synopsis "Multi-architecture binary analysis toolkit")
+    (description
+     "This package provides a versatile binary analysis platform with the
+ability to perform dynamic symbolic execution as well as various
+static analyses directly on binaries.  As such, it can be used for all
+kinds of reverse engineering, vulnerability discovery, exploit
+generation, and software testing purposes.")
+    (license license:bsd-2)))
+
 (define-public python-peachpy
   ;; There is no tag in this repo.
   (let ((commit "913d74c35a6b1d330e90bfc055208ce5b06b35a0")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (18 preceding siblings ...)
  2024-03-10 20:09 ` [bug#69074] [PATCH v2 01/14] gnu: Add python-itanium-demangle soeren
@ 2024-03-10 20:12 ` Sören Tempel
  2024-03-10 22:46   ` Troy Figiel
  2024-07-04 14:05 ` Sören Tempel
                   ` (2 subsequent siblings)
  22 siblings, 1 reply; 78+ messages in thread
From: Sören Tempel @ 2024-03-10 20:12 UTC (permalink / raw)
  To: 69074; +Cc: troy

Hi,

Thanks again for your feedback!

I believe I implemented most of your suggestions. Most importantly, I
believe, I resolved the cyclic dependency between python-xyz.scm and
engineering.scm. Further comments below.

> - Regarding binaries, I am honestly not sure how these would be best handled.
>   They are binaries, but without them there might not be much to test anyway...
>   A second opinion would be good here.

I don't think there is an issue with the binaries. angr is a binary
analysis tools. Naturally, the test suite will need sample binaries
for testing purposes. The GNU FSDG has an explicit clause regarding
"non-functional data", I believe this very much applies here as these
binaries are not executed and only needed for testing angr's analysis
capabilities. Without the binaries there are no tests to run for angr.
I would strongly advocate for not disabling the angr test suite as
running it on Guix has resulted in the discovery bugs both in angr
and in capstone [1, 2].

> I noticed you set them to version 9.2.46, but this is not the latest version.

Newer version of angr will require an update of the python-rich and
python-pygments Guix package. Since this would entail a lot of rebuilds
(and the upstream integration of the present changeset has already been
quite effortful), I opted for packaging an "older" version of angr for
now which does not depend on python-rich yet. As soon as python-rich and
python-pygments are updated, we can update angr too.

> The versions of all other angr packages you added are also set to
> 9.2.46. It looks like this is on purpose, or not?

This is intended, all of these packages are distributed by the angr
development team and need to be set to the same version as angr itself.
I added a corresponding comment.

> I see that you back ported some upstream patches. I tend to use patches
> more as a last resort and whenever possible I stick to upstream
> versions and commits (in that order of preference).

With the exception of one patch these are all upstreamed patches. I
don't want to package unreleased Git versions of these packages and
I think it's therefore preferable to just backport the bug fixes. Also
consider that angr is very sensitive to versions of packages distributed
by angr developers (see the prior comment).

> - Hope this helps! The rest LGTM. I will ping the Python team, so
> someone with commit rights can have a look.

Yea, the feedback definitely helps. Would also love to hear from the
Python team. What is left to do in order to get this merged?

Greetings
Sören

[1]: https://github.com/angr/angr/pull/4443
[2]: https://github.com/capstone-engine/capstone/pull/2240




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-03-10 20:12 ` [bug#69074] [PATCH] " Sören Tempel
@ 2024-03-10 22:46   ` Troy Figiel
  2024-03-11  8:50     ` Sören Tempel
  0 siblings, 1 reply; 78+ messages in thread
From: Troy Figiel @ 2024-03-10 22:46 UTC (permalink / raw)
  To: 69074; +Cc: Sören Tempel


[-- Attachment #1.1.1: Type: text/plain, Size: 2963 bytes --]

Hi Sören,

On 2024-03-10 21:12, Sören Tempel wrote:
> I don't think there is an issue with the binaries. angr is a binary
> analysis tools. Naturally, the test suite will need sample binaries
> for testing purposes. The GNU FSDG has an explicit clause regarding
> "non-functional data", I believe this very much applies here as these
> binaries are not executed and only needed for testing angr's analysis
> capabilities. Without the binaries there are no tests to run for angr.
> I would strongly advocate for not disabling the angr test suite as
> running it on Guix has resulted in the discovery bugs both in angr
> and in capstone [1, 2].

Thanks for finding some references. I also found Poppler ran into a
similar problem [1]. I am in favour of having these tests too, but I
think the difficult part will be the licensing. AFAIK we would have to
make sure all binaries that are included can be freely distributed.

I had a quick look and most (if not all) binaries are free. I would also
assume, if the angr authors are distributing the binaries in this way,
it should very likely be fine. I will have a more in-depth look the
coming week, feel free to do so as well.

By the way, I see the tests for python-cle require binaries. Are these
the same binaries as used for the python-angr tests? I didn't try it
out, but if so, it might be possible to run those tests during the build
as well.

> Newer version of angr will require an update of the python-rich and
> python-pygments Guix package. Since this would entail a lot of rebuilds
> (and the upstream integration of the present changeset has already been
> quite effortful), I opted for packaging an "older" version of angr for
> now which does not depend on python-rich yet. As soon as python-rich and
> python-pygments are updated, we can update angr too.

Sounds good!

> This is intended, all of these packages are distributed by the angr
> development team and need to be set to the same version as angr itself.
> I added a corresponding comment.

Super!

> With the exception of one patch these are all upstreamed patches. I
> don't want to package unreleased Git versions of these packages and
> I think it's therefore preferable to just backport the bug fixes. Also
> consider that angr is very sensitive to versions of packages distributed
> by angr developers (see the prior comment).

Fair enough, I see all patches that come from commits and PRs have a
reference, so it shouldn't be too hard to check whether they should be
removed/updated when updating the package version.

> What is left to do in order to get this merged?

We have to find someone with commit rights :-) I pinged the Python team
before, but might be good to do so again once we are sure about the
licensing of the binaries. I will keep you posted. The rest LGTM.

Best wishes,

Troy

[1] https://lists.gnu.org/archive/html/guix-devel/2022-06/msg00394.html

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 6367 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-03-10 22:46   ` Troy Figiel
@ 2024-03-11  8:50     ` Sören Tempel
  0 siblings, 0 replies; 78+ messages in thread
From: Sören Tempel @ 2024-03-11  8:50 UTC (permalink / raw)
  To: Troy Figiel; +Cc: 69074

Hi Troy,

Troy Figiel <troy@troyfigiel.com> wrote:
> By the way, I see the tests for python-cle require binaries. Are these
> the same binaries as used for the python-angr tests? I didn't try it
> out, but if so, it might be possible to run those tests during the build
> as well.

Yes, python-cle requires the same binaries. I just didn't enable those
tests yet as I did not want to invest additional work into tests based
on these binaries until someone with commit access confirms that it is
ok to use these as non-functional data in the tests.

> > What is left to do in order to get this merged?
> 
> We have to find someone with commit rights :-) I pinged the Python team
> before, but might be good to do so again once we are sure about the
> licensing of the binaries. I will keep you posted. The rest LGTM.

Great! And thanks again for your feedback it was really valuable.

Greetings
Sören




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (19 preceding siblings ...)
  2024-03-10 20:12 ` [bug#69074] [PATCH] " Sören Tempel
@ 2024-07-04 14:05 ` Sören Tempel
  2024-07-04 14:54   ` jgart via Guix-patches via
  2024-07-04 20:05 ` [bug#69074] [PATCH v3 01/14] gnu: Add python-itanium-demangle soeren
  2024-07-11 21:27 ` [bug#69074] [PATCH 01/11] gnu: Add python-keystone-engine soeren
  22 siblings, 1 reply; 78+ messages in thread
From: Sören Tempel @ 2024-07-04 14:05 UTC (permalink / raw)
  To: 69074; +Cc: sharlatanus, me, lars, troy, jgart, marius, tanguy

Hello again,

Troy Figiel <troy@troyfigiel.com> wrote:
> Hope this helps! The rest LGTM. I will ping the Python team, so someone with commit rights can have a look.

Any updates on this? This has been stale for a while now, there have
also been various new angr releases since. Is there are a chance that
this could be reviewed by some with commit rights so that I know
if it's worthwhile to invest the additional effort to update?

Best,
Sören




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-07-04 14:05 ` Sören Tempel
@ 2024-07-04 14:54   ` jgart via Guix-patches via
  2024-07-04 20:26     ` Sören Tempel
  0 siblings, 1 reply; 78+ messages in thread
From: jgart via Guix-patches via @ 2024-07-04 14:54 UTC (permalink / raw)
  To: 69074; +Cc: Troy Figiel, Sören Tempel


> Any updates on this? This has been stale for a while now, there have
> also been various new angr releases since. Is there are a chance that
> this could be reviewed by some with commit rights so that I know
> if it's worthwhile to invest the additional effort to update?

Hi, I can prioritize to take sometime to look next week if someone can
send an updated patch that applies to master without conflicts.

Just CC me when that patch is here.
-- 
all the best,
jgart




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v3 01/14] gnu: Add python-itanium-demangle.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (20 preceding siblings ...)
  2024-07-04 14:05 ` Sören Tempel
@ 2024-07-04 20:05 ` soeren
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 02/14] gnu: Add python-keystone-engine soeren
                     ` (12 more replies)
  2024-07-11 21:27 ` [bug#69074] [PATCH 01/11] gnu: Add python-keystone-engine soeren
  22 siblings, 13 replies; 78+ messages in thread
From: soeren @ 2024-07-04 20:05 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-itanium-demangle): New variable.
---
 gnu/packages/python-xyz.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 36f75b4b40..a727f1c0ba 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -33804,6 +33804,36 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-itanium-demangle
+  (package
+    (name "python-itanium-demangle")
+    (version "1.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/whitequark/python-itanium_demangler")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1q47aqm5z3db6pasdzw05d6236vnb8hnapfy88fcmn9dr5ym98r3"))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (home-page "https://github.com/whitequark/python-itanium_demangler")
+    (synopsis "Pure Python Itanium C++ ABI demangler")
+    (description
+     "This Python module provides an implementation of the Itanium C++
+ABI symbol mangling language.  The demangler generates an abstract
+syntax tree from mangled symbols, which can be used for directly
+extracting type information.")
+    (license license:bsd-0)))
+
 (define-public python-peachpy
   ;; There is no tag in this repo.
   (let ((commit "913d74c35a6b1d330e90bfc055208ce5b06b35a0")

base-commit: eeb24a50d2f1f78095bdb16b40ddb93bb51474bc




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v3 02/14] gnu: Add python-keystone-engine.
  2024-07-04 20:05 ` [bug#69074] [PATCH v3 01/14] gnu: Add python-itanium-demangle soeren
@ 2024-07-04 20:05   ` soeren
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 03/14] gnu: Add python-mulpyplexer soeren
                     ` (11 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-04 20:05 UTC (permalink / raw)
  To: 69074

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/emulators.scm (python-keystone-engine): New variable.
---
 gnu/packages/emulators.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index 4471de9040..602b75984b 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -2702,6 +2702,28 @@ (define-public uxn
 stack-machine, written in ANSI C.  Graphical output is implemented using SDL2.")
       (license license:expat))))
 
+(define-public python-keystone-engine
+  (package
+    (name "python-keystone-engine")
+    (version "0.9.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "keystone-engine" version))
+       (sha256
+        (base32 "1xahdr6bh3dw5swrc2r8kqa8ljhqlb7k2kxv5mrw5rhcmcnzcyig"))))
+    (native-inputs (list cmake))
+    (build-system pyproject-build-system)
+    (home-page "https://www.keystone-engine.org")
+    (synopsis
+     "Lightweight multi-platform, multi-architecture assembler framework")
+    (description
+     "Keystone is a lightweight multi-platform, multi-architecture
+assembler framework.  It supports a wide-range of different architectures
+and offers an intuitive architecture-neutral API for interacting with
+assembly for these architectures.")
+    (license license:gpl2)))
+
 (define-public emu8051
   (let ((commit "5dc681275151c4a5d7b85ec9ff4ceb1b25abd5a8")
         (revision "1"))




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v3 03/14] gnu: Add python-mulpyplexer.
  2024-07-04 20:05 ` [bug#69074] [PATCH v3 01/14] gnu: Add python-itanium-demangle soeren
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 02/14] gnu: Add python-keystone-engine soeren
@ 2024-07-04 20:05   ` soeren
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 04/14] gnu: Add python-nampa soeren
                     ` (10 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-04 20:05 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-mulpyplexer): New variable.
---
 gnu/packages/python-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index a727f1c0ba..5855d2939c 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -33804,6 +33804,29 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-mulpyplexer
+  (package
+    (name "python-mulpyplexer")
+    (version "0.09")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "mulpyplexer" version))
+       (sha256
+        (base32 "0c5xzci1djy1yi9hxxh8g67l6ms8r7ad7ja20pv8hfbdysdrwkhl"))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (invoke "python" "mulpyplexer.py")))))))
+    (home-page "https://github.com/zardus/mulpyplexer/")
+    (synopsis "Multiplexes interactions with lists of Python objects")
+    (description "This module provides utilities for multiplexing
+interactions with lists of Python objects.")
+    (license license:bsd-2)))
+
 (define-public python-itanium-demangle
   (package
     (name "python-itanium-demangle")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v3 04/14] gnu: Add python-nampa.
  2024-07-04 20:05 ` [bug#69074] [PATCH v3 01/14] gnu: Add python-itanium-demangle soeren
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 02/14] gnu: Add python-keystone-engine soeren
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 03/14] gnu: Add python-mulpyplexer soeren
@ 2024-07-04 20:05   ` soeren
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 05/14] gnu: Add python-rpyc soeren
                     ` (9 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-04 20:05 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-nampa): New variable.
---
 gnu/packages/python-xyz.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 5855d2939c..99e51f2d3a 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -33804,6 +33804,26 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-nampa
+  (package
+    (name "python-nampa")
+    (version "0.1.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "nampa" version))
+       (sha256
+        (base32 "0k6cq2gflpkm40qhgqbbcjmq5lq589c15bmk567qyh3d08062hvd"))))
+    (build-system pyproject-build-system)
+    (propagated-inputs (list python-future))
+    (home-page "https://github.com/thebabush/nampa")
+    (synopsis "Python implementation of IDA Pro's FLIRT technology")
+    (description
+     "This Python module implements the @acronym{FLIRT, Fast Library Identification
+and Recognition Technology}.  This technology is useful for identifying
+common library subroutines in disassembled binaries.")
+    (license license:lgpl3)))
+
 (define-public python-mulpyplexer
   (package
     (name "python-mulpyplexer")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v3 05/14] gnu: Add python-rpyc.
  2024-07-04 20:05 ` [bug#69074] [PATCH v3 01/14] gnu: Add python-itanium-demangle soeren
                     ` (2 preceding siblings ...)
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 04/14] gnu: Add python-nampa soeren
@ 2024-07-04 20:05   ` soeren
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 06/14] gnu: Add python-pysmt soeren
                     ` (8 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-04 20:05 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-rpyc): New variable.
---
 gnu/packages/python-xyz.scm | 40 +++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 99e51f2d3a..0033f4df0f 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -33804,6 +33804,46 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-rpyc
+  (package
+    (name "python-rpyc")
+    (version "5.3.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/tomerfiliba-org/rpyc")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "15mnp9qkyw3mmxmr5y4kf3xkvxyp00n892vqaqwznr7al35apgnr"))
+       (snippet '(begin
+                   ;; Disable deploy tests, these rely on OpenSSH and require
+                   ;; configuring the SSH client manually to accept the host key.
+                   (delete-file "tests/test_deploy.py")
+                   ;; Disable tests requiring network access.  These tests
+                   ;; presently fail with the error "Network is unreachable".
+                   (delete-file "tests/test_registry.py")))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (propagated-inputs (list python-hatchling python-plumbum))
+    (home-page "https://github.com/tomerfiliba-org/rpyc")
+    (synopsis
+     "Remote Python Call (RPyC) is a symmetric distributed computing library")
+    (description
+     "This Python module enables remote procedure calls, clustering, and
+distributed-computing.  For this purpose, it makes use of object-proxying, a technique
+that employs python's dynamic nature, to overcome the physical boundaries between
+processes and computers, so that remote objects can be manipulated as if they
+were local.")
+    (license license:expat)))
+
 (define-public python-nampa
   (package
     (name "python-nampa")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v3 06/14] gnu: Add python-pysmt.
  2024-07-04 20:05 ` [bug#69074] [PATCH v3 01/14] gnu: Add python-itanium-demangle soeren
                     ` (3 preceding siblings ...)
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 05/14] gnu: Add python-rpyc soeren
@ 2024-07-04 20:05   ` soeren
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 07/14] gnu: Add python-claripy soeren
                     ` (7 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-04 20:05 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/patches/python-pysmt-fix-pow-return-type.patch:
New patch.
* gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch:
New patch.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/python-xyz.scm (python-pysmt): New variable.
---
 gnu/local.mk                                  |   2 +
 .../python-pysmt-fix-pow-return-type.patch    | 258 ++++++++++++++++++
 ...-pysmt-fix-smtlib-serialization-test.patch |  86 ++++++
 gnu/packages/python-xyz.scm                   |  32 +++
 4 files changed, 378 insertions(+)
 create mode 100644 gnu/packages/patches/python-pysmt-fix-pow-return-type.patch
 create mode 100644 gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 11f393dac0..3327161547 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1972,6 +1972,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-pyan3-fix-absolute-path-bug.patch \
   %D%/packages/patches/python-pyan3-fix-positional-arguments.patch \
   %D%/packages/patches/python-pygpgme-fix-pinentry-tests.patch	\
+  %D%/packages/patches/python-pysmt-fix-pow-return-type.patch	\
+  %D%/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch	\
   %D%/packages/patches/python-pytorch-fix-codegen.patch		\
   %D%/packages/patches/python-pytorch-runpath.patch		\
   %D%/packages/patches/python-pytorch-system-libraries.patch	\
diff --git a/gnu/packages/patches/python-pysmt-fix-pow-return-type.patch b/gnu/packages/patches/python-pysmt-fix-pow-return-type.patch
new file mode 100644
index 0000000000..0ec2d41b3c
--- /dev/null
+++ b/gnu/packages/patches/python-pysmt-fix-pow-return-type.patch
@@ -0,0 +1,258 @@
+Backport of an upstream patch which fixes a test failure with our
+packaged version of the Z3 SMT solver.
+
+Taken from: https://github.com/pysmt/pysmt/commit/f522e8cd8f3e75ff85f5eae29b427e18a6701859
+
+diff --git a/pysmt/formula.py b/pysmt/formula.py
+index ea4b46c..6cb9cbf 100644
+--- a/pysmt/formula.py
++++ b/pysmt/formula.py
+@@ -252,11 +252,7 @@ class FormulaManager(object):
+ 
+         if base.is_constant():
+             val = base.constant_value() ** exponent.constant_value()
+-            if base.is_constant(types.REAL):
+-                return self.Real(val)
+-            else:
+-                assert base.is_constant(types.INT)
+-                return self.Int(val)
++            return self.Real(val)
+         return self.create_node(node_type=op.POW, args=(base, exponent))
+ 
+     def Div(self, left, right):
+diff --git a/pysmt/logics.py b/pysmt/logics.py
+index ef88dd6..9dc45b1 100644
+--- a/pysmt/logics.py
++++ b/pysmt/logics.py
+@@ -495,6 +495,12 @@ QF_NRA = Logic(name="QF_NRA",
+                real_arithmetic=True,
+                linear=False)
+ 
++QF_NIRA = Logic(name="QF_NIRA",
++                description="""Quantifier-free integer and real arithmetic.""",
++                quantifier_free=True,
++                integer_arithmetic=True,
++                real_arithmetic=True,
++                linear=False)
+ 
+ QF_RDL = Logic(name="QF_RDL",
+                description=\
+@@ -619,41 +625,41 @@ QF_AUFBVLIRA = Logic(name="QF_AUFBVLIRA",
+ AUTO = Logic(name="Auto",
+              description="Special logic used to indicate that the logic to be used depends on the formula.")
+ 
+-SMTLIB2_LOGICS = frozenset([ AUFLIA,
+-                             AUFLIRA,
+-                             AUFNIRA,
+-                             ALIA,
+-                             LRA,
+-                             LIA,
+-                             NIA,
+-                             NRA,
+-                             UFLRA,
+-                             UFNIA,
+-                             UFLIRA,
+-                             QF_ABV,
+-                             QF_AUFBV,
+-                             QF_AUFLIA,
+-                             QF_ALIA,
+-                             QF_AX,
+-                             QF_BV,
+-                             QF_IDL,
+-                             QF_LIA,
+-                             QF_LRA,
+-                             QF_NIA,
+-                             QF_NRA,
+-                             QF_RDL,
+-                             QF_UF,
+-                             QF_UFBV ,
+-                             QF_UFIDL,
+-                             QF_UFLIA,
+-                             QF_UFLRA,
+-                             QF_UFNRA,
+-                             QF_UFNIA,
+-                             QF_UFLIRA,
+-                             QF_SLIA
+-                         ])
+-
+-LOGICS = SMTLIB2_LOGICS | frozenset([ QF_BOOL, BOOL, QF_AUFBVLIRA])
++SMTLIB2_LOGICS = frozenset([AUFLIA,
++                            AUFLIRA,
++                            AUFNIRA,
++                            ALIA,
++                            LRA,
++                            LIA,
++                            NIA,
++                            NRA,
++                            UFLRA,
++                            UFNIA,
++                            UFLIRA,
++                            QF_ABV,
++                            QF_AUFBV,
++                            QF_AUFLIA,
++                            QF_ALIA,
++                            QF_AX,
++                            QF_BV,
++                            QF_IDL,
++                            QF_LIA,
++                            QF_LRA,
++                            QF_NIA,
++                            QF_NRA,
++                            QF_RDL,
++                            QF_UF,
++                            QF_UFBV,
++                            QF_UFIDL,
++                            QF_UFLIA,
++                            QF_UFLRA,
++                            QF_UFNRA,
++                            QF_UFNIA,
++                            QF_UFLIRA,
++                            QF_SLIA
++                            ])
++
++LOGICS = SMTLIB2_LOGICS | frozenset([QF_BOOL, BOOL, QF_AUFBVLIRA, QF_NIRA])
+ 
+ QF_LOGICS = frozenset(_l for _l in LOGICS if _l.quantifier_free)
+ 
+@@ -668,8 +674,8 @@ PYSMT_LOGICS = frozenset([QF_BOOL, QF_IDL, QF_LIA, QF_LRA, QF_RDL, QF_UF, QF_UFI
+                           QF_BV, QF_UFBV,
+                           QF_ABV, QF_AUFBV, QF_AUFLIA, QF_ALIA, QF_AX,
+                           QF_AUFBVLIRA,
+-                          QF_NRA, QF_NIA, UFBV, BV,
+-                      ])
++                          QF_NRA, QF_NIA, QF_NIRA, UFBV, BV,
++                          ])
+ 
+ # PySMT Logics includes additional features:
+ #  - constant arrays: QF_AUFBV  becomes QF_AUFBV*
+@@ -697,7 +703,6 @@ for l in PYSMT_LOGICS:
+         ext_logics.add(nl)
+ 
+ 
+-
+ LOGICS = LOGICS | frozenset(ext_logics)
+ PYSMT_LOGICS = PYSMT_LOGICS | frozenset(ext_logics)
+ 
+diff --git a/pysmt/solvers/z3.py b/pysmt/solvers/z3.py
+index 3fb42b9..210b771 100644
+--- a/pysmt/solvers/z3.py
++++ b/pysmt/solvers/z3.py
+@@ -595,6 +595,8 @@ class Z3Converter(Converter, DagWalker):
+                                              None, None,
+                                              0, None,
+                                              expr.ast)
++        print("Z3: SMTLIB")
++        print(s)
+         stream_in = StringIO(s)
+         r = parser.get_script(stream_in).get_last_formula(self.mgr)
+         key = (askey(expr), None)
+diff --git a/pysmt/test/examples.py b/pysmt/test/examples.py
+index 73455ee..b653185 100644
+--- a/pysmt/test/examples.py
++++ b/pysmt/test/examples.py
+@@ -898,12 +898,12 @@ def get_full_example_formulae(environment=None):
+                     logic=pysmt.logics.QF_NRA
+                 ),
+ 
+-            Example(hr="((p ^ 2) = 0)",
+-                    expr=Equals(Pow(p, Int(2)), Int(0)),
++            Example(hr="((p ^ 2) = 0.0)",
++                    expr=Equals(Pow(p, Int(2)), Real(0)),
+                     is_valid=False,
+                     is_sat=True,
+-                    logic=pysmt.logics.QF_NIA
+-                ),
++                    logic=pysmt.logics.QF_NIRA
++                    ),
+ 
+             Example(hr="((r ^ 2.0) = 0.0)",
+                     expr=Equals(Pow(r, Real(2)), Real(0)),
+diff --git a/pysmt/test/test_back.py b/pysmt/test/test_back.py
+index bceb45b..7a0ad63 100644
+--- a/pysmt/test/test_back.py
++++ b/pysmt/test/test_back.py
+@@ -55,10 +55,10 @@ class TestBasic(TestCase):
+         res = msat.converter.back(term)
+         self.assertFalse(f == res)
+ 
+-    def do_back(self, solver_name, z3_string_buffer=False):
++    def do_back(self, solver_name, via_smtlib=False):
+         for formula, _, _, logic in get_example_formulae():
+             if logic.quantifier_free:
+-                if logic.theory.custom_type and z3_string_buffer:
++                if logic.theory.custom_type and via_smtlib:
+                     # Printing of declare-sort from Z3 is not conformant
+                     # with the SMT-LIB. We might consider extending our
+                     # parser.
+@@ -67,7 +67,7 @@ class TestBasic(TestCase):
+                     s = Solver(name=solver_name, logic=logic)
+                     term = s.converter.convert(formula)
+                     if solver_name == "z3":
+-                        if z3_string_buffer:
++                        if via_smtlib:
+                             res = s.converter.back_via_smtlib(term)
+                         else:
+                             res = s.converter.back(term)
+@@ -84,8 +84,8 @@ class TestBasic(TestCase):
+ 
+     @skipIfSolverNotAvailable("z3")
+     def test_z3_back_formulae(self):
+-        self.do_back("z3", z3_string_buffer=False)
+-        self.do_back("z3", z3_string_buffer=True)
++        self.do_back("z3", via_smtlib=True)
++        self.do_back("z3", via_smtlib=False)
+ 
+ 
+ if __name__ == '__main__':
+diff --git a/pysmt/type_checker.py b/pysmt/type_checker.py
+index b700fcf..7ce05aa 100644
+--- a/pysmt/type_checker.py
++++ b/pysmt/type_checker.py
+@@ -33,6 +33,8 @@ class SimpleTypeChecker(walkers.DagWalker):
+ 
+     def __init__(self, env=None):
+         walkers.DagWalker.__init__(self, env=env)
++        # Return None if the type cannot be computed rather than
++        # raising an exception.
+         self.be_nice = False
+ 
+     def _get_key(self, formula, **kwargs):
+@@ -42,7 +44,7 @@ class SimpleTypeChecker(walkers.DagWalker):
+         """ Returns the pysmt.types type of the formula """
+         res = self.walk(formula)
+         if not self.be_nice and res is None:
+-            raise PysmtTypeError("The formula '%s' is not well-formed" \
++            raise PysmtTypeError("The formula '%s' is not well-formed"
+                                  % str(formula))
+         return res
+ 
+@@ -114,7 +116,7 @@ class SimpleTypeChecker(walkers.DagWalker):
+ 
+     def walk_bv_comp(self, formula, args, **kwargs):
+         # We check that all children are BV and the same size
+-        a,b = args
++        a, b = args
+         if a != b or (not a.is_bv_type()):
+             return None
+         return BVType(1)
+@@ -187,7 +189,7 @@ class SimpleTypeChecker(walkers.DagWalker):
+         if args[0].is_bool_type():
+             raise PysmtTypeError("The formula '%s' is not well-formed."
+                                  "Equality operator is not supported for Boolean"
+-                                 " terms. Use Iff instead." \
++                                 " terms. Use Iff instead."
+                                  % str(formula))
+         elif args[0].is_bv_type():
+             return self.walk_bv_to_bool(formula, args)
+@@ -324,10 +326,7 @@ class SimpleTypeChecker(walkers.DagWalker):
+     def walk_pow(self, formula, args, **kwargs):
+         if args[0] != args[1]:
+             return None
+-        # Exponent must be positive for INT
+-        if args[0].is_int_type() and formula.arg(1).constant_value() < 0 :
+-            return None
+-        return args[0]
++        return REAL
+ 
+ # EOC SimpleTypeChecker
+ 
diff --git a/gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch b/gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch
new file mode 100644
index 0000000000..eee555f807
--- /dev/null
+++ b/gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch
@@ -0,0 +1,86 @@
+Backport of an upstream patch fixing a test suite failure.
+
+Taken from: https://github.com/pysmt/pysmt/commit/a246669a487aff69f5da34570ef867841d18508a
+
+diff --git a/pysmt/test/smtlib/test_parser_examples.py b/pysmt/test/smtlib/test_parser_examples.py
+index cca4194..c0852be 100644
+--- a/pysmt/test/smtlib/test_parser_examples.py
++++ b/pysmt/test/smtlib/test_parser_examples.py
+@@ -29,6 +29,7 @@ from pysmt.shortcuts import Iff
+ from pysmt.shortcuts import read_smtlib, write_smtlib, get_env
+ from pysmt.exceptions import PysmtSyntaxError
+ 
++
+ class TestSMTParseExamples(TestCase):
+ 
+     def test_parse_examples(self):
+@@ -41,7 +42,6 @@ class TestSMTParseExamples(TestCase):
+             buf = StringIO()
+             script_out = smtlibscript_from_formula(f_out)
+             script_out.serialize(outstream=buf)
+-            #print(buf)
+ 
+             buf.seek(0)
+             parser = SmtLibParser()
+@@ -49,7 +49,6 @@ class TestSMTParseExamples(TestCase):
+             f_in = script_in.get_last_formula()
+             self.assertEqual(f_in.simplify(), f_out.simplify())
+ 
+-
+     @skipIfNoSolverForLogic(logics.QF_BV)
+     def test_parse_examples_bv(self):
+         """For BV we represent a superset of the operators defined in SMT-LIB.
+@@ -108,7 +107,18 @@ class TestSMTParseExamples(TestCase):
+             self.assertValid(Iff(f_in, f_out), f_in.serialize())
+ 
+     def test_dumped_logic(self):
+-        # Dumped logic matches the logic in the example
++        # Dumped logic matches the logic in the example.
++        #
++        # There are a few cases where we use a logic
++        # that does not exist in SMT-LIB, and the SMT-LIB
++        # serialization logic will find a logic that
++        # is more expressive. We need to adjust the test
++        # for those cases (see rewrite dict below).
++        rewrite = {
++            logics.QF_BOOL: logics.QF_UF,
++            logics.BOOL: logics.LRA,
++            logics.QF_NIRA: logics.AUFNIRA,
++        }
+         fs = get_example_formulae()
+ 
+         for (f_out, _, _, logic) in fs:
+@@ -121,14 +131,9 @@ class TestSMTParseExamples(TestCase):
+             for cmd in script_in:
+                 if cmd.name == "set-logic":
+                     logic_in = cmd.args[0]
+-                    if logic == logics.QF_BOOL:
+-                        self.assertEqual(logic_in, logics.QF_UF)
+-                    elif logic == logics.BOOL:
+-                        self.assertEqual(logic_in, logics.LRA)
+-                    else:
+-                        self.assertEqual(logic_in, logic, script_in)
++                    self.assertEqual(logic_in, rewrite.get(logic, logic))
+                     break
+-            else: # Loops exited normally
++            else:  # Loops exited normally
+                 print("-"*40)
+                 print(script_in)
+ 
+@@ -136,7 +141,7 @@ class TestSMTParseExamples(TestCase):
+         fs = get_example_formulae()
+ 
+         fdi, tmp_fname = mkstemp()
+-        os.close(fdi) # Close initial file descriptor
++        os.close(fdi)  # Close initial file descriptor
+         for (f_out, _, _, _) in fs:
+             write_smtlib(f_out, tmp_fname)
+             # with open(tmp_fname) as fin:
+@@ -197,7 +202,6 @@ class TestSMTParseExamples(TestCase):
+         f_in = script.get_last_formula()
+         self.assertSat(f_in)
+ 
+-
+     def test_int_promotion_define_fun(self):
+         script = """
+         (define-fun x () Int 8)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 0033f4df0f..3e55b5f661 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -33804,6 +33804,38 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-pysmt
+  (package
+    (name "python-pysmt")
+    (version "0.9.5")
+    (source
+     (origin
+       (method git-fetch)
+       (patches (search-patches "python-pysmt-fix-pow-return-type.patch"
+                 "python-pysmt-fix-smtlib-serialization-test.patch"))
+       (uri (git-reference
+             (url "https://github.com/pysmt/pysmt")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0hrxv23y5ip4ijfx5pvbwc2fq4zg9jz42wc9zqgqm0g0mjc9ckvh"))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (add-before 'check 'set-pysmt-solver
+                    (lambda _
+                      (setenv "PYSMT_SOLVER" "z3"))))))
+    (native-inputs (list python-pytest))
+    (propagated-inputs (list z3))
+    (home-page "https://github.com/pysmt/pysmt")
+    (synopsis
+     "Solver-agnostic library for SMT formula manipulation and solving")
+    (description
+     "This Python module provides a solver-agnostic abstraction for
+working with @acronym{SMT, Satisfiability Modulo Theory} formulas.  For example,
+it allows manipulation and solving such formulas.")
+    (license license:asl2.0)))
+
 (define-public python-rpyc
   (package
     (name "python-rpyc")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v3 07/14] gnu: Add python-claripy.
  2024-07-04 20:05 ` [bug#69074] [PATCH v3 01/14] gnu: Add python-itanium-demangle soeren
                     ` (4 preceding siblings ...)
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 06/14] gnu: Add python-pysmt soeren
@ 2024-07-04 20:05   ` soeren
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 08/14] gnu: Add python-archinfo soeren
                     ` (6 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-04 20:05 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-claripy): New variable.
---
 gnu/packages/python-xyz.scm | 39 +++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 3e55b5f661..9e685abf17 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -33804,6 +33804,45 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-claripy
+  (package
+    (name "python-claripy")
+    ;; Must be the same version as python-angr.
+    (version "9.2.46")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/angr/claripy")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0nmawpi1596d9plafrp2db36cjsidy2fagkzkja51jwlx2m1ngai"))
+       (modules '((guix build utils)))
+       (snippet '(begin
+                   (substitute* "setup.cfg"
+                     ;; Relax the z3 version constraint.
+                     ;; See https://github.com/angr/claripy/commit/d1fe2df
+                     (("z3-solver==4.10.2.0")
+                      ""))))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (propagated-inputs (list python-cachetools python-decorator python-pysmt
+                             z3))
+    (home-page "https://github.com/angr/claripy")
+    (synopsis "Abstraction layer for constraint solvers")
+    (description
+     "This Python module provides an abstraction layer for interacting
+with constraint solvers.  Specifically, it is intended to be used with
+SMT solvers and is built on top of the Z3 solver.")
+    (license license:bsd-2)))
+
 (define-public python-pysmt
   (package
     (name "python-pysmt")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v3 08/14] gnu: Add python-archinfo.
  2024-07-04 20:05 ` [bug#69074] [PATCH v3 01/14] gnu: Add python-itanium-demangle soeren
                     ` (5 preceding siblings ...)
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 07/14] gnu: Add python-claripy soeren
@ 2024-07-04 20:05   ` soeren
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 09/14] gnu: Add python-pyvex soeren
                     ` (5 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-04 20:05 UTC (permalink / raw)
  To: 69074

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/emulators.scm (python-archinfo): New variable.
---
 gnu/packages/emulators.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index 602b75984b..994abb0fd3 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -66,6 +66,7 @@ (define-module (gnu packages emulators)
   #:use-module (gnu packages cross-base)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages digest)
+  #:use-module (gnu packages engineering)
   #:use-module (gnu packages elf)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fltk)
@@ -2724,6 +2725,33 @@ (define-public python-keystone-engine
 assembly for these architectures.")
     (license license:gpl2)))
 
+(define-public python-archinfo
+  (package
+    (name "python-archinfo")
+    ;; Must be the same version as python-angr.
+    (version "9.2.46")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "archinfo" version))
+       (sha256
+        (base32 "037xfq3wcf8ngayxz9623l4646m780v2102mfbygpzbkkjha1966"))))
+    (build-system pyproject-build-system)
+    (propagated-inputs (list python-capstone python-keystone-engine))
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (home-page "https://github.com/angr/archinfo")
+    (synopsis "Extract architecture-specific information from binaries")
+    (description
+     "Collection of classes that contain architecture-specific information
+information.  Useful for cross-architecture tools (such as @code{python-pyvex}).")
+    (license license:bsd-2)))
+
 (define-public emu8051
   (let ((commit "5dc681275151c4a5d7b85ec9ff4ceb1b25abd5a8")
         (revision "1"))




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v3 09/14] gnu: Add python-pyvex.
  2024-07-04 20:05 ` [bug#69074] [PATCH v3 01/14] gnu: Add python-itanium-demangle soeren
                     ` (6 preceding siblings ...)
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 08/14] gnu: Add python-archinfo soeren
@ 2024-07-04 20:05   ` soeren
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 10/14] gnu: Add python-cle soeren
                     ` (4 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-04 20:05 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/patches/python-pyvex-remove-angr-dependency.patch:
New patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/python-xyz.scm (python-pyvex): New variable.
---
 gnu/local.mk                                  |  1 +
 .../python-pyvex-remove-angr-dependency.patch | 80 +++++++++++++++++++
 gnu/packages/python-xyz.scm                   | 37 +++++++++
 3 files changed, 118 insertions(+)
 create mode 100644 gnu/packages/patches/python-pyvex-remove-angr-dependency.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 3327161547..c88832f08a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1978,6 +1978,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-pytorch-runpath.patch		\
   %D%/packages/patches/python-pytorch-system-libraries.patch	\
   %D%/packages/patches/python-pytorch-without-kineto.patch	\
+  %D%/packages/patches/python-pyvex-remove-angr-dependency.patch	\
   %D%/packages/patches/python-robotframework-atest.patch	\
   %D%/packages/patches/python-robotframework-source-date-epoch.patch \
   %D%/packages/patches/python-robotframework-sshlibrary-rf5-compat.patch \
diff --git a/gnu/packages/patches/python-pyvex-remove-angr-dependency.patch b/gnu/packages/patches/python-pyvex-remove-angr-dependency.patch
new file mode 100644
index 0000000000..dccf22bbc6
--- /dev/null
+++ b/gnu/packages/patches/python-pyvex-remove-angr-dependency.patch
@@ -0,0 +1,80 @@
+This patch removes the angr dependency from the pyvex these, thus
+resolving a circular dependency (as angr depends on pyvex). This
+patch has been taken from upstream.
+
+This patch is a squashed version of the following upstream patches:
+
+* https://github.com/angr/pyvex/commit/61fb26f223a8d8a276b702d2448a12e02c5c9c6b
+* https://github.com/angr/pyvex/commit/a1fb2a4d0826b0e43bd8bbdd00b6db032643ec95
+
+diff --git a/tests/test_spotter.py b/tests/test_spotter.py
+index 9271ccd..bed7dd4 100644
+--- a/tests/test_spotter.py
++++ b/tests/test_spotter.py
+@@ -1,6 +1,5 @@
+ import os
+ 
+-import angr
+ import archinfo
+ 
+ import pyvex
+@@ -98,53 +97,28 @@ class CortexSpotter(GymratLifter):
+ register(CortexSpotter, "ARMEL")
+ 
+ 
+-def test_full_binary():
+-    p = angr.Project(
+-        os.path.join(test_location, "armel", "RTOSDemo.axf.issue_685"),
+-        arch="ARMEL",
+-        auto_load_libs=False,
+-    )
+-    st = p.factory.call_state(0x000013CE + 1)
+-    b = st.block().vex
+-    simgr = p.factory.simulation_manager(st)
+-    simgr.step()
+-    assert b.jumpkind == "Ijk_Sys_syscall"
+-    assert simgr.active[0].regs.ip_at_syscall.args[0] == 0x13FB
+-
+-
+ def test_tmrs():
+-    test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../binaries/tests"))
+-    p = angr.Project(
+-        os.path.join(test_location, "armel", "helloworld"),
+-        arch="ARMEL",
+-        auto_load_libs=False,
+-    )
++    arch = archinfo.arch_from_id("ARMEL")
+     ins = b"\xef\xf3\x08\x82"
+-    b = pyvex.block.IRSB(ins, 1, p.arch)
++    b = pyvex.block.IRSB(ins, 1, arch)
+     assert b.jumpkind == "Ijk_Boring"
+     assert type(b.statements[1].data) == pyvex.expr.Get
+-    assert p.arch.register_names.get(b.statements[1].data.offset, "") == "sp"
++    assert arch.register_names.get(b.statements[1].data.offset, "") == "sp"
+     assert type(b.statements[2]) == pyvex.stmt.Put
+ 
+ 
+ def test_tmsr():
+-    test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../binaries/tests"))
+-    p = angr.Project(
+-        os.path.join(test_location, "armel", "helloworld"),
+-        arch="ARMEL",
+-        auto_load_libs=False,
+-    )
++    arch = archinfo.arch_from_id("ARMEL")
+     inss = b"\x82\xf3\x08\x88"
+-    b = pyvex.block.IRSB(inss, 1, p.arch, opt_level=3)
++    b = pyvex.block.IRSB(inss, 1, arch, opt_level=3)
+     assert b.jumpkind == "Ijk_Boring"
+     assert type(b.statements[1].data) == pyvex.expr.Get
+-    assert p.arch.register_names.get(b.statements[1].data.offset, "") == "r2"
++    assert arch.register_names.get(b.statements[1].data.offset, "") == "r2"
+     assert type(b.statements[2]) == pyvex.stmt.Put
+ 
+ 
+ if __name__ == "__main__":
+     test_basic()
+     test_embedded()
+-    test_full_binary()
+     test_tmrs()
+     test_tmsr()
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 9e685abf17..7c1a9b04ec 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -199,6 +199,7 @@ (define-module (gnu packages python-xyz)
   #:use-module (gnu packages docker)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages elf)
+  #:use-module (gnu packages emulators)
   #:use-module (gnu packages enchant)
   #:use-module (gnu packages file)
   #:use-module (gnu packages fonts)
@@ -33804,6 +33805,42 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-pyvex
+  (package
+    (name "python-pyvex")
+    ;; Must be the same version as python-angr.
+    (version "9.2.46")
+    (source
+     (origin
+       (method url-fetch)
+       (patches (search-patches "python-pyvex-remove-angr-dependency.patch"))
+       (uri (pypi-uri "pyvex" version))
+       (sha256
+        (base32 "1v64rn7gxy6fg065bgsy38z6r494k5ri5r6sn4g08hjj32ihx1ka"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:phases #~(modify-phases %standard-phases
+                   (replace 'check
+                     (lambda* (#:key tests? #:allow-other-keys)
+                       (when tests?
+                         (with-directory-excursion "tests"
+                           (invoke "python" "-m" "unittest")))))
+
+                   (add-before 'build 'set-cc-native
+                     (lambda _
+                       (setenv "CC" #$(cc-for-target))
+                       (setenv "CC_NATIVE" "gcc"))))))
+    (propagated-inputs (list python-archinfo python-bitstring python-cffi))
+    (home-page "https://github.com/angr/pyvex")
+    (synopsis "Python interface to libVEX and VEX IR")
+    (description
+     "This package provides a Python interface the libVEX and VEX IR.
+VEX is the intermediate representation (also known as intermediate
+language) used by the Valgrind analysis tool.  As such, VEX is designed
+to enable all kinds of binary analysis tasks.")
+    (license license:bsd-2)))
+
 (define-public python-claripy
   (package
     (name "python-claripy")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v3 10/14] gnu: Add python-cle.
  2024-07-04 20:05 ` [bug#69074] [PATCH v3 01/14] gnu: Add python-itanium-demangle soeren
                     ` (7 preceding siblings ...)
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 09/14] gnu: Add python-pyvex soeren
@ 2024-07-04 20:05   ` soeren
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 11/14] gnu: Add python-ailment soeren
                     ` (3 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-04 20:05 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-cle): New variable.
---
 gnu/packages/python-xyz.scm | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 7c1a9b04ec..e256a322e7 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -33805,6 +33805,32 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-cle
+  (package
+    (name "python-cle")
+    ;; Must be the same version as python-angr.
+    (version "9.2.46")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "cle" version))
+       (sha256
+        (base32 "0mswv9gd2p2ws7zfsshqv5ybbj27wkdwakdcknq4vsrx9ry9k4yc"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:tests? #f))
+    (propagated-inputs (list python-pefile python-pyelftools python-pyvex
+                             python-sortedcontainers))
+    (native-inputs (list python-cffi))
+    (home-page "https://github.com/angr/cle")
+    (synopsis "Python loader for binaries and their associated libraries")
+    (description
+     "CLE loads binaries and their associated libraries, resolves
+imports and provides an abstraction of process memory the same way as if
+it was loader by the operating system's loader.")
+    (license license:bsd-2)))
+
 (define-public python-pyvex
   (package
     (name "python-pyvex")
@@ -33827,7 +33853,7 @@ (define-public python-pyvex
                          (with-directory-excursion "tests"
                            (invoke "python" "-m" "unittest")))))
 
-                   (add-before 'build 'set-cc-native
+                   (add-before 'build 'set-cc
                      (lambda _
                        (setenv "CC" #$(cc-for-target))
                        (setenv "CC_NATIVE" "gcc"))))))




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v3 11/14] gnu: Add python-ailment.
  2024-07-04 20:05 ` [bug#69074] [PATCH v3 01/14] gnu: Add python-itanium-demangle soeren
                     ` (8 preceding siblings ...)
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 10/14] gnu: Add python-cle soeren
@ 2024-07-04 20:05   ` soeren
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 12/14] gnu: unicorn: Update to 2.0.1.post1 soeren
                     ` (2 subsequent siblings)
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-04 20:05 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-ailment): New variable.
---
 gnu/packages/python-xyz.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index e256a322e7..6797bba3bd 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -33805,6 +33805,34 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-ailment
+  (package
+    (name "python-ailment")
+    ;; Must be the same version as python-angr.
+    (version "9.2.46")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "ailment" version))
+       (sha256
+        (base32 "073fcssbjis1ckwv2w0dcz2dfl6715bj4d4qdhspajj911mvng2f"))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    ;; Many tests are skipped due to cyclic dependencies.
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (home-page "https://github.com/angr/ailment")
+    (synopsis "The angr intermediate language")
+    (description
+     "This Python module implements an @acronym{IL, Intermediate Language},
+also known as @acronym{IR, Intermediate Representation}, used by the angr
+binary analysis platform.")
+    (license license:bsd-2)))
+
 (define-public python-cle
   (package
     (name "python-cle")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v3 12/14] gnu: unicorn: Update to 2.0.1.post1.
  2024-07-04 20:05 ` [bug#69074] [PATCH v3 01/14] gnu: Add python-itanium-demangle soeren
                     ` (9 preceding siblings ...)
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 11/14] gnu: Add python-ailment soeren
@ 2024-07-04 20:05   ` soeren
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 13/14] gnu: capstone: Backport upstream fix for Python bindings soeren
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 14/14] gnu: Add python-angr soeren
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-04 20:05 UTC (permalink / raw)
  To: 69074

From: c4droid <c4droid@foxmail.com>

* gnu/packages/emulators.scm (unicorn) Update to 2.0.1.post1.

Co-authored-by: Sören Tempel <soeren@soeren-tempel.net>
---
 gnu/packages/emulators.scm | 118 ++++++-------------------------------
 1 file changed, 19 insertions(+), 99 deletions(-)

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index 994abb0fd3..ddc5b4315d 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -61,6 +61,7 @@ (define-module (gnu packages emulators)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages cdrom)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages containers)
   #:use-module (gnu packages cross-base)
@@ -114,6 +115,7 @@ (define-module (gnu packages emulators)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system python)
+  #:use-module (guix build-system pyproject)
   #:use-module (guix build-system qt))
 
 (define-public vice
@@ -2297,106 +2299,24 @@ (define-public zsnes
     (license license:gpl2+)
     (supported-systems (list "x86_64-linux"))))
 
-;; python-pwntools requires a -rc release of unicorn
 (define-public unicorn
-  (let ((unless-x86
-          (lambda (code)
-            (if (member (%current-system) '("x86_64-linux" "i686-linux"))
-              '()
-              code))))
-    (package
-      (name "unicorn")
-      (version "1.0.2-rc4")
-      ;; NOTE: unicorn ships a bundled QEMU, but with a lot of custom modifications.
-      (source
-       (origin
-         (method git-fetch)
-         (uri (git-reference
-               (url "https://github.com/unicorn-engine/unicorn")
-               (commit version)))
-         (file-name (git-file-name name version))
-         (sha256
-          (base32
-           "17nyccgk7hpc4hab24yn57f1xnmr7kq4px98zbp2bkwcrxny8gwy"))))
-      (outputs '("out" "python"))
-      ;; The main library is not written in Python, but the build process has
-      ;; little in common with any defined build system, so we might as well
-      ;; build on top of python-build-system and make use of all
-      ;; the Python-specific phases that can be reused.
-      (build-system python-build-system)
-      (arguments
-       `(#:modules ((srfi srfi-26)
-                    (guix build python-build-system)
-                    (guix build utils))
-         #:phases
-         (modify-phases %standard-phases
-           (add-before 'build 'build-library
-             (lambda* (#:key inputs #:allow-other-keys)
-               (invoke "make"
-                       "-j" (number->string (parallel-job-count))
-                       "UNICORN_STATIC=no"
-                       "CC=gcc")))
-           (add-after 'build-library 'install-library
-             (lambda* (#:key outputs #:allow-other-keys)
-               (invoke "make" "install"
-                       "UNICORN_STATIC=no"
-                       (string-append
-                        "PREFIX="
-                        (assoc-ref outputs "out")))))
-           (add-before 'build 'prepare-bindings
-             (lambda* (#:key outputs #:allow-other-keys)
-               (chdir "bindings/python")
-               ;; Set this environment variable so that the Python bindings
-               ;; don't build their own copy of the shared object, but use
-               ;; a dummy value such that the bindings test suite uses the
-               ;; same mechanism for loading the library as any other user.
-               (setenv "LIBUNICORN_PATH" "1")
-               (substitute* "unicorn/unicorn.py"
-                 (("_path_list = \\[.*")
-                  (string-append
-                   "_path_list = [\""
-                   (assoc-ref outputs "out")
-                   ;; eat the rest of the list
-                   "/lib\"] + 0*[")))
-               #t))
-           (add-before 'check 'check-library
-             (lambda* (#:key outputs #:allow-other-keys)
-               (for-each
-                 (lambda (suite)
-                   (with-directory-excursion
-                     (string-append "../../tests/" suite)
-                     (invoke "make" "test" "CC=gcc"
-                             ,@(unless-x86
-                                '("AS=i686-unknown-linux-gnu-as"
-                                  "OBJCOPY=i686-unknown-linux-gnu-objcopy")))))
-                 '("unit" "regress"))
-               #t))
-           (add-after 'install 'install-samples
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let* ((python-samples (find-files "." "sample_.*"))
-                      (c-samples (find-files "../../samples" ".*\\.c"))
-                      (python-docdir
-                        (string-append (assoc-ref outputs "python")
-                                       "/share/doc/unicorn/samples"))
-                      (c-docdir
-                        (string-append (assoc-ref outputs "out")
-                                       "/share/doc/unicorn/samples")))
-                 (for-each (cut install-file <> c-docdir) c-samples)
-                 (for-each (cut install-file <> python-docdir) python-samples)
-                 #t))))))
-      (native-inputs
-       ;; NOTE: cross-binutils needs to be wrapped with unless-x86, as otherwise
-       ;; the linker provided by the package will be used, circumventing the ld-wrapper.
-       `(,@(unless-x86
-            `(("assembler-for-tests" ,(cross-binutils "i686-unknown-linux-gnu"))))
-         ("cmocka" ,cmocka)
-         ("hexdump-for-tests" ,util-linux)))
-      (home-page "https://www.unicorn-engine.org")
-      (synopsis "Unicorn CPU emulator framework")
-      (description
-       "Unicorn is a lightweight, multi-platform, multi-architecture CPU emulator
-framework based on QEMU.")
-      (license license:gpl2+))))
+  (package
+    (name "unicorn")
+    (version "2.0.1.post1")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri name version))
+              (sha256
+               (base32
+                 "0mlfs8qfi0clyncfkbxp6in0cpl747510i6bqymwid43xcirbikz"))))
+    (build-system pyproject-build-system)
+    (native-inputs (list cmake pkg-config))
+    (home-page "https://www.unicorn-engine.org")
+    (synopsis "Generic CPU emulator framework")
+    (description
+      "Uniforn is a lightweight, multi-platform, multi-architecture CPU
+emulator framework based on QEMU.")
+    (license license:gpl2+)))
 
 (define-public ppsspp
   (package




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v3 13/14] gnu: capstone: Backport upstream fix for Python bindings.
  2024-07-04 20:05 ` [bug#69074] [PATCH v3 01/14] gnu: Add python-itanium-demangle soeren
                     ` (10 preceding siblings ...)
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 12/14] gnu: unicorn: Update to 2.0.1.post1 soeren
@ 2024-07-04 20:05   ` soeren
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 14/14] gnu: Add python-angr soeren
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-04 20:05 UTC (permalink / raw)
  To: 69074

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/patches/python-capstone-fix-python-constants.patch:
New patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/engineering.scm (capstone): New patch.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/engineering.scm                  |  1 +
 ...python-capstone-fix-python-constants.patch | 84 +++++++++++++++++++
 3 files changed, 86 insertions(+)
 create mode 100644 gnu/packages/patches/python-capstone-fix-python-constants.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index c88832f08a..d41f635b73 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1947,6 +1947,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-3-hurd-configure.patch		\
   %D%/packages/patches/python-aionotify-0.2.0-py3.8.patch	\
   %D%/packages/patches/python-argcomplete-1.11.1-fish31.patch	\
+  %D%/packages/patches/python-capstone-fix-python-constants.patch	\
   %D%/packages/patches/python-cross-compile.patch		\
   %D%/packages/patches/python-configobj-setuptools.patch	\
   %D%/packages/patches/python-dateutil-pytest-compat.patch	\
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 64335d89f7..48db91389c 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -1787,6 +1787,7 @@ (define-public capstone
     (version "5.0.1")
     (source (origin
               (method git-fetch)
+              (patches (search-patches "python-capstone-fix-python-constants.patch"))
               (uri (git-reference
                     (url "https://github.com/capstone-engine/capstone")
                     (commit version)))
diff --git a/gnu/packages/patches/python-capstone-fix-python-constants.patch b/gnu/packages/patches/python-capstone-fix-python-constants.patch
new file mode 100644
index 0000000000..75100c6652
--- /dev/null
+++ b/gnu/packages/patches/python-capstone-fix-python-constants.patch
@@ -0,0 +1,84 @@
+Backport upstream patch fixing various constants in the Python bindings.
+
+Taken from: https://github.com/capstone-engine/capstone/commit/f180e176de3efb060db62820ff981d0291ea8525
+
+diff --git a/bindings/python/capstone/__init__.py b/bindings/python/capstone/__init__.py
+index bda2fdb6..52353c28 100755
+--- a/bindings/python/capstone/__init__.py
++++ b/bindings/python/capstone/__init__.py
+@@ -113,7 +113,6 @@ __all__ = [
+     'CS_OPT_SYNTAX_NOREGNAME',
+     'CS_OPT_SYNTAX_MASM',
+     'CS_OPT_SYNTAX_MOTOROLA',
+-    'CS_OPT_SYNTAX_CS_REG_ALIAS',
+ 
+     'CS_OPT_DETAIL',
+     'CS_OPT_MODE',
+@@ -152,19 +151,6 @@ __all__ = [
+     'CS_OP_REG',
+     'CS_OP_IMM',
+     'CS_OP_FP',
+-    'CS_OP_PRED',
+-    'CS_OP_RESERVED_5',
+-    'CS_OP_RESERVED_6',
+-    'CS_OP_RESERVED_7',
+-    'CS_OP_RESERVED_8',
+-    'CS_OP_RESERVED_9',
+-    'CS_OP_RESERVED_10',
+-    'CS_OP_RESERVED_11',
+-    'CS_OP_RESERVED_12',
+-    'CS_OP_RESERVED_13',
+-    'CS_OP_RESERVED_14',
+-    'CS_OP_RESERVED_15',
+-    'CS_OP_SPECIAL',
+     'CS_OP_MEM',
+ 
+     'CS_GRP_INVALID',
+@@ -298,26 +284,13 @@ CS_OPT_NO_BRANCH_OFFSET = 9  # ARM, prints branch immediates without offset.
+ 
+ # Capstone option value
+ CS_OPT_OFF = 0             # Turn OFF an option - default option of CS_OPT_DETAIL
+-CS_OPT_ON = 1 << 0              # Turn ON an option (CS_OPT_DETAIL)
++CS_OPT_ON = 3              # Turn ON an option (CS_OPT_DETAIL)
+ 
+ # Common instruction operand types - to be consistent across all architectures.
+ CS_OP_INVALID = 0  # uninitialized/invalid operand.
+ CS_OP_REG = 1  # Register operand.
+ CS_OP_IMM = 2  # Immediate operand.
+ CS_OP_FP  = 3  # Floating-Point operand.
+-CS_OP_PRED = 4  # Predicate operand.
+-CS_OP_RESERVED_5 = 5
+-CS_OP_RESERVED_6 = 6
+-CS_OP_RESERVED_7 = 7
+-CS_OP_RESERVED_8 = 8
+-CS_OP_RESERVED_9 = 9
+-CS_OP_RESERVED_10 = 10
+-CS_OP_RESERVED_11 = 11
+-CS_OP_RESERVED_12 = 12
+-CS_OP_RESERVED_13 = 13
+-CS_OP_RESERVED_14 = 14
+-CS_OP_RESERVED_15 = 15
+-CS_OP_SPECIAL = 0x10  # Special operands from archs
+ CS_OP_MEM = 0x80  # Memory operand. Can be ORed with another operand type.
+ 
+ # Common instruction groups - to be consistent across all architectures.
+@@ -336,13 +309,12 @@ CS_AC_READ     = (1 << 0) # Operand that is read from.
+ CS_AC_WRITE    = (1 << 1) # Operand that is written to.
+ 
+ # Capstone syntax value
+-CS_OPT_SYNTAX_DEFAULT = 1 << 1  # Default assembly syntax of all platforms (CS_OPT_SYNTAX)
+-CS_OPT_SYNTAX_INTEL = 1 << 2  # Intel X86 asm syntax - default syntax on X86 (CS_OPT_SYNTAX, CS_ARCH_X86)
+-CS_OPT_SYNTAX_ATT = 1 << 3  # ATT asm syntax (CS_OPT_SYNTAX, CS_ARCH_X86)
+-CS_OPT_SYNTAX_NOREGNAME = 1 << 4  # Asm syntax prints register name with only number - (CS_OPT_SYNTAX, CS_ARCH_PPC, CS_ARCH_ARM)
+-CS_OPT_SYNTAX_MASM = 1 << 5  # MASM syntax (CS_OPT_SYNTAX, CS_ARCH_X86)
+-CS_OPT_SYNTAX_MOTOROLA = 1 << 6  # MOS65XX use $ as hex prefix
+-CS_OPT_SYNTAX_CS_REG_ALIAS = 1 << 7  # Prints common register alias which are not defined in LLVM (ARM: r9 = sb etc.)
++CS_OPT_SYNTAX_DEFAULT = 0    # Default assembly syntax of all platforms (CS_OPT_SYNTAX)
++CS_OPT_SYNTAX_INTEL = 1    # Intel X86 asm syntax - default syntax on X86 (CS_OPT_SYNTAX, CS_ARCH_X86)
++CS_OPT_SYNTAX_ATT = 2      # ATT asm syntax (CS_OPT_SYNTAX, CS_ARCH_X86)
++CS_OPT_SYNTAX_NOREGNAME = 3   # Asm syntax prints register name with only number - (CS_OPT_SYNTAX, CS_ARCH_PPC, CS_ARCH_ARM)
++CS_OPT_SYNTAX_MASM = 4      # MASM syntax (CS_OPT_SYNTAX, CS_ARCH_X86)
++CS_OPT_SYNTAX_MOTOROLA = 5 # MOS65XX use $ as hex prefix
+ 
+ # Capstone error type
+ CS_ERR_OK = 0      # No error: everything was fine




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH v3 14/14] gnu: Add python-angr.
  2024-07-04 20:05 ` [bug#69074] [PATCH v3 01/14] gnu: Add python-itanium-demangle soeren
                     ` (11 preceding siblings ...)
  2024-07-04 20:05   ` [bug#69074] [PATCH v3 13/14] gnu: capstone: Backport upstream fix for Python bindings soeren
@ 2024-07-04 20:05   ` soeren
  12 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-04 20:05 UTC (permalink / raw)
  To: 69074
  Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/patches/python-angr-addition-type-error.patch:
New patch.
* gnu/packages/patches/python-angr-check-exec-deps.patch:
New patch.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/python-xyz.scm (python-angr): New variable.
---
 gnu/local.mk                                  |  2 +
 .../python-angr-addition-type-error.patch     | 18 ++++
 .../patches/python-angr-check-exec-deps.patch | 93 ++++++++++++++++++
 gnu/packages/python-xyz.scm                   | 96 +++++++++++++++++++
 4 files changed, 209 insertions(+)
 create mode 100644 gnu/packages/patches/python-angr-addition-type-error.patch
 create mode 100644 gnu/packages/patches/python-angr-check-exec-deps.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index d41f635b73..faf278ba44 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1945,6 +1945,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-3-search-paths.patch		\
   %D%/packages/patches/python-3-fix-tests.patch			\
   %D%/packages/patches/python-3-hurd-configure.patch		\
+  %D%/packages/patches/python-angr-addition-type-error.patch	\
+  %D%/packages/patches/python-angr-check-exec-deps.patch	\
   %D%/packages/patches/python-aionotify-0.2.0-py3.8.patch	\
   %D%/packages/patches/python-argcomplete-1.11.1-fish31.patch	\
   %D%/packages/patches/python-capstone-fix-python-constants.patch	\
diff --git a/gnu/packages/patches/python-angr-addition-type-error.patch b/gnu/packages/patches/python-angr-addition-type-error.patch
new file mode 100644
index 0000000000..7301d8b505
--- /dev/null
+++ b/gnu/packages/patches/python-angr-addition-type-error.patch
@@ -0,0 +1,18 @@
+This fixes failures of the test_ln_gcc_O2 and other related tests
+in the angr test suite.  The patch has been proposed upstream.
+
+Taken form: https://github.com/angr/angr/pull/4443
+
+diff --git a/angr/analyses/reassembler.py b/angr/analyses/reassembler.py
+index 7a2399a60..b09b3a8cb 100644
+--- a/angr/analyses/reassembler.py
++++ b/angr/analyses/reassembler.py
+@@ -730,7 +730,7 @@ class Instruction:
+             elif operand.type == capstone.CS_OP_MEM:
+                 operand_offsets.append(capstone_instr.disp_offset)
+             else:
+-                operand_offsets.append(None)
++                operand_offsets.append(0)
+ 
+         if self.addr is not None:
+             self._initialize(capstone_instr.operands, operand_offsets)
diff --git a/gnu/packages/patches/python-angr-check-exec-deps.patch b/gnu/packages/patches/python-angr-check-exec-deps.patch
new file mode 100644
index 0000000000..438f8ef183
--- /dev/null
+++ b/gnu/packages/patches/python-angr-check-exec-deps.patch
@@ -0,0 +1,93 @@
+The angr test suite performs analysis on several pre-compiled binaries
+to ensure its binary analysis capabilities are working as intended.
+Some of these binaries are also executed as part of the test suite to
+test if the simulation engine provided by angr results in the same
+output as native execution of the binary.
+
+For Guix, this files as the glibc shared objects cannot be found.
+Additionally, we don't really want to execute pre-compiled binaries
+on Guix, hence we disable those tests.
+
+diff --git a/tests/test_ctype_locale.py b/tests/test_ctype_locale.py
+index 08cb89836..2b9233558 100644
+--- a/tests/test_ctype_locale.py
++++ b/tests/test_ctype_locale.py
+@@ -14,7 +14,7 @@ test_location = os.path.dirname(os.path.abspath(__file__))
+ 
+ 
+ class TestCtypeLocale(unittest.TestCase):
+-    @skip_if_not_linux
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_ctype_b_loc(self):
+         """
+         test_ctype_locale.test_ctype_b_loc
+@@ -60,7 +60,7 @@ class TestCtypeLocale(unittest.TestCase):
+         output = subprocess.check_output(bin_path, shell=True)
+         assert result == output
+ 
+-    @skip_if_not_linux
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_ctype_tolower_loc(self):
+         """
+         test_ctype_locale.test_ctype_tolower_loc
+@@ -109,7 +109,7 @@ class TestCtypeLocale(unittest.TestCase):
+         output = subprocess.check_output(bin_path, shell=True)
+         assert result == output
+ 
+-    @skip_if_not_linux
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_ctype_toupper_loc(self):
+         """
+         test_ctype_locale.test_ctype_toupper_loc
+diff --git a/tests/test_signed_div.py b/tests/test_signed_div.py
+index 59cb9b8d1..994ed9c65 100644
+--- a/tests/test_signed_div.py
++++ b/tests/test_signed_div.py
+@@ -1,6 +1,7 @@
+ import angr
+ import subprocess
+ import sys
++import pytest
+ 
+ import logging
+ 
+@@ -13,7 +14,7 @@ import os
+ test_location = os.path.dirname(os.path.realpath(__file__))
+ 
+ 
+-@skipUnless(sys.platform.startswith("linux"), "linux only")
++@pytest.mark.skip(reason="test executes pre-compiled binaries")
+ def test_signed_div():
+     test_bin = os.path.join(test_location, "..", "..", "binaries", "tests", "x86_64", "test_signed_div")
+     b = angr.Project(test_bin, auto_load_libs=False)
+diff --git a/tests/test_sscanf.py b/tests/test_sscanf.py
+index 29d2c8403..ea799b310 100644
+--- a/tests/test_sscanf.py
++++ b/tests/test_sscanf.py
+@@ -1,3 +1,4 @@
++import pytest
+ import angr
+ import subprocess
+ import sys
+@@ -14,7 +15,7 @@ test_location = os.path.dirname(os.path.realpath(__file__))
+ 
+ 
+ class TestSscanf(unittest.TestCase):
+-    @unittest.skipUnless(sys.platform.startswith("linux"), "linux only")
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_sscanf(self):
+         test_bin = os.path.join(test_location, "..", "..", "binaries", "tests", "x86_64", "sscanf_test")
+         b = angr.Project(test_bin, auto_load_libs=False)
+diff --git a/tests/test_strtol.py b/tests/test_strtol.py
+index 6c29cab22..f36181407 100644
+--- a/tests/test_strtol.py
++++ b/tests/test_strtol.py
+@@ -11,7 +11,7 @@ class TestStrtol(unittest.TestCase):
+     # pylint: disable=no-self-use
+ 
+     @slow_test
+-    @unittest.skipUnless(sys.platform.startswith("linux"), "linux-only")
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_strtol(self, threads=None):
+         test_bin = os.path.join(bin_location, "tests", "x86_64", "strtol_test")
+         # disabling auto_load_libs increases the execution time of the test case.
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 6797bba3bd..0e423c9f64 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -34079,6 +34079,102 @@ (define-public python-itanium-demangle
 extracting type information.")
     (license license:bsd-0)))
 
+(define-public python-angr
+  (package
+    (name "python-angr")
+    (version "9.2.46")
+    (source
+     (origin
+       (method git-fetch)
+       (patches (search-patches "python-angr-addition-type-error.patch"
+                                "python-angr-check-exec-deps.patch"))
+       (uri (git-reference
+             (url "https://github.com/angr/angr")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "18y9wyf7va7gvp9zd6lhw82j9a2x2ajsvbawh96xnxzml0jwlwjm"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'patch-tests
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       (let ((coreutils (assoc-ref inputs "coreutils")))
+                         (substitute* "tests/test_vault.py"
+                           (("/bin/false")
+                            (which "false")))
+                         (substitute* "tests/common.py"
+                           (("\\[\"cc\"\\]")
+                            "[\"gcc\"]")))))
+                   (replace 'check
+                     (lambda* (#:key inputs tests? #:allow-other-keys)
+                       (when tests?
+                         (copy-recursively #$(this-package-native-input "binaries")
+                                           "../binaries")
+                         (with-directory-excursion "tests"
+                           ;; test_mips32_missing_offset_in_instructions fails
+                           ;; with capstone 5 and passes with capstone 4. Might
+                           ;; be a capstone regressions, needs investigation.
+                           ;;
+                           ;; test_concrete_memset is a non-deterministic benchmark.
+                           (invoke "pytest" "-vv" "-x" "--dist" "loadfile"
+                                   "-k" "not test_mips32_missing_offset_in_instructions and not test_concrete_memset"
+                                   "-n" (number->string (parallel-job-count)))))))
+                   (add-before 'build 'set-cc
+                     (lambda _
+                       (setenv "CC" "gcc"))))))
+    (propagated-inputs (list python-ailment
+                             python-archinfo
+                             python-cachetools
+                             python-cffi
+                             python-claripy
+                             python-cle
+                             python-colorama
+                             python-cppheaderparser
+                             python-dpkt
+                             python-gitpython
+                             python-mulpyplexer
+                             python-nampa
+                             python-networkx
+                             python-protobuf
+                             python-psutil
+                             python-itanium-demangle
+                             python-pycparser
+                             python-pyvex
+                             python-progressbar2
+                             python-rpyc
+                             python-sortedcontainers
+                             python-sqlalchemy
+                             python-sympy
+                             unicorn))
+    (native-inputs `(("python-pytest" ,python-pytest)
+                     ("python-pytest-xdist" ,python-pytest-xdist)
+                     ("binaries"
+                      ;; This repository ships several binaries used only for testing
+                      ;; purpose.  The binaries are not executed and not part of the
+                      ;; angr distribution, they are only used to test angr's binary
+                      ;; analysis capabilities.  In the context of the GNU FSDG, these
+                      ;; files should be considered non-functional data.
+                      ,(origin
+                         (method git-fetch)
+                         (uri (git-reference (url
+                                              "https://github.com/angr/binaries")
+                                             (commit (string-append "v"
+                                                                    version))))
+                         (file-name (git-file-name "angr-binaries" version))
+                         (sha256 (base32
+                                  "1f286b2239zavxzwg1184hj1zs380cr9qr549mvy3vywvm8bsmgr"))))))
+    (home-page "https://github.com/angr/angr")
+    (synopsis "Multi-architecture binary analysis toolkit")
+    (description
+     "This package provides a versatile binary analysis platform with the
+ability to perform dynamic symbolic execution as well as various
+static analyses directly on binaries.  As such, it can be used for all
+kinds of reverse engineering, vulnerability discovery, exploit
+generation, and software testing purposes.")
+    (license license:bsd-2)))
+
 (define-public python-peachpy
   ;; There is no tag in this repo.
   (let ((commit "913d74c35a6b1d330e90bfc055208ce5b06b35a0")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-07-04 14:54   ` jgart via Guix-patches via
@ 2024-07-04 20:26     ` Sören Tempel
  2024-07-04 20:52       ` jgart via Guix-patches via
                         ` (2 more replies)
  0 siblings, 3 replies; 78+ messages in thread
From: Sören Tempel @ 2024-07-04 20:26 UTC (permalink / raw)
  To: jgart; +Cc: Troy Figiel, 69074

jgart <jgart@dismail.de> wrote:
> Hi, I can prioritize to take sometime to look next week if someone can
> send an updated patch that applies to master without conflicts.
> 
> Just CC me when that patch is here.

Hi, thanks a lot for the response! I rebased the patch, the v3 now
applies cleanly on top of eeb24a50d2f1f78095bdb16b40ddb93bb51474bc which
is the current HEAD of the master branch. If you have any tips on making
this easier to review feel free to let me know.

Looking forward to your feedback! :)

Greetings,
Sören




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-07-04 20:26     ` Sören Tempel
@ 2024-07-04 20:52       ` jgart via Guix-patches via
  2024-07-05 11:47         ` Sören Tempel
  2024-07-04 20:54       ` [bug#69074] " jgart via Guix-patches via
  2024-07-05  0:09       ` jgart via Guix-patches via
  2 siblings, 1 reply; 78+ messages in thread
From: jgart via Guix-patches via @ 2024-07-04 20:52 UTC (permalink / raw)
  To: Sören Tempel; +Cc: Troy Figiel, 69074

> Hi, thanks a lot for the response! I rebased the patch, the v3 now
> 
> applies cleanly on top of eeb24a50d2f1f78095bdb16b40ddb93bb51474bc which
> 
> is the current HEAD of the master branch. If you have any tips on making
> 
> this easier to review feel free to let me know.

Hi,

One tip I can provide is submitting smaller patch sets. Larger patch sets require more review time investment so structuring your contributions small bits at a time allows the reviewer to not be overwhelmed by the amount of stuff they have to review in order to close the ticket.

In addition to that, I would also say to make sure you run the linter on all of your code to check for warnings and fix suggestions.

That said, can you send a revision fixing the suggestions made by the linter in the latest version of your patch set? Please add the linter fixes grouped to their respective logical commit.

all the best,

jgart




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-07-04 20:26     ` Sören Tempel
  2024-07-04 20:52       ` jgart via Guix-patches via
@ 2024-07-04 20:54       ` jgart via Guix-patches via
  2024-07-05  0:09       ` jgart via Guix-patches via
  2 siblings, 0 replies; 78+ messages in thread
From: jgart via Guix-patches via @ 2024-07-04 20:54 UTC (permalink / raw)
  To: Sören Tempel; +Cc: Troy Figiel, 69074

Another tip:

To save time, in this case you can run the linter checks with the --no-network flag like this:

./pre-inst-env guix lint -n python-itanium-demangle python-keystone-engine python-mulpyplexer python-nampa python-rpyc python-pysmt python-claripy python-archinfo python-pyvex python-cle python-ailment unicorn capstone python-angr

all the best,

jgart




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-07-04 20:26     ` Sören Tempel
  2024-07-04 20:52       ` jgart via Guix-patches via
  2024-07-04 20:54       ` [bug#69074] " jgart via Guix-patches via
@ 2024-07-05  0:09       ` jgart via Guix-patches via
  2 siblings, 0 replies; 78+ messages in thread
From: jgart via Guix-patches via @ 2024-07-05  0:09 UTC (permalink / raw)
  To: Sören Tempel; +Cc: Troy Figiel, 69074

If the cc-for-target fix that the linter is talking about is too much work feel free to leave that out and I can take care of it in a separate commit or ticket.

all best,

jgart




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-07-04 20:52       ` jgart via Guix-patches via
@ 2024-07-05 11:47         ` Sören Tempel
  2024-07-08 21:29           ` jgart via Guix-patches via
  0 siblings, 1 reply; 78+ messages in thread
From: Sören Tempel @ 2024-07-05 11:47 UTC (permalink / raw)
  To: jgart; +Cc: Troy Figiel, 69074

Hi,

Thanks for your feedback!

"jgart" <jgart@dismail.de> wrote:
> In addition to that, I would also say to make sure you run the linter
> on all of your code to check for warnings and fix suggestions.
>
> That said, can you send a revision fixing the suggestions made by the
> linter in the latest version of your patch set? Please add the linter fixes
> grouped to their respective logical commit.

I was under the impression that I fixed the relevant linker warnings. I
didn't fix the capstone warnings as I only added a patch for capstone
and didn't want to refactor the existing code as part of that (i.e. the
warnings are not introduced by my changes). For python-angr I only get
two "line is way too long"-warnings, both caused by long not easily
breakable strings (e.g. the checksum).

Should I refactor the capstone package as part of this patchset?
Am I missing any additional linter warnings?

Best,
Sören




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-07-05 11:47         ` Sören Tempel
@ 2024-07-08 21:29           ` jgart via Guix-patches via
  2024-07-09 16:35             ` Sören Tempel
  2024-07-11 21:32             ` Sören Tempel
  0 siblings, 2 replies; 78+ messages in thread
From: jgart via Guix-patches via @ 2024-07-08 21:29 UTC (permalink / raw)
  To: 69074; +Cc: Troy Figiel, jgart, Sören Tempel


> I was under the impression that I fixed the relevant linker warnings. I
> didn't fix the capstone warnings as I only added a patch for capstone
> and didn't want to refactor the existing code as part of that (i.e. the
> warnings are not introduced by my changes). For python-angr I only get
> two "line is way too long"-warnings, both caused by long not easily
> breakable strings (e.g. the checksum).
>

Hi Soeren,

> Should I refactor the capstone package as part of this patchset?

Could you send just the capstone package in a separate new ticket and CC me?

I can review capstone separately. Once that ticket is resolved we can
update this ticket and continue the reviewing here for angr with less
patches for me to review all at once. My time is limited and I think
that this will allow us to progress on this issue.

Notice that I changed the package name. The upstream is called
*demangler and not *demangle. I also added a note as to why we are not
using the PyPI source. If not using the PyPI source we should add a
comment as to why not. We prefer PyPI whenever possible for `guix
import` tool reasons.

Can you send a v2 without python-itanium-demangler in a new patch
series?

I spent some time reviewing these patches. There's definitely a lot to
look at.

I applied python-itanium-demangler in this commit:

https://git.savannah.gnu.org/cgit/guix.git/commit/?id=789c4037947d59a7143999269791bf75436fdccd

Another thing I noticed is that we have this ticket open for pwntools:

https://issues.guix.gnu.org/61431

-;; python-pwntools requires a -rc release of unicorn

The above line was removed but this patch series leaves pwntools broken.

I think we should resolve that here.

Also, if there are versions of Python packages that are specifically
needed for angr and no other packages depend on them then I think it
would be better practice to call them python-foo-for-angr instead of
leaving a comment and using the package name python-claripy. For
example, python-claripy-for-python-angr. We have similar packages in the
guix package collection that follow such a pattern. The latest version
of python-claripy is 9.2.109 and you're packaging 9.2.46 with the
top-level variable name.

Other python team members or guix contributors feel free to comment on
this if you have additional feedback.

-- 
all the best,
jgart




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-07-08 21:29           ` jgart via Guix-patches via
@ 2024-07-09 16:35             ` Sören Tempel
  2024-07-09 19:19               ` jgart via Guix-patches via
  2024-07-11 21:32             ` Sören Tempel
  1 sibling, 1 reply; 78+ messages in thread
From: Sören Tempel @ 2024-07-09 16:35 UTC (permalink / raw)
  To: jgart; +Cc: Troy Figiel, 69074

Thanks for taking the time to look at the patchset in greater detail!
I really appreciate your feedback and have been learning a lot :)

jgart <jgart@dismail.de> wrote:
> Could you send just the capstone package in a separate new ticket and CC me?

Sure, see #72015. I can also submit each new package separately if that
easier to review for you, just let me know.

> My time is limited and I think that this will allow us to progress on
> this issue.

Sorry, I don't intend to waste your time. I thought this patchset was in
a good state already given that I already incorporated a lot of good
feedback from Troy, fixed all the linter warnings, made it pass on the
CI and also have been using this Guix package for a long time myself.
I am definitely committed and interested in improving it further.

> Notice that I changed the package name. The upstream is called
> *demangler and not *demangle. I also added a note as to why we are not
> using the PyPI source. If not using the PyPI source we should add a
> comment as to why not. We prefer PyPI whenever possible for `guix
> import` tool reasons.

Thanks for pointing this out! I can add more comments. In most cases,
the PyPI source is missing files required to run the test suite.

> Can you send a v2 without python-itanium-demangler in a new patch
> series?

Yes, will do so after the capstone patch from above is merged so that
I can also exclude that patch from the v2 of this patchset.

> I applied python-itanium-demangler in this commit:
>
> https://git.savannah.gnu.org/cgit/guix.git/commit/?id=789c4037947d59a7143999269791bf75436fdccd

Thanks!

> Another thing I noticed is that we have this ticket open for pwntools:
>
> https://issues.guix.gnu.org/61431
>
> -;; python-pwntools requires a -rc release of unicorn
>
> The above line was removed but this patch series leaves pwntools broken.

python-pwntools does not build right now. Therefore, pwntools is already
in a broken state. As such, my patchset doesn't change the status quo in
this regard. My initial goal was to keep this patchset simple(r) by
focusing on angr and not including unrelated changes; hence, I didn't
touch pwntools here.

> Also, if there are versions of Python packages that are specifically
> needed for angr and no other packages depend on them then I think it
> would be better practice to call them python-foo-for-angr instead of
> leaving a comment and using the package name python-claripy. For
> example, python-claripy-for-python-angr. We have similar packages in the
> guix package collection that follow such a pattern. The latest version
> of python-claripy is 9.2.109 and you're packaging 9.2.46 with the
> top-level variable name.

claripy and the other packages added here can be used without angr (and
there is free software out there which does so), it's just that the
version needs to be in sync with python-angr. I would personally prefer
to stick to the PyPI name.

Sincerely,
Sören




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-07-09 16:35             ` Sören Tempel
@ 2024-07-09 19:19               ` jgart via Guix-patches via
  2024-07-10  8:12                 ` Sören Tempel
  0 siblings, 1 reply; 78+ messages in thread
From: jgart via Guix-patches via @ 2024-07-09 19:19 UTC (permalink / raw)
  To: Sören Tempel; +Cc: Troy Figiel, 69074

> python-pwntools does not build right now. Therefore, pwntools is already
> 
> in a broken state. As such, my patchset doesn't change the status quo in
> 
> this regard. My initial goal was to keep this patchset simple(r) by
> 
> focusing on angr and not including unrelated changes; hence, I didn't
> 
> touch pwntools here.

Ok, don't worry about pwntools then for this ticket scope.

> claripy and the other packages added here can be used without angr (and
> 
> there is free software out there which does so), it's just that the
> 
> version needs to be in sync with python-angr. I would personally prefer
> 
> to stick to the PyPI name.

Hi Sören,

Ok, if in the future someone else wants the latest version of said packages then we might need to do some renames/accomodations since the versions that you are proposing are primarily for python-angr. That sounds good to me.

Regarding unicorn,

There are currently two tickets open that are trying to address updating unicorn:

https://issues.guix.gnu.org/40267
https://issues.guix.gnu.org/63442

If you can help with consolidating the efforts there through review with me we can then decide what to do with unicorn. Otherwise, I'll have to find some time to look through those two tickets in addition to your unicorn proposal and consolidate/decide what we will add first.

We can make progress on angr while ignoring the unicorn package for now if you can create one separate ticket for the new packages that are not python-angr and that are not dependent on a particular version of unicorn and I can try to review those by this week.

Once all of the above is merged and resolved, update ticket 69074 with the latest patch set that just includes python-angr for me to review.

Thanks and glad I can help with what I can,

jgart




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-07-09 19:19               ` jgart via Guix-patches via
@ 2024-07-10  8:12                 ` Sören Tempel
  0 siblings, 0 replies; 78+ messages in thread
From: Sören Tempel @ 2024-07-10  8:12 UTC (permalink / raw)
  To: jgart; +Cc: Troy Figiel, 69074

> There are currently two tickets open that are trying to address updating unicorn:
> 
> https://issues.guix.gnu.org/40267
> https://issues.guix.gnu.org/63442

My patchset includes the unicorn patch from #63442 and preserve the
original author information, see also the comment I left in #63442. Feel
free to review that first separately, I can address any feedback that
you post there (please CC me). #40267 is based on a severely outdated
unicorn version, I don't think it's relevant any more.

Also keep in mind: unicorn does currently not build, therefore it is
also already broken as-is and any changes making unicorn build again
are an improvement.

> We can make progress on angr while ignoring the unicorn package for
> now if you can create one separate ticket for the new packages that
> are not python-angr and that are not dependent on a particular version
> of unicorn and I can try to review those by this week.

I think given what I wrote above (unicorn doesn't build right now), the
unicorn changes proposed in #63442 should be straightforward to review.

Greetings
Sören




^ permalink raw reply	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH 01/11] gnu: Add python-keystone-engine.
  2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
                   ` (21 preceding siblings ...)
  2024-07-04 20:05 ` [bug#69074] [PATCH v3 01/14] gnu: Add python-itanium-demangle soeren
@ 2024-07-11 21:27 ` soeren
  2024-07-11 21:27   ` [bug#69074] [PATCH 02/11] gnu: Add python-mulpyplexer soeren
                     ` (9 more replies)
  22 siblings, 10 replies; 78+ messages in thread
From: soeren @ 2024-07-11 21:27 UTC (permalink / raw)
  To: 69074; +Cc: jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/emulators.scm (python-keystone-engine): New variable.
---
 gnu/packages/emulators.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index 5979294ef2..486610f1f0 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -2622,6 +2622,28 @@ (define-public uxn
 stack-machine, written in ANSI C.  Graphical output is implemented using SDL2.")
       (license license:expat))))
 
+(define-public python-keystone-engine
+  (package
+    (name "python-keystone-engine")
+    (version "0.9.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "keystone-engine" version))
+       (sha256
+        (base32 "1xahdr6bh3dw5swrc2r8kqa8ljhqlb7k2kxv5mrw5rhcmcnzcyig"))))
+    (native-inputs (list cmake))
+    (build-system pyproject-build-system)
+    (home-page "https://www.keystone-engine.org")
+    (synopsis
+     "Lightweight multi-platform, multi-architecture assembler framework")
+    (description
+     "Keystone is a lightweight multi-platform, multi-architecture
+assembler framework.  It supports a wide-range of different architectures
+and offers an intuitive architecture-neutral API for interacting with
+assembly for these architectures.")
+    (license license:gpl2)))
+
 (define-public emu8051
   (let ((commit "5dc681275151c4a5d7b85ec9ff4ceb1b25abd5a8")
         (revision "1"))

base-commit: eeb24a50d2f1f78095bdb16b40ddb93bb51474bc
prerequisite-patch-id: ee2a9b6687430c128ae37013d0cabf78965c97b1
prerequisite-patch-id: 138a1596bdb469002dca48d090b3c1600fd76fe3
prerequisite-patch-id: be3c2bd6aeda961b25ee63b73fb3fd8c07c0edf9
prerequisite-patch-id: 061d0cdfd9efb74fccd55e2a30e427385a6a982f
prerequisite-patch-id: e0c8dd359305affa867e537d444f0cf688b5e342
prerequisite-patch-id: c3c2c5dd54341be192b3e29ced43d91db7747a13
prerequisite-patch-id: 17a62f3de0eeeb2cfdcddd1c02acbd36f9d19b6c
prerequisite-patch-id: ee3c5dd8dfe405e38b940b24bf3b58627d1fa612
prerequisite-patch-id: fd89a91e88e4814b0f7e2e09aa55354a8ad0c120
prerequisite-patch-id: eca98c7f708c5fc13b9cae1feefab139bf78aa2e
prerequisite-patch-id: ab8c3f10a0cd324b842682b562a4030063027b8d
prerequisite-patch-id: c3a135b6c179a25a56cb5b7f0158d1907b2d1105
prerequisite-patch-id: e6cf480f56b860681b0b0f802beac67deafe6452
prerequisite-patch-id: 94ca864f10447787f81847557be750c7b20d18f7
prerequisite-patch-id: ec9b1772c7e723bf56dc7e55e94a9b68c22814d7
prerequisite-patch-id: cfc1254a999cacdb45980c36dd5e65920df1b89b
prerequisite-patch-id: 1ab9eda560e3de9fa6c93c9f7e2b54df1af3885c
prerequisite-patch-id: 5673937acc787fa0cd0f7b2c19b5008f50d18192
prerequisite-patch-id: 2896487a69c866bc0384671f38804aec09718fb8
prerequisite-patch-id: 19fee3925913d427510f10efe8e3e84a9fc7c39d
prerequisite-patch-id: 9fde04d4b1031d5b0c761817482ea50518806317
prerequisite-patch-id: 1de5295e2929eae0b45a1259f7d85a8b6dd27bd3
prerequisite-patch-id: 19288643faed672174a7c8f2397989ec99909cc6
prerequisite-patch-id: 1f7ea830b18e7bdd313982dc2b9953c8637e7c6a
prerequisite-patch-id: a90142a9e9166ccc5842af5c39e46b5ab135bb60
prerequisite-patch-id: d156d4761f70108268b7e7436a1b71e2d77051a1
prerequisite-patch-id: 1366b1b8446f870e6bd094f5f0e7d90c4ae52211
prerequisite-patch-id: 51b10a06e7f8b68addda26d09963acc037606c5c
prerequisite-patch-id: 16be4fd9482c923a5b24713ad77e6d677bf4c225
prerequisite-patch-id: 1f98a03c4f43ffb5837c559459ec029451d7650d
prerequisite-patch-id: 56e9505321e0685920470198d0f0f86c7f41ff37
prerequisite-patch-id: c9f80b814007a2239da588836629a4f50c1a1ca6
prerequisite-patch-id: f6afa2e319d2ba8b4eb81d38de53ddf61cc4f21c
prerequisite-patch-id: 53b8bbcb6ded77c3e42d8b127d04aca73878aa59
prerequisite-patch-id: afc7e0fc337dbd8166b32297c73efc767a2c2a9d
prerequisite-patch-id: cede852fd458d339f3b69ba81ceb7c84430aca11
prerequisite-patch-id: b531f235c82c61593d427d21f3b0af204f7eb99f
prerequisite-patch-id: 85d9203714f534be6ca76958f1b954dfdf4d333c
prerequisite-patch-id: b5a3fdea1b5207839dc9ec762fe2c5650b905e8a
prerequisite-patch-id: 51d2c8a901e4c994e12043e67e30f02f150d20e8
prerequisite-patch-id: 2e758f8e75d266792a277a998eae19d12710d9d4
prerequisite-patch-id: 43df7a9621736fc82b0a6d360b1374080e0e5930
prerequisite-patch-id: f6c4adbef94c3035a2c5d772f8d33ba563e43163
prerequisite-patch-id: 195523867e21de90d11bdda7d6c12f10214cc5df
prerequisite-patch-id: 9e2487f4759b2da3a0d00fc308c6a5c08fbd4ddb
prerequisite-patch-id: 4c7af60712af6e188a4a067386093fe0af12c512
prerequisite-patch-id: af5d9d932b9485e2a4257a983f6a3b1a19d5e251
prerequisite-patch-id: 623116ba5a8ff752dfe0936090247a94c2fb3d44
prerequisite-patch-id: d920223ad4dd8c4e1b3e2e95b047ace057eeddf8
prerequisite-patch-id: f124d556ef42048680e42355c111f0696d9ced07
prerequisite-patch-id: a0a1bf5290e018b70edfbb5563d137733c84e84a
prerequisite-patch-id: cddea9eb650801dad93c64ac5ce9428b71ae5a49
prerequisite-patch-id: ffcfad1a27d77037fb8557aafd3cf7e87cdd18e4
prerequisite-patch-id: 9c1bcec9ae21688933c037236a53c7425c5fceea
prerequisite-patch-id: 90278399df23105fe2c95a7411b65e9f7b694715
prerequisite-patch-id: 83e7f0f584612d90aee26439b041260c687abe57
prerequisite-patch-id: 07d49663d4b40bfd68ddc3b11f20d9202287cc9d
prerequisite-patch-id: e215f35e710fa97323c05f2bc99f4c601f952d53
prerequisite-patch-id: e3963527bafe11f97e3ae8fb364c42c2a6561bcd
prerequisite-patch-id: 3c36669d6f54a4a08145a915e5eac834332eec2f
prerequisite-patch-id: b02c68976af2b96fcf28ed5aa29db07627ef11b7
prerequisite-patch-id: 784e11d7de3b1c571171fc09ff90d391ad483718
prerequisite-patch-id: a849f7e9ac2b52f560238c9613a85cb7fd4b98aa
prerequisite-patch-id: e6156c5eb23a8241dc5992867972bd0f07983856
prerequisite-patch-id: 9fc78ae5ab7b06c7ec58e9fdca80227ff918fd31
prerequisite-patch-id: fb62bda29d3876fd6ee9a0bf5aaf9eb762219622
prerequisite-patch-id: 21bf49815ae3aa66d1d5fef03655d326ac9d0adb
prerequisite-patch-id: fe6d3db81178f5e072fd340b5d27328daea63f34
prerequisite-patch-id: 74a98f931bc5d8788557486c93a72aa688fa36d3
prerequisite-patch-id: da69b335229478fdedf53a939c4752eded87b73a
prerequisite-patch-id: be5bb4b6176b5be6299763079370706283ce13c9
prerequisite-patch-id: dc97b52c8bacfbfb294b77ea2dabe5ba9a8985e2
prerequisite-patch-id: b3168981390c63a0cef9d6fe0ca7707485160404
prerequisite-patch-id: c016251bd2844e7690d9b7c0291e55eb92cb00ac
prerequisite-patch-id: 18c437112e77e4d14c5c59e9ac83f7ef3c0b12ba
prerequisite-patch-id: e878d9dcb07c107cfc8aa83dfa292d61721a5e0c
prerequisite-patch-id: 5f4a3da0fc7f31001d9b13a341a82eb2cfe682e7
prerequisite-patch-id: 2ce101315a4201cdf98b03fae404e6d9c831cf6b
prerequisite-patch-id: 52655961a6850fa337d669ac9dcaf3ba1d162542
prerequisite-patch-id: fef620a490a2e023270deaf963fc581c04bc7e4d
prerequisite-patch-id: d33430877bd2b369d4e2256bab25c8b83975eb84
prerequisite-patch-id: 5b2c36cde3b9a00a66c47457852891463c38bc3c
prerequisite-patch-id: 4ebd7039ea8b9b4bb8ade5e71b0d8b019ea765f2
prerequisite-patch-id: 274c63ac97f70daa65df867b924ea0a24171c1c6
prerequisite-patch-id: b382e7ecea1b2dfbba7c338f2b8af486bb35e9f3
prerequisite-patch-id: 2704b2b8d8a02b9a2279edd961e59ed9eed6256b
prerequisite-patch-id: 54e1300814b7cfca8ebb499afa1ee89479b87710
prerequisite-patch-id: 8b6ce0b84817352801b14ab96a450a6ad9356ec8
prerequisite-patch-id: f9bc677c3905468c474bed4132f05aa36f5382bf
prerequisite-patch-id: 537fa3126a0a9b1af03261dae6ae688c16ca48da
prerequisite-patch-id: 7f583c8db492c317ab2147c983d5ba22753d257e
prerequisite-patch-id: 35780a02172eae74567f5aadba9408f39d0a8492
prerequisite-patch-id: 65cc902b6de99b9b02437ea1cd6f2b2a523dc498
prerequisite-patch-id: 617a7d93ef8af7a17ae40cafb7d9976a11b86163
prerequisite-patch-id: 68175767ffa72be5c643cca9f0036382d20dc101
prerequisite-patch-id: 6cf4afd487cc5f32498341530784827c1726ebef
prerequisite-patch-id: ca605c020137a25b96c9bd71884e1a86ba210e95
prerequisite-patch-id: bb2250935248a0299948c7e591cab8a82dba44b1
prerequisite-patch-id: 81db931ccf1748cff5fcfe4af1f90159f3f02cab
prerequisite-patch-id: 9c9d9859db152cb21ab1c37de087ff93490b0b64
prerequisite-patch-id: 3cd623a611d607371646f9383e1d6a1bc46ddedd
prerequisite-patch-id: 056e1be56770469dfb476bc72d46227f7abe79c4
prerequisite-patch-id: 188b79a11a0f0eceb557575f46997738c7227a86
prerequisite-patch-id: 658cb16a15d6a2c14ba66aa64a1dcd900a75f18d
prerequisite-patch-id: b677a11ef8e9967a7bc426f169f5b5e2af73487b
prerequisite-patch-id: b9fa59346caab93c190ee1c6e47870b9659cb24c
prerequisite-patch-id: cd3fe0c0101c6ac89b3bc400409a75a2629e854d
prerequisite-patch-id: b941ff72681258c6c0a1708c40e6e31a2af2e191
prerequisite-patch-id: 86fe9322ab23299e4e87f997000f3f1d64963faf
prerequisite-patch-id: 97a875f39fab4032358aa8d885fd5e0fc0787209
prerequisite-patch-id: 863f9364ba949e0450508a59d74f133a06ba7ead
prerequisite-patch-id: 5161a414b806e2acd0e5fea99cc3a1703467e6cb
prerequisite-patch-id: 696650d9fb7c28c4bb25a5712b74cbfbdd09fe6f
prerequisite-patch-id: 38d4941b88dcff499679693b7398d6d22083c1bd
prerequisite-patch-id: b8494b8f1310b48706c150087fb65083c9eeede9
prerequisite-patch-id: 8e7864232e3d94950c9d96773b8f80a0506b6eb9
prerequisite-patch-id: eaf60cdd22d393e23abea667f67255a0db4b0762
prerequisite-patch-id: c7699bbb2f614934c243e7fe25dfd911093db8ea
prerequisite-patch-id: 3ce91d33cab9bdb27e7476bd009a8eca298e2e08
prerequisite-patch-id: 1d230e7e6050526d1593784b73f7e16caa18801e
prerequisite-patch-id: 2ff7b34709e0639a35ec3a91fbba522beb94279a
prerequisite-patch-id: 8d2c1a269f7dc0626347cd2286d7ae5032394dd2
prerequisite-patch-id: eb421be1145eac0296e3cb0fe93238f108718757
prerequisite-patch-id: c0afc5206ffb8b8288c76c658874c9bffd09c3d9
prerequisite-patch-id: f5bae70da8b680d16e79495064c9b8e304fab800
prerequisite-patch-id: fff9a6b6c9304cdfe4ccca45adb58fb57cb90afb
prerequisite-patch-id: 3378924b569afad71f1592b60b99b55e894597db
prerequisite-patch-id: 8db8877e10300781457258e4b4bbbeadf17948ba
prerequisite-patch-id: f70dd4c37be36c1b4b760b5d926ebc26d2523240
prerequisite-patch-id: c483136940a6721d5c361bce1890f283e0878a03
prerequisite-patch-id: 7cb82188f58a9948b235ef6db0fc7d42762ba634
prerequisite-patch-id: 3456d25e4cfb669dd74f76938b248e244ea2a91e
prerequisite-patch-id: ecdb27047aeea5490e287e01f570f4fc1a259694
prerequisite-patch-id: 6050146a29e503df76feebd8c076eb58245ccbff
prerequisite-patch-id: 0817d7b1196dc4c898627bd174df85dabb331adf
prerequisite-patch-id: 5c275f0fc5e2a0e26e5989cdecc017535cadb135
prerequisite-patch-id: 113e3bd8199b850cda55628cb93974ead7e3224f
prerequisite-patch-id: 19ad15c33500bcd7552d0c0acd95b036d4dc8c86
prerequisite-patch-id: 27d7db3a4d253d3bd095bdf6a800ee311f70f847
prerequisite-patch-id: ae43fa4cce7cb6d30cd2e5100a12c88a1e024b37
prerequisite-patch-id: d43f846502d8e7d5bea10c7356a09e414a28b576
prerequisite-patch-id: 8bc091c42c2c833b071099d391f90fbb5d6dc59a
prerequisite-patch-id: e455414a1d6628662f75f1c79d166876b4398fba
prerequisite-patch-id: 7d6bf43f518c7bfcbfde7532f2f5a278af748c77
prerequisite-patch-id: fcc6571143067b1670fd14d65efbea629a024f94
prerequisite-patch-id: 386e61da3f3163371e78a0ad3c6ed88145ce03af
prerequisite-patch-id: e8887c5fca8d035d3127324ee25c77a6383ae022
prerequisite-patch-id: b6150b1895040c35d2649d8431bf68b66b35937e
prerequisite-patch-id: c5a0c4f9d1c91f2ea9977e6738629d585b396f13
prerequisite-patch-id: f6d0a83c3871eb8c1c39bd0204f1190cc7b712b0
prerequisite-patch-id: bc6383e94c91879a2c152e39785a297618d19b22
prerequisite-patch-id: 13d64eed62d69eeb659389a9954ffd2b304664fa
prerequisite-patch-id: 50d722489630d05615ed6e1b4e3f5558445eb9ac
prerequisite-patch-id: d0081ac95e4277af5f712be84e76d0cdb44e0a56




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH 02/11] gnu: Add python-mulpyplexer.
  2024-07-11 21:27 ` [bug#69074] [PATCH 01/11] gnu: Add python-keystone-engine soeren
@ 2024-07-11 21:27   ` soeren
  2024-07-11 21:27   ` [bug#69074] [PATCH 03/11] gnu: Add python-nampa soeren
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-11 21:27 UTC (permalink / raw)
  To: 69074
  Cc: jgart, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-mulpyplexer): New variable.
---
 gnu/packages/python-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 2618c2078d..2a00bed697 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -33787,6 +33787,29 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-mulpyplexer
+  (package
+    (name "python-mulpyplexer")
+    (version "0.09")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "mulpyplexer" version))
+       (sha256
+        (base32 "0c5xzci1djy1yi9hxxh8g67l6ms8r7ad7ja20pv8hfbdysdrwkhl"))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (invoke "python" "mulpyplexer.py")))))))
+    (home-page "https://github.com/zardus/mulpyplexer/")
+    (synopsis "Multiplexes interactions with lists of Python objects")
+    (description "This module provides utilities for multiplexing
+interactions with lists of Python objects.")
+    (license license:bsd-2)))
+
 (define-public python-itanium-demangler
   (package
     (name "python-itanium-demangler")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH 03/11] gnu: Add python-nampa.
  2024-07-11 21:27 ` [bug#69074] [PATCH 01/11] gnu: Add python-keystone-engine soeren
  2024-07-11 21:27   ` [bug#69074] [PATCH 02/11] gnu: Add python-mulpyplexer soeren
@ 2024-07-11 21:27   ` soeren
  2024-07-11 21:27   ` [bug#69074] [PATCH 04/11] gnu: Add python-rpyc soeren
                     ` (7 subsequent siblings)
  9 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-11 21:27 UTC (permalink / raw)
  To: 69074
  Cc: jgart, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-nampa): New variable.
---
 gnu/packages/python-xyz.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 2a00bed697..1a80de7818 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -33787,6 +33787,26 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-nampa
+  (package
+    (name "python-nampa")
+    (version "0.1.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "nampa" version))
+       (sha256
+        (base32 "0k6cq2gflpkm40qhgqbbcjmq5lq589c15bmk567qyh3d08062hvd"))))
+    (build-system pyproject-build-system)
+    (propagated-inputs (list python-future))
+    (home-page "https://github.com/thebabush/nampa")
+    (synopsis "Python implementation of IDA Pro's FLIRT technology")
+    (description
+     "This Python module implements the @acronym{FLIRT, Fast Library Identification
+and Recognition Technology}.  This technology is useful for identifying
+common library subroutines in disassembled binaries.")
+    (license license:lgpl3)))
+
 (define-public python-mulpyplexer
   (package
     (name "python-mulpyplexer")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH 04/11] gnu: Add python-rpyc.
  2024-07-11 21:27 ` [bug#69074] [PATCH 01/11] gnu: Add python-keystone-engine soeren
  2024-07-11 21:27   ` [bug#69074] [PATCH 02/11] gnu: Add python-mulpyplexer soeren
  2024-07-11 21:27   ` [bug#69074] [PATCH 03/11] gnu: Add python-nampa soeren
@ 2024-07-11 21:27   ` soeren
  2024-07-11 21:27   ` [bug#69074] [PATCH 05/11] gnu: Add python-pysmt soeren
                     ` (6 subsequent siblings)
  9 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-11 21:27 UTC (permalink / raw)
  To: 69074
  Cc: jgart, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-rpyc): New variable.
---
 gnu/packages/python-xyz.scm | 41 +++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 1a80de7818..6f80ff9d83 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -33787,6 +33787,47 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-rpyc
+  (package
+    (name "python-rpyc")
+    (version "5.3.1")
+    (source
+     (origin
+       ;; Fetching from Git as pypi release doesn't include all test files.
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/tomerfiliba-org/rpyc")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "15mnp9qkyw3mmxmr5y4kf3xkvxyp00n892vqaqwznr7al35apgnr"))
+       (snippet '(begin
+                   ;; Disable deploy tests, these rely on OpenSSH and require
+                   ;; configuring the SSH client manually to accept the host key.
+                   (delete-file "tests/test_deploy.py")
+                   ;; Disable tests requiring network access.  These tests
+                   ;; presently fail with the error "Network is unreachable".
+                   (delete-file "tests/test_registry.py")))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (propagated-inputs (list python-hatchling python-plumbum))
+    (home-page "https://github.com/tomerfiliba-org/rpyc")
+    (synopsis
+     "Remote Python Call (RPyC) is a symmetric distributed computing library")
+    (description
+     "This Python module enables remote procedure calls, clustering, and
+distributed-computing.  For this purpose, it makes use of object-proxying, a technique
+that employs python's dynamic nature, to overcome the physical boundaries between
+processes and computers, so that remote objects can be manipulated as if they
+were local.")
+    (license license:expat)))
+
 (define-public python-nampa
   (package
     (name "python-nampa")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH 05/11] gnu: Add python-pysmt.
  2024-07-11 21:27 ` [bug#69074] [PATCH 01/11] gnu: Add python-keystone-engine soeren
                     ` (2 preceding siblings ...)
  2024-07-11 21:27   ` [bug#69074] [PATCH 04/11] gnu: Add python-rpyc soeren
@ 2024-07-11 21:27   ` soeren
  2024-07-11 21:27   ` [bug#69074] [PATCH 06/11] gnu: Add python-claripy soeren
                     ` (5 subsequent siblings)
  9 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-11 21:27 UTC (permalink / raw)
  To: 69074
  Cc: jgart, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/patches/python-pysmt-fix-pow-return-type.patch:
New patch.
* gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch:
New patch.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/python-xyz.scm (python-pysmt): New variable.
---
 gnu/local.mk                                  |   2 +
 .../python-pysmt-fix-pow-return-type.patch    | 258 ++++++++++++++++++
 ...-pysmt-fix-smtlib-serialization-test.patch |  86 ++++++
 gnu/packages/python-xyz.scm                   |  33 +++
 4 files changed, 379 insertions(+)
 create mode 100644 gnu/packages/patches/python-pysmt-fix-pow-return-type.patch
 create mode 100644 gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index ea4cc251ae..73b445f1fc 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1975,6 +1975,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-pyan3-fix-absolute-path-bug.patch \
   %D%/packages/patches/python-pyan3-fix-positional-arguments.patch \
   %D%/packages/patches/python-pygpgme-fix-pinentry-tests.patch	\
+  %D%/packages/patches/python-pysmt-fix-pow-return-type.patch	\
+  %D%/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch	\
   %D%/packages/patches/python-pytorch-fix-codegen.patch		\
   %D%/packages/patches/python-pytorch-runpath.patch		\
   %D%/packages/patches/python-pytorch-system-libraries.patch	\
diff --git a/gnu/packages/patches/python-pysmt-fix-pow-return-type.patch b/gnu/packages/patches/python-pysmt-fix-pow-return-type.patch
new file mode 100644
index 0000000000..0ec2d41b3c
--- /dev/null
+++ b/gnu/packages/patches/python-pysmt-fix-pow-return-type.patch
@@ -0,0 +1,258 @@
+Backport of an upstream patch which fixes a test failure with our
+packaged version of the Z3 SMT solver.
+
+Taken from: https://github.com/pysmt/pysmt/commit/f522e8cd8f3e75ff85f5eae29b427e18a6701859
+
+diff --git a/pysmt/formula.py b/pysmt/formula.py
+index ea4b46c..6cb9cbf 100644
+--- a/pysmt/formula.py
++++ b/pysmt/formula.py
+@@ -252,11 +252,7 @@ class FormulaManager(object):
+ 
+         if base.is_constant():
+             val = base.constant_value() ** exponent.constant_value()
+-            if base.is_constant(types.REAL):
+-                return self.Real(val)
+-            else:
+-                assert base.is_constant(types.INT)
+-                return self.Int(val)
++            return self.Real(val)
+         return self.create_node(node_type=op.POW, args=(base, exponent))
+ 
+     def Div(self, left, right):
+diff --git a/pysmt/logics.py b/pysmt/logics.py
+index ef88dd6..9dc45b1 100644
+--- a/pysmt/logics.py
++++ b/pysmt/logics.py
+@@ -495,6 +495,12 @@ QF_NRA = Logic(name="QF_NRA",
+                real_arithmetic=True,
+                linear=False)
+ 
++QF_NIRA = Logic(name="QF_NIRA",
++                description="""Quantifier-free integer and real arithmetic.""",
++                quantifier_free=True,
++                integer_arithmetic=True,
++                real_arithmetic=True,
++                linear=False)
+ 
+ QF_RDL = Logic(name="QF_RDL",
+                description=\
+@@ -619,41 +625,41 @@ QF_AUFBVLIRA = Logic(name="QF_AUFBVLIRA",
+ AUTO = Logic(name="Auto",
+              description="Special logic used to indicate that the logic to be used depends on the formula.")
+ 
+-SMTLIB2_LOGICS = frozenset([ AUFLIA,
+-                             AUFLIRA,
+-                             AUFNIRA,
+-                             ALIA,
+-                             LRA,
+-                             LIA,
+-                             NIA,
+-                             NRA,
+-                             UFLRA,
+-                             UFNIA,
+-                             UFLIRA,
+-                             QF_ABV,
+-                             QF_AUFBV,
+-                             QF_AUFLIA,
+-                             QF_ALIA,
+-                             QF_AX,
+-                             QF_BV,
+-                             QF_IDL,
+-                             QF_LIA,
+-                             QF_LRA,
+-                             QF_NIA,
+-                             QF_NRA,
+-                             QF_RDL,
+-                             QF_UF,
+-                             QF_UFBV ,
+-                             QF_UFIDL,
+-                             QF_UFLIA,
+-                             QF_UFLRA,
+-                             QF_UFNRA,
+-                             QF_UFNIA,
+-                             QF_UFLIRA,
+-                             QF_SLIA
+-                         ])
+-
+-LOGICS = SMTLIB2_LOGICS | frozenset([ QF_BOOL, BOOL, QF_AUFBVLIRA])
++SMTLIB2_LOGICS = frozenset([AUFLIA,
++                            AUFLIRA,
++                            AUFNIRA,
++                            ALIA,
++                            LRA,
++                            LIA,
++                            NIA,
++                            NRA,
++                            UFLRA,
++                            UFNIA,
++                            UFLIRA,
++                            QF_ABV,
++                            QF_AUFBV,
++                            QF_AUFLIA,
++                            QF_ALIA,
++                            QF_AX,
++                            QF_BV,
++                            QF_IDL,
++                            QF_LIA,
++                            QF_LRA,
++                            QF_NIA,
++                            QF_NRA,
++                            QF_RDL,
++                            QF_UF,
++                            QF_UFBV,
++                            QF_UFIDL,
++                            QF_UFLIA,
++                            QF_UFLRA,
++                            QF_UFNRA,
++                            QF_UFNIA,
++                            QF_UFLIRA,
++                            QF_SLIA
++                            ])
++
++LOGICS = SMTLIB2_LOGICS | frozenset([QF_BOOL, BOOL, QF_AUFBVLIRA, QF_NIRA])
+ 
+ QF_LOGICS = frozenset(_l for _l in LOGICS if _l.quantifier_free)
+ 
+@@ -668,8 +674,8 @@ PYSMT_LOGICS = frozenset([QF_BOOL, QF_IDL, QF_LIA, QF_LRA, QF_RDL, QF_UF, QF_UFI
+                           QF_BV, QF_UFBV,
+                           QF_ABV, QF_AUFBV, QF_AUFLIA, QF_ALIA, QF_AX,
+                           QF_AUFBVLIRA,
+-                          QF_NRA, QF_NIA, UFBV, BV,
+-                      ])
++                          QF_NRA, QF_NIA, QF_NIRA, UFBV, BV,
++                          ])
+ 
+ # PySMT Logics includes additional features:
+ #  - constant arrays: QF_AUFBV  becomes QF_AUFBV*
+@@ -697,7 +703,6 @@ for l in PYSMT_LOGICS:
+         ext_logics.add(nl)
+ 
+ 
+-
+ LOGICS = LOGICS | frozenset(ext_logics)
+ PYSMT_LOGICS = PYSMT_LOGICS | frozenset(ext_logics)
+ 
+diff --git a/pysmt/solvers/z3.py b/pysmt/solvers/z3.py
+index 3fb42b9..210b771 100644
+--- a/pysmt/solvers/z3.py
++++ b/pysmt/solvers/z3.py
+@@ -595,6 +595,8 @@ class Z3Converter(Converter, DagWalker):
+                                              None, None,
+                                              0, None,
+                                              expr.ast)
++        print("Z3: SMTLIB")
++        print(s)
+         stream_in = StringIO(s)
+         r = parser.get_script(stream_in).get_last_formula(self.mgr)
+         key = (askey(expr), None)
+diff --git a/pysmt/test/examples.py b/pysmt/test/examples.py
+index 73455ee..b653185 100644
+--- a/pysmt/test/examples.py
++++ b/pysmt/test/examples.py
+@@ -898,12 +898,12 @@ def get_full_example_formulae(environment=None):
+                     logic=pysmt.logics.QF_NRA
+                 ),
+ 
+-            Example(hr="((p ^ 2) = 0)",
+-                    expr=Equals(Pow(p, Int(2)), Int(0)),
++            Example(hr="((p ^ 2) = 0.0)",
++                    expr=Equals(Pow(p, Int(2)), Real(0)),
+                     is_valid=False,
+                     is_sat=True,
+-                    logic=pysmt.logics.QF_NIA
+-                ),
++                    logic=pysmt.logics.QF_NIRA
++                    ),
+ 
+             Example(hr="((r ^ 2.0) = 0.0)",
+                     expr=Equals(Pow(r, Real(2)), Real(0)),
+diff --git a/pysmt/test/test_back.py b/pysmt/test/test_back.py
+index bceb45b..7a0ad63 100644
+--- a/pysmt/test/test_back.py
++++ b/pysmt/test/test_back.py
+@@ -55,10 +55,10 @@ class TestBasic(TestCase):
+         res = msat.converter.back(term)
+         self.assertFalse(f == res)
+ 
+-    def do_back(self, solver_name, z3_string_buffer=False):
++    def do_back(self, solver_name, via_smtlib=False):
+         for formula, _, _, logic in get_example_formulae():
+             if logic.quantifier_free:
+-                if logic.theory.custom_type and z3_string_buffer:
++                if logic.theory.custom_type and via_smtlib:
+                     # Printing of declare-sort from Z3 is not conformant
+                     # with the SMT-LIB. We might consider extending our
+                     # parser.
+@@ -67,7 +67,7 @@ class TestBasic(TestCase):
+                     s = Solver(name=solver_name, logic=logic)
+                     term = s.converter.convert(formula)
+                     if solver_name == "z3":
+-                        if z3_string_buffer:
++                        if via_smtlib:
+                             res = s.converter.back_via_smtlib(term)
+                         else:
+                             res = s.converter.back(term)
+@@ -84,8 +84,8 @@ class TestBasic(TestCase):
+ 
+     @skipIfSolverNotAvailable("z3")
+     def test_z3_back_formulae(self):
+-        self.do_back("z3", z3_string_buffer=False)
+-        self.do_back("z3", z3_string_buffer=True)
++        self.do_back("z3", via_smtlib=True)
++        self.do_back("z3", via_smtlib=False)
+ 
+ 
+ if __name__ == '__main__':
+diff --git a/pysmt/type_checker.py b/pysmt/type_checker.py
+index b700fcf..7ce05aa 100644
+--- a/pysmt/type_checker.py
++++ b/pysmt/type_checker.py
+@@ -33,6 +33,8 @@ class SimpleTypeChecker(walkers.DagWalker):
+ 
+     def __init__(self, env=None):
+         walkers.DagWalker.__init__(self, env=env)
++        # Return None if the type cannot be computed rather than
++        # raising an exception.
+         self.be_nice = False
+ 
+     def _get_key(self, formula, **kwargs):
+@@ -42,7 +44,7 @@ class SimpleTypeChecker(walkers.DagWalker):
+         """ Returns the pysmt.types type of the formula """
+         res = self.walk(formula)
+         if not self.be_nice and res is None:
+-            raise PysmtTypeError("The formula '%s' is not well-formed" \
++            raise PysmtTypeError("The formula '%s' is not well-formed"
+                                  % str(formula))
+         return res
+ 
+@@ -114,7 +116,7 @@ class SimpleTypeChecker(walkers.DagWalker):
+ 
+     def walk_bv_comp(self, formula, args, **kwargs):
+         # We check that all children are BV and the same size
+-        a,b = args
++        a, b = args
+         if a != b or (not a.is_bv_type()):
+             return None
+         return BVType(1)
+@@ -187,7 +189,7 @@ class SimpleTypeChecker(walkers.DagWalker):
+         if args[0].is_bool_type():
+             raise PysmtTypeError("The formula '%s' is not well-formed."
+                                  "Equality operator is not supported for Boolean"
+-                                 " terms. Use Iff instead." \
++                                 " terms. Use Iff instead."
+                                  % str(formula))
+         elif args[0].is_bv_type():
+             return self.walk_bv_to_bool(formula, args)
+@@ -324,10 +326,7 @@ class SimpleTypeChecker(walkers.DagWalker):
+     def walk_pow(self, formula, args, **kwargs):
+         if args[0] != args[1]:
+             return None
+-        # Exponent must be positive for INT
+-        if args[0].is_int_type() and formula.arg(1).constant_value() < 0 :
+-            return None
+-        return args[0]
++        return REAL
+ 
+ # EOC SimpleTypeChecker
+ 
diff --git a/gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch b/gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch
new file mode 100644
index 0000000000..eee555f807
--- /dev/null
+++ b/gnu/packages/patches/python-pysmt-fix-smtlib-serialization-test.patch
@@ -0,0 +1,86 @@
+Backport of an upstream patch fixing a test suite failure.
+
+Taken from: https://github.com/pysmt/pysmt/commit/a246669a487aff69f5da34570ef867841d18508a
+
+diff --git a/pysmt/test/smtlib/test_parser_examples.py b/pysmt/test/smtlib/test_parser_examples.py
+index cca4194..c0852be 100644
+--- a/pysmt/test/smtlib/test_parser_examples.py
++++ b/pysmt/test/smtlib/test_parser_examples.py
+@@ -29,6 +29,7 @@ from pysmt.shortcuts import Iff
+ from pysmt.shortcuts import read_smtlib, write_smtlib, get_env
+ from pysmt.exceptions import PysmtSyntaxError
+ 
++
+ class TestSMTParseExamples(TestCase):
+ 
+     def test_parse_examples(self):
+@@ -41,7 +42,6 @@ class TestSMTParseExamples(TestCase):
+             buf = StringIO()
+             script_out = smtlibscript_from_formula(f_out)
+             script_out.serialize(outstream=buf)
+-            #print(buf)
+ 
+             buf.seek(0)
+             parser = SmtLibParser()
+@@ -49,7 +49,6 @@ class TestSMTParseExamples(TestCase):
+             f_in = script_in.get_last_formula()
+             self.assertEqual(f_in.simplify(), f_out.simplify())
+ 
+-
+     @skipIfNoSolverForLogic(logics.QF_BV)
+     def test_parse_examples_bv(self):
+         """For BV we represent a superset of the operators defined in SMT-LIB.
+@@ -108,7 +107,18 @@ class TestSMTParseExamples(TestCase):
+             self.assertValid(Iff(f_in, f_out), f_in.serialize())
+ 
+     def test_dumped_logic(self):
+-        # Dumped logic matches the logic in the example
++        # Dumped logic matches the logic in the example.
++        #
++        # There are a few cases where we use a logic
++        # that does not exist in SMT-LIB, and the SMT-LIB
++        # serialization logic will find a logic that
++        # is more expressive. We need to adjust the test
++        # for those cases (see rewrite dict below).
++        rewrite = {
++            logics.QF_BOOL: logics.QF_UF,
++            logics.BOOL: logics.LRA,
++            logics.QF_NIRA: logics.AUFNIRA,
++        }
+         fs = get_example_formulae()
+ 
+         for (f_out, _, _, logic) in fs:
+@@ -121,14 +131,9 @@ class TestSMTParseExamples(TestCase):
+             for cmd in script_in:
+                 if cmd.name == "set-logic":
+                     logic_in = cmd.args[0]
+-                    if logic == logics.QF_BOOL:
+-                        self.assertEqual(logic_in, logics.QF_UF)
+-                    elif logic == logics.BOOL:
+-                        self.assertEqual(logic_in, logics.LRA)
+-                    else:
+-                        self.assertEqual(logic_in, logic, script_in)
++                    self.assertEqual(logic_in, rewrite.get(logic, logic))
+                     break
+-            else: # Loops exited normally
++            else:  # Loops exited normally
+                 print("-"*40)
+                 print(script_in)
+ 
+@@ -136,7 +141,7 @@ class TestSMTParseExamples(TestCase):
+         fs = get_example_formulae()
+ 
+         fdi, tmp_fname = mkstemp()
+-        os.close(fdi) # Close initial file descriptor
++        os.close(fdi)  # Close initial file descriptor
+         for (f_out, _, _, _) in fs:
+             write_smtlib(f_out, tmp_fname)
+             # with open(tmp_fname) as fin:
+@@ -197,7 +202,6 @@ class TestSMTParseExamples(TestCase):
+         f_in = script.get_last_formula()
+         self.assertSat(f_in)
+ 
+-
+     def test_int_promotion_define_fun(self):
+         script = """
+         (define-fun x () Int 8)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 6f80ff9d83..df9f5d742c 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -33787,6 +33787,39 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-pysmt
+  (package
+    (name "python-pysmt")
+    (version "0.9.5")
+    (source
+     (origin
+       ;; Fetching from Git as pypi release doesn't include all test files.
+       (method git-fetch)
+       (patches (search-patches "python-pysmt-fix-pow-return-type.patch"
+                 "python-pysmt-fix-smtlib-serialization-test.patch"))
+       (uri (git-reference
+             (url "https://github.com/pysmt/pysmt")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0hrxv23y5ip4ijfx5pvbwc2fq4zg9jz42wc9zqgqm0g0mjc9ckvh"))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (add-before 'check 'set-pysmt-solver
+                    (lambda _
+                      (setenv "PYSMT_SOLVER" "z3"))))))
+    (native-inputs (list python-pytest))
+    (propagated-inputs (list z3))
+    (home-page "https://github.com/pysmt/pysmt")
+    (synopsis
+     "Solver-agnostic library for SMT formula manipulation and solving")
+    (description
+     "This Python module provides a solver-agnostic abstraction for
+working with @acronym{SMT, Satisfiability Modulo Theory} formulas.  For example,
+it allows manipulation and solving such formulas.")
+    (license license:asl2.0)))
+
 (define-public python-rpyc
   (package
     (name "python-rpyc")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH 06/11] gnu: Add python-claripy.
  2024-07-11 21:27 ` [bug#69074] [PATCH 01/11] gnu: Add python-keystone-engine soeren
                     ` (3 preceding siblings ...)
  2024-07-11 21:27   ` [bug#69074] [PATCH 05/11] gnu: Add python-pysmt soeren
@ 2024-07-11 21:27   ` soeren
  2024-07-11 21:27   ` [bug#69074] [PATCH 07/11] gnu: Add python-archinfo soeren
                     ` (4 subsequent siblings)
  9 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-11 21:27 UTC (permalink / raw)
  To: 69074
  Cc: jgart, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-claripy): New variable.
---
 gnu/packages/python-xyz.scm | 40 +++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index df9f5d742c..dc92d4db08 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -33787,6 +33787,46 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-claripy
+  (package
+    (name "python-claripy")
+    ;; Must be the same version as python-angr.
+    (version "9.2.46")
+    (source
+     (origin
+       ;; Fetching from Git as pypi release doesn't include all test files.
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/angr/claripy")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0nmawpi1596d9plafrp2db36cjsidy2fagkzkja51jwlx2m1ngai"))
+       (modules '((guix build utils)))
+       (snippet '(begin
+                   (substitute* "setup.cfg"
+                     ;; Relax the z3 version constraint.
+                     ;; See https://github.com/angr/claripy/commit/d1fe2df
+                     (("z3-solver==4.10.2.0")
+                      ""))))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (propagated-inputs (list python-cachetools python-decorator python-pysmt
+                             z3))
+    (home-page "https://github.com/angr/claripy")
+    (synopsis "Abstraction layer for constraint solvers")
+    (description
+     "This Python module provides an abstraction layer for interacting
+with constraint solvers.  Specifically, it is intended to be used with
+SMT solvers and is built on top of the Z3 solver.")
+    (license license:bsd-2)))
+
 (define-public python-pysmt
   (package
     (name "python-pysmt")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH 07/11] gnu: Add python-archinfo.
  2024-07-11 21:27 ` [bug#69074] [PATCH 01/11] gnu: Add python-keystone-engine soeren
                     ` (4 preceding siblings ...)
  2024-07-11 21:27   ` [bug#69074] [PATCH 06/11] gnu: Add python-claripy soeren
@ 2024-07-11 21:27   ` soeren
  2024-07-11 21:27   ` [bug#69074] [PATCH 08/11] gnu: Add python-pyvex soeren
                     ` (3 subsequent siblings)
  9 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-11 21:27 UTC (permalink / raw)
  To: 69074; +Cc: jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/emulators.scm (python-archinfo): New variable.
---
 gnu/packages/emulators.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index 486610f1f0..f2b93666b1 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -67,6 +67,7 @@ (define-module (gnu packages emulators)
   #:use-module (gnu packages cross-base)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages digest)
+  #:use-module (gnu packages engineering)
   #:use-module (gnu packages elf)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fltk)
@@ -2644,6 +2645,33 @@ (define-public python-keystone-engine
 assembly for these architectures.")
     (license license:gpl2)))
 
+(define-public python-archinfo
+  (package
+    (name "python-archinfo")
+    ;; Must be the same version as python-angr.
+    (version "9.2.46")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "archinfo" version))
+       (sha256
+        (base32 "037xfq3wcf8ngayxz9623l4646m780v2102mfbygpzbkkjha1966"))))
+    (build-system pyproject-build-system)
+    (propagated-inputs (list python-capstone python-keystone-engine))
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (home-page "https://github.com/angr/archinfo")
+    (synopsis "Extract architecture-specific information from binaries")
+    (description
+     "Collection of classes that contain architecture-specific information
+information.  Useful for cross-architecture tools (such as @code{python-pyvex}).")
+    (license license:bsd-2)))
+
 (define-public emu8051
   (let ((commit "5dc681275151c4a5d7b85ec9ff4ceb1b25abd5a8")
         (revision "1"))




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH 08/11] gnu: Add python-pyvex.
  2024-07-11 21:27 ` [bug#69074] [PATCH 01/11] gnu: Add python-keystone-engine soeren
                     ` (5 preceding siblings ...)
  2024-07-11 21:27   ` [bug#69074] [PATCH 07/11] gnu: Add python-archinfo soeren
@ 2024-07-11 21:27   ` soeren
  2024-07-11 21:27   ` [bug#69074] [PATCH 09/11] gnu: Add python-cle soeren
                     ` (2 subsequent siblings)
  9 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-11 21:27 UTC (permalink / raw)
  To: 69074
  Cc: jgart, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/patches/python-pyvex-remove-angr-dependency.patch:
New patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/python-xyz.scm (python-pyvex): New variable.
---
 gnu/local.mk                                  |  1 +
 .../python-pyvex-remove-angr-dependency.patch | 80 +++++++++++++++++++
 gnu/packages/python-xyz.scm                   | 37 +++++++++
 3 files changed, 118 insertions(+)
 create mode 100644 gnu/packages/patches/python-pyvex-remove-angr-dependency.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 73b445f1fc..020f85337a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1981,6 +1981,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-pytorch-runpath.patch		\
   %D%/packages/patches/python-pytorch-system-libraries.patch	\
   %D%/packages/patches/python-pytorch-without-kineto.patch	\
+  %D%/packages/patches/python-pyvex-remove-angr-dependency.patch	\
   %D%/packages/patches/python-robotframework-atest.patch	\
   %D%/packages/patches/python-robotframework-source-date-epoch.patch \
   %D%/packages/patches/python-robotframework-sshlibrary-rf5-compat.patch \
diff --git a/gnu/packages/patches/python-pyvex-remove-angr-dependency.patch b/gnu/packages/patches/python-pyvex-remove-angr-dependency.patch
new file mode 100644
index 0000000000..dccf22bbc6
--- /dev/null
+++ b/gnu/packages/patches/python-pyvex-remove-angr-dependency.patch
@@ -0,0 +1,80 @@
+This patch removes the angr dependency from the pyvex these, thus
+resolving a circular dependency (as angr depends on pyvex). This
+patch has been taken from upstream.
+
+This patch is a squashed version of the following upstream patches:
+
+* https://github.com/angr/pyvex/commit/61fb26f223a8d8a276b702d2448a12e02c5c9c6b
+* https://github.com/angr/pyvex/commit/a1fb2a4d0826b0e43bd8bbdd00b6db032643ec95
+
+diff --git a/tests/test_spotter.py b/tests/test_spotter.py
+index 9271ccd..bed7dd4 100644
+--- a/tests/test_spotter.py
++++ b/tests/test_spotter.py
+@@ -1,6 +1,5 @@
+ import os
+ 
+-import angr
+ import archinfo
+ 
+ import pyvex
+@@ -98,53 +97,28 @@ class CortexSpotter(GymratLifter):
+ register(CortexSpotter, "ARMEL")
+ 
+ 
+-def test_full_binary():
+-    p = angr.Project(
+-        os.path.join(test_location, "armel", "RTOSDemo.axf.issue_685"),
+-        arch="ARMEL",
+-        auto_load_libs=False,
+-    )
+-    st = p.factory.call_state(0x000013CE + 1)
+-    b = st.block().vex
+-    simgr = p.factory.simulation_manager(st)
+-    simgr.step()
+-    assert b.jumpkind == "Ijk_Sys_syscall"
+-    assert simgr.active[0].regs.ip_at_syscall.args[0] == 0x13FB
+-
+-
+ def test_tmrs():
+-    test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../binaries/tests"))
+-    p = angr.Project(
+-        os.path.join(test_location, "armel", "helloworld"),
+-        arch="ARMEL",
+-        auto_load_libs=False,
+-    )
++    arch = archinfo.arch_from_id("ARMEL")
+     ins = b"\xef\xf3\x08\x82"
+-    b = pyvex.block.IRSB(ins, 1, p.arch)
++    b = pyvex.block.IRSB(ins, 1, arch)
+     assert b.jumpkind == "Ijk_Boring"
+     assert type(b.statements[1].data) == pyvex.expr.Get
+-    assert p.arch.register_names.get(b.statements[1].data.offset, "") == "sp"
++    assert arch.register_names.get(b.statements[1].data.offset, "") == "sp"
+     assert type(b.statements[2]) == pyvex.stmt.Put
+ 
+ 
+ def test_tmsr():
+-    test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../binaries/tests"))
+-    p = angr.Project(
+-        os.path.join(test_location, "armel", "helloworld"),
+-        arch="ARMEL",
+-        auto_load_libs=False,
+-    )
++    arch = archinfo.arch_from_id("ARMEL")
+     inss = b"\x82\xf3\x08\x88"
+-    b = pyvex.block.IRSB(inss, 1, p.arch, opt_level=3)
++    b = pyvex.block.IRSB(inss, 1, arch, opt_level=3)
+     assert b.jumpkind == "Ijk_Boring"
+     assert type(b.statements[1].data) == pyvex.expr.Get
+-    assert p.arch.register_names.get(b.statements[1].data.offset, "") == "r2"
++    assert arch.register_names.get(b.statements[1].data.offset, "") == "r2"
+     assert type(b.statements[2]) == pyvex.stmt.Put
+ 
+ 
+ if __name__ == "__main__":
+     test_basic()
+     test_embedded()
+-    test_full_binary()
+     test_tmrs()
+     test_tmsr()
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index dc92d4db08..6abeac61e6 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -200,6 +200,7 @@ (define-module (gnu packages python-xyz)
   #:use-module (gnu packages docker)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages elf)
+  #:use-module (gnu packages emulators)
   #:use-module (gnu packages enchant)
   #:use-module (gnu packages file)
   #:use-module (gnu packages fonts)
@@ -33787,6 +33788,42 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-pyvex
+  (package
+    (name "python-pyvex")
+    ;; Must be the same version as python-angr.
+    (version "9.2.46")
+    (source
+     (origin
+       (method url-fetch)
+       (patches (search-patches "python-pyvex-remove-angr-dependency.patch"))
+       (uri (pypi-uri "pyvex" version))
+       (sha256
+        (base32 "1v64rn7gxy6fg065bgsy38z6r494k5ri5r6sn4g08hjj32ihx1ka"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:phases #~(modify-phases %standard-phases
+                   (replace 'check
+                     (lambda* (#:key tests? #:allow-other-keys)
+                       (when tests?
+                         (with-directory-excursion "tests"
+                           (invoke "python" "-m" "unittest")))))
+
+                   (add-before 'build 'set-cc-native
+                     (lambda _
+                       (setenv "CC" #$(cc-for-target))
+                       (setenv "CC_NATIVE" "gcc"))))))
+    (propagated-inputs (list python-archinfo python-bitstring python-cffi))
+    (home-page "https://github.com/angr/pyvex")
+    (synopsis "Python interface to libVEX and VEX IR")
+    (description
+     "This package provides a Python interface the libVEX and VEX IR.
+VEX is the intermediate representation (also known as intermediate
+language) used by the Valgrind analysis tool.  As such, VEX is designed
+to enable all kinds of binary analysis tasks.")
+    (license license:bsd-2)))
+
 (define-public python-claripy
   (package
     (name "python-claripy")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH 09/11] gnu: Add python-cle.
  2024-07-11 21:27 ` [bug#69074] [PATCH 01/11] gnu: Add python-keystone-engine soeren
                     ` (6 preceding siblings ...)
  2024-07-11 21:27   ` [bug#69074] [PATCH 08/11] gnu: Add python-pyvex soeren
@ 2024-07-11 21:27   ` soeren
  2024-07-11 21:27   ` [bug#69074] [PATCH 10/11] gnu: Add python-ailment soeren
  2024-07-11 21:27   ` [bug#69074] [PATCH 11/11] gnu: Add python-angr soeren
  9 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-11 21:27 UTC (permalink / raw)
  To: 69074
  Cc: jgart, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-cle): New variable.
---
 gnu/packages/python-xyz.scm | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 6abeac61e6..a5b36fda81 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -33788,6 +33788,32 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-cle
+  (package
+    (name "python-cle")
+    ;; Must be the same version as python-angr.
+    (version "9.2.46")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "cle" version))
+       (sha256
+        (base32 "0mswv9gd2p2ws7zfsshqv5ybbj27wkdwakdcknq4vsrx9ry9k4yc"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:tests? #f))
+    (propagated-inputs (list python-pefile python-pyelftools python-pyvex
+                             python-sortedcontainers))
+    (native-inputs (list python-cffi))
+    (home-page "https://github.com/angr/cle")
+    (synopsis "Python loader for binaries and their associated libraries")
+    (description
+     "CLE loads binaries and their associated libraries, resolves
+imports and provides an abstraction of process memory the same way as if
+it was loader by the operating system's loader.")
+    (license license:bsd-2)))
+
 (define-public python-pyvex
   (package
     (name "python-pyvex")
@@ -33810,7 +33836,7 @@ (define-public python-pyvex
                          (with-directory-excursion "tests"
                            (invoke "python" "-m" "unittest")))))
 
-                   (add-before 'build 'set-cc-native
+                   (add-before 'build 'set-cc
                      (lambda _
                        (setenv "CC" #$(cc-for-target))
                        (setenv "CC_NATIVE" "gcc"))))))




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH 10/11] gnu: Add python-ailment.
  2024-07-11 21:27 ` [bug#69074] [PATCH 01/11] gnu: Add python-keystone-engine soeren
                     ` (7 preceding siblings ...)
  2024-07-11 21:27   ` [bug#69074] [PATCH 09/11] gnu: Add python-cle soeren
@ 2024-07-11 21:27   ` soeren
  2024-07-11 21:27   ` [bug#69074] [PATCH 11/11] gnu: Add python-angr soeren
  9 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-11 21:27 UTC (permalink / raw)
  To: 69074
  Cc: jgart, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/python-xyz.scm (python-ailment): New variable.
---
 gnu/packages/python-xyz.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index a5b36fda81..190333b178 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -33788,6 +33788,34 @@ (define-public python-opcodes
 and BMI2).")
       (license license:bsd-2))))
 
+(define-public python-ailment
+  (package
+    (name "python-ailment")
+    ;; Must be the same version as python-angr.
+    (version "9.2.46")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "ailment" version))
+       (sha256
+        (base32 "073fcssbjis1ckwv2w0dcz2dfl6715bj4d4qdhspajj911mvng2f"))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    ;; Many tests are skipped due to cyclic dependencies.
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (with-directory-excursion "tests"
+                          (invoke "python" "-m" "unittest"))))))))
+    (home-page "https://github.com/angr/ailment")
+    (synopsis "The angr intermediate language")
+    (description
+     "This Python module implements an @acronym{IL, Intermediate Language},
+also known as @acronym{IR, Intermediate Representation}, used by the angr
+binary analysis platform.")
+    (license license:bsd-2)))
+
 (define-public python-cle
   (package
     (name "python-cle")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH 11/11] gnu: Add python-angr.
  2024-07-11 21:27 ` [bug#69074] [PATCH 01/11] gnu: Add python-keystone-engine soeren
                     ` (8 preceding siblings ...)
  2024-07-11 21:27   ` [bug#69074] [PATCH 10/11] gnu: Add python-ailment soeren
@ 2024-07-11 21:27   ` soeren
  9 siblings, 0 replies; 78+ messages in thread
From: soeren @ 2024-07-11 21:27 UTC (permalink / raw)
  To: 69074
  Cc: jgart, Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
	Sharlatan Hellseher, Tanguy Le Carrour, jgart

From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/patches/python-angr-addition-type-error.patch:
New patch.
* gnu/packages/patches/python-angr-check-exec-deps.patch:
New patch.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/python-xyz.scm (python-angr): New variable.
---
 gnu/local.mk                                  |  2 +
 .../python-angr-addition-type-error.patch     | 18 ++++
 .../patches/python-angr-check-exec-deps.patch | 93 ++++++++++++++++++
 gnu/packages/python-xyz.scm                   | 97 +++++++++++++++++++
 4 files changed, 210 insertions(+)
 create mode 100644 gnu/packages/patches/python-angr-addition-type-error.patch
 create mode 100644 gnu/packages/patches/python-angr-check-exec-deps.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 020f85337a..e584e426d0 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1948,6 +1948,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-3-search-paths.patch		\
   %D%/packages/patches/python-3-fix-tests.patch			\
   %D%/packages/patches/python-3-hurd-configure.patch		\
+  %D%/packages/patches/python-angr-addition-type-error.patch	\
+  %D%/packages/patches/python-angr-check-exec-deps.patch	\
   %D%/packages/patches/python-aionotify-0.2.0-py3.8.patch	\
   %D%/packages/patches/python-argcomplete-1.11.1-fish31.patch	\
   %D%/packages/patches/python-cross-compile.patch		\
diff --git a/gnu/packages/patches/python-angr-addition-type-error.patch b/gnu/packages/patches/python-angr-addition-type-error.patch
new file mode 100644
index 0000000000..7301d8b505
--- /dev/null
+++ b/gnu/packages/patches/python-angr-addition-type-error.patch
@@ -0,0 +1,18 @@
+This fixes failures of the test_ln_gcc_O2 and other related tests
+in the angr test suite.  The patch has been proposed upstream.
+
+Taken form: https://github.com/angr/angr/pull/4443
+
+diff --git a/angr/analyses/reassembler.py b/angr/analyses/reassembler.py
+index 7a2399a60..b09b3a8cb 100644
+--- a/angr/analyses/reassembler.py
++++ b/angr/analyses/reassembler.py
+@@ -730,7 +730,7 @@ class Instruction:
+             elif operand.type == capstone.CS_OP_MEM:
+                 operand_offsets.append(capstone_instr.disp_offset)
+             else:
+-                operand_offsets.append(None)
++                operand_offsets.append(0)
+ 
+         if self.addr is not None:
+             self._initialize(capstone_instr.operands, operand_offsets)
diff --git a/gnu/packages/patches/python-angr-check-exec-deps.patch b/gnu/packages/patches/python-angr-check-exec-deps.patch
new file mode 100644
index 0000000000..438f8ef183
--- /dev/null
+++ b/gnu/packages/patches/python-angr-check-exec-deps.patch
@@ -0,0 +1,93 @@
+The angr test suite performs analysis on several pre-compiled binaries
+to ensure its binary analysis capabilities are working as intended.
+Some of these binaries are also executed as part of the test suite to
+test if the simulation engine provided by angr results in the same
+output as native execution of the binary.
+
+For Guix, this files as the glibc shared objects cannot be found.
+Additionally, we don't really want to execute pre-compiled binaries
+on Guix, hence we disable those tests.
+
+diff --git a/tests/test_ctype_locale.py b/tests/test_ctype_locale.py
+index 08cb89836..2b9233558 100644
+--- a/tests/test_ctype_locale.py
++++ b/tests/test_ctype_locale.py
+@@ -14,7 +14,7 @@ test_location = os.path.dirname(os.path.abspath(__file__))
+ 
+ 
+ class TestCtypeLocale(unittest.TestCase):
+-    @skip_if_not_linux
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_ctype_b_loc(self):
+         """
+         test_ctype_locale.test_ctype_b_loc
+@@ -60,7 +60,7 @@ class TestCtypeLocale(unittest.TestCase):
+         output = subprocess.check_output(bin_path, shell=True)
+         assert result == output
+ 
+-    @skip_if_not_linux
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_ctype_tolower_loc(self):
+         """
+         test_ctype_locale.test_ctype_tolower_loc
+@@ -109,7 +109,7 @@ class TestCtypeLocale(unittest.TestCase):
+         output = subprocess.check_output(bin_path, shell=True)
+         assert result == output
+ 
+-    @skip_if_not_linux
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_ctype_toupper_loc(self):
+         """
+         test_ctype_locale.test_ctype_toupper_loc
+diff --git a/tests/test_signed_div.py b/tests/test_signed_div.py
+index 59cb9b8d1..994ed9c65 100644
+--- a/tests/test_signed_div.py
++++ b/tests/test_signed_div.py
+@@ -1,6 +1,7 @@
+ import angr
+ import subprocess
+ import sys
++import pytest
+ 
+ import logging
+ 
+@@ -13,7 +14,7 @@ import os
+ test_location = os.path.dirname(os.path.realpath(__file__))
+ 
+ 
+-@skipUnless(sys.platform.startswith("linux"), "linux only")
++@pytest.mark.skip(reason="test executes pre-compiled binaries")
+ def test_signed_div():
+     test_bin = os.path.join(test_location, "..", "..", "binaries", "tests", "x86_64", "test_signed_div")
+     b = angr.Project(test_bin, auto_load_libs=False)
+diff --git a/tests/test_sscanf.py b/tests/test_sscanf.py
+index 29d2c8403..ea799b310 100644
+--- a/tests/test_sscanf.py
++++ b/tests/test_sscanf.py
+@@ -1,3 +1,4 @@
++import pytest
+ import angr
+ import subprocess
+ import sys
+@@ -14,7 +15,7 @@ test_location = os.path.dirname(os.path.realpath(__file__))
+ 
+ 
+ class TestSscanf(unittest.TestCase):
+-    @unittest.skipUnless(sys.platform.startswith("linux"), "linux only")
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_sscanf(self):
+         test_bin = os.path.join(test_location, "..", "..", "binaries", "tests", "x86_64", "sscanf_test")
+         b = angr.Project(test_bin, auto_load_libs=False)
+diff --git a/tests/test_strtol.py b/tests/test_strtol.py
+index 6c29cab22..f36181407 100644
+--- a/tests/test_strtol.py
++++ b/tests/test_strtol.py
+@@ -11,7 +11,7 @@ class TestStrtol(unittest.TestCase):
+     # pylint: disable=no-self-use
+ 
+     @slow_test
+-    @unittest.skipUnless(sys.platform.startswith("linux"), "linux-only")
++    @unittest.skip("test executes pre-compiled binaries")
+     def test_strtol(self, threads=None):
+         test_bin = os.path.join(bin_location, "tests", "x86_64", "strtol_test")
+         # disabling auto_load_libs increases the execution time of the test case.
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 190333b178..318325f624 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -34067,6 +34067,103 @@ (define-public python-itanium-demangler
 mangled symbols, which can be used for directly extracting type information.")
     (license license:bsd-0)))
 
+(define-public python-angr
+  (package
+    (name "python-angr")
+    (version "9.2.46")
+    (source
+     (origin
+       ;; Fetching from Git as pypi release doesn't include all test files.
+       (method git-fetch)
+       (patches (search-patches "python-angr-addition-type-error.patch"
+                                "python-angr-check-exec-deps.patch"))
+       (uri (git-reference
+             (url "https://github.com/angr/angr")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "18y9wyf7va7gvp9zd6lhw82j9a2x2ajsvbawh96xnxzml0jwlwjm"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'patch-tests
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       (let ((coreutils (assoc-ref inputs "coreutils")))
+                         (substitute* "tests/test_vault.py"
+                           (("/bin/false")
+                            (which "false")))
+                         (substitute* "tests/common.py"
+                           (("\\[\"cc\"\\]")
+                            "[\"gcc\"]")))))
+                   (replace 'check
+                     (lambda* (#:key inputs tests? #:allow-other-keys)
+                       (when tests?
+                         (copy-recursively #$(this-package-native-input "binaries")
+                                           "../binaries")
+                         (with-directory-excursion "tests"
+                           ;; test_mips32_missing_offset_in_instructions fails
+                           ;; with capstone 5 and passes with capstone 4. Might
+                           ;; be a capstone regressions, needs investigation.
+                           ;;
+                           ;; test_concrete_memset is a non-deterministic benchmark.
+                           (invoke "pytest" "-vv" "-x" "--dist" "loadfile"
+                                   "-k" "not test_mips32_missing_offset_in_instructions and not test_concrete_memset"
+                                   "-n" (number->string (parallel-job-count)))))))
+                   (add-before 'build 'set-cc
+                     (lambda _
+                       (setenv "CC" "gcc"))))))
+    (propagated-inputs (list python-ailment
+                             python-archinfo
+                             python-cachetools
+                             python-cffi
+                             python-claripy
+                             python-cle
+                             python-colorama
+                             python-cppheaderparser
+                             python-dpkt
+                             python-gitpython
+                             python-mulpyplexer
+                             python-nampa
+                             python-networkx
+                             python-protobuf
+                             python-psutil
+                             python-itanium-demangler
+                             python-pycparser
+                             python-pyvex
+                             python-progressbar2
+                             python-rpyc
+                             python-sortedcontainers
+                             python-sqlalchemy
+                             python-sympy
+                             unicorn))
+    (native-inputs `(("python-pytest" ,python-pytest)
+                     ("python-pytest-xdist" ,python-pytest-xdist)
+                     ("binaries"
+                      ;; This repository ships several binaries used only for testing
+                      ;; purpose.  The binaries are not executed and not part of the
+                      ;; angr distribution, they are only used to test angr's binary
+                      ;; analysis capabilities.  In the context of the GNU FSDG, these
+                      ;; files should be considered non-functional data.
+                      ,(origin
+                         (method git-fetch)
+                         (uri (git-reference (url
+                                              "https://github.com/angr/binaries")
+                                             (commit (string-append "v"
+                                                                    version))))
+                         (file-name (git-file-name "angr-binaries" version))
+                         (sha256 (base32
+                                  "1f286b2239zavxzwg1184hj1zs380cr9qr549mvy3vywvm8bsmgr"))))))
+    (home-page "https://github.com/angr/angr")
+    (synopsis "Multi-architecture binary analysis toolkit")
+    (description
+     "This package provides a versatile binary analysis platform with the
+ability to perform dynamic symbolic execution as well as various
+static analyses directly on binaries.  As such, it can be used for all
+kinds of reverse engineering, vulnerability discovery, exploit
+generation, and software testing purposes.")
+    (license license:bsd-2)))
+
 (define-public python-peachpy
   ;; There is no tag in this repo.
   (let ((commit "913d74c35a6b1d330e90bfc055208ce5b06b35a0")




^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [bug#69074] [PATCH] Add python-angr.
  2024-07-08 21:29           ` jgart via Guix-patches via
  2024-07-09 16:35             ` Sören Tempel
@ 2024-07-11 21:32             ` Sören Tempel
  2024-07-13 20:11               ` bug#69074: " jgart via Guix-patches via
  1 sibling, 1 reply; 78+ messages in thread
From: Sören Tempel @ 2024-07-11 21:32 UTC (permalink / raw)
  To: jgart; +Cc: Troy Figiel, 69074

Hi jgart,

Thanks for merging the capstone, unicorn, and python-itanium-demangler
patches and your helpful feedback for improving these patches further.

jgart <jgart@dismail.de> wrote:
> Can you send a v2 without python-itanium-demangler in a new patch
> series?

Yes, I just send a new revision of the patchset which has been rebased
against the current master and hence no longer includes changes
to capstone, unicorn or python-itanium-demangler.

> If not using the PyPI source we should add a comment as to why not. We
> prefer PyPI whenever possible for `guix import` tool reasons.

I also added these comments in the new patch revision.

Let me know what else needs to be done to get this merged.

Looking forward to your input!

Best,
Sören




^ permalink raw reply	[flat|nested] 78+ messages in thread

* bug#69074: [PATCH] Add python-angr.
  2024-07-11 21:32             ` Sören Tempel
@ 2024-07-13 20:11               ` jgart via Guix-patches via
  0 siblings, 0 replies; 78+ messages in thread
From: jgart via Guix-patches via @ 2024-07-13 20:11 UTC (permalink / raw)
  To: 69074-done; +Cc: Troy Figiel, jgart, Sören Tempel


Hi, applied!

Thanks for the revisions and your contributions to Guix.
-- 
all the best,
jgart




^ permalink raw reply	[flat|nested] 78+ messages in thread

end of thread, other threads:[~2024-07-13 20:13 UTC | newest]

Thread overview: 78+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-12 14:55 [bug#69074] [PATCH] Add python-angr soeren
2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-itanium-demangle soeren
2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-keystone-engine soeren
2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-mulpyplexer soeren
2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-nampa soeren
2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-rpyc soeren
2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-pysmt soeren
2024-02-12 14:58 ` Troy Figiel
2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-claripy soeren
2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-archinfo soeren
2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-pyvex soeren
2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-cle soeren
2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-ailment soeren
2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: unicorn: Update to 2.0.1.post1 soeren
2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: capstone: Backport upstream fix for Python bindings soeren
2024-02-12 14:58 ` [bug#69074] [PATCH] gnu: Add python-angr Troy Figiel
2024-02-12 14:58 ` soeren
2024-02-12 22:53 ` [bug#69074] [PATCH] " Troy Figiel
2024-02-13  9:53   ` [bug#69074] " Sören Tempel
2024-02-13 11:52     ` Troy Figiel
2024-02-15 21:39       ` Troy Figiel
2024-02-15 22:09         ` Troy Figiel
2024-03-01 12:02 ` Sören Tempel
2024-03-10 20:09 ` [bug#69074] [PATCH v2 01/14] gnu: Add python-itanium-demangle soeren
2024-03-10 20:09   ` [bug#69074] [PATCH v2 02/14] gnu: Add python-keystone-engine soeren
2024-03-10 20:09   ` [bug#69074] [PATCH v2 03/14] gnu: Add python-mulpyplexer soeren
2024-03-10 20:09   ` [bug#69074] [PATCH v2 04/14] gnu: Add python-nampa soeren
2024-03-10 20:09   ` [bug#69074] [PATCH v2 05/14] gnu: Add python-rpyc soeren
2024-03-10 20:09   ` [bug#69074] [PATCH v2 06/14] gnu: Add python-pysmt soeren
2024-03-10 20:09   ` [bug#69074] [PATCH v2 07/14] gnu: Add python-claripy soeren
2024-03-10 20:09   ` [bug#69074] [PATCH v2 08/14] gnu: Add python-archinfo soeren
2024-03-10 20:09   ` [bug#69074] [PATCH v2 09/14] gnu: Add python-pyvex soeren
2024-03-10 20:09   ` [bug#69074] [PATCH v2 10/14] gnu: Add python-cle soeren
2024-03-10 20:09   ` [bug#69074] [PATCH v2 11/14] gnu: Add python-ailment soeren
2024-03-10 20:09   ` [bug#69074] [PATCH v2 12/14] gnu: unicorn: Update to 2.0.1.post1 soeren
2024-03-10 20:09   ` [bug#69074] [PATCH v2 13/14] gnu: capstone: Backport upstream fix for Python bindings soeren
2024-03-10 20:09   ` [bug#69074] [PATCH v2 14/14] gnu: Add python-angr soeren
2024-03-10 20:12 ` [bug#69074] [PATCH] " Sören Tempel
2024-03-10 22:46   ` Troy Figiel
2024-03-11  8:50     ` Sören Tempel
2024-07-04 14:05 ` Sören Tempel
2024-07-04 14:54   ` jgart via Guix-patches via
2024-07-04 20:26     ` Sören Tempel
2024-07-04 20:52       ` jgart via Guix-patches via
2024-07-05 11:47         ` Sören Tempel
2024-07-08 21:29           ` jgart via Guix-patches via
2024-07-09 16:35             ` Sören Tempel
2024-07-09 19:19               ` jgart via Guix-patches via
2024-07-10  8:12                 ` Sören Tempel
2024-07-11 21:32             ` Sören Tempel
2024-07-13 20:11               ` bug#69074: " jgart via Guix-patches via
2024-07-04 20:54       ` [bug#69074] " jgart via Guix-patches via
2024-07-05  0:09       ` jgart via Guix-patches via
2024-07-04 20:05 ` [bug#69074] [PATCH v3 01/14] gnu: Add python-itanium-demangle soeren
2024-07-04 20:05   ` [bug#69074] [PATCH v3 02/14] gnu: Add python-keystone-engine soeren
2024-07-04 20:05   ` [bug#69074] [PATCH v3 03/14] gnu: Add python-mulpyplexer soeren
2024-07-04 20:05   ` [bug#69074] [PATCH v3 04/14] gnu: Add python-nampa soeren
2024-07-04 20:05   ` [bug#69074] [PATCH v3 05/14] gnu: Add python-rpyc soeren
2024-07-04 20:05   ` [bug#69074] [PATCH v3 06/14] gnu: Add python-pysmt soeren
2024-07-04 20:05   ` [bug#69074] [PATCH v3 07/14] gnu: Add python-claripy soeren
2024-07-04 20:05   ` [bug#69074] [PATCH v3 08/14] gnu: Add python-archinfo soeren
2024-07-04 20:05   ` [bug#69074] [PATCH v3 09/14] gnu: Add python-pyvex soeren
2024-07-04 20:05   ` [bug#69074] [PATCH v3 10/14] gnu: Add python-cle soeren
2024-07-04 20:05   ` [bug#69074] [PATCH v3 11/14] gnu: Add python-ailment soeren
2024-07-04 20:05   ` [bug#69074] [PATCH v3 12/14] gnu: unicorn: Update to 2.0.1.post1 soeren
2024-07-04 20:05   ` [bug#69074] [PATCH v3 13/14] gnu: capstone: Backport upstream fix for Python bindings soeren
2024-07-04 20:05   ` [bug#69074] [PATCH v3 14/14] gnu: Add python-angr soeren
2024-07-11 21:27 ` [bug#69074] [PATCH 01/11] gnu: Add python-keystone-engine soeren
2024-07-11 21:27   ` [bug#69074] [PATCH 02/11] gnu: Add python-mulpyplexer soeren
2024-07-11 21:27   ` [bug#69074] [PATCH 03/11] gnu: Add python-nampa soeren
2024-07-11 21:27   ` [bug#69074] [PATCH 04/11] gnu: Add python-rpyc soeren
2024-07-11 21:27   ` [bug#69074] [PATCH 05/11] gnu: Add python-pysmt soeren
2024-07-11 21:27   ` [bug#69074] [PATCH 06/11] gnu: Add python-claripy soeren
2024-07-11 21:27   ` [bug#69074] [PATCH 07/11] gnu: Add python-archinfo soeren
2024-07-11 21:27   ` [bug#69074] [PATCH 08/11] gnu: Add python-pyvex soeren
2024-07-11 21:27   ` [bug#69074] [PATCH 09/11] gnu: Add python-cle soeren
2024-07-11 21:27   ` [bug#69074] [PATCH 10/11] gnu: Add python-ailment soeren
2024-07-11 21:27   ` [bug#69074] [PATCH 11/11] gnu: Add python-angr soeren

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).