[yocto] [meta-security][PATCH 1/2] scapy: restore ptest by going to github directly

Armin Kuster akuster808 at gmail.com
Sun Feb 10 09:07:01 PST 2019


The pypi package removed the tests so
go to the git repo directly.

Signed-off-by: Armin Kuster <akuster808 at gmail.com>
---
 recipes-security/scapy/files/run-ptest        |  4 ++++
 recipes-security/scapy/python-scapy.inc       | 13 ++++++++++---
 recipes-security/scapy/python-scapy_2.4.2.bb  |  2 ++
 recipes-security/scapy/python3-scapy_2.4.2.bb |  3 +++
 4 files changed, 19 insertions(+), 3 deletions(-)
 create mode 100644 recipes-security/scapy/files/run-ptest

diff --git a/recipes-security/scapy/files/run-ptest b/recipes-security/scapy/files/run-ptest
new file mode 100644
index 0000000..91b29f9
--- /dev/null
+++ b/recipes-security/scapy/files/run-ptest
@@ -0,0 +1,4 @@
+#!/bin/sh
+UTscapy -t regression.uts -f text -l -C \
+    -o @PTEST_PATH@/scapy_ptest_$(date +%Y%m%d-%H%M%S).log \
+    2>&1 | sed -e 's/^passed None/PASS:/' -e 's/^failed None/FAIL:/'
diff --git a/recipes-security/scapy/python-scapy.inc b/recipes-security/scapy/python-scapy.inc
index 43ef959..99f30a7 100644
--- a/recipes-security/scapy/python-scapy.inc
+++ b/recipes-security/scapy/python-scapy.inc
@@ -5,10 +5,12 @@ LICENSE = "GPLv2"
 
 LIC_FILES_CHKSUM = "file://bin/scapy;beginline=9;endline=13;md5=1d5249872cc54cd4ca3d3879262d0c69"
 
-SRC_URI[md5sum] = "e6a03d8c924a6bbde1e86fc58bd2b9d6"
-SRC_URI[sha256sum] = "1baa048936207ceb1a4281a0e1e3b4317667c754872a0bb4734c5213c468e86a"
+S = "${WORKDIR}/git"
 
-inherit pypi
+SRCREV = "bad14cb1a5aee29f8107fbe8ad008d4645f14da7"
+SRC_URI = "git://github.com/secdev/scapy.git"
+
+inherit ptest
 
 do_install_append() {
     if [ "${PYTHON_PN}" = "python3" ]; then
@@ -17,6 +19,11 @@ do_install_append() {
     fi
 }
 
+do_install_ptest() {
+    install -m 0644 ${S}/test/regression.uts ${D}${PTEST_PATH}
+    sed -i 's, at PTEST_PATH@,${PTEST_PATH},' ${D}${PTEST_PATH}/run-ptest
+}
+
 RDEPENDS_${PN} = "tcpdump ${PYTHON_PN}-compression ${PYTHON_PN}-cryptography ${PYTHON_PN}-netclient  \
                   ${PYTHON_PN}-netserver ${PYTHON_PN}-pydoc ${PYTHON_PN}-pkgutil ${PYTHON_PN}-shell \
                   ${PYTHON_PN}-threading ${PYTHON_PN}-numbers ${PYTHON_PN}-pycrypto"
diff --git a/recipes-security/scapy/python-scapy_2.4.2.bb b/recipes-security/scapy/python-scapy_2.4.2.bb
index ea8764a..98db1fd 100644
--- a/recipes-security/scapy/python-scapy_2.4.2.bb
+++ b/recipes-security/scapy/python-scapy_2.4.2.bb
@@ -1,4 +1,6 @@
 inherit setuptools
 require python-scapy.inc
 
+SRC_URI += "file://run-ptest"
+
 RDEPENDS_${PN} += "${PYTHON_PN}-subprocess"
diff --git a/recipes-security/scapy/python3-scapy_2.4.2.bb b/recipes-security/scapy/python3-scapy_2.4.2.bb
index 34eb2a3..83c79f4 100644
--- a/recipes-security/scapy/python3-scapy_2.4.2.bb
+++ b/recipes-security/scapy/python3-scapy_2.4.2.bb
@@ -1,2 +1,5 @@
 inherit setuptools3
 require python-scapy.inc
+
+SRC_URI += "file://run-ptest"
+
-- 
2.17.1



More information about the yocto mailing list