From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id 0D5ZATQ1ymXEAAEA62LTzQ:P1 (envelope-from ) for ; Mon, 12 Feb 2024 16:11:48 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id 0D5ZATQ1ymXEAAEA62LTzQ (envelope-from ) for ; Mon, 12 Feb 2024 16:11:48 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=soeren-tempel.net header.s=opensmtpd header.b=oQoaskzT; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=soeren-tempel.net (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1707750707; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Slm20Vk8n3iCsoBuRJN5husZDlRuXUsAlJfWQYGwkJA=; b=DTj3Doxw/K1afBFJGJg0bQ3YCH+AnDRercFRQOkJIl1NucLy/9H8VYOjEO+XEwEC4hIGy3 LWhrEffb3liN0zn0hexQza9578Uy2mUcuNtqq5MivkCDE60GUTpxzh7ngqum53lvH5kOq2 nnX7xKP+z83fplVgFkkW2ZP2f/wPr+ZKpCszOvXgKebZgM0GBy37Ydw+8oFLL63wQC4FhR bSlDYhjzxYhx9qMW6/ZQy3maCn96SdL7vl3fnDHpkE4ubtZOiP2oOzNtdAUoMf0Vz16sIn BKerrDMS8krBwjg9upPNJT7uPiw4tfKsm/Kub2So+TV/PfpDzt43zKKYAheNTw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=soeren-tempel.net header.s=opensmtpd header.b=oQoaskzT; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=soeren-tempel.net (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1707750707; a=rsa-sha256; cv=none; b=Mb9wf1O321UQ0qICAQM+zVK7RGwQr9IfrRfPzFXoOxqnNSXnic3D3ssVW4ZRqQesTkK3cf TRFhW2Y+SA090al2H5MxJOSM9fCVQm7FXGrkI5TIXdQoeLYPVs7AsSa7zuCgnKLvnM7zxW vNDVoDe9XiZG881cHhwIA8ziDVHzbUXCkLxfaXoLajLN+8HZbq68eWxFzJRwFe9NW/x4CQ sFLRXkpr750lp2G+NTuwvN41C+eKMBEQC8y/P0FnxZcOr0EkJru4wPw3MiFrr4teXJvaFD AhrxJ189cUETtzkChYeK6C//dKlhho3d1SOgY/T0JFfF/30+BNTEgvGjsHxoUQ== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C77BD6A137 for ; Mon, 12 Feb 2024 16:11:47 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZXxO-0000wl-KR; Mon, 12 Feb 2024 10:10:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZXxL-0000wG-UV for guix-patches@gnu.org; Mon, 12 Feb 2024 10:10:51 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZXxL-0006I0-LY; Mon, 12 Feb 2024 10:10:51 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rZXxW-0001wJ-CN; Mon, 12 Feb 2024 10:11:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69074] [PATCH] gnu: Add python-pyvex. Resent-From: soeren@soeren-tempel.net Original-Sender: "Debbugs-submit" Resent-CC: lars@6xq.net, marius@gnu.org, me@bonfacemunyoki.com, sharlatanus@gmail.com, jgart@dismail.de, guix-patches@gnu.org Resent-Date: Mon, 12 Feb 2024 15:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69074 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69074@debbugs.gnu.org Cc: Lars-Dominik Braun , Marius Bakke , Munyoki Kilyungi , Sharlatan Hellseher , jgart X-Debbugs-Original-Xcc: Lars-Dominik Braun , Marius Bakke , Munyoki Kilyungi , Sharlatan Hellseher , jgart Received: via spool by 69074-submit@debbugs.gnu.org id=B69074.17077506207259 (code B ref 69074); Mon, 12 Feb 2024 15:11:02 +0000 Received: (at 69074) by debbugs.gnu.org; 12 Feb 2024 15:10:20 +0000 Received: from localhost ([127.0.0.1]:35924 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZXwo-0001sx-Qp for submit@debbugs.gnu.org; Mon, 12 Feb 2024 10:10:19 -0500 Received: from magnesium.8pit.net ([2001:19f0:6c01:4ae:5400:ff:fe66:af9d]:36193) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZXm5-0006kx-WB; Mon, 12 Feb 2024 09:59:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=JyHrYI1jub d+/fDNA4YuSKBzYbdzyEdBWEgj5bt8jDI=; h=references:in-reply-to:date: subject:to:from; d=soeren-tempel.net; b=oQoaskzTtIeJj6V+SyFikwm3+x/RWM mFfxMBlnkpYFo4EyFfXY+Bhw4j+OJqizYCfisIXhm/Sqe/dGJqdcT1JkG2U3cJAAI/nqhY 3MBfr7rTzayxirqZC54qpQOvC0Tq6ZPt+xjaAwuAeey8+/vy5XSvayRXskjxy1r+JPZhpq k= Received: from localhost (dynamic-2a02-3102-49da-001b-6371-147f-665b-ad6e.310.pool.telefonica.de [2a02:3102:49da:1b:6371:147f:665b:ad6e]) by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 1f78acde (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); Mon, 12 Feb 2024 15:58:50 +0100 (CET) From: soeren@soeren-tempel.net Date: Mon, 12 Feb 2024 15:58:24 +0100 Message-ID: <022636047a91685578f894adf01c344e0cdcbd54.1707749005.git.soeren@soeren-tempel.net> X-Mailer: git-send-email 2.43.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: 3.33 X-Migadu-Queue-Id: C77BD6A137 X-Spam-Score: 3.33 X-Migadu-Scanner: mx11.migadu.com X-TUID: mLq4x1rv3UbR From: Sören Tempel * 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")