From patchwork Wed Mar 11 10:54:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Vanbever X-Patchwork-Id: 1252782 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=essensium.com Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48cpll0dyrz9sPF for ; Wed, 11 Mar 2020 21:55:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 35DB787344; Wed, 11 Mar 2020 10:55:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id twUNBYmA5Jql; Wed, 11 Mar 2020 10:55:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id EAFDA8727B; Wed, 11 Mar 2020 10:55:31 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id BB9771BF313 for ; Wed, 11 Mar 2020 10:55:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id B812088045 for ; Wed, 11 Mar 2020 10:55:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id s7Rh2M5EtBgj for ; Wed, 11 Mar 2020 10:55:29 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by hemlock.osuosl.org (Postfix) with ESMTPS id BD9C488042 for ; Wed, 11 Mar 2020 10:55:28 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id n15so1939111wrw.13 for ; Wed, 11 Mar 2020 03:55:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=essensium.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C4q7vtl2fhta9GeG8pk0MbRNrO9U3RCHNKwjeQX1KPs=; b=XjLm4hiGl7Dv/VKTTjJx/qL703Hn/uwOMUj4kIJFG9o3hQ9iME4dd0r7RabvL2Qyxe XnDYwbaqjHAouJRD12MLiFXfy2jKQEzNFq42trBozbu+r5JWxa2tHi34r6EM8PPzD5Rr GE3XLQQivImZGmx7CrziePsz4KhBA/kgHf2XK5f4rGV6bjD/LCyvuYIQCtBcgN//75ZL 62gM6iYmnSTQlh+48fk4JTsfLEYbb5bPcOIJ+1xSDUPQsA2C3m/bWW5nnyIcBHoVfbJy 2xpGiNHURUp5f8Ye9fLZbgUhDaDx4fT5zM0uE3NZfukppd8yOZzOz1c6+1l1W9VHhLb/ OKlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=C4q7vtl2fhta9GeG8pk0MbRNrO9U3RCHNKwjeQX1KPs=; b=Fa5bWYDF3kLJG2UcZjMbuqMMV+CJxyqeWlZhS3Zx1F+wJwqW8M/puczQw/MbjIi3Fi E+Guq78njHMZudO0zVsuzYNXnWpwlcI8DRx/5qcwl/l7jXxtmNuB8jOl+akc2soiBsdN 6NkFu4Md58u3jOUPcpXqvr8vJSjqukw0DpUJKbgKVGaDQVSfUYG8CJomj8HJw3c7Prkk yxoQtm2bKRPHFmVWFBRZ3pd/88+vhoXDqK01mJ/ZLBNI6Xs72mer38j2IolQID7FayFw 0HY8kR59blNpWnV/SxPFR1OVNKmn7W9dOCUJxALlxcNGcQdPQmGym7THdVC0K+6nvLtL wfhA== X-Gm-Message-State: ANhLgQ308nI6f/UUNzfSjK0eMQa2zVFWWVEp7LOBR9NI8jvfDifu3jEp qsdOkUBtqW2UBe4OV0n8jfXOgsvdbvE= X-Google-Smtp-Source: ADFU+vtAoXcEp250D+yXLtGg1m9Ktm9OCtrr/2EVMN8NmmVSKs1I1lTq/WfZHwKRF5PADgkAFynLvA== X-Received: by 2002:adf:f5cb:: with SMTP id k11mr3852381wrp.214.1583924126713; Wed, 11 Mar 2020 03:55:26 -0700 (PDT) Received: from localhost.localdomain (ip-188-118-3-185.reverse.destiny.be. [188.118.3.185]) by smtp.gmail.com with ESMTPSA id i9sm8072485wmd.37.2020.03.11.03.55.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 03:55:26 -0700 (PDT) From: Frank Vanbever To: buildroot@buildroot.org Date: Wed, 11 Mar 2020 11:54:44 +0100 Message-Id: <20200311105447.23808-1-frank.vanbever@essensium.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200228163917.10596-1-frank.vanbever@essensium.com> References: <20200228163917.10596-1-frank.vanbever@essensium.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 1/4] package/python-iptables: add explicit dependency on dynamic libs X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matt Weber , Frank Vanbever , Asaf Kahlon Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The package uses ctypes.CDLL extensively which only makes sense when dynamic libraries are available. Signed-off-by: Frank Vanbever --- v2 -> v3: - None v1 -> v2: - Add some additional explanation in commit message. Signed-off-by: Frank Vanbever --- package/python-iptables/Config.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/python-iptables/Config.in b/package/python-iptables/Config.in index e55359963e..a35577bad3 100644 --- a/package/python-iptables/Config.in +++ b/package/python-iptables/Config.in @@ -1,7 +1,11 @@ config BR2_PACKAGE_PYTHON_IPTABLES bool "python-iptables" + depends on !BR2_STATIC_LIBS select BR2_PACKAGE_IPTABLES # runtime dependency help Python bindings for iptables. https://github.com/ldx/python-iptables + +comment "python-iptables needs a toolchain w/ dynamic library" + depends on BR2_STATIC_LIBS From patchwork Wed Mar 11 10:54:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Vanbever X-Patchwork-Id: 1252781 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=essensium.com Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48cplp2fByz9sPK for ; Wed, 11 Mar 2020 21:55:50 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7035C88677; Wed, 11 Mar 2020 10:55:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wblRqfXB1pvT; Wed, 11 Mar 2020 10:55:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id DB509875E9; Wed, 11 Mar 2020 10:55:44 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id CE63A1BF313 for ; Wed, 11 Mar 2020 10:55:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id CB38488045 for ; Wed, 11 Mar 2020 10:55:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dlHlQywQYCTi for ; Wed, 11 Mar 2020 10:55:43 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by hemlock.osuosl.org (Postfix) with ESMTPS id E999488042 for ; Wed, 11 Mar 2020 10:55:42 +0000 (UTC) Received: by mail-wm1-f50.google.com with SMTP id a5so1559474wmb.0 for ; Wed, 11 Mar 2020 03:55:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=essensium.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rvuKbOHMslsmYExvI9g7towK/hz6SXTUSS9cs34BdQM=; b=NR9n0xXAu9gHOi1e2swqWYJLOTQDltaNhUPUddO/RWYodCiiJaTGbJ5/S1Fi8AcHWT zKqFBIRQhgfINZsrvYvLNPrG/gIZf1i5URL2yWNPPkUfR9zlrVv5G94RvXXGjHSX9SyT lW0y2Dn0KDSvqcvFGVpmjAFqbAZhs+CvOz5JavfDj85xAiglS9AvefmckF4M8dMQagvd OwEaCkNqE1y2jdtIbr6S3UvWx3e40SI6Rz7S3DPooQTFeMh/AlN7X02CwO8zKxMKktvA nmo+QvUF2QJ6kZDJ9pOFP17uX2HFg96jfKbIxyI6Uaikpr8LGEJCH5sWq+YF1YALSYbs MSsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rvuKbOHMslsmYExvI9g7towK/hz6SXTUSS9cs34BdQM=; b=M/7AgadwReBmID4FKIWuudS7pt6GP6hRRBvXflhinjWn5cJlpJEHDIj/kz72WePf6R COzM+LxiBfAZQzHIJz3KksTeOURKip1tWJsP538p3VU07zlyt5F0feYfYnNISwKoPd5V 6yW4/cATYDrVA9x3euR92Dx0KGwlpLq9lrmdDR97KYkzc9030RLD69YTipPUg1iknf71 94kQHANNkIH7jKzhyCXVqKEi576sFj1JcLnAVZWO4LNCn0pYQQWwfNzynbrToPZRrkew J8pniP8dtm6qQ0qKH2vwv96qAyScr+E88OGoDlULV5SRoaIvVrlX4tNgcGofbcHmi3We h5cQ== X-Gm-Message-State: ANhLgQ2bFXBIT2MaNceM2sFGvtT8DuS/5yhPM8rINLXBgvDc7ddK3w9L 5rXyzCSov1tl+TbA0dSRSe66PO1yNyY= X-Google-Smtp-Source: ADFU+vulsH9zYWt2T8wuweKLbjzvyaH7MOfYjFNN4WBcRhkfZAxcIh6+3erZPYzMw3PuE1fsu3AbEA== X-Received: by 2002:a05:600c:2214:: with SMTP id z20mr3125403wml.57.1583924141080; Wed, 11 Mar 2020 03:55:41 -0700 (PDT) Received: from localhost.localdomain (ip-188-118-3-185.reverse.destiny.be. [188.118.3.185]) by smtp.gmail.com with ESMTPSA id i9sm8072485wmd.37.2020.03.11.03.55.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 03:55:40 -0700 (PDT) From: Frank Vanbever To: buildroot@buildroot.org Date: Wed, 11 Mar 2020 11:54:45 +0100 Message-Id: <20200311105447.23808-2-frank.vanbever@essensium.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200311105447.23808-1-frank.vanbever@essensium.com> References: <20200228163917.10596-1-frank.vanbever@essensium.com> <20200311105447.23808-1-frank.vanbever@essensium.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 2/4] package/python-iptables: try known libc instead of find_library() X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matt Weber , Frank Vanbever , Asaf Kahlon Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" ctypes.util.find_library() depends on gcc and friends to detect the location of a given shared library. Given that these are not available on the target and that python-iptables depends on this functionality we need to work around this. The SONAMEs of the libc are well known so we try the known ones for glibc, uClibc and musl. Fixes: https://bugs.busybox.net/show_bug.cgi?id=12271 Signed-off-by: Frank Vanbever ---- v2 -> v3: - None v1 -> v2: - Change URL in patch from pull request to commit Signed-off-by: Frank Vanbever --- ...-Add-separate-mechanism-to-load-libc.patch | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 package/python-iptables/0001-Add-separate-mechanism-to-load-libc.patch diff --git a/package/python-iptables/0001-Add-separate-mechanism-to-load-libc.patch b/package/python-iptables/0001-Add-separate-mechanism-to-load-libc.patch new file mode 100644 index 0000000000..2a344c2f55 --- /dev/null +++ b/package/python-iptables/0001-Add-separate-mechanism-to-load-libc.patch @@ -0,0 +1,90 @@ +From e3557528d7cdcdc2c579212be8837bc9b54635a4 Mon Sep 17 00:00:00 2001 +From: Frank Vanbever +Date: Thu, 20 Feb 2020 12:14:08 +0100 +Subject: [PATCH] Add separate mechanism to load libc + +ctypes.util.find_library() always returns None for systems which do not have the +tools installed to determine the location of a given shared library (i.e. +ldconfig, gcc, objdump). If find_libary() fails attempt to load known libc by +SONAME. + +Upstream: https://github.com/ldx/python-iptables/commit/e3557528d7cdcdc2c579212be8837bc9b54635a4 + +Signed-off-by: Frank Vanbever +--- + iptc/ip4tc.py | 4 ++-- + iptc/util.py | 16 ++++++++++++++++ + iptc/xtables.py | 4 ++-- + 3 files changed, 20 insertions(+), 4 deletions(-) + +diff --git a/iptc/ip4tc.py b/iptc/ip4tc.py +index 4c5d690..4ddd2dc 100644 +--- a/iptc/ip4tc.py ++++ b/iptc/ip4tc.py +@@ -9,7 +9,7 @@ import socket + import struct + import weakref + +-from .util import find_library, load_kernel ++from .util import find_library, load_kernel, find_libc + from .xtables import (XT_INV_PROTO, NFPROTO_IPV4, XTablesError, xtables, + xt_align, xt_counters, xt_entry_target, xt_entry_match) + +@@ -26,7 +26,7 @@ if not hasattr(socket, 'IPPROTO_SCTP'): + + _IFNAMSIZ = 16 + +-_libc = ct.CDLL("libc.so.6") ++_libc = find_libc() + _get_errno_loc = _libc.__errno_location + _get_errno_loc.restype = ct.POINTER(ct.c_int) + _malloc = _libc.malloc +diff --git a/iptc/util.py b/iptc/util.py +index ae5fb9b..e6b1649 100644 +--- a/iptc/util.py ++++ b/iptc/util.py +@@ -109,3 +109,19 @@ def find_library(*names): + major = int(m.group(1)) + return lib, major + return None, None ++ ++ ++def find_libc(): ++ lib = ctypes.util.find_library('c') ++ if lib is not None: ++ return ctypes.CDLL(lib, mode=ctypes.RTLD_GLOBAL) ++ ++ libnames = ['libc.so.6', 'libc.so.0', 'libc.so'] ++ for name in libnames: ++ try: ++ lib = ctypes.CDLL(name, mode=ctypes.RTLD_GLOBAL) ++ return lib ++ except: ++ pass ++ ++ return None +diff --git a/iptc/xtables.py b/iptc/xtables.py +index 93bc080..cf21029 100644 +--- a/iptc/xtables.py ++++ b/iptc/xtables.py +@@ -6,7 +6,7 @@ import sys + import weakref + + from . import version +-from .util import find_library ++from .util import find_library, find_libc + from .errors import * + + XT_INV_PROTO = 0x40 # invert the sense of PROTO +@@ -792,7 +792,7 @@ class xtables_target(ct.Union): + ("v12", _xtables_target_v12)] + + +-_libc, _ = find_library("c") ++_libc = find_libc() + _optind = ct.c_long.in_dll(_libc, "optind") + _optarg = ct.c_char_p.in_dll(_libc, "optarg") + +-- +2.20.1 + From patchwork Wed Mar 11 10:54:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Vanbever X-Patchwork-Id: 1252783 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=essensium.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=essensium.com header.i=@essensium.com header.a=rsa-sha256 header.s=google header.b=Yw5tVShA; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48cpm14qR8z9sPF for ; Wed, 11 Mar 2020 21:56:01 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 83B4721FFB; Wed, 11 Mar 2020 10:55:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RzIFktyi81Rb; Wed, 11 Mar 2020 10:55:57 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id EE2012210F; Wed, 11 Mar 2020 10:55:56 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 411FF1BF313 for ; Wed, 11 Mar 2020 10:55:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 3A2A62210F for ; Wed, 11 Mar 2020 10:55:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i+KlX7VkT-aM for ; Wed, 11 Mar 2020 10:55:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by silver.osuosl.org (Postfix) with ESMTPS id 9A9A021FFB for ; Wed, 11 Mar 2020 10:55:53 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id p2so1977947wrw.7 for ; Wed, 11 Mar 2020 03:55:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=essensium.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mKDAlM3PDJsDcUbnWcMM95eQsR7MD+dW+JYGkZYKod4=; b=Yw5tVShAfwzust7V9Nk9tYa+7KNzC6tQ8RKG8l2r28s1dXAcvyYQPW7bNHgil3dfIi fkVMnu8XEzAVwqV3rjg/dJznEftQaIh8zkJZSTbhy0pcLIqD/7ZTBFkTeL8LL5td5FYz g0JaEYyIGT/+Q20k0CCZXHkqSGcATykRqqaiiZAs7DSbg8Yaz5FCWV/WBAIf6IdPvKhM 2EuSfDHIV895Akn0ZG1l3+mjGr0NcojuwT2FbnoEXQEQ5aRTiGSstHOliqhslDSYfCpD fhljOkItDzgXrWKp9yEEDr5tM7H2nwPim8/o9i83w0GYm5uAI7eTZ4XKGXZPJM1/fIHo cg/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mKDAlM3PDJsDcUbnWcMM95eQsR7MD+dW+JYGkZYKod4=; b=hioNaDbdNZZ9nu7j/QxWfG6FsSU8pe4KG8JuF/pkafHrMLFsCjgR+dN90XwV9Y1Y8B Y7G28h6Yuk8KR8PTg9WDbaJ7rJhqan9UD0yqUcNnpppGWapvJkVdJBi6qTh6Q0I4CYZT R/vnaZR4EivEvEdlavLDT01XAqIigbhc06U0sHKO3xFqdo5HcQcwu6D6DUrK0ZOyctkY n90KMTEZyf/11VJEjh3kHIhRua0y+g59Jd/ANZlbvsEr/LnQ8H70OR3xzkELewVWelZW lViX4J0OTD+FpcA+W1KBacYV9FmsVVRGp/qEZLVn535lDqO6A027SGEtEONRMdgbMH7J cGFw== X-Gm-Message-State: ANhLgQ0Px4ws4c+Imqz/y3gA18059irWR72RDsXDA8CP7nQuu+Y2kkBs tvt7lOLPW5+jlUz/2NsOPRYJpRww3MI= X-Google-Smtp-Source: ADFU+vuALmYPvnde928Y+F6DuUugTrOS/eSaHvt7aMdQDch7NqBn0vrvDXWEyidCUkcSoHne2n22ow== X-Received: by 2002:adf:eece:: with SMTP id a14mr3987630wrp.334.1583924151389; Wed, 11 Mar 2020 03:55:51 -0700 (PDT) Received: from localhost.localdomain (ip-188-118-3-185.reverse.destiny.be. [188.118.3.185]) by smtp.gmail.com with ESMTPSA id i9sm8072485wmd.37.2020.03.11.03.55.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 03:55:50 -0700 (PDT) From: Frank Vanbever To: buildroot@buildroot.org Date: Wed, 11 Mar 2020 11:54:46 +0100 Message-Id: <20200311105447.23808-3-frank.vanbever@essensium.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200311105447.23808-1-frank.vanbever@essensium.com> References: <20200228163917.10596-1-frank.vanbever@essensium.com> <20200311105447.23808-1-frank.vanbever@essensium.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 3/4] package/python-iptables: use installed iptables by default X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matt Weber , Frank Vanbever , Asaf Kahlon Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" python-iptables depends on ctypes.util.find_library() which does not work due to the absence of gcc and friends on target. The location of the xtables library and the iptables modules can be configured through environment variables. Within the scope of buildroot we can determine what these should be at build time and replace the calls to os.getenv() with the correct value. Fixes: https://bugs.busybox.net/show_bug.cgi?id=12271 Signed-off-by: Frank Vanbever --- v2 -> v3: - None v1 -> v2: - Remove unnecessary continuation in pre-build hook - Change sed separator to % Signed-off-by: Frank Vanbever --- package/python-iptables/Config.in | 2 +- package/python-iptables/python-iptables.mk | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/package/python-iptables/Config.in b/package/python-iptables/Config.in index a35577bad3..0e24283d06 100644 --- a/package/python-iptables/Config.in +++ b/package/python-iptables/Config.in @@ -1,7 +1,7 @@ config BR2_PACKAGE_PYTHON_IPTABLES bool "python-iptables" depends on !BR2_STATIC_LIBS - select BR2_PACKAGE_IPTABLES # runtime dependency + select BR2_PACKAGE_IPTABLES help Python bindings for iptables. diff --git a/package/python-iptables/python-iptables.mk b/package/python-iptables/python-iptables.mk index 66e478a89a..38c6ee3950 100644 --- a/package/python-iptables/python-iptables.mk +++ b/package/python-iptables/python-iptables.mk @@ -9,5 +9,14 @@ PYTHON_IPTABLES_SITE = https://files.pythonhosted.org/packages/08/5e/16a5ca35c42 PYTHON_IPTABLES_SETUP_TYPE = setuptools PYTHON_IPTABLES_LICENSE = Apache-2.0 PYTHON_IPTABLES_LICENSE_FILES = NOTICE +PYTHON_IPTABLES_DEPENDENCIES = iptables + +define PYTHON_IPTABLES_SET_XTABLES_ENV_VARS + XTABLES_VERSION=`awk '/XTABLES_VERSION_CODE/ {print $$NF}' $(STAGING_DIR)/usr/include/xtables-version.h`; \ + sed -i "s%os.getenv(\"PYTHON_IPTABLES_XTABLES_VERSION\")%$$XTABLES_VERSION%" $(@D)/iptc/xtables.py + sed -i "s%os.getenv(\"XTABLES_LIBDIR\")%\"/usr/lib/xtables\"%" $(@D)/iptc/xtables.py +endef + +PYTHON_IPTABLES_PRE_BUILD_HOOKS += PYTHON_IPTABLES_SET_XTABLES_ENV_VARS $(eval $(python-package)) From patchwork Wed Mar 11 10:54:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Vanbever X-Patchwork-Id: 1252784 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=essensium.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=essensium.com header.i=@essensium.com header.a=rsa-sha256 header.s=google header.b=FAu17I9G; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48cpmJ5yyLz9sPg for ; Wed, 11 Mar 2020 21:56:16 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id E409988042; Wed, 11 Mar 2020 10:56:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DOa+HCHyFiLN; Wed, 11 Mar 2020 10:56:10 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 2D0F688281; Wed, 11 Mar 2020 10:56:10 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 25A4E1BF9AD for ; Wed, 11 Mar 2020 10:56:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 221D48727B for ; Wed, 11 Mar 2020 10:56:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7zsILGNwBPl3 for ; Wed, 11 Mar 2020 10:56:07 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by fraxinus.osuosl.org (Postfix) with ESMTPS id E5AAC873A5 for ; Wed, 11 Mar 2020 10:56:06 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id a5so1561028wmb.0 for ; Wed, 11 Mar 2020 03:56:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=essensium.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ypfx4o4hH3akD98n2XmQwMNCHVryZ2aG3oS1eXGIdUo=; b=FAu17I9GbOwQhFQJ5mP7WYCys9NZKjEXQCOoF85E2E+HdZdHjJzHQzfV5J4/0fxWrZ +6CeC/tucy0qhAQ9Rn2RSAbmy1bYfW47+rEwv85hhoQPpj2eDehdV/EKzZxUS5pV+b8P mhwJvhb1viaYqy0suJNvQEGg7EeCCSk/YuEu8ZN5gI/KQlAtozdJFYzmsUMUTl+CooA9 9k4RnQO6VNhOXlMLBLcQGREXz0TyMUAVRuyUQTYp8HSm5BmpT5W+tATnv8k5/kljVYti i5wKRagQflSzEYniW+VUfMuizAh5abP2k3IBnnwIkanL/s/MHQbTi0dM1Rl4AKLBrlHX 2O1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ypfx4o4hH3akD98n2XmQwMNCHVryZ2aG3oS1eXGIdUo=; b=dzCkq7DwKXQAgHste8TRaFGewK4YPX7SkTgfup5fPIPUVRn9Y1X83TWvukalZabT8G hMuZPl+o1HdeICnOSgEXznxcdlWAej1ncDfjupv9kU6o5xk/Zzc5iaT8LFMpy5u/zhmA DacUOan3B4gRsK7hkQ4u4y50DvaGNiRGZ8QS6rGFO/1yQn6pxLIGUWyjK+tqErunUGQZ 5N48Nl3It6L22eJBG8kCfLOwbI7u5tfSxXdIzVcn7taKlRWnEFF9cud0H4tvshPt2Cb5 92jRTc3GRqb0PRXHP7QbNnbYcN+prun7ANBF/AIA6v6urwNIUVSu1LmAaXYdVCWn6KYd Yrqw== X-Gm-Message-State: ANhLgQ1H5blSk/sLHe/doUDtrS0jeSO6r7d3OxgtJam4BJvlgwK95Vwl hUcprByTKyMMX6N3k4E0+8lgMSp0pJg= X-Google-Smtp-Source: ADFU+vtvi1lZU+aXrU5nLIzkoHE30o1HcY/di8KDguiPn/b/VQAuZGb3owZKAkSEsB5zgaJRN55UHA== X-Received: by 2002:a7b:c194:: with SMTP id y20mr3293941wmi.129.1583924164070; Wed, 11 Mar 2020 03:56:04 -0700 (PDT) Received: from localhost.localdomain (ip-188-118-3-185.reverse.destiny.be. [188.118.3.185]) by smtp.gmail.com with ESMTPSA id i9sm8072485wmd.37.2020.03.11.03.56.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 03:56:03 -0700 (PDT) From: Frank Vanbever To: buildroot@buildroot.org Date: Wed, 11 Mar 2020 11:54:47 +0100 Message-Id: <20200311105447.23808-4-frank.vanbever@essensium.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200311105447.23808-1-frank.vanbever@essensium.com> References: <20200228163917.10596-1-frank.vanbever@essensium.com> <20200311105447.23808-1-frank.vanbever@essensium.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 4/4] package/python-iptables: account for platform tag in extensions X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matt Weber , Frank Vanbever , Asaf Kahlon Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" EXT_SUFFIX in Python versions > 3.5 contains a platform tag which only applies to cpython extensions. Given that ctypes.util.find_library does not work on the target due to the absence of the underlying tools '.so' needs to be added as a possible suffix for libraries to enable python-iptables to find the iptables shared libraries. Signed-off-by: Frank Vanbever --- v2 -> v3: - Add additional patch to fix python-iptables for python > 3.5 --- ...o-as-additional-shared-object-suffix.patch | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 package/python-iptables/0002-Add-.so-as-additional-shared-object-suffix.patch diff --git a/package/python-iptables/0002-Add-.so-as-additional-shared-object-suffix.patch b/package/python-iptables/0002-Add-.so-as-additional-shared-object-suffix.patch new file mode 100644 index 0000000000..41d49fc1e6 --- /dev/null +++ b/package/python-iptables/0002-Add-.so-as-additional-shared-object-suffix.patch @@ -0,0 +1,57 @@ +From 899d25c511c6ce779b7153e9ae2e41055b30b9c5 Mon Sep 17 00:00:00 2001 +From: Frank Vanbever +Date: Mon, 9 Mar 2020 12:36:47 +0100 +Subject: [PATCH] Add '.so' as additional shared object suffix + +EXT_SUFFIX includes a platform information tag starting from Python 3.5 [0] +For example: + + >>> sysconfig.get_config_var("EXT_SUFFIX") + '.cpython-38-aarch64-linux-gnu.so' + +This suffix only applies to cpython extensions i.e. not to the iptables shared +objects. + +Adding '.so' as an additional suffix for shared objects fixes the issue. + +Fixes: Issue #301 + +Signed-off-by: Frank Vanbever + +Backported from: 899d25c511c6ce779b7153e9ae2e41055b30b9c5 + +[0]: https://docs.python.org/3/whatsnew/3.5.html#build-and-c-api-changes +--- + iptc/util.py | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/iptc/util.py b/iptc/util.py +index e6b1649..04fe905 100644 +--- a/iptc/util.py ++++ b/iptc/util.py +@@ -80,12 +80,19 @@ def _do_find_library(name): + + + def _find_library(*names): ++ exts = [] + if version_info >= (3, 3): +- ext = get_config_var("EXT_SUFFIX") ++ exts.append(get_config_var("EXT_SUFFIX")) + else: +- ext = get_config_var('SO') ++ exts.append(get_config_var('SO')) ++ ++ if version_info >= (3, 5): ++ exts.append('.so') ++ + for name in names: +- libnames = [name, "lib" + name, name + ext, "lib" + name + ext] ++ libnames = [name, "lib" + name] ++ for ext in exts: ++ libnames += [name + ext, "lib" + name + ext] + libdir = os.environ.get('IPTABLES_LIBDIR', None) + if libdir is not None: + libdirs = libdir.split(':') +-- +2.20.1 +