[arch-commits] Commit in python-pcapy/trunk (2 files)

Evangelos Foutras foutrelis at gemini.archlinux.org
Thu Dec 9 18:09:42 UTC 2021


    Date: Thursday, December 9, 2021 @ 18:09:41
  Author: foutrelis
Revision: 1065856

Switch to pcapy-ng for Python 3.10

Added:
  python-pcapy/trunk/replace-one-more-unsigned-int-len-with-Py_ssize_t.patch
Modified:
  python-pcapy/trunk/PKGBUILD

---------------------------------------------------------+
 PKGBUILD                                                |   42 +++++++-------
 replace-one-more-unsigned-int-len-with-Py_ssize_t.patch |   23 +++++++
 2 files changed, 45 insertions(+), 20 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2021-12-09 18:05:57 UTC (rev 1065855)
+++ PKGBUILD	2021-12-09 18:09:41 UTC (rev 1065856)
@@ -1,38 +1,40 @@
 # Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
 # Contributor: Chris Severance aur.severach AatT spamgourmet.com
 
-_pyname=pcapy
+_pyname=pcapy-ng
 pkgname=python-pcapy
-pkgver=0.11.5
-pkgrel=5
+pkgver=1.0.4
+pkgrel=1
 pkgdesc='Extension module that interfaces with the libpcap packet capture library'
-url='https://github.com/CoreSecurity/pcapy'
+url='https://github.com/stamparm/pcapy-ng'
 arch=('x86_64')
 license=('Apache')
 depends=('python' 'libpcap')
-makedepends=('python' 'python-setuptools' 'libpcap')
-source=(https://github.com/CoreSecurity/pcapy/archive/${pkgver}/${pkgbase}-${pkgver}.tar.gz)
-sha256sums=('2ff96eb65caee8a45a3ae3edb78d5b4d8debcace9dc2921aefa3be83bb0af9c6')
-sha512sums=('b7b5e81ed94e828501de01758292e18888497e77acc9864421b555b59de26f233c4365093e48213b36e27a51ad887e7f4d5ce2e4fac3f2f1a3006b5b75297977')
+makedepends=('python' 'python-setuptools')
+source=(https://github.com/stamparm/pcapy-ng/archive/${pkgver}/${_pyname}-${pkgver}.tar.gz
+        replace-one-more-unsigned-int-len-with-Py_ssize_t.patch)
+sha256sums=('2fd66fbf5915199a9b92fd23051a0404fc95eca5ad0e9b20777539b314132951'
+            'cef155f680372ba4a9bbd7dcc8fb1279b60147fefe960047fd84c95e3f0e16e7')
+sha512sums=('713238a91037c2b420df81cce68bc26e5993d40ba4797914798ea071b6a7fdc66530b6ab17cbd32aee4b77436e9d1bd8f54f9bda1f98f7d4363435c7e05ac190'
+            '3fdba64da2ace23d3fb31938c213aeb4e0858d93bf21093f27f44fa7f9bd43a54e5e8293683f703b9a3cb4fdaa3e4ccc4d5f22fa629bf70bf2a0e183df049f80')
 
 prepare() {
-  sed '/self.assertEqual(refNone, sys.getrefcount(None))/d' -i ${_pyname}-${pkgver}/tests/pcapytests.py
+  cd ${_pyname}-${pkgver}
+  # https://github.com/stamparm/pcapy-ng/pull/2
+  patch -Np1 -i ../replace-one-more-unsigned-int-len-with-Py_ssize_t.patch
+  sed -i '/self.assertEqual(refNone, sys.getrefcount(None))/d' tests/pcapytests.py
 }
 
 build() {
-  echo 'Building python...'
-  (cd ${_pyname}-${pkgver}
-    python setup.py build
-  )
+  cd ${_pyname}-${pkgver}
+  python setup.py build
 }
 
 check() {
-  echo 'Checking python...'
-  (cd ${_pyname}-${pkgver}/tests
-    local PYTHONVERSION="$(python -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))')"
-    PYTHONPATH="../build/lib.linux-${CARCH}-${PYTHONVERSION}" \
-      python pcapytests.py
-  )
+  cd ${_pyname}-${pkgver}/tests
+  local PYTHONVERSION="$(python -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))')"
+  PYTHONPATH="../build/lib.linux-${CARCH}-${PYTHONVERSION}" \
+    python pcapytests.py
 }
 
 package() {
@@ -39,7 +41,7 @@
   cd ${_pyname}-${pkgver}
   python setup.py install -O1 --root="${pkgdir}" --skip-build
   install -Dm 644 pcapy.html ChangeLog -t "${pkgdir}/usr/share/doc/${pkgname}"
-  rm -r "${pkgdir}/usr/share/doc/pcapy"
+  rm -r "${pkgdir}/usr/share/doc/${_pyname}"
 }
 
 # vim: ts=2 sw=2 et:

Added: replace-one-more-unsigned-int-len-with-Py_ssize_t.patch
===================================================================
--- replace-one-more-unsigned-int-len-with-Py_ssize_t.patch	                        (rev 0)
+++ replace-one-more-unsigned-int-len-with-Py_ssize_t.patch	2021-12-09 18:09:41 UTC (rev 1065856)
@@ -0,0 +1,23 @@
+From 2a95795c87738600a9dd1bf12db674614263f93e Mon Sep 17 00:00:00 2001
+From: Evangelos Foutras <evangelos at foutrelis.com>
+Date: Thu, 9 Dec 2021 19:30:20 +0200
+Subject: [PATCH] Replace one more 'unsigned int len' with Py_ssize_t
+
+Similar to commit 9d62fd8b86c0 ("Bug fix (segfault reported privately").
+---
+ bpfobj.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/bpfobj.cc b/bpfobj.cc
+index b8c164b..63d6af0 100644
+--- a/bpfobj.cc
++++ b/bpfobj.cc
+@@ -193,7 +193,7 @@ p_filter(register bpfobject* bpf, PyObject* args)
+ {
+   int status;
+   u_char* packet;
+-  unsigned int len;
++  Py_ssize_t len;
+ 
+   if (Py_TYPE(bpf) != &BPFProgramType)
+     {



More information about the arch-commits mailing list