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/files/, sys-auth/nss-pam-ldapd/
Date: Mon, 31 Jul 2017 23:01:37
Message-Id: 1501542083.1756fc0f53d40072e7b634ed3baf8a87152fd6af.chutzpah@gentoo
1 commit: 1756fc0f53d40072e7b634ed3baf8a87152fd6af
2 Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 31 22:58:54 2017 +0000
4 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 31 23:01:23 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1756fc0f
7
8 sys-auth/nss-pam-ldapd: Revision bump, make python deps optional
9
10 .../nss-pam-ldapd-0.9.8-pynslcd-module-paths.patch | 25 ++++
11 sys-auth/nss-pam-ldapd/files/pynslcd.initd | 28 ++++
12 sys-auth/nss-pam-ldapd/metadata.xml | 1 +
13 .../nss-pam-ldapd/nss-pam-ldapd-0.9.8-r1.ebuild | 164 +++++++++++++++++++++
14 4 files changed, 218 insertions(+)
15
16 diff --git a/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.8-pynslcd-module-paths.patch b/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.8-pynslcd-module-paths.patch
17 new file mode 100644
18 index 00000000000..11c86eff2e2
19 --- /dev/null
20 +++ b/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.8-pynslcd-module-paths.patch
21 @@ -0,0 +1,25 @@
22 +diff --git a/pynslcd/pynslcd.py b/pynslcd/pynslcd.py
23 +index d367a8c..9a52120 100755
24 +--- a/pynslcd.py
25 ++++ b/pynslcd.py
26 +@@ -30,13 +30,13 @@ import threading
27 + import daemon
28 + import ldap
29 +
30 +-from tio import TIOStream
31 +-import cfg
32 +-import common
33 +-import constants
34 +-import invalidator
35 +-import mypidfile
36 +-import search
37 ++from pynslcd.tio import TIOStream
38 ++import pynslcd.cfg as cfg
39 ++import pynslcd.common as common
40 ++import pynslcd.constants as constants
41 ++import pynslcd.invalidator as invalidator
42 ++import pynslcd.mypidfile as mypidfile
43 ++import pynslcd.search as search
44 +
45 +
46 + # the name of the program
47
48 diff --git a/sys-auth/nss-pam-ldapd/files/pynslcd.initd b/sys-auth/nss-pam-ldapd/files/pynslcd.initd
49 new file mode 100644
50 index 00000000000..7b6540810ae
51 --- /dev/null
52 +++ b/sys-auth/nss-pam-ldapd/files/pynslcd.initd
53 @@ -0,0 +1,28 @@
54 +#!/sbin/openrc-run
55 +# Copyright 1999-2015 Gentoo Foundation
56 +# Distributed under the terms of the GNU General Public License v2
57 +
58 +command=/usr/sbin/pynslcd
59 +pidfile=/var/run/nslcd/nslcd.pid
60 +extra_commands="checkconfig"
61 +cfg="/etc/nslcd.conf"
62 +
63 +depend() {
64 + need net
65 + use dns logger
66 +}
67 +
68 +checkconfig() {
69 + if [ ! -f "$cfg" ] ; then
70 + eerror "Please create $cfg"
71 + eerror "Example config: /usr/share/nss-ldapd/nslcd.conf"
72 + return 1
73 + fi
74 + return 0
75 +}
76 +
77 +start_pre() {
78 + checkpath -q -d /run/nslcd -o nslcd:nslcd
79 + checkconfig
80 + return $?
81 +}
82
83 diff --git a/sys-auth/nss-pam-ldapd/metadata.xml b/sys-auth/nss-pam-ldapd/metadata.xml
84 index f76306794b1..ad8b010a0a0 100644
85 --- a/sys-auth/nss-pam-ldapd/metadata.xml
86 +++ b/sys-auth/nss-pam-ldapd/metadata.xml
87 @@ -11,6 +11,7 @@
88 </maintainer>
89 <use>
90 <flag name="utils">Install the command-line utilities</flag>
91 + <flag name="pynslcd">Install the python implementation along with the standard implementation</flag>
92 </use>
93 <longdescription lang="en">
94 Provides a Name Service Switch (NSS) module that allows your LDAP
95
96 diff --git a/sys-auth/nss-pam-ldapd/nss-pam-ldapd-0.9.8-r1.ebuild b/sys-auth/nss-pam-ldapd/nss-pam-ldapd-0.9.8-r1.ebuild
97 new file mode 100644
98 index 00000000000..f8ec1cb488f
99 --- /dev/null
100 +++ b/sys-auth/nss-pam-ldapd/nss-pam-ldapd-0.9.8-r1.ebuild
101 @@ -0,0 +1,164 @@
102 +# Copyright 1999-2017 Gentoo Foundation
103 +# Distributed under the terms of the GNU General Public License v2
104 +
105 +EAPI=6
106 +
107 +PYTHON_COMPAT=(python2_7)
108 +inherit eutils prefix user python-r1 multilib multilib-minimal systemd s6
109 +
110 +DESCRIPTION="NSS module for name lookups using LDAP"
111 +HOMEPAGE="http://arthurdejong.org/nss-pam-ldapd/"
112 +SRC_URI="http://arthurdejong.org/${PN}/${P}.tar.gz"
113 +
114 +LICENSE="LGPL-2.1"
115 +SLOT="0"
116 +KEYWORDS="~amd64 ~x86"
117 +IUSE="debug kerberos +pam pynslcd sasl test +utils"
118 +
119 +COMMON_DEP="
120 + net-nds/openldap[${MULTILIB_USEDEP}]
121 + dev-python/python-ldap[${PYTHON_USEDEP}]
122 + sasl? ( dev-libs/cyrus-sasl[${MULTILIB_USEDEP}] )
123 + kerberos? ( virtual/krb5[${MULTILIB_USEDEP}] )
124 + virtual/pam[${MULTILIB_USEDEP}]
125 + utils? ( ${PYTHON_DEPS} )
126 + pynslcd? (
127 + dev-python/python-ldap[${PYTHON_USEDEP}]
128 + dev-python/python-daemon[${PYTHON_USEDEP}]
129 + )
130 + !sys-auth/nss_ldap
131 + !sys-auth/pam_ldap"
132 +RDEPEND="${COMMON_DEP}"
133 +DEPEND="${COMMON_DEP}
134 + test? (
135 + ${PYTHON_DEPS}
136 + dev-python/pylint[${PYTHON_USEDEP}]
137 + )
138 + sys-devel/automake"
139 +
140 +REQUIRED_USE="
141 + utils? ( ${PYTHON_REQUIRED_USE} )
142 + test? ( ${PYTHON_REQUIRED_USE} pynslcd )"
143 +
144 +PATCHES=(
145 + "${FILESDIR}"/${PN}-0.9.4-disable-py3-only-linters.patch
146 + "${FILESDIR}"/${PN}-0.9.8-pynslcd-module-paths.patch
147 +)
148 +
149 +pkg_setup() {
150 + enewgroup nslcd
151 + enewuser nslcd -1 -1 -1 nslcd
152 +}
153 +
154 +src_prepare() {
155 + cp pynslcd/pynslcd.py "${S}" || die "Copying pynslcd failed"
156 +
157 + default
158 + use utils && python_setup
159 + touch pynslcd/__init__.py || die "Could not create __init__.py for pynslcd"
160 +}
161 +
162 +multilib_src_configure() {
163 + local -a myconf
164 +
165 + myconf=(
166 + --disable-utils
167 + --enable-warnings
168 + --with-ldap-lib=openldap
169 + --with-ldap-conf-file=/etc/nslcd.conf
170 + --with-nslcd-pidfile=/run/nslcd/nslcd.pid
171 + --with-nslcd-socket=/run/nslcd/socket
172 + $(usex x86-fbsd '--with-nss-flavour=' '--with-nss-flavour=' 'freebsd' 'glibc')
173 + $(use_enable pynslcd)
174 + $(use_enable debug)
175 + $(use_enable kerberos)
176 + $(use_enable pam)
177 + $(use_enable sasl)
178 + )
179 +
180 + # nss libraries always go in /lib on Gentoo
181 + if multilib_is_native_abi ; then
182 + myconf+=("--with-pam-seclib-dir=${EPREFIX}/$(get_libdir)/security")
183 + myconf+=("--libdir=${EPREFIX}/$(get_libdir)")
184 + else
185 + myconf+=("--with-pam-seclib-dir=/$(get_libdir)/security")
186 + myconf+=("--libdir=/$(get_libdir)")
187 + fi
188 +
189 + ECONF_SOURCE="${S}" econf "${myconf[@]}"
190 +}
191 +
192 +multilib_src_install_all() {
193 + local script
194 +
195 + newinitd "${FILESDIR}"/nslcd-init-r1 nslcd
196 + newinitd "${FILESDIR}"/nslcd-init-r2 nslcd
197 + s6_install_service nslcd "${FILESDIR}"/nslcd-run-s6
198 +
199 + insinto /usr/share/nss-pam-ldapd
200 + doins "${WORKDIR}/${P}/nslcd.conf"
201 +
202 + fperms o-r /etc/nslcd.conf
203 +
204 + if use utils; then
205 + python_moduleinto nslcd
206 + python_foreach_impl python_domodule utils/*.py
207 +
208 + for script in chsh getent; do
209 + python_foreach_impl python_newscript utils/${script}.py ${script}.ldap
210 + done
211 + fi
212 + if use pynslcd; then
213 + rm -rf "${D}"/usr/share/pynslcd
214 + python_moduleinto pynslcd
215 + python_foreach_impl python_domodule pynslcd/*.py
216 + python_scriptinto /usr/sbin
217 + python_newscript pynslcd.py pynslcd
218 + newinitd "${FILESDIR}"/pynslcd.initd pynslcd
219 + fi
220 +
221 + systemd_newtmpfilesd "${FILESDIR}"/nslcd-tmpfiles.conf nslcd.conf
222 + systemd_dounit "${FILESDIR}"/nslcd.service
223 +}
224 +
225 +multilib_src_install() {
226 + emake DESTDIR="${D}" install
227 +
228 + if use pynslcd; then
229 + python_moduleinto pynslcd
230 + python_foreach_impl python_domodule pynslcd/*.py
231 + fi
232 +}
233 +
234 +python_test() {
235 + PYTHONPATH="${S}" emake check
236 +}
237 +
238 +multilib_src_test() {
239 + pushd "${BUILD_DIR}"
240 + ln -s ../pynslcd/constants.py utils/constants.py
241 + python_foreach_impl python_test
242 + popd
243 +}
244 +
245 +pkg_postinst() {
246 + echo
247 + elog "For this to work you must configure /etc/nslcd.conf"
248 + elog "This configuration is similar to pam_ldap's /etc/ldap.conf"
249 + echo
250 + elog "In order to use nss-pam-ldapd, nslcd needs to be running. You can"
251 + elog "start it like this:"
252 + elog " # /etc/init.d/nslcd start"
253 + echo
254 + elog "You can add it to the default runlevel like so:"
255 + elog " # rc-update add nslcd default"
256 + elog
257 + elog "If you have >=sys-apps/openrc-0.16.3, you can also use s6"
258 + elog "to supervise this service."
259 + elog "To do this, emerge sys-apps/s6 then add nslcd-s6"
260 + elog "default runlevel instead of nslcd."
261 + elog
262 + elog "If you are upgrading, keep in mind that /etc/nss-ldapd.conf"
263 + elog " is now named /etc/nslcd.conf"
264 + echo
265 +}