From 9a9e5cf66808b00d09125811ea6281d2d9e23e0f Mon Sep 17 00:00:00 2001 From: Otto Modinos Date: Mon, 27 May 2024 02:54:01 +0300 Subject: [PATCH] samba: update patches & services, fix `check` --- srcpkgs/samba/files/ctdbd/control/t | 2 + srcpkgs/samba/files/ctdbd/run | 1 + srcpkgs/samba/files/nmbd/run | 3 -- srcpkgs/samba/files/smbd/run | 6 +-- srcpkgs/samba/files/winbindd/run | 6 +++ ...fix-for-system-db-lacking-a-.pc-file.patch | 27 +++++++++++ ...r-cmocka-lacking-LargestIntegralType.patch | 29 +++++++++++ srcpkgs/samba/patches/musl_uintptr.patch | 35 -------------- srcpkgs/samba/template | 48 ++++++++++--------- 9 files changed, 91 insertions(+), 66 deletions(-) create mode 100644 srcpkgs/samba/files/ctdbd/control/t create mode 100644 srcpkgs/samba/files/winbindd/run create mode 100644 srcpkgs/samba/patches/0001-fix-for-system-db-lacking-a-.pc-file.patch create mode 100644 srcpkgs/samba/patches/0002-fix-for-cmocka-lacking-LargestIntegralType.patch delete mode 100644 srcpkgs/samba/patches/musl_uintptr.patch diff --git a/srcpkgs/samba/files/ctdbd/control/t b/srcpkgs/samba/files/ctdbd/control/t new file mode 100644 index 00000000000000..a7f47e30ef6ee0 --- /dev/null +++ b/srcpkgs/samba/files/ctdbd/control/t @@ -0,0 +1,2 @@ +#!/bin/sh +/usr/bin/ctdb shutdown diff --git a/srcpkgs/samba/files/ctdbd/run b/srcpkgs/samba/files/ctdbd/run index 2f57f789c5b35e..ee20c74f894bff 100644 --- a/srcpkgs/samba/files/ctdbd/run +++ b/srcpkgs/samba/files/ctdbd/run @@ -1,3 +1,4 @@ #!/bin/sh exec 2>&1 + exec ctdbd -i diff --git a/srcpkgs/samba/files/nmbd/run b/srcpkgs/samba/files/nmbd/run index cf111269b26244..5e5723f36643d4 100755 --- a/srcpkgs/samba/files/nmbd/run +++ b/srcpkgs/samba/files/nmbd/run @@ -4,7 +4,4 @@ exec 2>&1 [ -r ./conf ] && . ./conf -mkdir -p /run/samba -mkdir -p /run/lock/samba - exec nmbd -F ${OPTS:--d1} diff --git a/srcpkgs/samba/files/smbd/run b/srcpkgs/samba/files/smbd/run index 2e65e3b246ab52..57785a658ea19a 100755 --- a/srcpkgs/samba/files/smbd/run +++ b/srcpkgs/samba/files/smbd/run @@ -1,10 +1,6 @@ #!/bin/sh - exec 2>&1 -[ -r ./conf ] && . ./conf - -mkdir -p /run/samba -mkdir -p /run/lock/samba +[ -r ./conf ] && . ./conf exec smbd -F ${OPTS:--d1} diff --git a/srcpkgs/samba/files/winbindd/run b/srcpkgs/samba/files/winbindd/run new file mode 100644 index 00000000000000..0a328467c0ffa6 --- /dev/null +++ b/srcpkgs/samba/files/winbindd/run @@ -0,0 +1,6 @@ +#!/bin/sh +exec 2>&1 + +[ -f ./conf ] && . ./conf + +exec winbindd -F ${OPTS:--d1} diff --git a/srcpkgs/samba/patches/0001-fix-for-system-db-lacking-a-.pc-file.patch b/srcpkgs/samba/patches/0001-fix-for-system-db-lacking-a-.pc-file.patch new file mode 100644 index 00000000000000..dbd1e0ab863095 --- /dev/null +++ b/srcpkgs/samba/patches/0001-fix-for-system-db-lacking-a-.pc-file.patch @@ -0,0 +1,27 @@ +From 17a3d1d047d4dfef7a5d4a922c7356d9dd24b4b6 Mon Sep 17 00:00:00 2001 +From: Otto Modinos +Date: Tue, 28 May 2024 13:21:19 +0300 +Subject: [PATCH 1/2] fix for system `db` lacking a `.pc` file + +In Void Linux, we link our `kdb` against the system `db` library which does not +have a pkg-config file and the samba build scripts just cannot handle that. +--- + wscript_configure_system_mitkrb5 | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/wscript_configure_system_mitkrb5 b/wscript_configure_system_mitkrb5 +index d40bb36737e..9e990fe8eaf 100644 +--- a/wscript_configure_system_mitkrb5 ++++ b/wscript_configure_system_mitkrb5 +@@ -66,6 +66,8 @@ if conf.env.KRB5_CONFIG: + if conf.CHECK_CFG(path=conf.env.KRB5_CONFIG, args="--cflags --libs", + package="kdb", uselib_store="KDB5"): + krb5_define_syslib(conf, "kdb5", conf.env['LIB_KDB5']) ++ if 'db' in conf.env['LIB_KDB5'] and not conf.check_cfg(package="db", mandatory=False): ++ krb5_define_syslib(conf, "db", []) + conf.CHECK_HEADERS('kdb.h', lib='kdb5') + else: + raise Errors.WafError('Unable to find required kdb5 library!') +-- +2.45.1 + diff --git a/srcpkgs/samba/patches/0002-fix-for-cmocka-lacking-LargestIntegralType.patch b/srcpkgs/samba/patches/0002-fix-for-cmocka-lacking-LargestIntegralType.patch new file mode 100644 index 00000000000000..f96f256bc0623e --- /dev/null +++ b/srcpkgs/samba/patches/0002-fix-for-cmocka-lacking-LargestIntegralType.patch @@ -0,0 +1,29 @@ +From 7495f3db9490f9a1c40603ae84e9c5341b2854d2 Mon Sep 17 00:00:00 2001 +From: Otto Modinos +Date: Tue, 28 May 2024 13:38:42 +0300 +Subject: [PATCH 2/2] fix for `cmocka` lacking `LargestIntegralType` + +In Void Linux, we've patched our `cmocka` headers to replace all the +`LargestIntegralType` definitions and uses with the standard C `uintmax_t`. +--- + source4/auth/tests/sam.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/source4/auth/tests/sam.c b/source4/auth/tests/sam.c +index a2bc4a5665e..6e8069c508d 100644 +--- a/source4/auth/tests/sam.c ++++ b/source4/auth/tests/sam.c +@@ -82,8 +82,8 @@ int __wrap_samdb_msg_add_int64( + * Mock implementations + *****************************************************************************/ + +-static int check_dn(const LargestIntegralType left_value, +- const LargestIntegralType right_value) ++static int check_dn(const uintmax_t left_value, ++ const uintmax_t right_value) + { + /* + * We have to cast away const so we can get the linearized form with +-- +2.45.1 + diff --git a/srcpkgs/samba/patches/musl_uintptr.patch b/srcpkgs/samba/patches/musl_uintptr.patch deleted file mode 100644 index cbf606708eda6c..00000000000000 --- a/srcpkgs/samba/patches/musl_uintptr.patch +++ /dev/null @@ -1,35 +0,0 @@ -commit f81e5b71ce78f33250347914dacc75c8463bf102 -Author: Breno Leitao -Date: Wed Mar 29 15:22:38 2017 -0300 - - include: Check for previous declaration of uintptr_t - - Adding a extra check before declaring uintptr_t. Currently musl uses - macro __DEFINED_uintptr_t once it defines uintptr_t type. Checking - this macro before defining it, and, defining it when uintptr_t is - defined. - - Signed-off-by: Breno Leitao - -diff --git third_party/cmocka/cmocka.h third_party/cmocka/cmocka.h -index 303d0ae..a2bfc40 100644 ---- a/third_party/cmocka/cmocka.h -+++ b/third_party/cmocka/cmocka.h -@@ -111,7 +111,7 @@ - ((LargestIntegralType)(value)) - - /* Smallest integral type capable of holding a pointer. */ --#if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED) -+#if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED) && !defined(__DEFINED_uintptr_t) - # if defined(_WIN32) - /* WIN32 is an ILP32 platform */ - typedef unsigned int uintptr_t; -@@ -137,6 +137,8 @@ - - # define _UINTPTR_T - # define _UINTPTR_T_DEFINED -+# define __DEFINED_uintptr_t -+ - #endif /* !defined(_UINTPTR_T) || !defined(_UINTPTR_T_DEFINED) */ - - /* Perform an unsigned cast to uintptr_t. */ diff --git a/srcpkgs/samba/template b/srcpkgs/samba/template index 7753f947c05bf0..a73f87b1fb3b80 100644 --- a/srcpkgs/samba/template +++ b/srcpkgs/samba/template @@ -1,14 +1,10 @@ # Template file for 'samba' pkgname=samba version=4.20.1 -revision=2 +revision=3 build_style=waf3 build_helper="qemu" configure_script="buildtools/bin/waf" -_idmap_modules="idmap_ad,idmap_rid,idmap_ldap,idmap_hash,idmap_tdb2" -_pdb_modules="pdb_tdbsam,pdb_ldap,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4" -_auth_modules="auth_unix,auth_wbc,auth_server,auth_samba4,auth_skel" -_vfs_modules="vfs_io_uring" configure_args="--enable-fhs --sysconfdir=/etc --localstatedir=/var --sbindir=/usr/bin --with-privatelibdir=/usr/lib --with-privatedir=/etc/samba/private --with-piddir=/run/samba @@ -16,8 +12,7 @@ configure_args="--enable-fhs --sysconfdir=/etc --localstatedir=/var --disable-rpath --disable-rpath-install --nopyc --nopyo --without-gettext --without-systemd --without-gpgme --with-cluster-support --with-system-mitkrb5 --with-experimental-mit-ad-dc - --bundled-libraries=NONE --builtin-libraries=NONE - --with-shared-modules=${_idmap_modules},${_pdb_modules},${_auth_modules},${_vfs_modules}" + --bundled-libraries=NONE --builtin-libraries=NONE" hostmakedepends="pkg-config perl-Parse-Yapp rpcsvc-proto docbook-xsl libxslt libtasn1-tools tdb-python3 tevent-python3 talloc-python3 ldb-python3 flex bison mit-krb5 python3-Markdown python3-dnspython" @@ -37,21 +32,30 @@ make_dirs="/etc/samba/private 0750 root root" subpackages="smbclient samba-ctdb samba-cups samba-devel samba-libs samba-python3 samba-dc" +_idmap_modules="idmap_ad,idmap_rid,idmap_ldap,idmap_hash,idmap_tdb2" +_pdb_modules="pdb_tdbsam,pdb_ldap,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4" +_auth_modules="auth_unix,auth_wbc,auth_server,auth_samba4" +_vfs_modules="vfs_io_uring" + if [ "$XBPS_TARGET_LIBC" = "musl" ]; then makedepends+=" musl-legacy-compat musl-nscd-devel libexecinfo-devel" else + _vfs_modules+=",vfs_glusterfs" makedepends+=" glusterfs-devel" subpackages+=" samba-glusterfs" +fi - if [ "$XBPS_CHECK_PKGS" ]; then - configure_args+=" --enable-selftest" - hostmakedepends+=" python3-cryptography python3-iso8601 - python3-pyasn1" - makedepends+=" nss_wrapper pam_wrapper resolv_wrapper - socket_wrapper uid_wrapper" - fi +if [ "$XBPS_CHECK_PKGS" ] && [ "$XBPS_TARGET_LIBC" = "glibc" ]; then + _auth_modules+=",auth_skel" + configure_args+=" --enable-selftest" + hostmakedepends+=" python3-cryptography python3-iso8601 python3-pyasn1" + makedepends+=" nss_wrapper pam_wrapper resolv_wrapper socket_wrapper + uid_wrapper" + checkdepends+=" tdb python3-setproctitle" fi +configure_args+=" --with-shared-modules=${_idmap_modules},${_pdb_modules},${_auth_modules},${_vfs_modules}" + export PYTHON_CONFIG="${XBPS_CROSS_BASE}/usr/bin/python3-config" export PYTHONHASHSEED=1 @@ -60,24 +64,20 @@ post_patch() { vsed -i third_party/waf/waflib/Tools/python.py \ -e "s|env.pyext_PATTERN = .*$|env.pyext_PATTERN = '%s.so'|g" - # Fix for our `kdb` linking against the system `db` package which - # doesn't distribute a pkg-config file and the samba build scripts just - # can't handle that. - cat >>wscript_configure_system_mitkrb5 <<_EOF -if ("db" in conf.env["LIB_KDB5"] - and not conf.check_cfg(package="db", mandatory=False)): - krb5_define_syslib(conf, "db", []) -_EOF - # Fix log and spool locations in conf file vsed -i examples/smb.conf.default \ -e 's|/usr/spool/samba|/var/spool/samba|g' \ -e 's|log file = .*$|log file = /var/log/samba/%m.log|g' } +do_check() { + ${configure_script} test --quick +} + post_install() { # install conf file vinstall examples/smb.conf.default 644 etc/samba smb.conf + vinstall ctdb/config/ctdb.conf 644 etc/ctdb # move winbind krb5 locator into place vmkdir usr/lib/krb5/plugins/libkrb5 @@ -86,6 +86,7 @@ post_install() { vsv nmbd vsv smbd + vsv winbindd # PAM support vinstall ${FILESDIR}/samba.pam 644 etc/pam.d samba @@ -147,6 +148,7 @@ smbclient_package() { samba-ctdb_package() { depends="${sourcepkg}>=${version}_${revision}" short_desc+=" - Clustered TDB support" + conf_files="/etc/ctdb/ctdb.conf" pkg_install() { local _f vmove "usr/bin/ctdb*"