Message ID | 20230608232859.1245497-1-romain.naour@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [v2,01/17] package/python-iptables: fix _find_library() | expand |
On Fri, 9 Jun 2023 01:28:43 +0200 Romain Naour <romain.naour@gmail.com> wrote: > While the commit [1] already fixed some runtime issue with > uClibc toolchain, the same test TestPythonPy3Iptables fail > with Glibc toolchain. > > xtables_version = 12 > if xtables_version: > _searchlib = "libxtables.so.%s" % (xtables_version,) > else: > _searchlib = "xtables" > _lib_xtables, xtables_version = find_library(_searchlib) > > _lib_xtables and xtables_version are null with glibc > > The implementation of find_library() rely on the custom > _find_library() that try to use the IPTABLES_LIBDIR > environment variable (that does not exist in the context > of Buildroot). > > Within the scope of buildroot we can determine what > IPTABLES_LIBDIR should be at build time and replace the > calls to os.environ.get('IPTABLES_LIBDIR', None) with > the correct value. > > [1] d341ec035067120b456f669a826e26eb594c0237 > > Signed-off-by: Romain Naour <romain.naour@gmail.com> > --- > I don't know why TestPythonPy3Iptables pass succesfully > with a uClibc toolchain but not with a glibc toolchain. > The current python code searching for xtables, modules > and libraries seems fragile... > --- > package/python-iptables/python-iptables.mk | 1 + > 1 file changed, 1 insertion(+) There hasn't been much feedback on the overall principle, but I found it reasonable: we're using glibc as the default C library now, so it kind of makes sense to use it primarily in our test cases. So I've applied the entire series, thanks for this work! Thomas
>>>>> "Romain" == Romain Naour <romain.naour@gmail.com> writes: > While the commit [1] already fixed some runtime issue with > uClibc toolchain, the same test TestPythonPy3Iptables fail > with Glibc toolchain. > xtables_version = 12 > if xtables_version: > _searchlib = "libxtables.so.%s" % (xtables_version,) > else: > _searchlib = "xtables" > _lib_xtables, xtables_version = find_library(_searchlib) > _lib_xtables and xtables_version are null with glibc > The implementation of find_library() rely on the custom > _find_library() that try to use the IPTABLES_LIBDIR > environment variable (that does not exist in the context > of Buildroot). > Within the scope of buildroot we can determine what > IPTABLES_LIBDIR should be at build time and replace the > calls to os.environ.get('IPTABLES_LIBDIR', None) with > the correct value. > [1] d341ec035067120b456f669a826e26eb594c0237 > Signed-off-by: Romain Naour <romain.naour@gmail.com> > --- > I don't know why TestPythonPy3Iptables pass succesfully > with a uClibc toolchain but not with a glibc toolchain. > The current python code searching for xtables, modules > and libraries seems fragile... Committed to 2023.02.x and 2023.05.x, thanks.
diff --git a/package/python-iptables/python-iptables.mk b/package/python-iptables/python-iptables.mk index 0ccf064217..9cb4285ec3 100644 --- a/package/python-iptables/python-iptables.mk +++ b/package/python-iptables/python-iptables.mk @@ -15,6 +15,7 @@ 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 + sed -i "s%os.environ.get('IPTABLES_LIBDIR', None)%\"/usr/lib\"%" $(@D)/iptc/util.py endef PYTHON_IPTABLES_PRE_BUILD_HOOKS += PYTHON_IPTABLES_SET_XTABLES_ENV_VARS
While the commit [1] already fixed some runtime issue with uClibc toolchain, the same test TestPythonPy3Iptables fail with Glibc toolchain. xtables_version = 12 if xtables_version: _searchlib = "libxtables.so.%s" % (xtables_version,) else: _searchlib = "xtables" _lib_xtables, xtables_version = find_library(_searchlib) _lib_xtables and xtables_version are null with glibc The implementation of find_library() rely on the custom _find_library() that try to use the IPTABLES_LIBDIR environment variable (that does not exist in the context of Buildroot). Within the scope of buildroot we can determine what IPTABLES_LIBDIR should be at build time and replace the calls to os.environ.get('IPTABLES_LIBDIR', None) with the correct value. [1] d341ec035067120b456f669a826e26eb594c0237 Signed-off-by: Romain Naour <romain.naour@gmail.com> --- I don't know why TestPythonPy3Iptables pass succesfully with a uClibc toolchain but not with a glibc toolchain. The current python code searching for xtables, modules and libraries seems fragile... --- package/python-iptables/python-iptables.mk | 1 + 1 file changed, 1 insertion(+)