Gentoo Archives: gentoo-commits

From: Patrick McLean <chutzpah@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: Sat, 05 Sep 2020 00:08:01
Message-Id: 1599264465.8f75b8e5458a93664ab8993bc95e769aae0e0b7f.chutzpah@gentoo
1 commit: 8f75b8e5458a93664ab8993bc95e769aae0e0b7f
2 Author: Patrick McLean <patrick.mclean <AT> sony <DOT> com>
3 AuthorDate: Sat Sep 5 00:04:46 2020 +0000
4 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 5 00:07:45 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8f75b8e5
7
8 sys-auth/nss-pam-ldapd-0.9.11-r3: EAPI=7, py38 (bug #718520)
9
10 Closes: https://bugs.gentoo.org/718520
11 Copyright: Sony Interactive Entertainment Inc.
12 Package-Manager: Portage-3.0.5, Repoman-3.0.1
13 Signed-off-by: Patrick McLean <patrick.mclean <AT> sony.com>
14 Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
15
16 .../nss-pam-ldapd-0.9.11-relative-imports.patch | 452 +++++++++++++++++++++
17 .../files/nss-pam-ldapd-0.9.11-tests.patch | 34 ++
18 .../files/nss-pam-ldapd-0.9.11-use-mkstemp.patch | 25 ++
19 .../nss-pam-ldapd/nss-pam-ldapd-0.9.11-r3.ebuild | 167 ++++++++
20 4 files changed, 678 insertions(+)
21
22 diff --git a/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.11-relative-imports.patch b/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.11-relative-imports.patch
23 new file mode 100644
24 index 00000000000..101d0c77450
25 --- /dev/null
26 +++ b/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.11-relative-imports.patch
27 @@ -0,0 +1,452 @@
28 +diff --git a/pynslcd/Makefile.am b/pynslcd/Makefile.am
29 +index 383dd3c..39a3bfb 100644
30 +--- a/pynslcd/Makefile.am
31 ++++ b/pynslcd/Makefile.am
32 +@@ -19,7 +19,7 @@
33 +
34 + pynslcddir = $(datadir)/pynslcd
35 +
36 +-pynslcd_PYTHON = pynslcd.py attmap.py cache.py cfg.py common.py expr.py \
37 ++pynslcd_PYTHON = main.py attmap.py cache.py cfg.py common.py expr.py \
38 + mypidfile.py invalidator.py search.py tio.py \
39 + config.py alias.py ether.py group.py host.py netgroup.py \
40 + network.py passwd.py protocol.py rpc.py service.py \
41 +@@ -38,6 +38,6 @@ constants.py: constants.py.in $(top_srcdir)/nslcd.h
42 + # create a symbolic link for the pynslcd daemon and fix permissions
43 + install-data-hook:
44 + $(MKDIR_P) $(DESTDIR)$(sbindir)
45 +- [ -L $(DESTDIR)$(sbindir)/pynslcd ] || $(LN_S) $(pynslcddir)/pynslcd.py $(DESTDIR)$(sbindir)/pynslcd
46 +- chmod a+rx $(DESTDIR)$(pynslcddir)/pynslcd.py
47 +- sed -i -e '1 s|^#!.*|#! $(PYTHON)|;1 s|^#! \([^/].*\)|#! /usr/bin/env \1|' $(DESTDIR)$(pynslcddir)/pynslcd.py
48 ++ [ -L $(DESTDIR)$(sbindir)/pynslcd ] || $(LN_S) $(pynslcddir)/main.py $(DESTDIR)$(sbindir)/pynslcd
49 ++ chmod a+rx $(DESTDIR)$(pynslcddir)/main.py
50 ++ sed -i -e '1 s|^#!.*|#! $(PYTHON)|;1 s|^#! \([^/].*\)|#! /usr/bin/env \1|' $(DESTDIR)$(pynslcddir)/main.py
51 +diff --git a/pynslcd/alias.py b/pynslcd/alias.py
52 +index 8096309..614dd53 100644
53 +--- a/pynslcd/alias.py
54 ++++ b/pynslcd/alias.py
55 +@@ -18,10 +18,10 @@
56 + # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
57 + # 02110-1301 USA
58 +
59 +-import cache
60 +-import common
61 +-import constants
62 +-import search
63 ++from pynslcd import cache
64 ++from pynslcd import common
65 ++from pynslcd import constants
66 ++from pynslcd import search
67 +
68 +
69 + attmap = common.Attributes(
70 +diff --git a/pynslcd/attmap.py b/pynslcd/attmap.py
71 +index 61862df..4d450f6 100644
72 +--- a/pynslcd/attmap.py
73 ++++ b/pynslcd/attmap.py
74 +@@ -45,7 +45,7 @@ import re
75 + import ldap.dn
76 + from ldap.filter import escape_filter_chars
77 +
78 +-from expr import Expression
79 ++from pynslcd.expr import Expression
80 +
81 +
82 + # exported names
83 +diff --git a/pynslcd/cfg.py b/pynslcd/cfg.py
84 +index 877d442..14ae850 100644
85 +--- a/pynslcd/cfg.py
86 ++++ b/pynslcd/cfg.py
87 +@@ -133,8 +133,8 @@ _tls_reqcert_options = {'never': ldap.OPT_X_TLS_NEVER,
88 +
89 + def _get_maps():
90 + # separate function as not to pollute the namespace and avoid import loops
91 +- import alias, ether, group, host, netgroup, network, passwd # noqa: E401
92 +- import protocol, rpc, service, shadow # noqa: E401
93 ++ from pynslcd import alias, ether, group, host, netgroup, network, passwd # noqa: E401
94 ++ from pynslcd import protocol, rpc, service, shadow # noqa: E401
95 + import sys
96 + return dict(
97 + alias=alias, aliases=alias,
98 +@@ -293,7 +293,7 @@ def read(filename): # noqa: C901 (many simple branches)
99 + # pam_authz_search <FILTER>
100 + m = re.match(r'pam_authz_search\s+(?P<value>\S.*)', line, re.IGNORECASE)
101 + if m:
102 +- from expr import Expression
103 ++ from pynslcd.expr import Expression
104 + pam_authz_searches.append(Expression(m.group('value')))
105 + # TODO: check pam_authz_search expression to only contain
106 + # username, service, ruser, rhost, tty, hostname, fqdn, dn or
107 +diff --git a/pynslcd/common.py b/pynslcd/common.py
108 +index a5b168d..568ac2f 100644
109 +--- a/pynslcd/common.py
110 ++++ b/pynslcd/common.py
111 +@@ -23,9 +23,9 @@ import sys
112 +
113 + import ldap
114 +
115 +-from attmap import Attributes # noqa: F401 (used by other modules)
116 +-import cfg
117 +-import constants
118 ++from pynslcd.attmap import Attributes # noqa: F401 (used by other modules)
119 ++from pynslcd import cfg
120 ++from pynslcd import constants
121 +
122 +
123 + def is_valid_name(name):
124 +diff --git a/pynslcd/config.py b/pynslcd/config.py
125 +index ee57db3..ba8badb 100644
126 +--- a/pynslcd/config.py
127 ++++ b/pynslcd/config.py
128 +@@ -18,9 +18,9 @@
129 + # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
130 + # 02110-1301 USA
131 +
132 +-import cfg
133 +-import common
134 +-import constants
135 ++from pynslcd import cfg
136 ++from pynslcd import common
137 ++from pynslcd import constants
138 +
139 +
140 + class ConfigGetRequest(common.Request):
141 +diff --git a/pynslcd/ether.py b/pynslcd/ether.py
142 +index 9462ef0..2edc5de 100644
143 +--- a/pynslcd/ether.py
144 ++++ b/pynslcd/ether.py
145 +@@ -20,10 +20,10 @@
146 +
147 + import struct
148 +
149 +-import cache
150 +-import common
151 +-import constants
152 +-import search
153 ++from pynslcd import cache
154 ++from pynslcd import common
155 ++from pynslcd import constants
156 ++from pynslcd import search
157 +
158 +
159 + def ether_aton(ether):
160 +diff --git a/pynslcd/group.py b/pynslcd/group.py
161 +index 263e40c..422ee9e 100644
162 +--- a/pynslcd/group.py
163 ++++ b/pynslcd/group.py
164 +@@ -23,12 +23,12 @@ import logging
165 + import ldap
166 + from ldap.filter import escape_filter_chars
167 +
168 +-import cache
169 +-import cfg
170 +-import common
171 +-import constants
172 +-import passwd
173 +-import search
174 ++from pynslcd import cache
175 ++from pynslcd import cfg
176 ++from pynslcd import common
177 ++from pynslcd import constants
178 ++from pynslcd import passwd
179 ++from pynslcd import search
180 +
181 +
182 + def clean(lst):
183 +diff --git a/pynslcd/host.py b/pynslcd/host.py
184 +index c6639df..30259d6 100644
185 +--- a/pynslcd/host.py
186 ++++ b/pynslcd/host.py
187 +@@ -18,10 +18,10 @@
188 + # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
189 + # 02110-1301 USA
190 +
191 +-import cache
192 +-import common
193 +-import constants
194 +-import search
195 ++from pynslcd import cache
196 ++from pynslcd import common
197 ++from pynslcd import constants
198 ++from pynslcd import search
199 +
200 +
201 + attmap = common.Attributes(
202 +diff --git a/pynslcd/invalidator.py b/pynslcd/invalidator.py
203 +index 6d2eefe..b54946e 100644
204 +--- a/pynslcd/invalidator.py
205 ++++ b/pynslcd/invalidator.py
206 +@@ -23,7 +23,7 @@ import logging
207 + import os
208 + import subprocess
209 +
210 +-import cfg
211 ++from pynslcd import cfg
212 +
213 +
214 + # the file descriptor used for sending messages to the child process
215 +diff --git a/pynslcd/mypidfile.py b/pynslcd/mypidfile.py
216 +index 42935e2..dd7d59a 100644
217 +--- a/pynslcd/mypidfile.py
218 ++++ b/pynslcd/mypidfile.py
219 +@@ -22,7 +22,7 @@ import errno
220 + import fcntl
221 + import os
222 +
223 +-import cfg
224 ++from pynslcd import cfg
225 +
226 +
227 + class MyPIDLockFile(object):
228 +diff --git a/pynslcd/netgroup.py b/pynslcd/netgroup.py
229 +index 47a4c6e..8d0fbb2 100644
230 +--- a/pynslcd/netgroup.py
231 ++++ b/pynslcd/netgroup.py
232 +@@ -20,10 +20,10 @@
233 +
234 + import re
235 +
236 +-import cache
237 +-import common
238 +-import constants
239 +-import search
240 ++from pynslcd import cache
241 ++from pynslcd import common
242 ++from pynslcd import constants
243 ++from pynslcd import search
244 +
245 +
246 + _netgroup_triple_re = re.compile(
247 +diff --git a/pynslcd/network.py b/pynslcd/network.py
248 +index da587b9..3b94d06 100644
249 +--- a/pynslcd/network.py
250 ++++ b/pynslcd/network.py
251 +@@ -18,10 +18,10 @@
252 + # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
253 + # 02110-1301 USA
254 +
255 +-import cache
256 +-import common
257 +-import constants
258 +-import search
259 ++from pynslcd import cache
260 ++from pynslcd import common
261 ++from pynslcd import constants
262 ++from pynslcd import search
263 +
264 +
265 + attmap = common.Attributes(
266 +diff --git a/pynslcd/pam.py b/pynslcd/pam.py
267 +index b372cdd..bb7add8 100644
268 +--- a/pynslcd/pam.py
269 ++++ b/pynslcd/pam.py
270 +@@ -27,12 +27,12 @@ import ldap
271 + from ldap.controls.ppolicy import PasswordPolicyControl, PasswordPolicyError
272 + from ldap.filter import escape_filter_chars
273 +
274 +-import cfg
275 +-import common
276 +-import constants
277 +-import passwd
278 +-import search
279 +-import shadow
280 ++from pynslcd import cfg
281 ++from pynslcd import common
282 ++from pynslcd import constants
283 ++from pynslcd import passwd
284 ++from pynslcd import search
285 ++from pynslcd import shadow
286 +
287 +
288 + random = random.SystemRandom()
289 +diff --git a/pynslcd/passwd.py b/pynslcd/passwd.py
290 +index 1274f21..51ae57e 100644
291 +--- a/pynslcd/passwd.py
292 ++++ b/pynslcd/passwd.py
293 +@@ -20,11 +20,11 @@
294 +
295 + import logging
296 +
297 +-import cache
298 +-import cfg
299 +-import common
300 +-import constants
301 +-import search
302 ++from pynslcd import cache
303 ++from pynslcd import cfg
304 ++from pynslcd import common
305 ++from pynslcd import constants
306 ++from pynslcd import search
307 +
308 +
309 + attmap = common.Attributes(
310 +diff --git a/pynslcd/protocol.py b/pynslcd/protocol.py
311 +index dc41c4b..396f337 100644
312 +--- a/pynslcd/protocol.py
313 ++++ b/pynslcd/protocol.py
314 +@@ -18,10 +18,10 @@
315 + # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
316 + # 02110-1301 USA
317 +
318 +-import cache
319 +-import common
320 +-import constants
321 +-import search
322 ++from pynslcd import cache
323 ++from pynslcd import common
324 ++from pynslcd import constants
325 ++from pynslcd import search
326 +
327 +
328 + attmap = common.Attributes(
329 +diff --git a/pynslcd/pynslcd.py b/pynslcd/pynslcd.py
330 +index 0691b61..973ecd9 100755
331 +--- a/pynslcd/pynslcd.py
332 ++++ b/pynslcd/pynslcd.py
333 +@@ -30,13 +30,13 @@ import threading
334 + import daemon
335 + import ldap
336 +
337 +-import cfg
338 +-import common
339 +-import constants
340 +-import invalidator
341 +-import mypidfile
342 +-import search
343 +-from tio import TIOStream
344 ++import pynslcd.cfg as cfg
345 ++import pynslcd.common as common
346 ++import pynslcd.constants as constants
347 ++import pynslcd.invalidator as invalidator
348 ++import pynslcd.mypidfile as mypidfile
349 ++import pynslcd.search as search
350 ++from pynslcd.tio import TIOStream
351 +
352 +
353 + # the name of the program
354 +@@ -188,20 +188,20 @@ def getpeercred(fd):
355 +
356 +
357 + handlers = {}
358 +-handlers.update(common.get_handlers('config'))
359 +-handlers.update(common.get_handlers('alias'))
360 +-handlers.update(common.get_handlers('ether'))
361 +-handlers.update(common.get_handlers('group'))
362 +-handlers.update(common.get_handlers('host'))
363 +-handlers.update(common.get_handlers('netgroup'))
364 +-handlers.update(common.get_handlers('network'))
365 +-handlers.update(common.get_handlers('passwd'))
366 +-handlers.update(common.get_handlers('protocol'))
367 +-handlers.update(common.get_handlers('rpc'))
368 +-handlers.update(common.get_handlers('service'))
369 +-handlers.update(common.get_handlers('shadow'))
370 +-handlers.update(common.get_handlers('pam'))
371 +-handlers.update(common.get_handlers('usermod'))
372 ++handlers.update(common.get_handlers('pynslcd.config'))
373 ++handlers.update(common.get_handlers('pynslcd.alias'))
374 ++handlers.update(common.get_handlers('pynslcd.ether'))
375 ++handlers.update(common.get_handlers('pynslcd.group'))
376 ++handlers.update(common.get_handlers('pynslcd.host'))
377 ++handlers.update(common.get_handlers('pynslcd.netgroup'))
378 ++handlers.update(common.get_handlers('pynslcd.network'))
379 ++handlers.update(common.get_handlers('pynslcd.passwd'))
380 ++handlers.update(common.get_handlers('pynslcd.protocol'))
381 ++handlers.update(common.get_handlers('pynslcd.rpc'))
382 ++handlers.update(common.get_handlers('pynslcd.service'))
383 ++handlers.update(common.get_handlers('pynslcd.shadow'))
384 ++handlers.update(common.get_handlers('pynslcd.pam'))
385 ++handlers.update(common.get_handlers('pynslcd.usermod'))
386 +
387 +
388 + def acceptconnection(nslcd_serversocket, session):
389 +diff --git a/pynslcd/rpc.py b/pynslcd/rpc.py
390 +index 49d9c7c..e1ea4f5 100644
391 +--- a/pynslcd/rpc.py
392 ++++ b/pynslcd/rpc.py
393 +@@ -18,10 +18,10 @@
394 + # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
395 + # 02110-1301 USA
396 +
397 +-import cache
398 +-import common
399 +-import constants
400 +-import search
401 ++from pynslcd import cache
402 ++from pynslcd import common
403 ++from pynslcd import constants
404 ++from pynslcd import search
405 +
406 +
407 + attmap = common.Attributes(
408 +diff --git a/pynslcd/search.py b/pynslcd/search.py
409 +index 39850d2..f017451 100644
410 +--- a/pynslcd/search.py
411 ++++ b/pynslcd/search.py
412 +@@ -24,7 +24,7 @@ import sys
413 + import ldap
414 + import ldap.ldapobject
415 +
416 +-import cfg
417 ++from pynslcd import cfg
418 +
419 +
420 + # global indicator that there was some error connection to an LDAP server
421 +diff --git a/pynslcd/service.py b/pynslcd/service.py
422 +index b0c53e3..96c2aaf 100644
423 +--- a/pynslcd/service.py
424 ++++ b/pynslcd/service.py
425 +@@ -20,10 +20,10 @@
426 +
427 + import datetime
428 +
429 +-import cache
430 +-import common
431 +-import constants
432 +-import search
433 ++from pynslcd import cache
434 ++from pynslcd import common
435 ++from pynslcd import constants
436 ++from pynslcd import search
437 +
438 +
439 + attmap = common.Attributes(
440 +diff --git a/pynslcd/shadow.py b/pynslcd/shadow.py
441 +index 59e1af6..3ed695b 100644
442 +--- a/pynslcd/shadow.py
443 ++++ b/pynslcd/shadow.py
444 +@@ -20,11 +20,11 @@
445 +
446 + import logging
447 +
448 +-import cache
449 +-import cfg
450 +-import common
451 +-import constants
452 +-import search
453 ++from pynslcd import cache
454 ++from pynslcd import cfg
455 ++from pynslcd import common
456 ++from pynslcd import constants
457 ++from pynslcd import search
458 +
459 +
460 + attmap = common.Attributes(
461 +diff --git a/pynslcd/usermod.py b/pynslcd/usermod.py
462 +index 4e37ded..ffd651b 100644
463 +--- a/pynslcd/usermod.py
464 ++++ b/pynslcd/usermod.py
465 +@@ -26,10 +26,10 @@ import os.path
466 +
467 + import ldap
468 +
469 +-import cfg
470 +-import constants
471 +-import pam
472 +-import passwd
473 ++from pynslcd import cfg
474 ++from pynslcd import constants
475 ++from pynslcd import pam
476 ++from pynslcd import passwd
477 +
478 +
479 + def list_shells():
480
481 diff --git a/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.11-tests.patch b/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.11-tests.patch
482 new file mode 100644
483 index 00000000000..5e13854b6cd
484 --- /dev/null
485 +++ b/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.11-tests.patch
486 @@ -0,0 +1,34 @@
487 +diff --git a/tests/Makefile.am b/tests/Makefile.am
488 +index 1bbbcc2..4adf062 100644
489 +--- a/tests/Makefile.am
490 ++++ b/tests/Makefile.am
491 +@@ -23,7 +23,7 @@ TESTS = test_dict test_set test_tio test_expr test_getpeercred test_cfg \
492 + test_pamcmds.sh test_manpages.sh test_clock \
493 + test_tio_timeout
494 + if HAVE_PYTHON
495 +- TESTS += test_pycompile.sh test_pylint.sh
496 ++ TESTS += test_pycompile.sh
497 + endif
498 + if ENABLE_PYNSLCD
499 + TESTS += test_pynslcd_cache.py test_doctest.sh
500 +@@ -48,7 +48,6 @@ EXTRA_DIST = README nslcd-test.conf usernames.txt testenv.sh test_myldap.sh \
501 + test_nsscmds.sh test_ldapcmds.sh test_pamcmds.sh \
502 + test_pamcmds.expect test_manpages.sh \
503 + test_pycompile.sh test_doctest.sh \
504 +- test_pylint.sh pylint.rc \
505 + test_flake8.sh flake8.ini \
506 + test_pynslcd_cache.py \
507 + setup_slapd.sh config.ldif test.ldif
508 +diff --git a/tests/test_doctest.sh b/tests/test_doctest.sh
509 +index 5b3a13d..26c73e7 100755
510 +--- a/tests/test_doctest.sh
511 ++++ b/tests/test_doctest.sh
512 +@@ -38,7 +38,7 @@ find_python() {
513 + fi
514 + done
515 + }
516 +-interpreters=`find_python | sort -u`
517 ++interpreters=${PYTHON}
518 +
519 + # if Python is missing, ignore
520 + if [ -z "$interpreters" ]
521
522 diff --git a/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.11-use-mkstemp.patch b/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.11-use-mkstemp.patch
523 new file mode 100644
524 index 00000000000..1803067f402
525 --- /dev/null
526 +++ b/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.11-use-mkstemp.patch
527 @@ -0,0 +1,25 @@
528 +diff --git a/pynslcd/cache.py b/pynslcd/cache.py
529 +index 0be3a71..b463d2e 100644
530 +--- a/pynslcd/cache.py
531 ++++ b/pynslcd/cache.py
532 +@@ -22,6 +22,7 @@ import datetime
533 + import os
534 + import sqlite3
535 + import sys
536 ++import tempfile
537 +
538 +
539 + # TODO: probably create a config table
540 +@@ -192,10 +193,8 @@ _connection = None
541 + def _get_connection():
542 + global _connection
543 + if _connection is None:
544 +- filename = '/tmp/pynslcd_cache.sqlite'
545 +- dirname = os.path.dirname(filename)
546 +- if not os.path.isdir(dirname):
547 +- os.mkdir(dirname)
548 ++ tmpfd, filename = tempfile.mkstemp(suffix=".sqlite", prefix="pynslcd_cache")
549 ++ os.close(tmpfd)
550 + connection = sqlite3.connect(
551 + filename, detect_types=sqlite3.PARSE_DECLTYPES,
552 + check_same_thread=False)
553
554 diff --git a/sys-auth/nss-pam-ldapd/nss-pam-ldapd-0.9.11-r3.ebuild b/sys-auth/nss-pam-ldapd/nss-pam-ldapd-0.9.11-r3.ebuild
555 new file mode 100644
556 index 00000000000..bc76968a718
557 --- /dev/null
558 +++ b/sys-auth/nss-pam-ldapd/nss-pam-ldapd-0.9.11-r3.ebuild
559 @@ -0,0 +1,167 @@
560 +# Copyright 1999-2020 Gentoo Authors
561 +# Distributed under the terms of the GNU General Public License v2
562 +
563 +EAPI=7
564 +
565 +PYTHON_COMPAT=(python3_{6..8})
566 +inherit eutils prefix python-r1 autotools multilib multilib-minimal systemd s6
567 +
568 +DESCRIPTION="NSS module for name lookups using LDAP"
569 +HOMEPAGE="https://arthurdejong.org/nss-pam-ldapd/"
570 +SRC_URI="https://arthurdejong.org/${PN}/${P}.tar.gz"
571 +
572 +LICENSE="LGPL-2.1"
573 +SLOT="0"
574 +KEYWORDS="~amd64 ~x86"
575 +IUSE="debug kerberos +pam pynslcd sasl test +utils"
576 +RESTRICT="!test? ( test )"
577 +
578 +COMMON_DEP="
579 + acct-group/nslcd
580 + acct-user/nslcd
581 + net-nds/openldap[${MULTILIB_USEDEP}]
582 + sasl? ( dev-libs/cyrus-sasl[${MULTILIB_USEDEP}] )
583 + kerberos? ( virtual/krb5[${MULTILIB_USEDEP}] )
584 + sys-libs/pam[${MULTILIB_USEDEP}]
585 + utils? ( ${PYTHON_DEPS} )
586 + pynslcd? (
587 + dev-python/python-ldap[${PYTHON_USEDEP}]
588 + dev-python/python-daemon[${PYTHON_USEDEP}]
589 + )
590 + !sys-auth/nss_ldap
591 + !sys-auth/pam_ldap
592 +"
593 +RDEPEND="${COMMON_DEP}"
594 +DEPEND="${COMMON_DEP}
595 + test? (
596 + ${PYTHON_DEPS}
597 + dev-python/pylint[${PYTHON_USEDEP}]
598 + )
599 +"
600 +BDEPEND="
601 + ${PYTHON_DEPS}
602 + sys-devel/automake
603 +"
604 +
605 +REQUIRED_USE="
606 + utils? ( ${PYTHON_REQUIRED_USE} )
607 + test? ( ${PYTHON_REQUIRED_USE} pynslcd )
608 +"
609 +
610 +PATCHES=(
611 + "${FILESDIR}/nss-pam-ldapd-0.9.4-disable-py3-only-linters.patch"
612 + "${FILESDIR}/nss-pam-ldapd-0.9.11-use-mkstemp.patch"
613 + "${FILESDIR}/nss-pam-ldapd-0.9.11-relative-imports.patch"
614 + "${FILESDIR}/nss-pam-ldapd-0.9.11-tests.patch"
615 +)
616 +
617 +src_prepare() {
618 + default
619 + use utils && python_setup
620 + touch pynslcd/__init__.py || die "Could not create __init__.py for pynslcd"
621 + mv pynslcd/pynslcd.py pynslcd/main.py || die
622 +
623 + eautoreconf
624 +}
625 +
626 +multilib_src_configure() {
627 + local -a myconf=(
628 + --disable-utils
629 + --enable-warnings
630 + --with-ldap-lib=openldap
631 + --with-ldap-conf-file=/etc/nslcd.conf
632 + --with-nslcd-pidfile=/run/nslcd/nslcd.pid
633 + --with-nslcd-socket=/run/nslcd/socket
634 + $(usex x86-fbsd '--with-nss-flavour=' '--with-nss-flavour=' 'freebsd' 'glibc')
635 + $(use_enable pynslcd)
636 + $(use_enable debug)
637 + $(use_enable kerberos)
638 + $(use_enable pam)
639 + $(use_enable sasl)
640 + )
641 +
642 + # nss libraries always go in /lib on Gentoo
643 + if multilib_is_native_abi ; then
644 + myconf+=("--with-pam-seclib-dir=${EPREFIX}/$(get_libdir)/security")
645 + myconf+=("--libdir=${EPREFIX}/$(get_libdir)")
646 + else
647 + myconf+=("--with-pam-seclib-dir=/$(get_libdir)/security")
648 + myconf+=("--libdir=/$(get_libdir)")
649 + fi
650 +
651 + ECONF_SOURCE="${S}" econf "${myconf[@]}"
652 +}
653 +
654 +multilib_src_test() {
655 + pushd "${BUILD_DIR}" >/dev/null || die
656 + ln -s ../pynslcd/constants.py utils/constants.py || die
657 + python_foreach_impl python_test
658 + popd >/dev/null || die
659 +}
660 +
661 +python_test() {
662 + emake check
663 +}
664 +
665 +multilib_src_install_all() {
666 + local script
667 +
668 + newinitd "${FILESDIR}"/nslcd.init nslcd
669 + s6_install_service nslcd "${FILESDIR}"/nslcd.s6
670 +
671 + insinto /usr/share/nss-pam-ldapd
672 + doins "${WORKDIR}/${P}/nslcd.conf"
673 +
674 + fperms o-r /etc/nslcd.conf
675 +
676 + if use utils; then
677 + python_moduleinto nslcd
678 + python_foreach_impl python_domodule utils/*.py
679 +
680 + for script in chsh getent; do
681 + python_foreach_impl python_newscript utils/${script}.py ${script}.ldap
682 + done
683 + fi
684 + if use pynslcd; then
685 + rm -rf "${D}"/usr/share/pynslcd
686 + python_moduleinto pynslcd
687 + python_foreach_impl python_domodule pynslcd/*.py
688 + python_scriptinto /usr/sbin
689 + python_foreach_impl python_newscript pynslcd/main.py pynslcd
690 + newinitd "${FILESDIR}"/pynslcd.init pynslcd
691 + fi
692 +
693 + systemd_newtmpfilesd "${FILESDIR}"/nslcd-tmpfiles.conf nslcd.conf
694 + systemd_newunit "${FILESDIR}"/nslcd.service nslcd.service
695 +}
696 +
697 +multilib_src_install() {
698 + emake DESTDIR="${D}" install
699 +
700 + if use pynslcd; then
701 + python_moduleinto pynslcd
702 + python_foreach_impl python_domodule pynslcd/*.py
703 + fi
704 +}
705 +
706 +pkg_postinst() {
707 + echo
708 + elog "For this to work you must configure /etc/nslcd.conf"
709 + elog "This configuration is similar to pam_ldap's /etc/ldap.conf"
710 + echo
711 + elog "In order to use nss-pam-ldapd, nslcd needs to be running. You can"
712 + elog "start it like this:"
713 + elog " # /etc/init.d/nslcd start"
714 + echo
715 + elog "You can add it to the default runlevel like so:"
716 + elog " # rc-update add nslcd default"
717 + elog
718 + elog "If you have >=sys-apps/openrc-0.16.3, you can also use s6"
719 + elog "to supervise this service."
720 + elog "To do this, emerge sys-apps/s6 then add nslcd-s6"
721 + elog "default runlevel instead of nslcd."
722 + elog
723 + elog "If you are upgrading, keep in mind that /etc/nss-ldapd.conf"
724 + elog " is now named /etc/nslcd.conf"
725 + echo
726 +}