[packages/libdnet] - updated to 1.18.0, added python3 module

qboosh qboosh at pld-linux.org
Sun Jul 6 20:39:47 CEST 2025


commit 16e91f136b03e0f497cf88facf685b75bc8a14b6
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Jul 6 20:41:18 2025 +0200

    - updated to 1.18.0, added python3 module

 libdnet-ip6.patch    | 24 --------------
 libdnet-python.patch | 57 --------------------------------
 libdnet-vlan.patch   |  9 +++---
 libdnet.spec         | 91 +++++++++++++++++++++++++++++++++++++++-------------
 4 files changed, 73 insertions(+), 108 deletions(-)
---
diff --git a/libdnet.spec b/libdnet.spec
index e996058..6fec0c2 100644
--- a/libdnet.spec
+++ b/libdnet.spec
@@ -1,26 +1,33 @@
 #
 # Conditional build:
-%bcond_without	static_libs	# don't build static library
+%bcond_without	python2		# CPython 2.x module
+%bcond_without	python3		# CPython 3.x module
+%bcond_without	static_libs	# static library
 #
 Summary:	Interface to several low-level networking routines
 Summary(pl.UTF-8):	Interfejs do niektórych niskopoziomowych funkcji sieciowych
 Name:		libdnet
-Version:	1.12
-Release:	4
+Version:	1.18.0
+Release:	1
 License:	BSD
 Group:		Libraries
-#Source0Download: https://code.google.com/p/libdnet/downloads/list
-Source0:	https://libdnet.googlecode.com/files/%{name}-%{version}.tgz
-# Source0-md5:	9253ef6de1b5e28e9c9a62b882e44cc9
-Patch0:		%{name}-python.patch
+#Source0Download: https://github.com/ofalk/libdnet/releases
+Source0:	https://github.com/ofalk/libdnet/archive/libdnet-%{version}/%{name}-%{version}.tar.gz
+# Source0-md5:	5215b66fee62f0d52a8a74de5312abc3
 Patch1:		%{name}-vlan.patch
 Patch2:		%{name}-ip6.patch
-URL:		https://code.google.com/p/libdnet/
-BuildRequires:	autoconf >= 2.53
+URL:		https://github.com/ofalk/libdnet
+BuildRequires:	autoconf >= 2.71
 BuildRequires:	automake
-BuildRequires:	libtool
-BuildRequires:	python-Pyrex
-BuildRequires:	python-devel >= 1:2.5
+BuildRequires:	libtool >= 2:2.2
+%if %{with python2}
+BuildRequires:	python-Cython
+BuildRequires:	python-devel >= 1:2.7
+%endif
+%if %{with python3}
+BuildRequires:	python3-Cython
+BuildRequires:	python3-devel >= 1:3.2
+%endif
 BuildRequires:	rpm-pythonprov
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -79,21 +86,31 @@ Sample applications to use with libdnet.
 Przykładowe aplikacje do wykorzystania libdnet.
 
 %package -n python-libdnet
-Summary:	libdnet Python module
-Summary(pl.UTF-8):	Moduł libdnet dla Pythona
+Summary:	dnet Python 2 module
+Summary(pl.UTF-8):	Moduł dnet dla Pythona 2
 Group:		Libraries
 Requires:	%{name} = %{version}-%{release}
-%pyrequires_eq	python-libs
 
 %description -n python-libdnet
-libdnet Python module.
+dnet Python module.
 
 %description -n python-libdnet -l pl.UTF-8
-Moduł libdnet dla Pythona.
+Moduł dnet dla Pythona.
+
+%package -n python3-libdnet
+Summary:	dnet Python 3 module
+Summary(pl.UTF-8):	Moduł dnet dla Pythona 3
+Group:		Libraries
+Requires:	%{name} = %{version}-%{release}
+
+%description -n python3-libdnet
+dnet Python module.
+
+%description -n python3-libdnet -l pl.UTF-8
+Moduł dnet dla Pythona.
 
 %prep
-%setup -q
-%patch -P0 -p1
+%setup -q -n %{name}-libdnet-%{version}
 %patch -P1 -p1
 %patch -P2 -p1
 
@@ -107,16 +124,37 @@ Moduł libdnet dla Pythona.
 %{__autoheader}
 %{__automake}
 %configure \
