Bug 230110

Summary: net/scapy: Update to 2.4.2
Product: Ports & Packages Reporter: Kai Knoblich <kai>
Component: Individual Port(s)Assignee: Kai Knoblich <kai>
Status: Closed FIXED    
Severity: Affects Only Me CC: bofh, kai, leres, python, vanhu
Priority: --- Flags: tobik: maintainer-feedback-
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on: 236642, 236643, 236674    
Bug Blocks:    
Description Flags
Update version 2.3.3=>2.4.2
Update version 2.3.3=>2.4.2
Update version 2.3.3=>2.4.2
Comment out DARWIN use_bpf check none

Description Kai Knoblich freebsd_committer 2018-07-28 14:22:13 UTC
Created attachment 195532 [details]


attached is the patch that updates net/scapy to 2.4.0 . This release introduces support for Python 3 but some dependent ports in the ports tree aren't ready for Python 3, yet.

So this version still sticks to Python 2.7.

Changes by upstream:
- https://github.com/secdev/scapy/releases/tag/v2.4.0

Changes to the port:
- sorted variables according to the PHB
- added noflavors
- added back the SOX option (dependencies were available but the option was omitted)
- fixed dependencies for the PYX option
- added IPYTHON option
- made post-patch target a bit more readable
- reformatted pkg-plist to make it more readable

- poudriere (10.4-, 11.1-, 11.2-RELEASE, 12.0-CURRENT @r336739) for each amd64 + i386 archs -> OK
- portlint -> OK

Before this update can be committed the graphics/py-PyX12 port must be downgraded to 0.12.1 (see also PR #230109 -> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230109)
Comment 1 Tobias Kortkamp freebsd_committer 2019-02-27 07:41:49 UTC
Assignee and maintainer timeout.  Assign to submitter who has a commit bit now.
Comment 2 Muhammad Moinur Rahman freebsd_committer 2019-03-14 23:52:14 UTC
Created attachment 202866 [details]
Update version 2.3.3=>2.4.2

Patched for version 2.4.2.

With thee previous version the main difference is in version and I have removed noflavors. As it uses python:2.7 builders will never try other flavors. Poudriere and portlint seems alright

Comment 3 Kai Knoblich freebsd_committer 2019-03-15 09:47:05 UTC
(In reply to Muhammad Moinur Rahman from comment #2)

Thank you for updating the patch, this will speed up things. One small tweak is still required for the patch:

devel/ipython has been updated to 6.5.0 in ports r476502 that requires Python 3. So we should use devel/ipython5 instead.
Comment 4 Antoine Brodin freebsd_committer 2019-03-15 09:51:40 UTC
You must add a PKGNAMEPREFIX if you want multiple flavors
Comment 5 Muhammad Moinur Rahman freebsd_committer 2019-04-05 23:11:12 UTC
Created attachment 203419 [details]
Update version 2.3.3=>2.4.2
Comment 6 Muhammad Moinur Rahman freebsd_committer 2019-04-05 23:40:30 UTC
Comment on attachment 203419 [details]
Update version 2.3.3=>2.4.2

Didn't handle ipython versions. :(
Comment 7 Muhammad Moinur Rahman freebsd_committer 2019-04-05 23:41:01 UTC
Created attachment 203423 [details]
Update version 2.3.3=>2.4.2

Handles ipython/ipython5 versions
Comment 8 Kai Knoblich freebsd_committer 2019-04-06 22:20:00 UTC
(In reply to Muhammad Moinur Rahman from comment #7)

Thanks for the updated patch. I have a similar patch in my working repository, that also patches "scapy_config.py".

I have some questions/suggestions:

- Would it make sense to pin net/scapy to Python 3.5+ even though it still supports Python 2.7? Antoine is already working on it to make Python 3.6 as the default Python version for the ports tree in bug #234633.

- Maybe it also make sense to add the "noflavors" back and remove the PYTHON_PKGNAMEPREFIX to keep the current package name as net/scapy is more an application than a Python library?

- You may also take this PR if you like because you did the most work (py-pcap and {py-}libdnet) to make net/scapy work with Python 3.
Comment 9 Muhammad Moinur Rahman freebsd_committer 2019-04-07 18:14:15 UTC
(In reply to Kai Knoblich from comment #8)
- There are still people using 2.7 at mass. And the EOL is still 8 months away from now. So I don't see a point in removing 2.7 support right away. Till now 2.7 is the most widely used python version.

- Noops. Removing noflavors was alright when we were working with 2.7 only as there is only 2.7 from 2.X branches. Even we remove support for 2.X branch now we cannot do it for 3.X; as we 3.6 and 3.7 in ports tree. Hence flavors and PYTHON_PKGNAMEPREFIX is must while we are using 3.X branches. So yes bringing support for 3.X branches have brought forward a couple of problems too. :D

- I would be delighted to. As I need to work with scapy on a regular basis.
Comment 10 Kai Knoblich freebsd_committer 2019-04-07 18:33:18 UTC
(In reply to Muhammad Moinur Rahman from comment #9)

Alright, makes sense then. Feel free to take this PR. :)
Comment 11 Craig Leres freebsd_committer 2019-04-08 21:42:05 UTC
Created attachment 203506 [details]
Comment out DARWIN use_bpf check

I tried the 203423 patch with 11.2-RELEASE and DEFAULT_VERSIONS=python=3.7 and it fails with FreeBSD:

      File "/usr/local/lib/python3.7/site-packages/scapy/config.py", line 436, in _set_conf_sockets
        raise ScapyInvalidPlatformException("Darwin (OSX) only !")
    scapy.error.ScapyInvalidPlatformException: Darwin (OSX) only !

Commenting out the check in _set_conf_sockets() seems to solve this. The patch is for the change I made after applying 203423.
Comment 12 Muhammad Moinur Rahman freebsd_committer 2019-04-09 20:54:54 UTC
(In reply to Craig Leres from comment #11)
Please check my patch on config.py and it works fine with 3.7. The upstream patch is similar to this.
Comment 13 Craig Leres freebsd_committer 2019-04-09 22:07:51 UTC
(In reply to Muhammad Moinur Rahman from comment #12)
Ah! patch-scapy_config.py didn't apply for me because it wasn't in the files subdir. (Also the recommended way to generate ports patches is relative to /usr/ports.)

What you have will work. But I would probably at least change the error message (the test is for BSD but reports Darwin/OSX).
Comment 14 Muhammad Moinur Rahman freebsd_committer 2019-04-09 22:10:32 UTC
(In reply to Craig Leres from comment #13)
if conf.use_bpf and not BSD:
        Interceptor.set_from_hook(conf, "use_bpf", False)
        raise ScapyInvalidPlatformException("BSD-like (OSX, *BSD...) only !")

Does this work ? Excerpted from upstream .. :D
Comment 15 Craig Leres freebsd_committer 2019-04-09 23:01:43 UTC
(In reply to Muhammad Moinur Rahman from comment #14)
If I move patch-scapy_config.py into the files subdir and build the resulting package works with python 3.7.
Comment 16 commit-hook freebsd_committer 2019-04-10 22:40:57 UTC
A commit references this bug:

Author: bofh
Date: Wed Apr 10 22:40:36 UTC 2019
New revision: 498612
URL: https://svnweb.freebsd.org/changeset/ports/498612

  net/scapy: Update version 2.3.3=>2.4.2

  - Works for both Python 2 and 3 [1]
  - Fix pkg-descr
  - MAINTAINER reset due to nearly 3 years maintainer inactivity;

  PR:		230110
  Submitted by:	kai bofh [1]
  Approved by:	vanhu (implicitly)