From 9eda6ed9e51d5b05dcd93ae8cfc6973d529e108e Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Mon, 8 Apr 2024 15:27:25 +0200 Subject: [PATCH] net-fs/samba: Apply Flatcar modifications - Add a minimal USE flag for only installing libraries - Change the Perl run-time dep to build-time only - Disable building libraries requiring Python - Disable building Perl JSON libraries - Limit the size of bundled libraries Co-authored-by: Sayan Chowdhury --- .../net-fs/samba/samba-4.19.7.ebuild | 37 +++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/net-fs/samba/samba-4.19.7.ebuild b/sdk_container/src/third_party/coreos-overlay/net-fs/samba/samba-4.19.7.ebuild index c80c621228..071a629b9c 100644 --- a/sdk_container/src/third_party/coreos-overlay/net-fs/samba/samba-4.19.7.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/net-fs/samba/samba-4.19.7.ebuild @@ -5,6 +5,7 @@ EAPI=8 PYTHON_COMPAT=( python3_{10..12} ) PYTHON_REQ_USE="threads(+),xml(+)" +TMPFILES_OPTIONAL=1 inherit python-single-r1 flag-o-matic waf-utils multilib-minimal linux-info systemd pam tmpfiles DESCRIPTION="Samba Suite Version 4" @@ -26,6 +27,7 @@ IUSE="acl addc ads ceph client cluster cups debug fam glusterfs gpg" IUSE+=" iprint json ldap llvm-libunwind pam profiling-data python quota +regedit selinux" IUSE+=" snapper spotlight syslog system-heimdal +system-mitkrb5 systemd test unwind winbind" IUSE+=" zeroconf" +IUSE+=" +minimal" # Flatcar: Only install libraries, not executables. REQUIRED_USE="${PYTHON_REQUIRED_USE} addc? ( json python !system-mitkrb5 winbind ) @@ -59,14 +61,13 @@ TALLOC_VERSION="2.4.1" TDB_VERSION="1.4.9" TEVENT_VERSION="0.15.0" +# Flatcar: exclude perl, icu, libtasn1, Parse-Yapp from DEPEND COMMON_DEPEND=" >=app-arch/libarchive-3.1.2:=[${MULTILIB_USEDEP}] - dev-lang/perl:= - dev-libs/icu:=[${MULTILIB_USEDEP}] + spotlight? ( dev-libs/icu:=[${MULTILIB_USEDEP}] ) dev-libs/libbsd[${MULTILIB_USEDEP}] - dev-libs/libtasn1:=[${MULTILIB_USEDEP}] + !minimal? ( dev-libs/libtasn1:=[${MULTILIB_USEDEP}] ) dev-libs/popt[${MULTILIB_USEDEP}] - dev-perl/Parse-Yapp >=net-libs/gnutls-3.4.7:=[${MULTILIB_USEDEP}] >=sys-fs/e2fsprogs-1.46.4-r51[${MULTILIB_USEDEP}] >=sys-libs/ldb-2.8.1:=[ldap(+)?,${MULTILIB_USEDEP}] @@ -118,8 +119,9 @@ COMMON_DEPEND=" ) zeroconf? ( net-dns/avahi[dbus] ) " +# Flatcar: pull in JSON only if json is enabled DEPEND="${COMMON_DEPEND} - dev-perl/JSON + json? ( dev-perl/JSON ) net-libs/libtirpc[${MULTILIB_USEDEP}] net-libs/rpcsvc-proto spotlight? ( dev-libs/glib ) @@ -139,6 +141,8 @@ RDEPEND="${COMMON_DEPEND} selinux? ( sec-policy/selinux-samba ) " BDEPEND="${PYTHON_DEPS} + dev-lang/perl:= + dev-perl/Parse-Yapp app-text/docbook-xsl-stylesheets dev-libs/libxslt virtual/pkgconfig @@ -249,6 +253,10 @@ multilib_src_configure() { EOF fi + # Flatcar: we need only the mandatory bundled library, ldb by default. + # Without that, configure will fail because of a missing bundled library. + bundled_libs="ldb" + local myconf=( --enable-fhs --sysconfdir="${EPREFIX}/etc" @@ -358,7 +366,8 @@ multilib_src_install() { newinitd "${CONFDIR}/samba4.initd-r1" samba newconfd "${CONFDIR}/samba4.confd" samba - dotmpfiles "${FILESDIR}"/samba.conf + # Flatcar: do not create samba config if minimal enabled + use minimal || dotmpfiles "${FILESDIR}"/samba.conf if ! use addc ; then rm "${D}/$(systemd_get_systemunitdir)/samba.service" \ || die @@ -378,8 +387,22 @@ multilib_src_install() { insinto /etc/security doins examples/pam_winbind/pam_winbind.conf fi + + # Flatcar: clean up unnecessary files + rm -f "${ED%/}"/etc/samba/* + rm -f "${ED%/}"/usr/lib*/samba/ldb/* + if use minimal ; then + mv "${ED%/}"/usr/bin/net "${T}"/ + rm -f "${ED%/}"/usr/bin/* "${ED%/}"/usr/sbin/* + mv "${T}"/net "${ED%/}"/usr/bin/net + rm -rf ${ED%/}/lib*/security + rm -rf ${ED%/}/usr/lib/systemd + rm -rf ${ED%/}/usr/lib*/perl* + rm -rf ${ED%/}/usr/lib*/python* + rm -rf ${ED%/}/var + fi } pkg_postinst() { - tmpfiles_process samba.conf + use minimal || tmpfiles_process samba.conf }