-	--with-python \
-	%{!?with_static_libs:--disable-static}
+	%{!?with_static_libs:--disable-static} \
+	--without-python
+
 %{__make}
 
+cd python
+%if %{with python2}
+%py_build
+%endif
+
+%if %{with python3}
+%py3_build
+%endif
+
 %install
 rm -rf $RPM_BUILD_ROOT
 
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
 
+cd python
+%if %{with python2}
+%py_install
+
+%py_postclean
+%endif
+
+%if %{with python3}
+%py3_install
+%endif
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -125,7 +163,7 @@ rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(644,root,root,755)
-%doc LICENSE README THANKS TODO
+%doc LICENSE README.md THANKS TODO
 %attr(755,root,root) %{_libdir}/libdnet.so.*.*.*
 %attr(755,root,root) %ghost %{_libdir}/libdnet.so.1
 
@@ -149,7 +187,16 @@ rm -rf $RPM_BUILD_ROOT
 %attr(755,root,root) %{_sbindir}/dnet
 %{_mandir}/man8/dnet.8*
 
+%if %{with python2}
 %files -n python-libdnet
 %defattr(644,root,root,755)
 %attr(755,root,root) %{py_sitedir}/dnet.so
 %{py_sitedir}/dnet-%{version}-py*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-libdnet
+%defattr(644,root,root,755)
+%attr(755,root,root) %{py3_sitedir}/dnet.cpython-*.so
+%{py3_sitedir}/dnet-%{version}-py*.egg-info
+%endif
diff --git a/libdnet-ip6.patch b/libdnet-ip6.patch
index b6e3f29..8d39e2c 100644
--- a/libdnet-ip6.patch
+++ b/libdnet-ip6.patch
@@ -10,30 +10,6 @@ diff -ruN libdnet-1.11.orig/test/dnet/Makefile.am libdnet-1.11/test/dnet/Makefil
  
  man_MANS = dnet.8
  
-diff -ruN libdnet-1.11.orig/test/dnet/Makefile.in libdnet-1.11/test/dnet/Makefile.in
---- libdnet-1.11.orig/test/dnet/Makefile.in	2006-01-19 09:24:46.000000000 +0100
-+++ libdnet-1.11/test/dnet/Makefile.in	2011-12-03 23:05:24.899192576 +0100
-@@ -106,7 +106,7 @@
- sbin_PROGRAMS = dnet
- 
- dnet_SOURCES = addr.c arp.c aton.c aton.h dnet.c eth.c fw.c hex.c \
--	icmp.c intf.c ip.c mod.h rand.c route.c send.c tcp.c udp.c
-+	icmp.c intf.c ip.c ip6.c mod.h rand.c route.c send.c tcp.c udp.c
- 
- 
- man_MANS = dnet.8
-@@ -123,8 +123,9 @@
- 
- am_dnet_OBJECTS = addr.$(OBJEXT) arp.$(OBJEXT) aton.$(OBJEXT) \
- 	dnet.$(OBJEXT) eth.$(OBJEXT) fw.$(OBJEXT) hex.$(OBJEXT) \
--	icmp.$(OBJEXT) intf.$(OBJEXT) ip.$(OBJEXT) rand.$(OBJEXT) \
--	route.$(OBJEXT) send.$(OBJEXT) tcp.$(OBJEXT) udp.$(OBJEXT)
-+	icmp.$(OBJEXT) intf.$(OBJEXT) ip.$(OBJEXT) ip6.$(OBJEXT) \
-+	rand.$(OBJEXT) route.$(OBJEXT) send.$(OBJEXT) tcp.$(OBJEXT) \
-+	udp.$(OBJEXT)
- dnet_OBJECTS = $(am_dnet_OBJECTS)
- dnet_DEPENDENCIES = $(top_builddir)/src/libdnet.la
- dnet_LDFLAGS =
 diff -ruN libdnet-1.11.orig/test/dnet/aton.c libdnet-1.11/test/dnet/aton.c
 --- libdnet-1.11.orig/test/dnet/aton.c	2002-10-14 17:42:10.000000000 +0200
 +++ libdnet-1.11/test/dnet/aton.c	2011-12-03 23:06:18.852669377 +0100
