aboutsummaryrefslogtreecommitdiffstats
path: root/community/py-ethtool
diff options
context:
space:
mode:
authorLeonardo Arena <rnalrd@alpinelinux.org>2015-11-10 07:55:24 +0000
committerLeonardo Arena <rnalrd@alpinelinux.org>2015-11-10 07:56:41 +0000
commit5622ee34cbe17d63d4bccc613011fafcf9f24fab (patch)
tree556c70241a86b2b17869957eec5ba30d737236b2 /community/py-ethtool
parent5293bf889543fa940029b17889cca569c4b93b42 (diff)
downloadaports-5622ee34cbe17d63d4bccc613011fafcf9f24fab.tar.bz2
aports-5622ee34cbe17d63d4bccc613011fafcf9f24fab.tar.xz
community/py-ethtool: moved from main
Diffstat (limited to 'community/py-ethtool')
-rw-r--r--community/py-ethtool/APKBUILD52
-rw-r--r--community/py-ethtool/fix-includes-and-types.patch25
-rw-r--r--community/py-ethtool/python-ethtool-libnl-1.0-support.patch71
3 files changed, 148 insertions, 0 deletions
diff --git a/community/py-ethtool/APKBUILD b/community/py-ethtool/APKBUILD
new file mode 100644
index 0000000000..fdb2b1f60f
--- /dev/null
+++ b/community/py-ethtool/APKBUILD
@@ -0,0 +1,52 @@
+# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
+pkgname=py-ethtool
+_realname=python-ethtool
+pkgver=0.7
+pkgrel=0
+pkgdesc="Python library for the ethtool kernel interface"
+url="http://www.ohloh.net/p/python-ethtool"
+arch="all"
+license="GPL2"
+depends=
+depends_dev="libnl-dev pkgconfig python-dev"
+makedepends="linux-headers $depends_dev"
+install=
+subpackages=
+source="http://dsommers.fedorapeople.org/python-ethtool/$_realname-$pkgver.tar.bz2
+ python-ethtool-libnl-1.0-support.patch
+ fix-includes-and-types.patch
+ "
+
+
+_builddir="$srcdir"/$_realname-$pkgver
+prepare() {
+ cd "$_builddir"
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+
+build() {
+ cd "$_builddir"
+ return 0
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install || return 1
+ # python setup.py install --root="$pkgdir"
+}
+
+md5sums="2d13e2412948344b8375f5af4ced1c20 python-ethtool-0.7.tar.bz2
+188f260534eb838193e0e8c249b6a33c python-ethtool-libnl-1.0-support.patch
+2f9b03956f7e31080718036ad387669f fix-includes-and-types.patch"
+sha256sums="5ac6543c2fb7ffc7188cfaee1fac2e2bf6a9f59ce4d62d47b037d3a5ccaefa48 python-ethtool-0.7.tar.bz2
+6682d46a027a4b83b2724625ab0518d224b0805a7bddeb237f497cea7945a932 python-ethtool-libnl-1.0-support.patch
+5d2815a5e883b9aebaefbbad11485f15332c6e8484ed6ee57c7884b617a8085f fix-includes-and-types.patch"
+sha512sums="ee258bbb308d405c7089ab3a9e307c3bdafe557d220a2fad2498af3c54938ef9093973cdde52b6b971d07f888698af42bdcdbff00300c461248cfb2bdc3c35f5 python-ethtool-0.7.tar.bz2
+f3b3fbebfc276de712383f24439539bc649dd8cb91c9f63dd53ddf2c074592eb8deb22200947237e52dc6262c1dd3c4729e3912a40d42634a949c8b23deb96c9 python-ethtool-libnl-1.0-support.patch
+d600fb49864b328be7dae349d948e6f32d1608e590c5dec5289ac6873bb1386527a5eb05e310a94033bc2e48c019b23a88da277b14ad99c798935c9d9359e4c9 fix-includes-and-types.patch"
diff --git a/community/py-ethtool/fix-includes-and-types.patch b/community/py-ethtool/fix-includes-and-types.patch
new file mode 100644
index 0000000000..da655f7c67
--- /dev/null
+++ b/community/py-ethtool/fix-includes-and-types.patch
@@ -0,0 +1,25 @@
+--- python-ethtool-0.7.orig/python-ethtool/etherinfo.c
++++ python-ethtool-0.7/python-ethtool/etherinfo.c
+@@ -16,7 +16,6 @@
+ */
+
+ #include <Python.h>
+-#include <bits/sockaddr.h>
+ #include <stdio.h>
+ #include <string.h>
+ #include <sys/types.h>
+--- python-ethtool-0.7.orig/python-ethtool/ethtool.c
++++ python-ethtool-0.7/python-ethtool/ethtool.c
+@@ -41,9 +41,9 @@
+ #endif
+
+ typedef unsigned long long u64;
+-typedef __uint32_t u32;
+-typedef __uint16_t u16;
+-typedef __uint8_t u8;
++typedef uint32_t u32;
++typedef uint16_t u16;
++typedef uint8_t u8;
+
+ #include "ethtool-copy.h"
+ #include <linux/sockios.h> /* for SIOCETHTOOL */
diff --git a/community/py-ethtool/python-ethtool-libnl-1.0-support.patch b/community/py-ethtool/python-ethtool-libnl-1.0-support.patch
new file mode 100644
index 0000000000..43c53dba4e
--- /dev/null
+++ b/community/py-ethtool/python-ethtool-libnl-1.0-support.patch
@@ -0,0 +1,71 @@
+diff --git a/python-ethtool/etherinfo.c b/python-ethtool/etherinfo.c
+index 3d2072b..23f03c6 100644
+--- a/python-ethtool/etherinfo.c
++++ b/python-ethtool/etherinfo.c
+@@ -30,6 +30,52 @@
+ #include "etherinfo_struct.h"
+ #include "etherinfo.h"
+
++#ifdef LIBNL_1_0
++#define NLHDR_COMMON \
++ int ce_refcnt; \
++ struct nl_object_ops * ce_ops; \
++ struct nl_cache * ce_cache; \
++ struct nl_list_head ce_list; \
++ int ce_msgtype; \
++ int ce_flags; \
++ uint32_t ce_mask;
++
++struct nl_cache
++{
++ struct nl_list_head c_items;
++ int c_nitems;
++ int c_iarg1;
++ int c_iarg2;
++ struct nl_cache_ops * c_ops;
++};
++
++struct nl_object
++{
++ NLHDR_COMMON
++};
++
++void nl_cache_free(struct nl_cache *cache)
++{
++ struct nl_object *obj, *tmp;
++
++ if( !cache )
++ return;
++
++ nl_list_for_each_entry_safe(obj, tmp, &cache->c_items, ce_list) {
++ struct nl_cache *cache = obj->ce_cache;
++ if( !cache ) {
++ break;
++ }
++
++ nl_list_del(&obj->ce_list);
++ obj->ce_cache = NULL;
++ nl_object_put(obj);
++ cache->c_nitems--;
++ }
++ free(cache);
++}
++#endif
++
+ /*
+ *
+ * Internal functions for working with struct etherinfo
+diff --git a/setup.py b/setup.py
+index bde04dc..9adff64 100644
+--- a/setup.py
++++ b/setup.py
+@@ -67,7 +67,8 @@ setup(name='ethtool',
+ include_dirs = libnl['include'],
+ library_dirs = libnl['libdirs'],
+ libraries = libnl['libs'],
+- define_macros = [('VERSION', '"%s"' % version)]
++ define_macros = [('VERSION', '"%s"' % version),
++ ('LIBNL_1_0', None)]
+ )
+ ]
+ )