From 6b8a9b9fef57677cc17bff0205a4b549a4e90469 Mon Sep 17 00:00:00 2001
From: Johannes Jost Meixner <xmj@FreeBSD.org>
Date: Mon, 11 May 2015 17:18:55 +0000
Subject: net/nsscache: add port

nsscache is a utility for caching directory service information into local
cache files.

On FreeBSD, it is intended to be used with the net/libnss-cache port but it
can also output BDB files for use by other operating systems.

WWW: https://github.com/google/nsscache

PR:		200123
Submitted by:	Kevin Bowling <kevin.bowling@kev009.com>
Obtained from:	Limelight Networks
---
 net/Makefile                           |  1 +
 net/nsscache/Makefile                  | 38 ++++++++++++++++++++++++++++++++++
 net/nsscache/distinfo                  |  2 ++
 net/nsscache/files/patch-nsscache.conf | 38 ++++++++++++++++++++++++++++++++++
 net/nsscache/files/patch-setup.py      |  9 ++++++++
 net/nsscache/pkg-descr                 |  7 +++++++
 6 files changed, 95 insertions(+)
 create mode 100644 net/nsscache/Makefile
 create mode 100644 net/nsscache/distinfo
 create mode 100644 net/nsscache/files/patch-nsscache.conf
 create mode 100644 net/nsscache/files/patch-setup.py
 create mode 100644 net/nsscache/pkg-descr

(limited to 'net')

diff --git a/net/Makefile b/net/Makefile
index f7dfa7628b6c..bf2be08737d2 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -431,6 +431,7 @@
     SUBDIR += nss-pam-ldapd
     SUBDIR += nss-pam-ldapd-sasl
     SUBDIR += nss_ldap
+    SUBDIR += nsscache
     SUBDIR += nstxd
     SUBDIR += ntimed
     SUBDIR += ntlmaps
