package/samba4: Do not force target python
PATCH v2 1/2 package/samba4: Do not force target python
Samba does not need python on the target for file server functionality. It does need it for the Active Directory Domain Controller feature, which is already configured in buildroot as optional and already depends on python3 since commit 4485a75859fbae99090b065ddd7c088a65571d37.
An unnecessary target python greatly increases the size of the target filesystem. A somewhat minimal configuration with a samba server shunk from an 82 MB rootfs to 53 MB with this patch.
---
Changes v1 -> v2 (after review of Thomas Petazzoni):
- Rework patch due so it can be applied after commits fe033bdf534a7892ced72c11635d863afa92d1d2 and 4485a75859fbae99090b065ddd7c088a65571d37
package/samba4/Config.in | 1 - package/samba4/samba4.mk | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-)
package/samba4/Config.in +0 -1
@@ -18,7 +18,6 @@ config BR2_PACKAGE_SAMBA4 select BR2_PACKAGE_GNUTLS select BR2_PACKAGE_LIBTIRPC if !BR2_TOOLCHAIN_HAS_NATIVE_RPC select BR2_PACKAGE_POPT - select BR2_PACKAGE_PYTHON3 if !BR2_PACKAGE_PYTHON select BR2_PACKAGE_ZLIB help Provides secure, stable and fast file and print services
package/samba4/samba4.mk +5 -7
@@ -26,14 +26,11 @@ SAMBA4_CONF_ENV = \ WAF_NO_PREFORK=1 ifeq ($(BR2_PACKAGE_PYTHON3),y) -SAMBA4_PYTHON = \ - PYTHON="$(HOST_DIR)/bin/python3" \ - PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config" -SAMBA4_DEPENDENCIES += host-python3 python3 +SAMBA4_PYTHON = PYTHON="$(HOST_DIR)/bin/python3" +SAMBA4_DEPENDENCIES += host-python3 else SAMBA4_PYTHON = PYTHON="$(HOST_DIR)/bin/python2" SAMBA4_DEPENDENCIES += host-python -SAMBA4_CONF_OPTS += --disable-python endif ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
@@ -143,9 +140,10 @@ define SAMBA4_INSTALL_TARGET_CMDS endef ifeq ($(BR2_PACKAGE_SAMBA4_AD_DC),y) -SAMBA4_DEPENDENCIES += jansson +SAMBA4_CONF_ENV += PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config" +SAMBA4_DEPENDENCIES += jansson python3 else -SAMBA4_CONF_OPTS += --without-ad-dc --without-json +SAMBA4_CONF_OPTS += --disable-python --without-ad-dc --without-json endif ifeq ($(BR2_PACKAGE_SAMBA4_ADS),y)
Signature · 1 line
2.24.0
PATCH v2 2/2 package/samba4: drop host-python
Drop host-python to always build samba4 with host-python3
--- package/samba4/samba4.mk | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
package/samba4/samba4.mk +2 -10
@@ -11,7 +11,7 @@ SAMBA4_INSTALL_STAGING = YES SAMBA4_LICENSE = GPL-3.0+ SAMBA4_LICENSE_FILES = COPYING SAMBA4_DEPENDENCIES = \ - host-e2fsprogs host-heimdal host-nfs-utils \ + host-e2fsprogs host-heimdal host-nfs-utils host-python3 \ cmocka e2fsprogs gnutls popt zlib \ $(if $(BR2_PACKAGE_LIBAIO),libaio) \ $(if $(BR2_PACKAGE_LIBCAP),libcap) \
@@ -22,17 +22,10 @@ SAMBA4_LDFLAGS = $(TARGET_LDFLAGS) $(TARGET_NLS_LIBS) SAMBA4_CONF_ENV = \ CFLAGS="$(SAMBA4_CFLAGS)" \ LDFLAGS="$(SAMBA4_LDFLAGS)" \ + PYTHON="$(HOST_DIR)/bin/python3" \ XSLTPROC=false \ WAF_NO_PREFORK=1 -ifeq ($(BR2_PACKAGE_PYTHON3),y) -SAMBA4_PYTHON = PYTHON="$(HOST_DIR)/bin/python3" -SAMBA4_DEPENDENCIES += host-python3 -else -SAMBA4_PYTHON = PYTHON="$(HOST_DIR)/bin/python2" -SAMBA4_DEPENDENCIES += host-python -endif - ifeq ($(BR2_PACKAGE_LIBTIRPC),y) SAMBA4_CFLAGS += `$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc` SAMBA4_LDFLAGS += `$(PKG_CONFIG_HOST_BINARY) --libs libtirpc`
@@ -99,7 +92,6 @@ define SAMBA4_CONFIGURE_CMDS $(INSTALL) -m 0644 package/samba4/samba4-cache.txt $(@D)/cache.txt; echo 'Checking uname machine type: $(BR2_ARCH)' >>$(@D)/cache.txt; (cd $(@D); \ - $(SAMBA4_PYTHON) \ python_LDFLAGS="" \ python_LIBDIR="" \ $(TARGET_CONFIGURE_OPTS) \
Signature · 1 line
2.24.0
PATCH v2 2/2 package/samba4: drop host-python
Quoted 3 lines · On Fri, 3 Jan 2020 12:25:16 +0100 Fabrice Fontaine…
Drop host-python to always build samba4 with host-python3
Signed-off-by Fabrice Fontaine <[email protected]>
What is the reasoning behind this change ? You don't explain *why* you do this change.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 1/2 package/samba4: Do not force target python
In reply to Fabrice FontaineQuoted 34 lines · On Fri, 3 Jan 2020 12:25:15 +0100 Fabrice Fontaine…
package/samba4/Config.in +0
-1@@ -18,7 +18,6 @@ config BR2_PACKAGE_SAMBA4 select BR2_PACKAGE_GNUTLS select BR2_PACKAGE_LIBTIRPC if !BR2_TOOLCHAIN_HAS_NATIVE_RPC select BR2_PACKAGE_POPT - select BR2_PACKAGE_PYTHON3 if !BR2_PACKAGE_PYTHON select BR2_PACKAGE_ZLIB help Provides secure, stable and fast file and print servicespackage/samba4/samba4.mk +2
-5@@ -26,14 +26,11 @@ SAMBA4_CONF_ENV = \ WAF_NO_PREFORK=1 ifeq ($(BR2_PACKAGE_PYTHON3),y) -SAMBA4_PYTHON = \ - PYTHON="$(HOST_DIR)/bin/python3" \ - PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config" -SAMBA4_DEPENDENCIES += host-python3 python3 +SAMBA4_PYTHON = PYTHON="$(HOST_DIR)/bin/python3" +SAMBA4_DEPENDENCIES += host-python3 else SAMBA4_PYTHON = PYTHON="$(HOST_DIR)/bin/python2" SAMBA4_DEPENDENCIES += host-python -SAMBA4_CONF_OPTS += --disable-python endif ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
package/samba4/samba4.mk define SAMBA4_INSTALL_TARGET_CMDS · line 147
Quoted 10 lines
package/samba4/samba4.mk +3
-2@@ -143,9 +140,10 @@ define SAMBA4_INSTALL_TARGET_CMDS endef ifeq ($(BR2_PACKAGE_SAMBA4_AD_DC),y) -SAMBA4_DEPENDENCIES += jansson +SAMBA4_CONF_ENV += PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config" +SAMBA4_DEPENDENCIES += jansson python3 else -SAMBA4_CONF_OPTS += --without-ad-dc --without-json +SAMBA4_CONF_OPTS += --disable-python --without-ad-dc --without-json endif
So there is nothing Python related in samba4, besides the AD DC support? In his e-mail at
http://lists.busybox.net/pipermail/buildroot/2019-November/266563.html,
Trent said:
But having looked at it more, samba's python support beyond the AD DC feature might not be all that useful. There is a python module, but nothing in buildroot uses it. Fedora 31 has only two (non-samba) packages, freeipa and fleet-commander, that use it. Neither is in buildroot.
To me, this feels like there are indeed some Python modules in Samba4, and those should be built and installed when Python is enabled, even if AD DC support is disabled.
So in this patch, I would in fact keep only the Config.in change that makes Python no longer mandatory on the target. But the rest could be kept as-is: if BR2_PACKAGE_PYTHON3=y, we do get the Python modules of Samba4, regardless of whether AD DC support is enabled or not.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com