summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authordarmac <xiaojun2@hisilicon.com>2020-09-12 22:36:30 +0800
committerGitHub <noreply@github.com>2020-09-12 09:36:30 -0500
commit6d39e6ebeac90ee794a22098c1fa96ac398758e0 (patch)
treee6b4b31007da4638449857d442564956daffd314 /var
parent128731ec746960b2d1666d4dd122849d796b7ff9 (diff)
downloadspack-6d39e6ebeac90ee794a22098c1fa96ac398758e0.tar.gz
spack-6d39e6ebeac90ee794a22098c1fa96ac398758e0.tar.bz2
spack-6d39e6ebeac90ee794a22098c1fa96ac398758e0.tar.xz
spack-6d39e6ebeac90ee794a22098c1fa96ac398758e0.zip
Add new package: hping (#18311)
* Add new package: hping * Update var/spack/repos/builtin/packages/hping/package.py Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com> * Update var/spack/repos/builtin/packages/hping/package.py Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com> * Update package.py Fix flake8 errors Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/hping/bpf.patch26
-rw-r--r--var/spack/repos/builtin/packages/hping/package.py40
2 files changed, 66 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/hping/bpf.patch b/var/spack/repos/builtin/packages/hping/bpf.patch
new file mode 100644
index 0000000000..c2657c0af5
--- /dev/null
+++ b/var/spack/repos/builtin/packages/hping/bpf.patch
@@ -0,0 +1,26 @@
+diff --git a/libpcap_stuff.c b/libpcap_stuff.c
+index 26f9993..aaa0d40 100644
+--- a/libpcap_stuff.c
++++ b/libpcap_stuff.c
+@@ -16,7 +16,7 @@
+ #include <string.h>
+ #include <stdlib.h>
+ #include <sys/ioctl.h>
+-#include <net/bpf.h>
++#include <pcap-bpf.h>
+ #include <pcap.h>
+
+ #include "globals.h"
+diff --git a/script.c b/script.c
+index 124370c..6c5fb1e 100644
+--- a/script.c
++++ b/script.c
+@@ -23,7 +23,7 @@
+ #include <sched.h>
+
+ #include <sys/ioctl.h>
+-#include <net/bpf.h>
++#include <pcap-bpf.h>
+ #include <pcap.h>
+
+ #include "release.h"
diff --git a/var/spack/repos/builtin/packages/hping/package.py b/var/spack/repos/builtin/packages/hping/package.py
new file mode 100644
index 0000000000..bc70bbaa66
--- /dev/null
+++ b/var/spack/repos/builtin/packages/hping/package.py
@@ -0,0 +1,40 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+from spack import *
+
+
+class Hping(AutotoolsPackage):
+ """hping is a command-line oriented TCP/IP packet assembler/analyzer."""
+
+ homepage = "http://www.hping.org"
+ git = "https://github.com/antirez/hping.git"
+
+ version('master', commit='3547c7691742c6eaa31f8402e0ccbb81387c1b99')
+
+ patch('bpf.patch', sha256='99b9f91a308ffca306f69ccdb285e289ee3d280ec47ec7229e3a7669cca512f2')
+
+ depends_on('libpcap')
+ depends_on('tcl')
+
+ def setup_build_environment(self, env):
+ env.set('TCLSH', self.spec['tcl'].prefix.bin.tclsh)
+
+ @run_before('configure')
+ def filter_before_configure(self):
+ makefileIn = FileFilter('Makefile.in')
+ makefileIn.filter(r'/usr/sbin', self.prefix.sbin)
+ configure = FileFilter('configure')
+ configure.filter(r'/usr/local/include/tcl\${TCL_VER}',
+ self.spec['tcl'].prefix.include)
+ configure.filter(r'/usr/local/lib/',
+ self.spec['tcl'].libs.directories[0])
+
+ def install(self, spec, prefix):
+ mkdirp(prefix.sbin)
+ make('install')
+
+ def setup_run_environment(self, env):
+ env.prepend_path('PATH', self.prefix.sbin)