aboutsummaryrefslogtreecommitdiff
path: root/sysutils/py-zfs
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2010-07-11 10:16:10 +0000
committerMartin Matuska <mm@FreeBSD.org>2010-07-11 10:16:10 +0000
commit430df3ca3ccb4e8427fbaddc9bd3d18fe9dddcf1 (patch)
tree0d3aa29d0b1b0eb7f241747617457a5ea53a15a7 /sysutils/py-zfs
parent91618c2c765235dfeaafc629c227b18a9fcc699f (diff)
downloadports-430df3ca3ccb4e8427fbaddc9bd3d18fe9dddcf1.tar.gz
ports-430df3ca3ccb4e8427fbaddc9bd3d18fe9dddcf1.zip
The Python ZFS library is a Python interface to ZFS functions.
Since ZFS v15, the following functionality of the "zfs" command requires this port installed: zfs allow zfs unallow zfs userspace zfs groupspace
Notes
Notes: svn path=/head/; revision=257636
Diffstat (limited to 'sysutils/py-zfs')
-rw-r--r--sysutils/py-zfs/Makefile66
-rw-r--r--sysutils/py-zfs/files/Makefile.lib30
-rw-r--r--sysutils/py-zfs/files/compile.py.in12
-rw-r--r--sysutils/py-zfs/pkg-descr9
-rw-r--r--sysutils/py-zfs/pkg-plist28
5 files changed, 145 insertions, 0 deletions
diff --git a/sysutils/py-zfs/Makefile b/sysutils/py-zfs/Makefile
new file mode 100644
index 000000000000..19eaed527183
--- /dev/null
+++ b/sysutils/py-zfs/Makefile
@@ -0,0 +1,66 @@
+# New ports collection makefile for: pyzfs
+# Date created: 11 July 2010
+# Whom: Martin Matuska <mm@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= zfs
+PORTVERSION= 1
+CATEGORIES= sysutils python
+MASTER_SITES= # none
+PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
+DISTFILES= # none
+
+MAINTAINER= mm@FreeBSD.org
+COMMENT= Python ZFS library
+
+USE_PYTHON= 2.4+
+MAKEFILE= ${FILESDIR}/Makefile.lib
+MAKE_ARGS+= PYTHON_INCLUDEDIR="${PYTHON_INCLUDEDIR}" \
+ PYTHON_LDFLAGS="-L${LOCALBASE}/lib -l${PYTHON_VERSION}"
+NO_WRKSUBDIR= yes
+SRCDIR?= /usr/src
+
+SUB_FILES+= compile.py
+SUB_LIST+= PYTHON_CMD=${PYTHON_CMD}
+
+PYFILES= __init__.py \
+ allow.py \
+ dataset.py \
+ groupspace.py\
+ unallow.py \
+ userspace.py \
+ util.py
+
+.if !exists(${SRCDIR}/cddl/contrib/opensolaris/lib/pyzfs) || \
+ !exists(${SRCDIR}/cddl/contrib/opensolaris/cmd/pyzfs)
+IGNORE= requires ZFS v15 or higher sources with pyzfs (in ${SRCDIR})
+.endif
+
+post-patch:
+ @${MKDIR} ${WRKSRC}
+ @${SED} -e "s|/usr/bin/python2.4|${PYTHON_CMD}|g" \
+ ${SRCDIR}/cddl/contrib/opensolaris/cmd/pyzfs/pyzfs.py \
+ > ${WRKSRC}/pyzfs.py
+.for PYFILE in ${PYFILES}
+ @${SED} -e "s|/usr/bin/python2.4|${PYTHON_CMD}|g" \
+ ${SRCDIR}/cddl/contrib/opensolaris/lib/pyzfs/common/${PYFILE} \
+ > ${WRKSRC}/${PYFILE}
+.endfor
+
+do-install:
+ ${MKDIR} ${PYTHONPREFIX_SITELIBDIR}/zfs
+.for PYFILE in ${PYFILES}
+ ${INSTALL_DATA} ${WRKSRC}/${PYFILE} \
+ ${PYTHONPREFIX_SITELIBDIR}/zfs
+.endfor
+ ${INSTALL_DATA} ${WRKSRC}/ioctl.so ${PYTHONPREFIX_SITELIBDIR}/zfs
+ @${PYTHON_CMD} ${WRKDIR}/compile.py ${PYTHONPREFIX_SITELIBDIR}/zfs
+ @${PYTHON_CMD} -O ${WRKDIR}/compile.py ${PYTHONPREFIX_SITELIBDIR}/zfs
+ ${MKDIR} /usr/lib/zfs
+ ${INSTALL_SCRIPT} ${WRKSRC}/pyzfs.py /usr/lib/zfs
+ @${PYTHON_CMD} ${WRKDIR}/compile.py /usr/lib/zfs
+ @${PYTHON_CMD} -O ${WRKDIR}/compile.py /usr/lib/zfs
+
+.include <bsd.port.mk>
diff --git a/sysutils/py-zfs/files/Makefile.lib b/sysutils/py-zfs/files/Makefile.lib
new file mode 100644
index 000000000000..e26574cabc0d
--- /dev/null
+++ b/sysutils/py-zfs/files/Makefile.lib
@@ -0,0 +1,30 @@
+# $FreeBSD$
+
+SRCDIR?= /usr/src
+
+.PATH: ${SRCDIR}/cddl/contrib/opensolaris/lib/pyzfs/common
+
+SRCS= ioctl.c
+
+SHLIB_NAME= ioctl.so
+LIB= ioctl
+DPADD= ${LIBGEOM} ${LIBZFS} ${LIBNVPAIR} ${LIBUUTIL}
+LDADD= -lgeom -lzfs -lnvpair -luutil ${PYTHON_LDFLAGS}
+
+CFLAGS+= -DNEED_SOLARIS_BOOLEAN
+CFLAGS+= -I${SRCDIR}/sys/cddl/compat/opensolaris
+CFLAGS+= -I${SRCDIR}/cddl/compat/opensolaris/include
+CFLAGS+= -I${SRCDIR}/cddl/compat/opensolaris/lib/libumem
+CFLAGS+= -I${SRCDIR}/cddl/contrib/opensolaris/lib/libzpool/common
+CFLAGS+= -I${SRCDIR}/sys/cddl/contrib/opensolaris/common/zfs
+CFLAGS+= -I${SRCDIR}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
+CFLAGS+= -I${SRCDIR}/sys/cddl/contrib/opensolaris/uts/common/sys
+CFLAGS+= -I${SRCDIR}/sys/cddl/contrib/opensolaris/uts/common
+CFLAGS+= -I${SRCDIR}/cddl/contrib/opensolaris/head
+CFLAGS+= -I${SRCDIR}/cddl/contrib/opensolaris/uts/common
+CFLAGS+= -I${SRCDIR}/cddl/contrib/opensolaris/lib/libnvpair
+CFLAGS+= -I${SRCDIR}/cddl/contrib/opensolaris/lib/libuutil/common
+CFLAGS+= -I${SRCDIR}/cddl/contrib/opensolaris/lib/libzfs/common
+CFLAGS+= -I${PYTHON_INCLUDEDIR}
+
+.include <bsd.lib.mk>
diff --git a/sysutils/py-zfs/files/compile.py.in b/sysutils/py-zfs/files/compile.py.in
new file mode 100644
index 000000000000..ceef660ab03c
--- /dev/null
+++ b/sysutils/py-zfs/files/compile.py.in
@@ -0,0 +1,12 @@
+#!%%PYTHON_CMD%%
+import sys
+import compileall
+
+import sys
+
+try:
+ sys.argv[1]
+except IndexError:
+ print "Path missing"
+else:
+ compileall.compile_dir(sys.argv[1], force=True)
diff --git a/sysutils/py-zfs/pkg-descr b/sysutils/py-zfs/pkg-descr
new file mode 100644
index 000000000000..e8fe9c6aeb44
--- /dev/null
+++ b/sysutils/py-zfs/pkg-descr
@@ -0,0 +1,9 @@
+The Python ZFS library is a Python interface to ZFS functions.
+
+Since ZFS v15, the following functionality of the "zfs" command
+requires this library and the pyzfs utility:
+
+zfs allow
+zfs unallow
+zfs userspace
+zfs groupspace
diff --git a/sysutils/py-zfs/pkg-plist b/sysutils/py-zfs/pkg-plist
new file mode 100644
index 000000000000..cf5e3f4ab9dc
--- /dev/null
+++ b/sysutils/py-zfs/pkg-plist
@@ -0,0 +1,28 @@
+%%PYTHON_SITELIBDIR%%/zfs/__init__.py
+%%PYTHON_SITELIBDIR%%/zfs/__init__.pyc
+%%PYTHON_SITELIBDIR%%/zfs/__init__.pyo
+%%PYTHON_SITELIBDIR%%/zfs/allow.py
+%%PYTHON_SITELIBDIR%%/zfs/allow.pyc
+%%PYTHON_SITELIBDIR%%/zfs/allow.pyo
+%%PYTHON_SITELIBDIR%%/zfs/dataset.py
+%%PYTHON_SITELIBDIR%%/zfs/dataset.pyc
+%%PYTHON_SITELIBDIR%%/zfs/dataset.pyo
+%%PYTHON_SITELIBDIR%%/zfs/groupspace.py
+%%PYTHON_SITELIBDIR%%/zfs/groupspace.pyc
+%%PYTHON_SITELIBDIR%%/zfs/groupspace.pyo
+%%PYTHON_SITELIBDIR%%/zfs/ioctl.so
+%%PYTHON_SITELIBDIR%%/zfs/unallow.py
+%%PYTHON_SITELIBDIR%%/zfs/unallow.pyc
+%%PYTHON_SITELIBDIR%%/zfs/unallow.pyo
+%%PYTHON_SITELIBDIR%%/zfs/userspace.py
+%%PYTHON_SITELIBDIR%%/zfs/userspace.pyc
+%%PYTHON_SITELIBDIR%%/zfs/userspace.pyo
+%%PYTHON_SITELIBDIR%%/zfs/util.py
+%%PYTHON_SITELIBDIR%%/zfs/util.pyc
+%%PYTHON_SITELIBDIR%%/zfs/util.pyo
+@dirrm %%PYTHON_SITELIBDIR%%/zfs
+@cwd /usr/lib
+zfs/pyzfs.py
+zfs/pyzfs.pyc
+zfs/pyzfs.pyo
+@dirrm zfs