aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2014-09-02 10:38:28 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2014-09-02 10:38:28 +0000
commitbea7ca8a4ca23a8ed0836389c1f105091d2dc34a (patch)
tree942a88001eb695400030d5fcbc0035c9288915e8
parentadf2b211f7bdf8c16c5a40c16d2541f32c80136f (diff)
downloadports-bea7ca8a4ca23a8ed0836389c1f105091d2dc34a.tar.gz
ports-bea7ca8a4ca23a8ed0836389c1f105091d2dc34a.zip
Resurrect it was actually staged
Reported by: koobs
Notes
Notes: svn path=/head/; revision=366982
-rw-r--r--sysutils/Makefile1
-rw-r--r--sysutils/py-zfs/Makefile89
-rw-r--r--sysutils/py-zfs/files/Makefile.lib31
-rw-r--r--sysutils/py-zfs/files/Makefile.lib.v2830
-rw-r--r--sysutils/py-zfs/files/compile.py.in12
-rw-r--r--sysutils/py-zfs/files/extra-patch-userspace.py43
-rw-r--r--sysutils/py-zfs/files/extra-patch-util.py24
-rw-r--r--sysutils/py-zfs/pkg-descr9
-rw-r--r--sysutils/py-zfs/pkg-plist34
9 files changed, 273 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile
index 08d5ca714573..7c217bbf769d 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -736,6 +736,7 @@
SUBDIR += py-stdiff
SUBDIR += py-supervisor
SUBDIR += py-zdaemon
+ SUBDIR += py-zfs
SUBDIR += pydf
SUBDIR += qchroot
SUBDIR += qjail
diff --git a/sysutils/py-zfs/Makefile b/sysutils/py-zfs/Makefile
new file mode 100644
index 000000000000..a5eb68d5d8fd
--- /dev/null
+++ b/sysutils/py-zfs/Makefile
@@ -0,0 +1,89 @@
+# Created by: Martin Matuska <mm@FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME= zfs
+PORTVERSION= 1
+PORTREVISION= 4
+CATEGORIES= sysutils python
+MASTER_SITES= # none
+PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
+DISTFILES= # none
+
+MAINTAINER= ports@FreeBSD.org
+COMMENT= Python ZFS library
+
+LICENSE= CDDL
+LICENSE_FILE= ${WRKSRC}/OPENSOLARIS.LICENSE
+
+USES= python:2
+MAKEFILE= ${FILESDIR}/Makefile.lib
+MAKE_ARGS+= PYTHON_INCLUDEDIR="${PYTHON_INCLUDEDIR}" \
+ PYTHON_LDFLAGS="-L${LOCALBASE}/lib -l${PYTHON_VERSION}"
+NO_WRKSUBDIR= yes
+
+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
+
+.include <bsd.port.pre.mk>
+
+.if !exists(${SRC_BASE}/cddl/contrib/opensolaris/lib/pyzfs) || \
+ !exists(${SRC_BASE}/cddl/contrib/opensolaris/cmd/pyzfs)
+IGNORE= requires ZFS v15 or higher sources with pyzfs (in ${SRC_BASE})
+.endif
+
+.if !exists(${SRC_BASE}/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h)
+MAKEFILE= ${FILESDIR}/Makefile.lib.v28
+.endif
+
+.if exists(${SRC_BASE}/cddl/contrib/opensolaris/lib/pyzfs/common/holds.py) && \
+exists(${SRC_BASE}/cddl/contrib/opensolaris/lib/pyzfs/common/table.py)
+PYFILES+= holds.py \
+ table.py
+PLIST_SUB+= V28=""
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-util.py \
+ ${FILESDIR}/extra-patch-userspace.py
+.else
+PLIST_SUB+= V28="@comment "
+.endif
+
+do-extract:
+ @${MKDIR} ${WRKSRC}
+ @${CP} ${SRC_BASE}/cddl/contrib/opensolaris/OPENSOLARIS.LICENSE \
+ ${WRKSRC}/OPENSOLARIS.LICENSE
+ @${CP} ${SRC_BASE}/cddl/contrib/opensolaris/cmd/pyzfs/pyzfs.py \
+ ${WRKSRC}/pyzfs.py
+.for PYFILE in ${PYFILES}
+ @${CP} ${SRC_BASE}/cddl/contrib/opensolaris/lib/pyzfs/common/${PYFILE} \
+ ${WRKSRC}/${PYFILE}
+.endfor
+
+post-patch:
+
+.for PYFILE in pyzfs.py ${PYFILES}
+ @${REINPLACE_CMD} -e "s|#! /usr/bin/python.*|#! ${PYTHON_CMD}|g" \
+ ${WRKSRC}/${PYFILE}
+.endfor
+
+do-install:
+ ${MKDIR} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/zfs
+.for PYFILE in ${PYFILES}
+ ${INSTALL_DATA} ${WRKSRC}/${PYFILE} \
+ ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/zfs
+.endfor
+ ${INSTALL_DATA} ${WRKSRC}/ioctl.so ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/zfs
+ @${PYTHON_CMD} ${WRKDIR}/compile.py ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/zfs
+ @${PYTHON_CMD} -O ${WRKDIR}/compile.py ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/zfs
+ ${MKDIR} ${STAGEDIR}/usr/lib/zfs
+ ${INSTALL_SCRIPT} ${WRKSRC}/pyzfs.py ${STAGEDIR}/usr/lib/zfs
+ @${PYTHON_CMD} ${WRKDIR}/compile.py ${STAGEDIR}/usr/lib/zfs
+ @${PYTHON_CMD} -O ${WRKDIR}/compile.py ${STAGEDIR}/usr/lib/zfs
+
+.include <bsd.port.post.mk>
diff --git a/sysutils/py-zfs/files/Makefile.lib b/sysutils/py-zfs/files/Makefile.lib
new file mode 100644
index 000000000000..e5a351ee58b8
--- /dev/null
+++ b/sysutils/py-zfs/files/Makefile.lib
@@ -0,0 +1,31 @@
+# $FreeBSD$
+
+SRCDIR?= /usr/src
+
+.PATH: ${SRCDIR}/cddl/contrib/opensolaris/lib/pyzfs/common
+
+SRCS= ioctl.c
+
+SHLIB_NAME= ioctl.so
+LIB= ioctl
+DPADD= ${LIBGEOM} ${LIBZFS} ${LIBZFS_CORE} ${LIBNVPAIR} ${LIBUUTIL}
+LDADD= -lgeom -lzfs -lzfs_core -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_core/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/Makefile.lib.v28 b/sysutils/py-zfs/files/Makefile.lib.v28
new file mode 100644
index 000000000000..e26574cabc0d
--- /dev/null
+++ b/sysutils/py-zfs/files/Makefile.lib.v28
@@ -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/files/extra-patch-userspace.py b/sysutils/py-zfs/files/extra-patch-userspace.py
new file mode 100644
index 000000000000..58b574be7cef
--- /dev/null
+++ b/sysutils/py-zfs/files/extra-patch-userspace.py
@@ -0,0 +1,43 @@
+--- userspace.py.orig 2010-12-23 09:35:39.917675583 +0100
++++ userspace.py 2010-12-23 09:52:20.873003971 +0100
+@@ -30,7 +30,6 @@
+ import pwd
+ import grp
+ import errno
+-import solaris.misc
+ import zfs.util
+ import zfs.ioctl
+ import zfs.dataset
+@@ -68,9 +67,9 @@
+ idstr = "%u" % rid
+
+ (typename, mapfunc) = {
+- (1, 1): ("SMB Group", lambda id: solaris.misc.sid_to_name(id, 0)),
++ (1, 1): ("SMB Group", id),
+ (1, 0): ("POSIX Group", lambda id: grp.getgrgid(int(id)).gr_name),
+- (0, 1): ("SMB User", lambda id: solaris.misc.sid_to_name(id, 1)),
++ (0, 1): ("SMB User", id),
+ (0, 0): ("POSIX User", lambda id: pwd.getpwuid(int(id)).pw_name)
+ }[isgroup, bool(domain)]
+
+@@ -107,13 +106,13 @@
+ (domain, rid, value) = elem
+ (field, isgroup) = props[prop]
+
+- if options.translate and domain:
+- try:
+- rid = solaris.misc.sid_to_id("%s-%u" % (domain, rid),
+- not isgroup)
+- domain = None
+- except KeyError:
+- pass;
++# if options.translate and domain:
++# try:
++# rid = solaris.misc.sid_to_id("%s-%u" % (domain, rid),
++# not isgroup)
++# domain = None
++# except KeyError:
++# pass;
+ key = (isgroup, domain, rid)
+
+ try:
diff --git a/sysutils/py-zfs/files/extra-patch-util.py b/sysutils/py-zfs/files/extra-patch-util.py
new file mode 100644
index 000000000000..d1f77623f561
--- /dev/null
+++ b/sysutils/py-zfs/files/extra-patch-util.py
@@ -0,0 +1,24 @@
+--- util.py.orig 2010-12-23 09:07:09.188744296 +0100
++++ util.py 2010-12-23 09:10:16.315849339 +0100
+@@ -28,7 +28,6 @@
+ import gettext
+ import errno
+ import os
+-import solaris.misc
+ # Note: this module (zfs.util) should not import zfs.ioctl, because that
+ # would introduce a circular dependency
+
+@@ -37,11 +36,8 @@
+
+ dev = open("/dev/zfs", "w")
+
+-try:
+- _ = gettext.translation("SUNW_OST_OSLIB", "/usr/lib/locale",
+- fallback=True).gettext
+-except:
+- _ = solaris.misc.gettext
++_ = gettext.translation("SUNW_OST_OSLIB", "/usr/lib/locale",
++ fallback=True).gettext
+
+ def default_repr(self):
+ """A simple __repr__ function."""
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..df6af218a10c
--- /dev/null
+++ b/sysutils/py-zfs/pkg-plist
@@ -0,0 +1,34 @@
+%%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
+%%V28%%%%PYTHON_SITELIBDIR%%/zfs/holds.py
+%%V28%%%%PYTHON_SITELIBDIR%%/zfs/holds.pyc
+%%V28%%%%PYTHON_SITELIBDIR%%/zfs/holds.pyo
+%%PYTHON_SITELIBDIR%%/zfs/ioctl.so
+%%V28%%%%PYTHON_SITELIBDIR%%/zfs/table.py
+%%V28%%%%PYTHON_SITELIBDIR%%/zfs/table.pyc
+%%V28%%%%PYTHON_SITELIBDIR%%/zfs/table.pyo
+%%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