Subject: [bug#72393] [PATCH 10/10] gnu: python-angr: Update to 9.2.112.

From: [email-masked]
Date: Wed, 31 Jul 2024 10:11:30 +0200

From: Sören Tempel <[email-masked]>

* gnu/packages/python-xyz.scm (python-angr): Update to 9.2.112.
[propagated-inputs]: Remove python-progressbar2; add python-pyformlang,
add python-rich, add python-unique-log-filter.
* gnu/packages/patches/python-angr-addition-type-error.patch:
Remove patch (merged upstream and included in new release).
* gnu/packages/patches/python-angr-check-exec-deps.patch:
Rebase for new release.
---
 gnu/local.mk                                  |  1 -
 .../python-angr-addition-type-error.patch     | 18 ----
 .../patches/python-angr-check-exec-deps.patch | 83 +++++++++----------
 gnu/packages/python-xyz.scm                   | 28 +++++--
 4 files changed, 58 insertions(+), 72 deletions(-)
 delete mode 100644 gnu/packages/patches/python-angr-addition-type-error.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 8b00928141..43e5116c08 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1945,7 +1945,6 @@ 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	\
diff --git a/gnu/packages/patches/python-angr-addition-type-error.patch b/gnu/packages/patches/python-angr-addition-type-error.patch
deleted file mode 100644
index 7301d8b505..0000000000
--- a/gnu/packages/patches/python-angr-addition-type-error.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-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
index 438f8ef183..6001d9c924 100644
--- a/gnu/packages/patches/python-angr-check-exec-deps.patch
+++ b/gnu/packages/patches/python-angr-check-exec-deps.patch
@@ -8,11 +8,11 @@ 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__))
+diff --git a/tests/procedures/glibc/test_ctype_locale.py b/tests/procedures/glibc/test_ctype_locale.py
+index ac3e1ee16..1fb0fd095 100755
+--- a/tests/procedures/glibc/test_ctype_locale.py
++++ b/tests/procedures/glibc/test_ctype_locale.py
+@@ -15,7 +15,7 @@ test_location = os.path.join(bin_location, "tests")

  class TestCtypeLocale(unittest.TestCase):
@@ -21,7 +21,7 @@ index 08cb89836..2b9233558 100644
      def test_ctype_b_loc(self):
          """
          test_ctype_locale.test_ctype_b_loc
-@@ -60,7 +60,7 @@ class TestCtypeLocale(unittest.TestCase):
+@@ -61,7 +61,7 @@ class TestCtypeLocale(unittest.TestCase):
          output = subprocess.check_output(bin_path, shell=True)
          assert result == output
  
@@ -30,7 +30,7 @@ index 08cb89836..2b9233558 100644
      def test_ctype_tolower_loc(self):
          """
          test_ctype_locale.test_ctype_tolower_loc
-@@ -109,7 +109,7 @@ class TestCtypeLocale(unittest.TestCase):
+@@ -110,7 +110,7 @@ class TestCtypeLocale(unittest.TestCase):
          output = subprocess.check_output(bin_path, shell=True)
          assert result == output
  
@@ -39,50 +39,24 @@ index 08cb89836..2b9233558 100644
      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")
[email-masked](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__))
+diff --git a/tests/procedures/libc/test_sscanf.py b/tests/procedures/libc/test_sscanf.py
+index 7c2da6f5e..e20952f54 100755
+--- a/tests/procedures/libc/test_sscanf.py
++++ b/tests/procedures/libc/test_sscanf.py
+@@ -14,7 +14,7 @@ test_location = os.path.join(bin_location, "tests")

  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")
+         test_bin = os.path.join(test_location, "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):
+diff --git a/tests/procedures/libc/test_strtol.py b/tests/procedures/libc/test_strtol.py
+index 4d7982b86..8818ced3b 100755
+--- a/tests/procedures/libc/test_strtol.py
++++ b/tests/procedures/libc/test_strtol.py
+@@ -15,7 +15,7 @@ class TestStrtol(unittest.TestCase):
      # pylint: disable=no-self-use
  
      @slow_test
@@ -91,3 +65,24 @@ index 6c29cab22..f36181407 100644
      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/tests/sim/exec_insn/test_signed_div.py b/tests/sim/exec_insn/test_signed_div.py
+index 46581020f..d5acc5370 100755
+--- a/tests/sim/exec_insn/test_signed_div.py
++++ b/tests/sim/exec_insn/test_signed_div.py
+@@ -2,6 +2,7 @@
+ # pylint: disable=missing-class-docstring,no-self-use,line-too-long
+ __package__ = __package__ or "tests.sim.exec_insn"  # pylint:disable=redefined-builtin
+ 
++import pytest
+ import os
+ import subprocess
+ import sys
+@@ -16,7 +17,7 @@ test_location = os.path.join(bin_location, "tests")
+ 
+ 
+ class TestSignedDiv(TestCase):
+-    @skipUnless(sys.platform.startswith("linux"), "linux only")
++    @pytest.mark.skip(reason="test executes pre-compiled binaries")
+     def test_signed_div(self):
+         test_bin = os.path.join(test_location, "x86_64", "test_signed_div")
+         b = angr.Project(test_bin, auto_load_libs=False)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 02d2a49dbb..ae13a49577 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -34335,19 +34335,18 @@ (define-public python-itanium-demangler
 (define-public python-angr
   (package
     (name "python-angr")
-    (version "9.2.46")
+    (version "9.2.112")
     (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"))
+       (patches (search-patches "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"))))
+        (base32 "1179926xbfh2930laz33p90vj532jk7g2qylzzpw1185yhlf9cis"))))
     (build-system pyproject-build-system)
     (arguments
      (list
@@ -34355,9 +34354,18 @@ (define-public python-angr
                    (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")))
+                         ;; The constraint exists because of a capstone bug for which
+                         ;; we backport a patch, hence we can relax the constraint.
+                         ;;
+                         ;; See https://github.com/angr/angr/issues/4656
+                         (substitute* "setup.cfg"
+                          (("capstone==5.0.0.post1")
+                           "capstone"))
+                         ;; Relax constraint on python-rich, the constraint is too strict,
+                         ;; angr work well with our packaged version of python-rich.
+                         (substitute* "setup.cfg"
+                           (("rich>=13.1.0")
+                            "rich"))
                          (substitute* "tests/common.py"
                            (("\\[\"cc\"\\]")
                             "[\"gcc\"]")))))
@@ -34396,11 +34404,13 @@ (define-public python-angr
                              python-itanium-demangler
                              python-pycparser
                              python-pyvex
-                             python-progressbar2
+                             python-pyformlang
+                             python-rich
                              python-rpyc
                              python-sortedcontainers
                              python-sqlalchemy
                              python-sympy
+                             python-unique-log-filter
                              unicorn))
     (native-inputs `(("python-pytest" ,python-pytest)
                      ("python-pytest-xdist" ,python-pytest-xdist)
@@ -34418,7 +34428,7 @@ (define-public python-angr
                                                                     version))))
                          (file-name (git-file-name "angr-binaries" version))
                          (sha256 (base32
-                                  "1f286b2239zavxzwg1184hj1zs380cr9qr549mvy3vywvm8bsmgr"))))))
+                                  "0bxzf6alkczv9r0151ksvcwyksnw8077acz1wd8drbxw0zl0qnmr"))))))
     (home-page "https://github.com/angr/angr")
     (synopsis "Multi-architecture binary analysis toolkit")
     (description