Skip to content

Commit 5ee18c9

Browse files
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 <schowdhury@microsoft.com>
1 parent aaed8d7 commit 5ee18c9

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

sdk_container/src/third_party/coreos-overlay/net-fs/samba/samba-4.18.9.ebuild

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ EAPI=8
55

66
PYTHON_COMPAT=( python3_{10..11} )
77
PYTHON_REQ_USE="threads(+),xml(+)"
8+
TMPFILES_OPTIONAL=1
89
inherit python-single-r1 flag-o-matic waf-utils multilib-minimal linux-info systemd pam tmpfiles
910

1011
DESCRIPTION="Samba Suite Version 4"
@@ -26,6 +27,7 @@ IUSE="acl addc ads ceph client cluster cpu_flags_x86_aes cups debug fam glusterf
2627
IUSE+=" iprint json ldap llvm-libunwind pam profiling-data python quota +regedit selinux"
2728
IUSE+=" snapper spotlight syslog system-heimdal +system-mitkrb5 systemd test unwind winbind"
2829
IUSE+=" zeroconf"
30+
IUSE+=" +minimal" # Flatcar: Only install libraries, not executables.
2931

3032
REQUIRED_USE="${PYTHON_REQUIRED_USE}
3133
addc? ( json python !system-mitkrb5 winbind )
@@ -59,14 +61,13 @@ TALLOC_VERSION="2.4.0"
5961
TDB_VERSION="1.4.8"
6062
TEVENT_VERSION="0.14.1"
6163

64+
# Flatcar: exclude perl, icu, libtasn1, Parse-Yapp from DEPEND
6265
COMMON_DEPEND="
6366
>=app-arch/libarchive-3.1.2:=[${MULTILIB_USEDEP}]
64-
dev-lang/perl:=
65-
dev-libs/icu:=[${MULTILIB_USEDEP}]
67+
spotlight? ( dev-libs/icu:=[${MULTILIB_USEDEP}] )
6668
dev-libs/libbsd[${MULTILIB_USEDEP}]
67-
dev-libs/libtasn1:=[${MULTILIB_USEDEP}]
69+
!minimal? ( dev-libs/libtasn1:=[${MULTILIB_USEDEP}] )
6870
dev-libs/popt[${MULTILIB_USEDEP}]
69-
dev-perl/Parse-Yapp
7071
>=net-libs/gnutls-3.4.7:=[${MULTILIB_USEDEP}]
7172
>=sys-fs/e2fsprogs-1.46.4-r51[${MULTILIB_USEDEP}]
7273
>=sys-libs/ldb-2.7.2:=[ldap(+)?,${MULTILIB_USEDEP}]
@@ -117,8 +118,9 @@ COMMON_DEPEND="
117118
)
118119
zeroconf? ( net-dns/avahi[dbus] )
119120
"
121+
# Flatcar: pull in JSON only if json is enabled
120122
DEPEND="${COMMON_DEPEND}
121-
dev-perl/JSON
123+
json? ( dev-perl/JSON )
122124
net-libs/libtirpc[${MULTILIB_USEDEP}]
123125
net-libs/rpcsvc-proto
124126
spotlight? ( dev-libs/glib )
@@ -138,6 +140,8 @@ RDEPEND="${COMMON_DEPEND}
138140
selinux? ( sec-policy/selinux-samba )
139141
"
140142
BDEPEND="${PYTHON_DEPS}
143+
dev-lang/perl:=
144+
dev-perl/Parse-Yapp
141145
app-text/docbook-xsl-stylesheets
142146
dev-libs/libxslt
143147
virtual/pkgconfig
@@ -248,6 +252,10 @@ multilib_src_configure() {
248252
EOF
249253
fi
250254

255+
# Flatcar: we need only the mandatory bundled library, ldb by default.
256+
# Without that, configure will fail because of a missing bundled library.
257+
bundled_libs="ldb"
258+
251259
local myconf=(
252260
--enable-fhs
253261
--sysconfdir="${EPREFIX}/etc"
@@ -358,7 +366,8 @@ multilib_src_install() {
358366
newinitd "${CONFDIR}/samba4.initd-r1" samba
359367
newconfd "${CONFDIR}/samba4.confd" samba
360368

361-
dotmpfiles "${FILESDIR}"/samba.conf
369+
# Flatcar: do not create samba config if minimal enabled
370+
use minimal || dotmpfiles "${FILESDIR}"/samba.conf
362371
if ! use addc ; then
363372
rm "${D}/$(systemd_get_systemunitdir)/samba.service" \
364373
|| die
@@ -376,8 +385,22 @@ multilib_src_install() {
376385
insinto /etc/security
377386
doins examples/pam_winbind/pam_winbind.conf
378387
fi
388+
389+
# Flatcar: clean up unnecessary files
390+
rm -f "${ED%/}"/etc/samba/*
391+
rm -f "${ED%/}"/usr/lib*/samba/ldb/*
392+
if use minimal ; then
393+
mv "${ED%/}"/usr/bin/net "${T}"/
394+
rm -f "${ED%/}"/usr/bin/* "${ED%/}"/usr/sbin/*
395+
mv "${T}"/net "${ED%/}"/usr/bin/net
396+
rm -rf ${ED%/}/lib*/security
397+
rm -rf ${ED%/}/usr/lib/systemd
398+
rm -rf ${ED%/}/usr/lib*/perl*
399+
rm -rf ${ED%/}/usr/lib*/python*
400+
rm -rf ${ED%/}/var
401+
fi
379402
}
380403

381404
pkg_postinst() {
382-
tmpfiles_process samba.conf
405+
use minimal || tmpfiles_process samba.conf
383406
}

0 commit comments

Comments
 (0)