summaryrefslogtreecommitdiff
path: root/dev-python/python-ptrace
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /dev-python/python-ptrace
reinit the tree, so we can have metadata
Diffstat (limited to 'dev-python/python-ptrace')
-rw-r--r--dev-python/python-ptrace/Manifest6
-rw-r--r--dev-python/python-ptrace/files/0.8.1-python3.4.patch147
-rw-r--r--dev-python/python-ptrace/metadata.xml12
-rw-r--r--dev-python/python-ptrace/python-ptrace-0.8.1-r1.ebuild30
4 files changed, 195 insertions, 0 deletions
diff --git a/dev-python/python-ptrace/Manifest b/dev-python/python-ptrace/Manifest
new file mode 100644
index 000000000000..a141f77bfc59
--- /dev/null
+++ b/dev-python/python-ptrace/Manifest
@@ -0,0 +1,6 @@
+AUX 0.8.1-python3.4.patch 4629 SHA256 3bb83e7303a412854912091394cc29a6a8acf3486b3008bac14669b744e81245 SHA512 3b5c072b55c138c97e9b6456354bdf17c820d448880e0d6bb5ce398b7dfd1bd432f9886da4f8b960578f60e24fb636142bdaa66566ac22e12cda0928753aa46e WHIRLPOOL a8aeaf886a02264170e84b97fbcc6291f8ca09e59dff9d8894debd69a916cf267044ddf527bd7c94cc7c89b7c00fe0fa557d8ff62e2e4ddaf636fb75978f9b86
+DIST python-ptrace-0.8.1.tar.gz 93674 SHA256 779e04c7bdc00150b739e7d49c9c61b7f36f17afd26355f91b10cd0e7d55d19f SHA512 1c3dadf381ad0fe30374fe030fc3a81b5ec0885c31ac9be4ae561cf14ff891fc2e465555133b2efce6be0154b06768121aa068161bb3de10aca6df0eb181e25c WHIRLPOOL 1541571ed580b5852b1fc51f515776463dc622a4a2c334691f0433083a29bc1059549e0b4e938ea7c694517e341cd39bbc3f487f5ea7f83b327aaad1dbd8b7df
+EBUILD python-ptrace-0.8.1-r1.ebuild 833 SHA256 5dee4182df9dd4923efd5e3c25ae3c5440ffb2c0026df66f06bc4ce41ad2c9dc SHA512 0c96fdfc2fe3ce4ebcf1c4b51f8bc08040c7be086ed822bfae16c7cf87d374cdef3dd415dc98f5311ffc4b1252ba177a06f1a3a99dad34ccb6028bc4281807fe WHIRLPOOL e303622ff6e43c4ca902aaf1139db6456850f86fd3ae65fd6980d5fb92e6b9cb9d928015cb08c2ab82d448132da7372aa49c7b0a2da6fecd11dab4a30a88c273
+MISC ChangeLog 3305 SHA256 9a3f9c2714b970cc4ff2d0dae0215d0332be761af89cd7ecfd07ab144c1affb6 SHA512 e24890ca2d15426c42cb9b2045a78eb6988baf8dc2584e9d71bb831faf393f70f5958620561eeaf8a095854fde85fc0e222f31b95b27f3a2e919cab91da8d750 WHIRLPOOL 3a3e6bc0b4d3df64a68becf4562c3377844665df3cc1c43a16b03ecb941d11748dda07da36b795e525112d7969a34b2311a717d95f571ef9d7583c0f23977878
+MISC ChangeLog-2015 3853 SHA256 39f74986e224d8ca77d3a4048f171f806ca7ee739c5f03cbcfa6da47d108fd8e SHA512 5893fb83bfa6fd03f3fb7a4e29ce893a36c589a5928a61caa329b90f404af9b3545dea814ed0a048edab478807c5b36c63d5803f5706fab9f679f8474301f179 WHIRLPOOL 8e23f5c9e551bf60023f70bb9df17c38e6d9a2ed553427ffaecac1ece896c07126a7ea510bef8eeb52de45fa459d364048a2e36242e5e7c9a2a4d18c621fa9ec
+MISC metadata.xml 390 SHA256 3dcc1e37f5e4374db25f42547dd7af3fc6325477960f110713e5fc9562b68219 SHA512 b9c75af73d22d67c125fafeb5615a03ef21cfa501a275d2139ef49364ba6bdd64c3757194e9dae7678aeff8f0cd4a9233796c907d4cfe6427aa43c6986bffa92 WHIRLPOOL 76cb17754ff03026314513ec909fa4bb424e2439cc341f5a05001e4cac3d2e5ba069761d37c1e39d6a68f018f4ef182df3fbd40cc9a602a641fbd3757ec3fde2
diff --git a/dev-python/python-ptrace/files/0.8.1-python3.4.patch b/dev-python/python-ptrace/files/0.8.1-python3.4.patch
new file mode 100644
index 000000000000..2e6e76f8e6df
--- /dev/null
+++ b/dev-python/python-ptrace/files/0.8.1-python3.4.patch
@@ -0,0 +1,147 @@
+# HG changeset patch
+# User Victor Stinner <victor.stinner@gmail.com>
+# Date 1417423044 -3600
+# Mon Dec 01 09:37:24 2014 +0100
+# Node ID eba1a6dba205559d724d32c80d955a65e078505e
+# Parent e6fef4231a8a28ef91c1feaf3bfbcbd29822c939
+Issue #17: syscall parser now supports O_CLOEXEC and SOCK_CLOEXEC, fix unit
+tests on Python 3.4 and newer
+
+diff --git a/doc/changelog.rst b/doc/changelog.rst
+--- a/doc/changelog.rst
++++ b/doc/changelog.rst
+@@ -3,6 +3,12 @@
+ Changelog
+ =========
+
++python-ptrace 0.8.2
++-------------------
++
++* Issue #17: syscall parser now supports O_CLOEXEC and SOCK_CLOEXEC, fix unit
++ tests on Python 3.4 and newer
++
+ python-ptrace 0.8.1 (2014-10-30)
+ --------------------------------
+
+diff --git a/ptrace/syscall/posix_arg.py b/ptrace/syscall/posix_arg.py
+--- a/ptrace/syscall/posix_arg.py
++++ b/ptrace/syscall/posix_arg.py
+@@ -24,7 +24,7 @@
+ return formatBits(argument.value, ACCESS_MODE_BITMASK, "F_OK")
+
+ # From /usr/include/bits/fcntl.h (Ubuntu Feisty, i386)
+-OPEN_MODE_BITMASK = (
++OPEN_MODE_BITMASK = [
+ (0o1, "O_WRONLY"),
+ (0o2, "O_RDWR"),
+ (0o100, "O_CREAT"),
+@@ -40,10 +40,17 @@
+ (0o200000, "O_DIRECTORY"),
+ (0o400000, "O_NOFOLLOW"),
+ (0o1000000, "O_NOATIME"),
+-)
++]
++O_CLOEXEC = 0o02000000
+
+ def formatOpenMode(argument):
+- return formatBits(int(argument.value), OPEN_MODE_BITMASK, "O_RDONLY", oct)
++ value = argument.value
++ cloexec = bool(value & O_CLOEXEC)
++ value = value & ~O_CLOEXEC
++ text = formatBits(int(value), OPEN_MODE_BITMASK, "O_RDONLY", oct)
++ if cloexec:
++ text += '|O_CLOEXEC'
++ return text
+
+ CLONE_FLAGS_BITMASK = (
+ (0x00000100, "CLONE_VM"),
+diff --git a/ptrace/syscall/posix_constants.py b/ptrace/syscall/posix_constants.py
+--- a/ptrace/syscall/posix_constants.py
++++ b/ptrace/syscall/posix_constants.py
+@@ -1,5 +1,5 @@
+ from ptrace.syscall.socketcall_constants import (
+- SOCKET_FAMILY, SOCKET_TYPE, SOCKET_PROTOCOL,
++ SOCKET_FAMILY, SOCKET_PROTOCOL,
+ SETSOCKOPT_LEVEL, SETSOCKOPT_OPTNAME)
+
+ SYSCALL_ARG_DICT = {
+@@ -51,7 +51,6 @@
+ },
+ "socket": {
+ "domain": SOCKET_FAMILY,
+- "type": SOCKET_TYPE,
+ "protocol": SOCKET_PROTOCOL,
+ },
+ "getsockopt": {
+diff --git a/ptrace/syscall/socketcall_constants.py b/ptrace/syscall/socketcall_constants.py
+--- a/ptrace/syscall/socketcall_constants.py
++++ b/ptrace/syscall/socketcall_constants.py
+@@ -1,3 +1,5 @@
++import socket
++
+ SOCKETCALL = {
+ 1: "socket",
+ 2: "bind",
+@@ -56,6 +58,19 @@
+ 10: "SOCK_PACKET",
+ }
+
++def formatSocketType(argument):
++ value = argument.value
++ text = []
++ if hasattr(socket, 'SOCK_CLOEXEC'):
++ cloexec = value & socket.SOCK_CLOEXEC
++ value &= ~socket.SOCK_CLOEXEC
++ else:
++ cloexec = False
++ text = SOCKET_TYPE.get(value, value)
++ if cloexec:
++ text += '|SOCK_CLOEXEC'
++ return text
++
+ SOCKET_PROTOCOL = {
+ 1: "IPPROTO_ICMP",
+ 58: "IPPROTO_ICMPV6",
+diff --git a/ptrace/syscall/syscall_argument.py b/ptrace/syscall/syscall_argument.py
+--- a/ptrace/syscall/syscall_argument.py
++++ b/ptrace/syscall/syscall_argument.py
+@@ -22,6 +22,7 @@
+ from ptrace.syscall.freebsd_constants import SYSCALL_ARG_DICT
+ else:
+ SYSCALL_ARG_DICT = {}
++from ptrace.syscall.socketcall_constants import formatSocketType
+
+ KNOWN_STRUCTS = []
+ if RUNNING_LINUX:
+@@ -35,6 +36,7 @@
+ "mmap": {"prot": formatMmapProt},
+ "mmap2": {"prot": formatMmapProt},
+ "clone": {"flags": formatCloneFlags},
++ "socket": {"type": formatSocketType},
+ "setsockopt": {"optval": formatOptVal},
+ }
+
+diff --git a/tests/test_strace.py b/tests/test_strace.py
+--- a/tests/test_strace.py
++++ b/tests/test_strace.py
+@@ -39,10 +39,19 @@
+ expected = os.fsencode(expected)
+ self.assertEqual(match.group(1), expected)
+
++ def test_open(self):
++ if PY3:
++ code = 'open(%a).close()' % __file__
++ else:
++ code = 'open(%r).close()' % __file__
++ stdout = self.strace(sys.executable, '-c', code)
++ pattern = re.compile(br"^open\(.*test_strace\.py', O_RDONLY(\|O_CLOEXEC)?\)", re.MULTILINE)
++ self.assertTrue(pattern.search(stdout), stdout)
++
+ def test_socket(self):
+ code = 'import socket; socket.socket(socket.AF_INET, socket.SOCK_STREAM).close()'
+ stdout = self.strace(sys.executable, '-c', code)
+- pattern = re.compile(b'^socket\\(AF_INET, SOCK_STREAM, ', re.MULTILINE)
++ pattern = re.compile(br'^socket\(AF_INET, SOCK_STREAM(\|SOCK_CLOEXEC)?, ', re.MULTILINE)
+ self.assertTrue(pattern.search(stdout), stdout)
+
+ if __name__ == "__main__":
diff --git a/dev-python/python-ptrace/metadata.xml b/dev-python/python-ptrace/metadata.xml
new file mode 100644
index 000000000000..b9062dfa01ed
--- /dev/null
+++ b/dev-python/python-ptrace/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="pypi">python-ptrace</remote-id>
+ <remote-id type="bitbucket">haypo/python-ptrace</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-python/python-ptrace/python-ptrace-0.8.1-r1.ebuild b/dev-python/python-ptrace/python-ptrace-0.8.1-r1.ebuild
new file mode 100644
index 000000000000..80a8f01dad6e
--- /dev/null
+++ b/dev-python/python-ptrace/python-ptrace-0.8.1-r1.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+PYTHON_COMPAT=( python{2_7,3_{4,5,6}} pypy )
+
+inherit distutils-r1
+
+DESCRIPTION="A debugger using ptrace (Linux, BSD and Darwin system call to trace processes)"
+HOMEPAGE="https://github.com/haypo/python-ptrace/ https://pypi.python.org/pypi/python-ptrace"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="doc examples"
+
+PATCHES=( "${FILESDIR}/0.8.1-python3.4.patch" )
+
+python_test() {
+ "${PYTHON}" runtests.py -v || die "Testing failed with ${EPYTHON}"
+}
+
+python_install_all() {
+ use examples && local EXAMPLES=( examples/. )
+ # doc folder missing key files to effect a proper doc build
+ use doc && local DOCS=( README doc/. )
+ distutils-r1_python_install_all
+}