summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: df64e6e1ecad975bb945e04719739769331ac924 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Ebubekir KARUL <ebubekirkarul@yandex.com>
# Contributor: s1gma,shirokuro

pkgbase=scapy-git
pkgname=('scapy-git' 'python-scapy-git' 'python2-scapy-git')
pkgver=2.4.0.dev43
pkgrel=1
pkgdesc='Powerful interactive packet manipulation program written in Python'
url='http://www.secdev.org/projects/scapy/'
makedepends=('git' 'tcpdump' 'python2' 'python')
checkdepends=('python2-cryptography' 'python2-pyx' 'python2-matplotlib'
              'python-cryptography' 'python-pyx' 'python-matplotlib'
              'graphviz' 'sox')
arch=('any')
license=('GPL2')
source=(${pkgbase}::git+https://github.com/secdev/scapy)
sha256sums=('SKIP')

pkgver() {
  cd ${pkgbase}
  PYTHONPATH=. python2 -c "print __import__('scapy').VERSION"
}

prepare() {
  cp -a ${pkgbase}{,-py2}
  cd ${pkgbase}-py2
  sed -e 's|env python|env python2|g' -i doc/scapy/*.rst scapy/contrib/*.py setup.py \
    run_scapy scapy/pipetool.py scapy/tools/check_asdis.py scapy/layers/*.py bin/*
}

build() {
  (cd ${pkgbase}-py2
    python2 setup.py build
  )
  (cd ${pkgbase}
    python setup.py build
  )
}

check() {
  # Run only main tests, without network access
  (cd ${pkgbase}-py2/test
    ./run_tests_py2 -K netaccess -F
  )
  (cd ${pkgbase}/test
    ./run_tests_py3 -K netaccess -F
  )
}

package_scapy-git() {
  depends=('python' 'python-scapy')
  pkgdesc+=' (tools)'
  provides=('scapy')
  conflicts=('scapy')
  cd ${pkgbase}
  python setup.py install -O1 --skip-build --root="${pkgdir}" --prefix=/usr
  install -d "${pkgdir}/usr/share/doc"
  ln -sf /usr/share/doc/python-scapy "${pkgdir}/usr/share/doc/${pkgname}"
  rm -r "${pkgdir}/usr/lib"
}

package_python-scapy-git() {
  pkgdesc+=' (library)'
  depends=('tcpdump' 'python')
  optdepends=('python-cryptography: WEP, IPsec and SSL/TLS support'
              'python-pyx: psdump() and pdfdump() functions'
              'python-matplotlib: plotting support'
              'graphviz: conversations() method support'
              'sox: for VOIP support')
  provides=('python-scapy')
  conflicts=('python-scapy')
  cd ${pkgbase}
  python setup.py install -O1 --skip-build --root="${pkgdir}" --prefix=/usr
  install -Dm 644 doc/scapy/*.rst -t "${pkgdir}/usr/share/doc/${pkgname}"
  rm -r "${pkgdir}"{/usr/bin,/usr/share/man}
}

package_python2-scapy-git() {
  pkgdesc+=' (library)'
  depends=('tcpdump' 'python2')
  optdepends=('python2-cryptography: WEP, IPsec and SSL/TLS support'
              'python2-pyx: psdump() and pdfdump() functions'
              'python2-matplotlib: plotting support'
              'graphviz: conversations() method support'
              'sox: for VOIP support')
  provides=('python2-scapy')
  conflicts=('python2-scapy')
  cd ${pkgbase}-py2
  python2 setup.py install -O1 --skip-build --root="${pkgdir}" --prefix=/usr
  install -Dm 644 doc/scapy/*.rst -t "${pkgdir}/usr/share/doc/${pkgname}"
  rm -r "${pkgdir}"{/usr/bin,/usr/share/man}
}

# vim: ts=2 sw=2 et: