Skip to contentSkip to conversation

libselinux: target python interface generation

PATCH New Matt Weber 3 participants 10 messages Apr 13, 2017 – Apr 14, 2017 2 messages not in the archive

lore
Share & tools
lore

Matt Weber

author
#0 lore raw

PATCH 1/3 libselinux: target python interface generation

Fixed a consistancy issue between toolchain revisions. Moves the swig and pywrap step seperate from the overall build "all".

Resolves:
http://autobuild.buildroot.net/results/967/967b74d0ae5b4b83ea2729217b005a3e1e4514d0/

---
 package/libselinux/libselinux.mk | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
package/libselinux/libselinux.mk +10 -4
index ca7836f..7e92de6 100644
@@ -20,7 +20,6 @@ LIBSELINUX_MAKE_OPTS = \
 	LDFLAGS="$(TARGET_LDFLAGS) -lpcre -lpthread" \
 	ARCH=$(KERNEL_ARCH)
 
-LIBSELINUX_MAKE_TARGETS = all
 LIBSELINUX_MAKE_INSTALL_TARGETS = install
 
 ifeq ($(BR2_PACKAGE_PYTHON)$(BR2_PACKAGE_PYTHON3),y)
@@ -39,16 +38,23 @@ LIBSELINUX_MAKE_OPTS += \
 	PYSITEDIR=$(TARGET_DIR)/usr/lib/$(LIBSELINUX_PYLIBVER)/site-packages \
 	SWIG_LIB="$(HOST_DIR)/usr/share/swig/$(SWIG_VERSION)/"
 
-LIBSELINUX_MAKE_TARGETS += swigify pywrap
 LIBSELINUX_MAKE_INSTALL_TARGETS += install-pywrap
+
+# dependencies are broken and result in file
+# truncation errors at library link if the
+# make targets are added to the existing BUILD_CMD
+define LIBSELINUX_BUILD_PYTHON_INTERFACE_
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+		$(LIBSELINUX_MAKE_OPTS) DESTDIR=$(STAGING_DIR) swigify pywrap
+endef
 endif # python || python3
 
 define LIBSELINUX_BUILD_CMDS
 	# DESTDIR is needed during the compile to compute library and
 	# header paths.
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
-		$(LIBSELINUX_MAKE_OPTS) DESTDIR=$(STAGING_DIR) \
-		$(LIBSELINUX_MAKE_TARGETS)
+		$(LIBSELINUX_MAKE_OPTS) DESTDIR=$(STAGING_DIR) all
+	$(LIBSELINUX_BUILD_PYTHON_INTERFACE)
 endef
 
 define LIBSELINUX_INSTALL_STAGING_CMDS
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 2/3 python3: ncurses condition for libselinux enabled

When libselinux is enabled, a circular dependency is created. Disable ncurses python support when libselinux is enabled so that the circular busybox, ncurses, python, libselinux chain is broken.

Resolves
http://autobuild.buildroot.net/results/db1/db1e6f3054092fc5576ccab8e04a3b9d74ca9a8c/

---
 package/python3/Config.in  | 1 +
 package/python3/python3.mk | 7 +++++++
 2 files changed, 8 insertions(+)
package/python3/Config.in +1 -0
index 35f57e6..fce635d 100644
@@ -53,6 +53,7 @@ config BR2_PACKAGE_PYTHON3_CODECSCJK
 config BR2_PACKAGE_PYTHON3_CURSES
 	bool "curses module"
 	select BR2_PACKAGE_NCURSES
+	depends on !BR2_PACKAGE_LIBSELINUX    #circular dependency
 	help
 	  curses module for Python3.
 
package/python3/python3.mk +7 -0
index 2532dee..4fd5d3e 100644
@@ -61,7 +61,14 @@ PYTHON3_CONF_OPTS += --disable-readline
 endif
 
 ifeq ($(BR2_PACKAGE_PYTHON3_CURSES),y)
+# If libselinux is enabled, this creates a circular dependency
+# with busybox, ncurses, python, libselinux, busybox
+# For this case, we disable curses as a opt in python3.
+ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
+PYTHON3_CONF_OPTS += --disable-curses
+else
 PYTHON3_DEPENDENCIES += ncurses
+endif
 else
 PYTHON3_CONF_OPTS += --disable-curses
 endif
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/3 python3: ncurses condition for libselinux enabled

Hello,

Quoted 9 lines · Matt Weber

When libselinux is enabled, a circular dependency is created. Disable ncurses python support when libselinux is enabled so that the circular busybox, ncurses, python, libselinux chain is broken.

Resolves
http://autobuild.buildroot.net/results/db1/db1e6f3054092fc5576ccab8e04a3b9d74ca9a8c/

