Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-auth/nss-pam-ldapd/, sys-auth/nss-pam-ldapd/files/
Date: Mon, 20 Mar 2023 05:36:13
Message-Id: 1679290173.090dc863c60b149b5942951fb2326472c6e70281.sam@gentoo
1 commit: 090dc863c60b149b5942951fb2326472c6e70281
2 Author: Cristian Othón Martínez Vera <cfuga <AT> cfuga <DOT> mx>
3 AuthorDate: Thu Mar 16 22:42:35 2023 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Mon Mar 20 05:29:33 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=090dc863
7
8 sys-auth/nss-pam-ldapd: fix musl build
9
10 * add sys-libs/musl-nscd as dependency for musl, to fix ```unknown type name nss_status_t``` error
11 * patch for missing NETDB_INTERNAL
12
13 Closes: https://bugs.gentoo.org/713612
14 Closes: https://bugs.gentoo.org/716272
15 Signed-off-by: Cristian Othón Martínez Vera <cfuga <AT> cfuga.mx>
16 Signed-off-by: Sam James <sam <AT> gentoo.org>
17
18 .../files/nss-pam-ldapd-0.9.12-netdb-defines.patch | 26 ++++
19 .../nss-pam-ldapd/nss-pam-ldapd-0.9.12-r3.ebuild | 163 +++++++++++++++++++++
20 2 files changed, 189 insertions(+)
21
22 diff --git a/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.12-netdb-defines.patch b/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.12-netdb-defines.patch
23 new file mode 100644
24 index 000000000000..2036da4fd7b1
25 --- /dev/null
26 +++ b/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.12-netdb-defines.patch
27 @@ -0,0 +1,26 @@
28 +Bug: https://bugs.gentoo.org/716272
29 +
30 +--- a/nss/hosts.c
31 ++++ b/nss/hosts.c
32 +@@ -49,6 +49,9 @@
33 + *h_errnop = NO_RECOVERY; \
34 + return NSS_STATUS_UNAVAIL;
35 +
36 ++#ifndef NETDB_INTERNAL
37 ++#define NETDB_INTERNAL -1
38 ++#endif
39 + #undef ERROR_OUT_BUFERROR
40 + #define ERROR_OUT_BUFERROR(fp) \
41 + *errnop = ERANGE; \
42 +--- a/nss/networks.c
43 ++++ b/nss/networks.c
44 +@@ -49,6 +49,9 @@
45 + *h_errnop = NO_RECOVERY; \
46 + return NSS_STATUS_UNAVAIL;
47 +
48 ++#ifndef NETDB_INTERNAL
49 ++#define NETDB_INTERNAL -1
50 ++#endif
51 + #undef ERROR_OUT_BUFERROR
52 + #define ERROR_OUT_BUFERROR(fp) \
53 + *errnop = ERANGE; \
54
55 diff --git a/sys-auth/nss-pam-ldapd/nss-pam-ldapd-0.9.12-r3.ebuild b/sys-auth/nss-pam-ldapd/nss-pam-ldapd-0.9.12-r3.ebuild
56 new file mode 100644
57 index 000000000000..2f0098518878
58 --- /dev/null
59 +++ b/sys-auth/nss-pam-ldapd/nss-pam-ldapd-0.9.12-r3.ebuild
60 @@ -0,0 +1,163 @@
61 +# Copyright 1999-2023 Gentoo Authors
62 +# Distributed under the terms of the GNU General Public License v2
63 +
64 +EAPI=8
65 +
66 +PYTHON_COMPAT=( python3_{9..11} )
67 +inherit autotools python-r1 s6 systemd tmpfiles multilib-minimal
68 +
69 +DESCRIPTION="NSS module for name lookups using LDAP"
70 +HOMEPAGE="https://arthurdejong.org/nss-pam-ldapd/"
71 +SRC_URI="https://arthurdejong.org/${PN}/${P}.tar.gz"
72 +
73 +LICENSE="LGPL-2.1"
74 +SLOT="0"
75 +KEYWORDS="~amd64 ~hppa ~ia64 ~sparc ~x86"
76 +IUSE="debug kerberos +pam pynslcd sasl test +utils"
77 +REQUIRED_USE="
78 + utils? ( ${PYTHON_REQUIRED_USE} )
79 + test? ( ${PYTHON_REQUIRED_USE} pynslcd )
80 +"
81 +RESTRICT="!test? ( test )"
82 +
83 +RDEPEND="
84 + acct-group/nslcd
85 + acct-user/nslcd
86 + net-nds/openldap:=[${MULTILIB_USEDEP}]
87 + sasl? ( dev-libs/cyrus-sasl[${MULTILIB_USEDEP}] )
88 + kerberos? ( virtual/krb5[${MULTILIB_USEDEP}] )
89 + sys-libs/pam[${MULTILIB_USEDEP}]
90 + utils? ( ${PYTHON_DEPS} )
91 + pynslcd? (
92 + dev-python/python-ldap[${PYTHON_USEDEP}]
93 + dev-python/python-daemon[${PYTHON_USEDEP}]
94 + )
95 + elibc_musl? ( sys-libs/musl-nscd )
96 + !sys-auth/nss_ldap
97 + !sys-auth/pam_ldap
98 +"
99 +DEPEND="${RDEPEND}"
100 +BDEPEND="
101 + ${PYTHON_DEPS}
102 + test? ( dev-python/pylint[${PYTHON_USEDEP}] )
103 +"
104 +
105 +PATCHES=(
106 + "${FILESDIR}"/nss-pam-ldapd-0.9.4-disable-py3-only-linters.patch
107 + "${FILESDIR}"/nss-pam-ldapd-0.9.11-use-mkstemp.patch
108 + "${FILESDIR}"/nss-pam-ldapd-0.9.11-relative-imports.patch
109 + "${FILESDIR}"/nss-pam-ldapd-0.9.11-tests.patch
110 + "${FILESDIR}"/nss-pam-ldapd-0.9.11-tests-py39.patch
111 + "${FILESDIR}"/nss-pam-ldapd-0.9.12-netdb-defines.patch
112 +)
113 +
114 +pkg_setup() {
115 + [[ ${MERGE_TYPE} != binary ]] && python_setup
116 +}
117 +
118 +src_prepare() {
119 + default
120 +
121 + touch pynslcd/__init__.py || die "Could not create __init__.py for pynslcd"
122 + mv pynslcd/pynslcd.py pynslcd/main.py || die
123 +
124 + eautoreconf
125 +}
126 +
127 +multilib_src_configure() {
128 + local myconf=(
129 + --disable-utils
130 + --enable-warnings
131 + --with-ldap-lib=openldap
132 + --with-ldap-conf-file="${EPREFIX}"/etc/nslcd.conf
133 + --with-nslcd-pidfile=/run/nslcd/nslcd.pid
134 + --with-nslcd-socket=/run/nslcd/socket
135 + --with-nss-flavour=glibc
136 + $(use_enable pynslcd)
137 + $(use_enable debug)
138 + $(use_enable kerberos)
139 + $(use_enable pam)
140 + $(use_enable sasl)
141 +
142 + # nss libraries always go in /lib on Gentoo
143 + --with-pam-seclib-dir="${EPREFIX}"/$(get_libdir)/security
144 + --libdir="${EPREFIX}"/$(get_libdir)
145 + )
146 + ECONF_SOURCE="${S}" econf "${myconf[@]}"
147 +}
148 +
149 +multilib_src_test() {
150 + python_test() {
151 + cp -l "${S}"/pynslcd/*.py pynslcd/ || die "Could not copy python files for tests"
152 + nonfatal emake check || die "tests failed with ${EPYTHON}"
153 + }
154 +
155 + pushd "${BUILD_DIR}" >/dev/null || die
156 + ln -s ../pynslcd/constants.py utils/constants.py || die
157 + python_foreach_impl python_test
158 + popd >/dev/null || die
159 +}
160 +
161 +multilib_src_install() {
162 + emake DESTDIR="${D}" install
163 +
164 + if use pynslcd; then
165 + python_moduleinto pynslcd
166 + python_foreach_impl python_domodule pynslcd/*.py
167 + fi
168 +}
169 +
170 +multilib_src_install_all() {
171 + einstalldocs
172 +
173 + newinitd "${FILESDIR}"/nslcd.init nslcd
174 + s6_install_service nslcd "${FILESDIR}"/nslcd.s6
175 +
176 + insinto /usr/share/nss-pam-ldapd
177 + doins "${WORKDIR}"/${P}/nslcd.conf
178 +
179 + fperms o-r /etc/nslcd.conf
180 +
181 + if use utils; then
182 + python_moduleinto nslcd
183 + python_foreach_impl python_domodule utils/*.py
184 +
185 + local script
186 + for script in chsh getent; do
187 + python_foreach_impl python_newscript utils/${script}.py ${script}.ldap
188 + done
189 + fi
190 + if use pynslcd; then
191 + rm -rf "${ED}"/usr/share/pynslcd || die
192 + python_moduleinto pynslcd
193 + python_foreach_impl python_domodule pynslcd/*.py
194 + python_scriptinto /usr/sbin
195 + python_foreach_impl python_newscript pynslcd/main.py pynslcd
196 + newinitd "${FILESDIR}"/pynslcd.init pynslcd
197 + fi
198 +
199 + newtmpfiles "${FILESDIR}"/nslcd-tmpfiles.conf nslcd.conf
200 + systemd_newunit "${FILESDIR}"/nslcd.service nslcd.service
201 +}
202 +
203 +pkg_postinst() {
204 + tmpfiles_process nslcd.conf
205 +
206 + elog "For this to work you must configure /etc/nslcd.conf"
207 + elog "This configuration is similar to pam_ldap's /etc/ldap.conf"
208 + elog
209 + elog "In order to use nss-pam-ldapd, nslcd needs to be running. You can"
210 + elog "start it like this:"
211 + elog " # /etc/init.d/nslcd start"
212 + elog
213 + elog "You can add it to the default runlevel like so:"
214 + elog " # rc-update add nslcd default"
215 + elog
216 + elog "If you have >=sys-apps/openrc-0.16.3, you can also use s6"
217 + elog "to supervise this service."
218 + elog "To do this, emerge sys-apps/s6 then add nslcd-s6"
219 + elog "default runlevel instead of nslcd."
220 + elog
221 + elog "If you are upgrading, keep in mind that /etc/nss-ldapd.conf"
222 + elog " is now named /etc/nslcd.conf"
223 +}