diff --git a/libdnet-python.patch b/libdnet-python.patch
deleted file mode 100644
index 066870a..0000000
--- a/libdnet-python.patch
+++ /dev/null
@@ -1,57 +0,0 @@
---- libdnet-1.11/python/dnet.pyx.orig	2006-01-19 07:09:01.000000000 +0100
-+++ libdnet-1.11/python/dnet.pyx	2008-03-21 19:09:11.058710426 +0100
-@@ -46,7 +46,6 @@
-     memcpy(dst, src, n)
- 
- cdef __oserror():
--    cdef extern int errno
-     return strerror(errno)
- 
- def __iter_append(entry, l):
---- libdnet-1.11/python/dnet.pyx.org	2008-11-02 01:02:58.687884947 +0100
-+++ libdnet-1.11/python/dnet.pyx	2008-11-02 01:04:19.111626507 +0100
-@@ -159,7 +159,7 @@
-     return PyString_FromStringAndSize(ea.data, 6)
- 
- def eth_pack_hdr(dst=ETH_ADDR_BROADCAST, src=ETH_ADDR_BROADCAST,
--                 type=ETH_TYPE_IP):
-+		ptype=ETH_TYPE_IP):
-     """Return a packed binary string representing an Ethernet header.
- 	
-     Keyword arguments:
-@@ -171,7 +171,7 @@
-     cdef eth_addr_t s, d
-     __memcpy(s.data, src, 6)
-     __memcpy(d.data, dst, 6)
--    __eth_pack_hdr(hdr, d, s, type)
-+    __eth_pack_hdr(hdr, d, s, ptype)
-     return PyString_FromStringAndSize(hdr, 14)
- 
- #
-@@ -440,7 +440,7 @@
-     """
-     cdef addr_t _addr
-     
--    def __init__(self, addrtxt=None, type=ADDR_TYPE_NONE):
-+    def __init__(self, addrtxt=None, ptype=ADDR_TYPE_NONE):
-         if addrtxt != None and addr_aton(addrtxt, &self._addr) < 0:
-             if PyString_Size(addrtxt) == 4:
-                 self._addr.addr_type = ADDR_TYPE_IP
-@@ -784,7 +784,7 @@
- cdef extern from *:
-     void __icmp_pack_hdr "icmp_pack_hdr" (char *hdr, int type, int code)
-     
--def icmp_pack_hdr(type, code):
-+def icmp_pack_hdr(ptype, code):
-     """Return a packed binary string representing an ICMP header.
- 
-     Keyword arguments:
-@@ -792,7 +792,7 @@
-     code -- ICMP code		(8-bit integer)
-     """
-     cdef char buf[4]
--    __icmp_pack_hdr(buf, type, code)
-+    __icmp_pack_hdr(buf, ptype, code)
-     return PyString_FromStringAndSize(buf, sizeof(buf))
- 
- #
diff --git a/libdnet-vlan.patch b/libdnet-vlan.patch
index 81c70bd..82ff559 100644
--- a/libdnet-vlan.patch
+++ b/libdnet-vlan.patch
@@ -17,11 +17,10 @@ diff -ruN libdnet-1.11.orig/test/dnet/aton.c libdnet-1.11/test/dnet/aton.c
 +	*vid = htons(i & 0xffff);
 +	return (0);
 +}
-diff -ruN libdnet-1.11.orig/test/dnet/dnet.8 libdnet-1.11/test/dnet/dnet.8
---- libdnet-1.11.orig/test/dnet/dnet.8	2002-04-01 09:11:34.000000000 +0200
-+++ libdnet-1.11/test/dnet/dnet.8	2011-12-03 23:10:04.055399746 +0100
-@@ -42,6 +42,7 @@
- .Op Nm type Ar type 
+--- libdnet-libdnet-1.18.0/test/dnet/dnet.8.orig	2024-03-08 14:03:35.000000000 +0100
++++ libdnet-libdnet-1.18.0/test/dnet/dnet.8	2025-07-06 20:06:32.817271272 +0200
+@@ -42,6 +42,7 @@ random bytes to standard output.
+ .Op Nm type Ar type
  .Op Nm src Ar mac
  .Op Nm dst Ar mac
 +.Op Nm vid Ar vlan_id
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libdnet.git/commitdiff/16e91f136b03e0f497cf88facf685b75bc8a14b6



More information about the pld-cvs-commit mailing list