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
This commit is contained in:
Martin Matuska 2010-07-11 10:16:10 +00:00
parent 91618c2c76
commit 430df3ca3c
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=257636
6 changed files with 146 additions and 0 deletions

View File

@ -665,6 +665,7 @@
SUBDIR += py-psutil
SUBDIR += py-supervisor
SUBDIR += py-zdaemon
SUBDIR += py-zfs
SUBDIR += pydf
SUBDIR += pyrenamer
SUBDIR += qlogtools

66
sysutils/py-zfs/Makefile Normal file
View File

@ -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>

View File

@ -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>

View File

@ -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)

View File

@ -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

28
sysutils/py-zfs/pkg-plist Normal file
View File

@ -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