diff mbox series

[meta-security,04/10] sssd: fix installation sss_analyze python3 files

Message ID 20241025082239.3468351-5-gael.portay+rtone@gmail.com
State New
Headers show
Series sssd: fix python3 support | expand

Commit Message

Gaël PORTAY Oct. 25, 2024, 8:22 a.m. UTC
SSSD has introduced the internal tool sss_analyze since 2.6.0[1].

	Add log parsing tool which can be used to track requests across
	responder and backend logs.

sss_analyze is a python3 script[2] with modules[3] that is run by the
sssctl command analyze[4][5][6].

The autotools installs the files to ${libexec} and ${python3dir}[7]. The
latter is set if the configure option --with-python3-bindings is set
only.

As a consequence, the Makefile installs the python3 files to /sssd
instead of /usr/lib/python3.12/site-packages/sssd if the option
--with-python3-bindings is unset:

	gportay@archlinux ~/src $ find build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/sssd
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/sssd
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/sssd/modules
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/sssd/modules/__init__.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/sssd/modules/request.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/sssd/modules/error.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/sssd/__init__.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/sssd/source_files.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/sssd/source_journald.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/sssd/source_reader.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/sssd/parser.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/sssd/sss_analyze.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/sssd/util.py

The sss_analyze tool is unrelated to the python3 bindings; the sssctl
does not condition its code if the python3 bindings are unset.

Therefore, sss_analyze has to be installed even if the python3 bindings
are unset.

This ensures the variable python3dir is set to the expected location by
adding it to --without-python3-bindings if the python3 feature is
disabled.

	gportay@archlinux ~/src $ find build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/usr/lib/python3.12
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/usr/lib/python3.12
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/usr/lib/python3.12/site-packages
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/usr/lib/python3.12/site-packages/sssd
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/usr/lib/python3.12/site-packages/sssd/modules
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/usr/lib/python3.12/site-packages/sssd/modules/__init__.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/usr/lib/python3.12/site-packages/sssd/modules/request.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/usr/lib/python3.12/site-packages/sssd/modules/error.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/usr/lib/python3.12/site-packages/sssd/__init__.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/usr/lib/python3.12/site-packages/sssd/source_files.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/usr/lib/python3.12/site-packages/sssd/source_journald.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/usr/lib/python3.12/site-packages/sssd/source_reader.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/usr/lib/python3.12/site-packages/sssd/parser.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/usr/lib/python3.12/site-packages/sssd/sss_analyze.py
	build/tmp/work/core2-64-poky-linux/sssd/2.9.2/image/usr/lib/python3.12/site-packages/sssd/util.py

[1]: https://github.com/SSSD/sssd/commit/82e051e1f15060554ecacc07107c82675369e0bb
[2]: https://github.com/SSSD/sssd/blob/2.9.2/src/tools/analyzer/sss_analyze#L1
[3]: https://github.com/SSSD/sssd/tree/2.9.2/src/tools/analyzer
[4]: https://github.com/SSSD/sssd/blob/2.9.2/src/tools/sssctl/sssctl_logs.c#L47
[5]: https://github.com/SSSD/sssd/blob/2.9.2/src/tools/sssctl/sssctl_logs.c#L605
[6]: https://github.com/SSSD/sssd/blob/2.9.2/src/tools/sssctl/sssctl.c#L337
[7]: https://github.com/SSSD/sssd/blob/2.9.2/src/tools/analyzer/Makefile.am#L7
[8]: https://github.com/SSSD/sssd/blob/2.9.2/configure.ac#L394

Signed-off-by: Gaël PORTAY <gael.portay+rtone@gmail.com>
---
 .../networking-layer/recipes-security/sssd/sssd_2.9.2.bb    | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/dynamic-layers/networking-layer/recipes-security/sssd/sssd_2.9.2.bb b/dynamic-layers/networking-layer/recipes-security/sssd/sssd_2.9.2.bb
index e8f3031..2035cd0 100644
--- a/dynamic-layers/networking-layer/recipes-security/sssd/sssd_2.9.2.bb
+++ b/dynamic-layers/networking-layer/recipes-security/sssd/sssd_2.9.2.bb
@@ -54,7 +54,7 @@  PACKAGECONFIG[manpages] = "--with-manpages, --with-manpages=no, libxslt-native d
 PACKAGECONFIG[nl] = "--with-libnl, --with-libnl=no, libnl"
 PACKAGECONFIG[nss] = ", ,nss,"
 PACKAGECONFIG[oidc_child] = "--with-oidc-child, --without-oidc-child"
-PACKAGECONFIG[python3] = "--with-python3-bindings, --without-python3-bindings"
+PACKAGECONFIG[python3] = "--with-python3-bindings, --without-python3-bindings python3dir=${PYTHON_SITEPACKAGES_DIR}"
 PACKAGECONFIG[samba] = "--with-samba, --with-samba=no, samba"
 PACKAGECONFIG[selinux] = "--with-selinux, --with-selinux=no --with-semanage=no, libselinux"
 PACKAGECONFIG[ssh] = "--with-ssh, --with-ssh=no, "
@@ -88,9 +88,6 @@  do_install () {
     rmdir --ignore-fail-on-non-empty "${D}/${bindir}"
 
     install -d ${D}/${sysconfdir}/${BPN}
-    install -d ${D}/${PYTHON_SITEPACKAGES_DIR}
-    mv ${D}/${BPN}  ${D}/${PYTHON_SITEPACKAGES_DIR}
-
     install -m 600 ${UNPACKDIR}/${BPN}.conf ${D}/${sysconfdir}/${BPN}
 
     # /var/log/sssd needs to be created in runtime. Use rmdir to catch if
@@ -112,7 +109,6 @@  do_install () {
     # Remove /run as it is created on startup
     rm -rf ${D}/run
 
-#    rm -fr ${D}/sssd
     rm -f ${D}${systemd_system_unitdir}/sssd-secrets.*
 }