diff --git a/net/nsscache/Makefile b/net/nsscache/Makefile
new file mode 100644
index 000000000000..ccd0e5fe3a35
--- /dev/null
+++ b/net/nsscache/Makefile
@@ -0,0 +1,38 @@
+# Created by: Kevin Bowling <k@kev009.com>
+# $FreeBSD$
+
+PORTNAME=	nsscache
+PORTVERSION=	0.29
+CATEGORIES=	net python
+
+MAINTAINER=	k@kev009.com
+COMMENT=	Python utility to create a local cache of directory services
+
+LICENSE=	GPLv2
+LICENSE_FILE=	${WRKSRC}/COPYING
+
+RUN_DEPENDS=	${PYTHON_SITELIBDIR}/pycurl.so:${PORTSDIR}/ftp/py-curl \
+		${PYTHON_PKGNAMEPREFIX}ldap2>0:${PORTSDIR}/net/py-ldap2 \
+		${PYTHON_PKGNAMEPREFIX}bsddb>0:${PORTSDIR}/databases/py-bsddb
+
+USES=		python:2
+USE_PYTHON=	autoplist distutils
+USE_GITHUB=	yes
+GH_ACCOUNT=	google
+GH_TAGNAME=	version/${DISTVERSION}
+
+PLIST_FILES=	'@sample etc/nsscache.conf.sample' '@dir /var/db/nsscache' \
+		man/man1/nsscache.1.gz man/man5/nsscache.conf.5.gz
+
+post-patch:
+	@${REINPLACE_CMD} -e 's|/etc/nsscache.conf|${PREFIX}/etc/nsscache.conf|g' ${WRKSRC}/nss_cache/config.py
+	@${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/nsscache.conf
+	@${REINPLACE_CMD} -e "s|/var/lib/misc|/var/db/nsscache|g" ${WRKSRC}/nsscache.conf.5
+
+post-install:
+	${INSTALL_DATA} ${WRKSRC}/nsscache.conf ${STAGEDIR}${PREFIX}/etc/nsscache.conf.sample
+	${INSTALL_MAN} ${WRKSRC}/nsscache.1 ${STAGEDIR}${MANPREFIX}/man/man1
+	${INSTALL_MAN} ${WRKSRC}/nsscache.conf.5 ${STAGEDIR}${MANPREFIX}/man/man5
+	@${MKDIR} ${STAGEDIR}/var/db/nsscache
+
+.include <bsd.port.mk>
diff --git a/net/nsscache/distinfo b/net/nsscache/distinfo
new file mode 100644
index 000000000000..926151acccf4
--- /dev/null
+++ b/net/nsscache/distinfo
@@ -0,0 +1,2 @@
+SHA256 (google-nsscache-0.29-version-0.29_GH0.tar.gz) = 631cd032eecdbf27d276540d9e5bb945fced6e71bb3bc8f64475d80c472d9308
+SIZE (google-nsscache-0.29-version-0.29_GH0.tar.gz) = 106591
diff --git a/net/nsscache/files/patch-nsscache.conf b/net/nsscache/files/patch-nsscache.conf
new file mode 100644
index 000000000000..69424443d250
--- /dev/null
+++ b/net/nsscache/files/patch-nsscache.conf
@@ -0,0 +1,38 @@
+--- nsscache.conf.orig	2014-10-21 10:32:31 UTC
++++ nsscache.conf
+@@ -2,7 +2,7 @@
+ #
+ # nsscache loads a config file from the environment variable NSSCACHE_CONFIG
+ #
+-# By default this is /etc/nsscache.conf
++# By default this is %%PREFIX%%/etc/nsscache.conf
+ #
+ # Commented values are overrideable defaults, uncommented values
+ # require you to set them.
+@@ -13,14 +13,14 @@
+ source = ldap
+ 
+ # Default NSS data cache module name
+-cache = nssdb
+-#cache = files
++#cache = nssdb
++cache = files
+ 
+ # NSS maps to be cached
+ maps = passwd, group, shadow, netgroup, automount
+ 
+ # Directory to store our update/modify timestamps
+-timestamp_dir = /var/lib/nsscache
++timestamp_dir = /var/db/nsscache
+ 
+ # Lockfile to use for update/repair operations
+ #lockfile = /var/run/nsscache
+@@ -89,7 +89,7 @@ ldap_filter = (objectclass=posixAccount)
+ 
+ # Directory to store nssdb databases.  Current libnss_db code requires
+ # the path below
+-nssdb_dir = /var/lib/misc
++nssdb_dir = /var/db/nsscache
+ 
+ # Path to `makedb', supplied by the nss_db module
+ #nssdb_makedb = /usr/bin/makedb
diff --git a/net/nsscache/files/patch-setup.py b/net/nsscache/files/patch-setup.py
new file mode 100644
index 000000000000..7b8bfda09cd3
--- /dev/null
+++ b/net/nsscache/files/patch-setup.py
@@ -0,0 +1,9 @@
+--- setup.py.orig	2014-10-21 10:32:31 UTC
++++ setup.py
+@@ -48,5 +48,4 @@ as LDAP.''',
+                                'nss_cache.util',
+                                'nss_cache.update',
+                                'nss_cache.sources'],
+-                     scripts=['nsscache'],
+-                     data_files=[('/etc', ['nsscache.conf'])])
++                     scripts=['nsscache'])
diff --git a/net/nsscache/pkg-descr b/net/nsscache/pkg-descr
new file mode 100644
index 000000000000..f81aa20d38c4
--- /dev/null
+++ b/net/nsscache/pkg-descr
@@ -0,0 +1,7 @@
+nsscache is a utility for caching directory service information into local
+cache files.
+
+On FreeBSD, it is intended to be used with the net/libnss-cache port but it
+can also output BDB files for use by other operating systems.
+
+WWW: https://github.com/google/nsscache
-- 
cgit debian/1.2.3+git2.25.1-1-2-gaceb0