diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | api/examples/Makefile.am | 6 | ||||
-rw-r--r-- | api/examples/__init__.py.in | 1 | ||||
-rw-r--r-- | api/examples/setup.py.in | 5 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | glusterfs.spec.in | 61 | ||||
-rw-r--r-- | xlators/features/glupy/Makefile.am | 2 | ||||
-rw-r--r-- | xlators/features/glupy/examples/Makefile.am | 5 | ||||
-rw-r--r-- | xlators/features/glupy/examples/debug-trace.py (renamed from xlators/features/glupy/src/debug-trace.py) | 11 | ||||
-rw-r--r-- | xlators/features/glupy/examples/helloworld.py (renamed from xlators/features/glupy/src/helloworld.py) | 2 | ||||
-rw-r--r-- | xlators/features/glupy/examples/negative.py (renamed from xlators/features/glupy/src/negative.py) | 3 | ||||
-rw-r--r-- | xlators/features/glupy/src/Makefile.am | 13 | ||||
-rw-r--r-- | xlators/features/glupy/src/glupy.c | 5 | ||||
-rw-r--r-- | xlators/features/glupy/src/glupy.py (renamed from xlators/features/glupy/src/gluster.py) | 0 | ||||
-rw-r--r-- | xlators/features/glupy/src/setup.py.in | 24 |
15 files changed, 120 insertions, 25 deletions
diff --git a/.gitignore b/.gitignore index ff253c1da90..f0d04706e77 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,8 @@ Makefile stamp-h1 # Generated files -api/examples/__init__.py* +api/examples/__init__.py +api/examples/__init__.py? api/examples/setup.py argp-standalone/libargp.a contrib/uuid/uuid_types.h @@ -46,3 +47,4 @@ ufo/.tox ufo/test/unit/.coverage xlators/mount/fuse/utils/mount.glusterfs xlators/mount/fuse/utils/mount_glusterfs +xlators/features/glupy/src/setup.py diff --git a/api/examples/Makefile.am b/api/examples/Makefile.am index 05f40ff53ed..f1a8d12b29e 100644 --- a/api/examples/Makefile.am +++ b/api/examples/Makefile.am @@ -1,6 +1,10 @@ +# The bits needed for glfsxmp EXTRA_PROGRAMS = glfsxmp glfsxmp_SOURCES = glfsxmp.c glfsxmp_CFLAGS = $(GLFS_CFLAGS) -Wall glfsxmp_LDADD = $(GLFS_LIBS) -lrt -EXTRA_DIST = gfapi.py +# Install __init__.py (a generated file), and gfapi.py into +# the Python site-packages area +pygfapidir = $(pythondir)/gluster +pygfapi_PYTHON = __init__.py gfapi.py diff --git a/api/examples/__init__.py.in b/api/examples/__init__.py.in new file mode 100644 index 00000000000..280beb2dcec --- /dev/null +++ b/api/examples/__init__.py.in @@ -0,0 +1 @@ +__version__ = "@PACKAGE_VERSION@" diff --git a/api/examples/setup.py.in b/api/examples/setup.py.in index 44b73809486..f22fa1f3099 100644 --- a/api/examples/setup.py.in +++ b/api/examples/setup.py.in @@ -1,10 +1,5 @@ from distutils.core import setup -# generate a __init__.py for the package namespace -fo = open('__init__.py', 'w') -fo.write('__version__ = "@PACKAGE_VERSION@"\n') -fo.close() - DESC = """GlusterFS is a clustered file-system capable of scaling to several petabytes. It aggregates various storage bricks over Infiniband RDMA or TCP/IP interconnect into one large parallel network file system. diff --git a/configure.ac b/configure.ac index d80bd303ada..f1a9e6da267 100644 --- a/configure.ac +++ b/configure.ac @@ -104,7 +104,9 @@ AC_CONFIG_FILES([Makefile xlators/features/changelog/lib/Makefile xlators/features/changelog/lib/src/Makefile xlators/features/glupy/Makefile + xlators/features/glupy/examples/Makefile xlators/features/glupy/src/Makefile + xlators/features/glupy/src/setup.py xlators/features/locks/Makefile xlators/features/locks/src/Makefile xlators/features/quota/Makefile @@ -172,6 +174,7 @@ AC_CONFIG_FILES([Makefile api/Makefile api/src/Makefile api/examples/Makefile + api/examples/__init__.py api/examples/setup.py geo-replication/Makefile geo-replication/src/Makefile diff --git a/glusterfs.spec.in b/glusterfs.spec.in index 4beb210040e..9798ab2ba17 100644 --- a/glusterfs.spec.in +++ b/glusterfs.spec.in @@ -347,6 +347,25 @@ is in user space and easily manageable. This package provides the glusterfs libgfapi library. +%package extra-xlators +Summary: Extra Gluster filesystem Translators +Group: Applications/File +# We need -api rpm for its __init__.py in Python site-packages area +Requires: %{name}-api = %{version}-%{release} +Requires: python python-ctypes + +%description extra-xlators +GlusterFS is a clustered file-system capable of scaling to several +petabytes. It aggregates various storage bricks over Infiniband RDMA +or TCP/IP interconnect into one large parallel network file +system. GlusterFS is one of the most sophisticated file systems in +terms of features and extensibility. It borrows a powerful concept +called Translators from GNU Hurd kernel. Much of the code in GlusterFS +is in user space and easily manageable. + +This package provides extra filesystem Translators, such as Glupy, +for GlusterFS. + %if ( 0%{!?_without_ocf:1} ) %package resource-agents Summary: OCF Resource Agents for GlusterFS @@ -384,6 +403,8 @@ like Pacemaker. Summary: Development Libraries Group: Development/Libraries Requires: %{name} = %{version}-%{release} +# Needed for the Glupy examples to work +Requires: %{name}-extra-xlators = %{version}-%{release} %description devel GlusterFS is a clustered file-system capable of scaling to several @@ -451,6 +472,12 @@ sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|' libtool make %{?_smp_mflags} +# Build Glupy +pushd xlators/features/glupy/src +FLAGS="$RPM_OPT_FLAGS" python setup.py build +popd + +# Build the Python libgfapi examples pushd api/examples FLAGS="$RPM_OPT_FLAGS" python setup.py build popd @@ -458,6 +485,10 @@ popd %install rm -rf %{buildroot} make install DESTDIR=%{buildroot} +# install the Glupy Python library in /usr/lib/python*/site-packages +pushd xlators/features/glupy/src +python setup.py install --skip-build --verbose --root %{buildroot} +popd # install the gfapi Python library in /usr/lib/python*/site-packages pushd api/examples python setup.py install --skip-build --verbose --root %{buildroot} @@ -670,6 +701,8 @@ rm -rf %{buildroot} %exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol/server* %exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/mgmt* %exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/nfs* +# Glupy files are in the -extra-xlators package +%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy* # sample xlators not generally used or usable %exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/encryption/rot-13* %exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/mac-compat* @@ -805,9 +838,26 @@ fi %files api %exclude %{_libdir}/*.so +# Shared Python-GlusterFS files +%{python_sitelib}/gluster/__init__.* +# Libgfapi files %{_libdir}/libgfapi.* %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/mount/api* -%{python_sitelib}/* +%{python_sitelib}/gluster/gfapi.* +# Don't expect a .egg-info file on EL5 +%if ( 0%{?rhel} && 0%{?rhel} > 5 ) || ( 0%{?fedora} ) +%{python_sitelib}/glusterfs_api*.egg-info +%endif + +%files extra-xlators +# Glupy C shared library +%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy.so +# Glupy Python files +%{python_sitelib}/gluster/glupy.* +# Don't expect a .egg-info file on EL5 +%if ( 0%{?rhel} && 0%{?rhel} > 5 ) || ( 0%{?fedora} ) +%{python_sitelib}/glusterfs_glupy*.egg-info +%endif %if ( 0%{!?_without_ocf:1} ) %files resource-agents @@ -821,6 +871,10 @@ fi %exclude %{_includedir}/glusterfs/api %exclude %{_libdir}/libgfapi.so %{_libdir}/*.so +# Glupy Translator examples +%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy/debug-trace.* +%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy/helloworld.* +%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy/negative.* %files api-devel %{_libdir}/pkgconfig/glusterfs-api.pc @@ -898,6 +952,11 @@ fi * Wed Feb 26 2014 Niels de Vos <ndevos@redhat.com> - Drop glusterfs-devel dependency from glusterfs-api (#1065750) +* Wed Feb 19 2014 Justin Clift <justin@gluster.org> +- Rename gluster.py to glupy.py to avoid namespace conflict (#1018619) +- Move the main Glupy files into glusterfs-extra-xlators rpm +- Move the Glupy Translator examples into glusterfs-devel rpm + * Thu Feb 06 2014 Aravinda VK <avishwan@redhat.com> - Include geo-replication upgrade scripts and hook scripts. diff --git a/xlators/features/glupy/Makefile.am b/xlators/features/glupy/Makefile.am index a985f42a877..060429ecf0f 100644 --- a/xlators/features/glupy/Makefile.am +++ b/xlators/features/glupy/Makefile.am @@ -1,3 +1,3 @@ -SUBDIRS = src +SUBDIRS = src examples CLEANFILES = diff --git a/xlators/features/glupy/examples/Makefile.am b/xlators/features/glupy/examples/Makefile.am new file mode 100644 index 00000000000..c26abeaafb6 --- /dev/null +++ b/xlators/features/glupy/examples/Makefile.am @@ -0,0 +1,5 @@ +xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/features + +glupyexamplesdir = $(xlatordir)/glupy + +glupyexamples_PYTHON = negative.py helloworld.py debug-trace.py diff --git a/xlators/features/glupy/src/debug-trace.py b/xlators/features/glupy/examples/debug-trace.py index 53e76546b15..6eef1b58b8f 100644 --- a/xlators/features/glupy/src/debug-trace.py +++ b/xlators/features/glupy/examples/debug-trace.py @@ -2,12 +2,13 @@ import sys import stat from uuid import UUID from time import strftime, localtime -from gluster import * +from gluster.glupy import * + # This translator was written primarily to test the fop entry point definitions -# and structure definitions in 'gluster.py'. -# It is similar to the debug-trace translator, one of the already available -# translator types written in C, that logs the arguments passed to the fops and -# their corresponding cbk functions. +# and structure definitions in 'glupy.py'. + +# It is similar to the C language debug-trace translator, which logs the +# arguments passed to the fops and their corresponding cbk functions. dl.get_id.restype = c_long dl.get_id.argtypes = [ POINTER(call_frame_t) ] diff --git a/xlators/features/glupy/src/helloworld.py b/xlators/features/glupy/examples/helloworld.py index 8fe4037118e..b565a4e5bc3 100644 --- a/xlators/features/glupy/src/helloworld.py +++ b/xlators/features/glupy/examples/helloworld.py @@ -1,5 +1,5 @@ import sys -from gluster import * +from gluster.glupy import * class xlator (Translator): diff --git a/xlators/features/glupy/src/negative.py b/xlators/features/glupy/examples/negative.py index 1023602b9f3..e7a4fc07ced 100644 --- a/xlators/features/glupy/src/negative.py +++ b/xlators/features/glupy/examples/negative.py @@ -1,6 +1,6 @@ import sys from uuid import UUID -from gluster import * +from gluster.glupy import * # Negative-lookup-caching example. If a file wasn't there the last time we # looked, it's probably still not there. This translator keeps track of @@ -89,4 +89,3 @@ class xlator (Translator): dl.unwind_create(frame,cookie,this,op_ret,op_errno,fd,inode,buf, preparent,postparent,xdata) return 0 - diff --git a/xlators/features/glupy/src/Makefile.am b/xlators/features/glupy/src/Makefile.am index 9608628398f..9ba33a1f2c6 100644 --- a/xlators/features/glupy/src/Makefile.am +++ b/xlators/features/glupy/src/Makefile.am @@ -1,11 +1,12 @@ xlator_LTLIBRARIES = glupy.la +# Ensure GLUSTER_PYTHON_PATH is passed to glupy.so xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/features - glupydir = $(xlatordir)/glupy +AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src -isystem $(BUILD_PYTHON_INC) +AM_CFLAGS = -Wall -fno-strict-aliasing -DGLUSTER_PYTHON_PATH=\"$(glupydir)\" $(GF_CFLAGS) -glupy_PYTHON = gluster.py negative.py helloworld.py debug-trace.py - +# Flags to build glupy.so with glupy_la_LDFLAGS = -module -avoid-version -shared -nostartfiles glupy_la_SOURCES = glupy.c glupy_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \ @@ -13,8 +14,8 @@ glupy_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \ noinst_HEADERS = glupy.h -AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src -isystem $(BUILD_PYTHON_INC) - -AM_CFLAGS = -Wall -fno-strict-aliasing -DGLUSTER_PYTHON_PATH=\"$(glupydir)\" $(GF_CFLAGS) +# Install glupy.py into the Python site-packages area +pyglupydir = $(pythondir)/gluster +pyglupy_PYTHON = glupy.py CLEANFILES = diff --git a/xlators/features/glupy/src/glupy.c b/xlators/features/glupy/src/glupy.c index dc86c0071e1..948b66f8d11 100644 --- a/xlators/features/glupy/src/glupy.c +++ b/xlators/features/glupy/src/glupy.c @@ -2365,7 +2365,7 @@ init (xlator_t *this) goto *err_cleanup; } - gf_log (this->name, GF_LOG_ERROR, "py_mod_name = %s", module_name); + gf_log (this->name, GF_LOG_DEBUG, "py_mod_name = %s", module_name); priv->py_module = PyImport_Import(py_mod_name); Py_DECREF(py_mod_name); if (!priv->py_module) { @@ -2375,6 +2375,7 @@ init (xlator_t *this) } goto *err_cleanup; } + gf_log (this->name, GF_LOG_INFO, "Import of %s succeeded", module_name); err_cleanup = &&err_deref_module; py_init_func = PyObject_GetAttrString(priv->py_module, "xlator"); @@ -2407,7 +2408,7 @@ init (xlator_t *this) } goto *err_cleanup; } - gf_log (this->name, GF_LOG_INFO, "init returned %p", priv->py_xlator); + gf_log (this->name, GF_LOG_DEBUG, "init returned %p", priv->py_xlator); return 0; diff --git a/xlators/features/glupy/src/gluster.py b/xlators/features/glupy/src/glupy.py index a5daa77d32a..a5daa77d32a 100644 --- a/xlators/features/glupy/src/gluster.py +++ b/xlators/features/glupy/src/glupy.py diff --git a/xlators/features/glupy/src/setup.py.in b/xlators/features/glupy/src/setup.py.in new file mode 100644 index 00000000000..1aea9875f0a --- /dev/null +++ b/xlators/features/glupy/src/setup.py.in @@ -0,0 +1,24 @@ +from distutils.core import setup + +DESC = """GlusterFS is a clustered file-system capable of scaling to +several petabytes. It aggregates various storage bricks over Infiniband +RDMA or TCP/IP interconnect into one large parallel network file system. +GlusterFS is one of the most sophisticated file systems in terms of +features and extensibility. It borrows a powerful concept called +Translators from GNU Hurd kernel. Much of the code in GlusterFS is in +user space and easily manageable. + +This package contains Glupy, the Python translator interface for GlusterFS.""" + +setup( + name='glusterfs-glupy', + version='@PACKAGE_VERSION@', + description='Glupy is the Python translator interface for GlusterFS', + long_description=DESC, + author='Gluster Community', + author_email='gluster-devel@nongnu.org', + license='LGPLv3', + url='http://gluster.org/', + package_dir={'gluster':''}, + packages=['gluster'] +) |