I am not sure this is the right approach to fix this issue. It feels really weird to no longer be able to use ncurses support in Python(3) when SELinux is enabled.

I believe the real issue is that Busybox really doesn't care at all about the Python bindings for libselinux. So perhaps we should split the Python bindings build/installation from libselinux into a separate package. I think we had a similar split for another package.

It would however require some investigation to figure out if it's possible to build just the Python bindings, using an already built and installed libselinux.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#3 lore raw

PATCH 2/3 python3: ncurses condition for libselinux enabled

Thomas,

Quoted 17 lines · Thomas Petazzoni

Hello,

Quoted 9 lines · Matt Weber

When libselinux is enabled, a circular dependency is created. Disable ncurses python support when libselinux is enabled so that the circular busybox, ncurses, python, libselinux chain is broken.

Resolves
http://autobuild.buildroot.net/results/db1/db1e6f3054092fc5576ccab8e04a3b9d74ca9a8c/

I am not sure this is the right approach to fix this issue. It feels really weird to no longer be able to use ncurses support in Python(3) when SELinux is enabled.

Quoted 8 lines

I believe the real issue is that Busybox really doesn't care at all about the Python bindings for libselinux. So perhaps we should split the Python bindings build/installation from libselinux into a separate package. I think we had a similar split for another package.

It would however require some investigation to figure out if it's possible to build just the Python bindings, using an already built and installed libselinux.

I'll take a look.

-Matt

#4 lore raw

PATCH 2/3 python3: ncurses condition for libselinux enabled

Quoted 26 lines · Matthew Weber

Thomas,

Quoted 22 lines · Thomas Petazzoni

Hello,

Quoted 9 lines · Matt Weber

When libselinux is enabled, a circular dependency is created. Disable ncurses python support when libselinux is enabled so that the circular busybox, ncurses, python, libselinux chain is broken.

Resolves
http://autobuild.buildroot.net/results/db1/db1e6f3054092fc5576ccab8e04a3b9d74ca9a8c/

I am not sure this is the right approach to fix this issue. It feels really weird to no longer be able to use ncurses support in Python(3) when SELinux is enabled.

I believe the real issue is that Busybox really doesn't care at all about the Python bindings for libselinux. So perhaps we should split the Python bindings build/installation from libselinux into a separate package. I think we had a similar split for another package.

Quoted 5 lines
Quoted 3 lines

It would however require some investigation to figure out if it's possible to build just the Python bindings, using an already built and installed libselinux.

I'll take a look.

Alternatively, we could cut the ncurses->busybox dependency. That only exists
to make sure that ncurses tools overwrite busybox tools. IIRC busybox will not overwrite existing tools, so the reverse should work as well. Or else remove these things from the busybox config.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#5 lore raw

PATCH 2/3 python3: ncurses condition for libselinux enabled

Arnout,

Quoted 33 lines · Arnout Vandecappelle
Quoted 30 lines · Matthew Weber

Thomas,

Quoted 25 lines · Thomas Petazzoni

Hello,

Quoted 9 lines · Matt Weber

When libselinux is enabled, a circular dependency is created. Disable ncurses python support when libselinux is enabled so that the circular busybox, ncurses, python, libselinux chain is broken.

Resolves
http://autobuild.buildroot.net/results/db1/db1e6f3054092fc5576ccab8e04a3b9d74ca9a8c/

I am not sure this is the right approach to fix this issue. It feels really weird to no longer be able to use ncurses support in Python(3) when SELinux is enabled.

I believe the real issue is that Busybox really doesn't care at all about the Python bindings for libselinux. So perhaps we should split the Python bindings build/installation from libselinux into a separate package. I think we had a similar split for another package.

It would however require some investigation to figure out if it's possible to build just the Python bindings, using an already built and installed libselinux.

Quoted 7 lines
Quoted 1 line

I'll take a look.

Alternatively, we could cut the ncurses->busybox dependency. That only exists
to make sure that ncurses tools overwrite busybox tools. IIRC busybox will not overwrite existing tools, so the reverse should work as well. Or else remove these things from the busybox config.

Good idea. I checked busybox/ncurses and only the ncurse's "clear"/reset tools overlap. I'll pull something together removing the dependency and doing a CONFIG_CLEAR/RESET disable as part of busybox configuration tweaks.

-Matt

#6 lore raw

PATCH 2/3 python3: ncurses condition for libselinux enabled

Hello,

Quoted 9 lines · Matthew Weber
Quoted 4 lines

Alternatively, we could cut the ncurses->busybox dependency. That only exists
to make sure that ncurses tools overwrite busybox tools. IIRC busybox will not overwrite existing tools, so the reverse should work as well. Or else remove these things from the busybox config.

