package/samba4: Do not force target python
PATCH 1/1 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.
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.
Target python will no longer be selected by SAMBA4 and is instead selected by the SAMBA4_AD_DC option. Samba will be built with/without python support based whether target python is enabled/disabled. This is the same as other optional samba features, which are only enabled when the package they need is also enabled.
--- package/samba4/Config.in | 2 +- package/samba4/samba4.mk | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-)
package/samba4/Config.in +1 -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
@@ -32,6 +31,7 @@ if BR2_PACKAGE_SAMBA4 config BR2_PACKAGE_SAMBA4_AD_DC bool "AD DC" select BR2_PACKAGE_JANSSON + select BR2_PACKAGE_PYTHON3 if !BR2_PACKAGE_PYTHON help Enable Active Directory Domain Controller functionality.
package/samba4/samba4.mk +7 -1
@@ -34,7 +34,13 @@ else SAMBA4_PYTHON = \ PYTHON="$(HOST_DIR)/bin/python2" \ PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python-config" -SAMBA4_DEPENDENCIES += host-python python +SAMBA4_DEPENDENCIES += host-python +ifeq ($(BR2_PACKAGE_PYTHON),y) +SAMBA4_DEPENDENCIES += python +else +SAMBA4_CONF_OPTS += --disable-python +endif + endif ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
Signature · 1 line
2.23.0
PATCH 1/1 package/samba4: Do not force target python
Hello Trent,
Quoted 7 lines · On Thu, 14 Nov 2019 17:48:51 +0000 Trent Piepho <[email protected]>…
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.
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.
Indeed, being able to drop the Python dependency is very good.
Quoted 5 lines
Target python will no longer be selected by SAMBA4 and is instead selected by the
SAMBA4_AD_DCoption. Samba will be built with/without python support based whether target python is enabled/disabled. This is the same as other optional samba features, which are only enabled when the package they need is also enabled.
Well, there is a BR2_PACKAGE_SAMBA4_AD_DC condition in samba4.mk, which I think we should use.
Quoted 6 lines
package/samba4/samba4.mk +0
-0@@ -34,7 +34,13 @@ else SAMBA4_PYTHON = \
package/samba4/samba4.mk else · line 43
Quoted 10 lines
package/samba4/samba4.mk +7
-1PYTHON="$(HOST_DIR)/bin/python2" \ PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python-config" -SAMBA4_DEPENDENCIES += host-python python +SAMBA4_DEPENDENCIES += host-python +ifeq ($(BR2_PACKAGE_PYTHON),y) +SAMBA4_DEPENDENCIES += python +else +SAMBA4_CONF_OPTS += --disable-python +endif +
I would prefer to do it like this:
ifeq ($(BR2_PACKAGE_PYTHON3),y)SAMBA4_PYTHON += PYTHON="$(HOST_DIR)/bin/python3"SAMBA4_DEPENDENCIES += host-python3
elseSAMBA4_PYTHON += PYTHON="$(HOST_DIR)/bin/python2"SAMBA4_DEPENDENCIES += host-python
endif
[...]
ifeq ($(BR2_PACKAGE_SAMBA4_AD_DC),y)SAMBA4_DEPENDENCIES += jansson
ifeq ($(BR2_PACKAGE_PYTHON3),y)SAMBA4_PYTHON += PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config" SAMBA4_DEPENDENCIES += python3
elseSAMBA4_PYTHON += PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python-config" SAMBA4_DEPENDENCIES += python
endif
elseSAMBA4_CONF_OPTS += --without-ad-dc --without-json
endif
It may be possible that PYTHON_CONFIG is only needed in SAMBA4_CONF_ENV and not in SAMBA4_PYTHON. Could you also test this ?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 package/samba4: Do not force target python
Quoted 11 lines · Thomas Petazzoni
Quoted 5 lines · On Thu, 14 Nov 2019 17:48:51 +0000 Trent Piepho <[email protected]>…
Target python will no longer be selected by SAMBA4 and is instead selected by the
SAMBA4_AD_DCoption. Samba will be built with/without python support based whether target python is enabled/disabled. This is the same as other optional samba features, which are only enabled when the package they need is also enabled.Well, there is a
BR2_PACKAGE_SAMBA4_AD_DCcondition in samba4.mk, which I think we should use.
I think there's a misunderstanding here. I did this use existing config, so that when it is on, it will force "select" a python, since python is required for that feature.
But samba also has python support for reasons other than the domain controller feature. There is a samba python module that other packages could use.
What I did, when the AD DC feature was not enable and python was not force selected, was to enable samba's python support automatically based on the existing status of target python. A common pattern in buildroot for things like optional readline or ncurses support in a package.
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.
So perhaps I should just disable samba python support if AD DC is not on, since it's likely that no one will use it.
I've also found that Fedora 31 has a requirement for the samba python module from the samba test package that contains the smbtorture program. Buildroot has smbtorture has an optional samba feature already. So perhaps it should also require python? Or perhaps this is a mistake in the fedora packages? Samba's build system certainly does not require python for smbtorture to build and I don't see, yet, how these programs would make any use of the samba python module.