Good idea. I checked busybox/ncurses and only the ncurse's "clear"/reset tools overlap. I'll pull something together removing the dependency and doing a CONFIG_CLEAR/RESET disable as part of busybox configuration tweaks.

Isn't it a bit annoying to no longer have clear/reset compiled as part of Busybox?

Perhaps we should enable the clear/reset applets in Busybox if ncurses is disabled, and disable the clear/reset applets in Busybox if ncurses is enabled. This way, we keep the existing functionality, but we can break the ncurses->busybox dependency.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

A message that is not in the archive (sent off-list or not yet received): CANQCQpb+0UX5C8npsCXNVMOvR89mdF1jZ1jATLwTufK_633kWw@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): CANQCQpbtX9ciJhtCSuA0k5Y9tFqtOuziZqpDYbjbz1viaPu6cg@mail.gmail.com

#9 lore raw

PATCH 2/3 python3: ncurses condition for libselinux enabled

Thomas,

On Apr 14, 2017 2:24 AM, "Thomas Petazzoni" <
[email protected]> wrote:

Hello,

Quoted 1 line · Matthew Weber
Quoted 1 line

Alternatively, we could cut the ncurses->busybox dependency. That only

exists

Quoted 1 line
Quoted 1 line

to make sure that ncurses tools overwrite busybox tools. IIRC busybox

will not

Quoted 1 line
Quoted 1 line

overwrite existing tools, so the reverse should work as well. Or else

remove

Quoted 6 lines
Quoted 1 line

these things from the busybox config.

Good idea. I checked busybox/ncurses and only the ncurse's "clear"/reset tools overlap. I'll pull something together removing the dependency and doing a CONFIG_CLEAR/RESET disable as part of busybox configuration tweaks.

Isn't it a bit annoying to no longer have clear/reset compiled as part of Busybox?

Perhaps we should enable the clear/reset applets in Busybox if ncurses is disabled, and disable the clear/reset applets in Busybox if ncurses is enabled. This way, we keep the existing functionality, but we can break the ncurses->busybox dependency.

Currently the buildroot default busybox config has the two tools which would be missing if ncurses was disabled, enabled by default. So I think that's ok, (not the cleanest though).

Thanks,

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170414/7908d1e9/attachment.html>

author
#10 lore raw

PATCH 3/3 python: ncurses condition for libselinux enabled

In reply to Matt Weber

When libselinux is enabled, a circular dependency is created. Disable ncurses python support when libselinux is enabled so that the circular busybox, ncurses, python, libselinux chain is broken.

Resolves
http://autobuild.buildroot.net/results/db1/db1e6f3054092fc5576ccab8e04a3b9d74ca9a8c/

---
 package/python/Config.in | 1 +
 package/python/python.mk | 7 +++++++
 2 files changed, 8 insertions(+)
package/python/Config.in +1 -0
index fa83e77..47001c5 100644
@@ -57,6 +57,7 @@ config BR2_PACKAGE_PYTHON_CODECSCJK
 
 config BR2_PACKAGE_PYTHON_CURSES
 	select BR2_PACKAGE_NCURSES
+	depends on !BR2_PACKAGE_LIBSELINUX    #circular dependency
 	bool "curses module"
 	help
 	  curses module for Python.
package/python/python.mk +7 -0
index 7ba5e37..ae90181 100644
@@ -71,7 +71,14 @@ PYTHON_CONF_OPTS += --disable-readline
 endif
 
 ifeq ($(BR2_PACKAGE_PYTHON_CURSES),y)
+# If libselinux is enabled, this creates a circular dependency
+# with busybox, ncurses, python, libselinux, busybox
+# For this case, we disable curses as a opt in python3.
+ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
+PYTHON_CONF_OPTS += --disable-curses
+else
 PYTHON_DEPENDENCIES += ncurses
+endif
 else
 PYTHON_CONF_OPTS += --disable-curses
 endif
Signature · 1 line
1.9.1
#11 lore raw

PATCH 1/3 libselinux: target python interface generation

In reply to Matt Weber

Hello,

Quoted 1 line · Matt Weber

Fixed a consistancy issue between toolchain revisions.

This sentence didn't make much sense, so I've reworded the commit log.

Quoted 10 lines

Moves the swig and pywrap step seperate from the overall build "all".

Resolves:
http://autobuild.buildroot.net/results/967/967b74d0ae5b4b83ea2729217b005a3e1e4514d0/

---
 package/libselinux/libselinux.mk | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Applied to master after doing tweaks to the commit log, and a few minor things in the patch itself (comment and variable name).

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com