Accepting request 591649 from home:jfehlig:branches:Virtualization
- Fix module initialization to work with both python2 and python3 Updated sanlock-python3.patch bsc#1076414 - Add code to build with both python2 and python3 bindings with provided condition so we can later on optionalize python2 builds sanlock-python3.patch bsc#1076414 - Cleanup with spec-cleaner (only support SLE12 and newer) - Add -fno-strict-aliasing to python subpkg - Create rcsanlk-resetd link for the service control OBS-URL: https://build.opensuse.org/request/show/591649 OBS-URL: https://build.opensuse.org/package/show/Virtualization/sanlock?expand=0&rev=46
This commit is contained in:
parent
107c6db1f9
commit
92e72bfed7
397
sanlock-python3.patch
Normal file
397
sanlock-python3.patch
Normal file
@ -0,0 +1,397 @@
|
||||
Index: sanlock-3.6.0/python/sanlock.c
|
||||
===================================================================
|
||||
--- sanlock-3.6.0.orig/python/sanlock.c
|
||||
+++ sanlock-3.6.0/python/sanlock.c
|
||||
@@ -12,6 +12,10 @@
|
||||
#include <sanlock_admin.h>
|
||||
#include <sanlock_direct.h>
|
||||
|
||||
+#if PY_MAJOR_VERSION >= 3
|
||||
+#define IS_PY3K
|
||||
+#endif
|
||||
+
|
||||
#ifndef __unused
|
||||
#define __unused __attribute__ ((unused))
|
||||
#endif
|
||||
@@ -30,6 +34,17 @@
|
||||
#define __neg_sets_exception
|
||||
#endif
|
||||
|
||||
+struct module_state {
|
||||
+ PyObject *error;
|
||||
+};
|
||||
+
|
||||
+#ifdef IS_PY3K
|
||||
+#define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
|
||||
+#else
|
||||
+#define GETSTATE(m) (&_state)
|
||||
+static struct module_state _state;
|
||||
+#endif
|
||||
+
|
||||
/* Functions prototypes */
|
||||
static void __set_exception(int en, char *msg) __sets_exception;
|
||||
static int __parse_resource(PyObject *obj, struct sanlk_resource **res_ret) __neg_sets_exception;
|
||||
@@ -102,14 +117,27 @@ __parse_resource(PyObject *obj, struct s
|
||||
path = PyTuple_GetItem(tuple, 0);
|
||||
offset = PyTuple_GetItem(tuple, 1);
|
||||
|
||||
+#ifdef IS_PY3K
|
||||
+ p = PyBytes_AsString(path);
|
||||
+#else
|
||||
p = PyString_AsString(path);
|
||||
+#endif
|
||||
|
||||
+#ifdef IS_PY3K
|
||||
+ if (!PyLong_Check(offset)) {
|
||||
+#else
|
||||
if (!PyInt_Check(offset)) {
|
||||
+#endif
|
||||
__set_exception(EINVAL, "Invalid resource offset");
|
||||
goto exit_fail;
|
||||
}
|
||||
+#ifdef IS_PY3K
|
||||
+ } else if (PyBytes_Check(tuple)) {
|
||||
+ p = PyBytes_AsString(tuple);
|
||||
+#else
|
||||
} else if (PyString_Check(tuple)) {
|
||||
p = PyString_AsString(tuple);
|
||||
+#endif
|
||||
}
|
||||
|
||||
if (p == NULL) {
|
||||
@@ -122,7 +150,11 @@ __parse_resource(PyObject *obj, struct s
|
||||
if (offset == NULL) {
|
||||
res->disks[i].offset = 0;
|
||||
} else {
|
||||
+#ifdef IS_PY3K
|
||||
+ res->disks[i].offset = PyLong_AsLong(offset);
|
||||
+#else
|
||||
res->disks[i].offset = PyInt_AsLong(offset);
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +181,11 @@ __hosts_to_list(struct sanlk_host *hss,
|
||||
goto exit_fail;
|
||||
|
||||
/* fill the dictionary information: host_id */
|
||||
+#ifdef IS_PY3K
|
||||
+ if ((ls_value = PyLong_FromLong(hss[i].host_id)) == NULL)
|
||||
+#else
|
||||
if ((ls_value = PyInt_FromLong(hss[i].host_id)) == NULL)
|
||||
+#endif
|
||||
goto exit_fail;
|
||||
rv = PyDict_SetItemString(ls_entry, "host_id", ls_value);
|
||||
Py_DECREF(ls_value);
|
||||
@@ -157,7 +193,11 @@ __hosts_to_list(struct sanlk_host *hss,
|
||||
goto exit_fail;
|
||||
|
||||
/* fill the dictionary information: generation */
|
||||
+#ifdef IS_PY3K
|
||||
+ if ((ls_value = PyLong_FromLong(hss[i].generation)) == NULL)
|
||||
+#else
|
||||
if ((ls_value = PyInt_FromLong(hss[i].generation)) == NULL)
|
||||
+#endif
|
||||
goto exit_fail;
|
||||
rv = PyDict_SetItemString(ls_entry, "generation", ls_value);
|
||||
Py_DECREF(ls_value);
|
||||
@@ -165,7 +205,11 @@ __hosts_to_list(struct sanlk_host *hss,
|
||||
goto exit_fail;
|
||||
|
||||
/* fill the dictionary information: timestamp */
|
||||
+#ifdef IS_PY3K
|
||||
+ if ((ls_value = PyLong_FromLong(hss[i].timestamp)) == NULL)
|
||||
+#else
|
||||
if ((ls_value = PyInt_FromLong(hss[i].timestamp)) == NULL)
|
||||
+#endif
|
||||
goto exit_fail;
|
||||
rv = PyDict_SetItemString(ls_entry, "timestamp", ls_value);
|
||||
Py_DECREF(ls_value);
|
||||
@@ -173,7 +217,11 @@ __hosts_to_list(struct sanlk_host *hss,
|
||||
goto exit_fail;
|
||||
|
||||
/* fill the dictionary information: io_timeout */
|
||||
+#ifdef IS_PY3K
|
||||
+ if ((ls_value = PyLong_FromLong(hss[i].io_timeout)) == NULL)
|
||||
+#else
|
||||
if ((ls_value = PyInt_FromLong(hss[i].io_timeout)) == NULL)
|
||||
+#endif
|
||||
goto exit_fail;
|
||||
rv = PyDict_SetItemString(ls_entry, "io_timeout", ls_value);
|
||||
Py_DECREF(ls_value);
|
||||
@@ -181,7 +229,11 @@ __hosts_to_list(struct sanlk_host *hss,
|
||||
goto exit_fail;
|
||||
|
||||
/* fill the dictionary information: flags */
|
||||
+#ifdef IS_PY3K
|
||||
+ if ((ls_value = PyLong_FromLong(hss[i].flags)) == NULL)
|
||||
+#else
|
||||
if ((ls_value = PyInt_FromLong(hss[i].flags)) == NULL)
|
||||
+#endif
|
||||
goto exit_fail;
|
||||
rv = PyDict_SetItemString(ls_entry, "flags", ls_value);
|
||||
Py_DECREF(ls_value);
|
||||
@@ -220,7 +272,11 @@ py_register(PyObject *self __unused, PyO
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+#ifdef IS_PY3K
|
||||
+ return PyLong_FromLong(sanlockfd);
|
||||
+#else
|
||||
return PyInt_FromLong(sanlockfd);
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* get_alignment */
|
||||
@@ -253,7 +309,11 @@ py_get_alignment(PyObject *self __unused
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+#ifdef IS_PY3K
|
||||
+ return PyLong_FromLong(rv);
|
||||
+#else
|
||||
return PyInt_FromLong(rv);
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* init_lockspace */
|
||||
@@ -439,7 +499,11 @@ py_read_lockspace(PyObject *self __unuse
|
||||
goto exit_fail;
|
||||
|
||||
/* fill the dictionary information: lockspace */
|
||||
+#ifdef IS_PY3K
|
||||
+ if ((ls_entry = PyBytes_FromString(ls.name)) == NULL)
|
||||
+#else
|
||||
if ((ls_entry = PyString_FromString(ls.name)) == NULL)
|
||||
+#endif
|
||||
goto exit_fail;
|
||||
rv = PyDict_SetItemString(ls_info, "lockspace", ls_entry);
|
||||
Py_DECREF(ls_entry);
|
||||
@@ -447,7 +511,11 @@ py_read_lockspace(PyObject *self __unuse
|
||||
goto exit_fail;
|
||||
|
||||
/* fill the dictionary information: iotimeout */
|
||||
+#ifdef IS_PY3K
|
||||
+ if ((ls_entry = PyLong_FromLong(io_timeout)) == NULL)
|
||||
+#else
|
||||
if ((ls_entry = PyInt_FromLong(io_timeout)) == NULL)
|
||||
+#endif
|
||||
goto exit_fail;
|
||||
rv = PyDict_SetItemString(ls_info, "iotimeout", ls_entry);
|
||||
Py_DECREF(ls_entry);
|
||||
@@ -515,7 +583,11 @@ py_read_resource(PyObject *self __unused
|
||||
goto exit_fail;
|
||||
|
||||
/* fill the dictionary information: lockspace */
|
||||
+#ifdef IS_PY3K
|
||||
+ if ((rs_entry = PyBytes_FromString(rs->lockspace_name)) == NULL)
|
||||
+#else
|
||||
if ((rs_entry = PyString_FromString(rs->lockspace_name)) == NULL)
|
||||
+#endif
|
||||
goto exit_fail;
|
||||
rv = PyDict_SetItemString(rs_info, "lockspace", rs_entry);
|
||||
Py_DECREF(rs_entry);
|
||||
@@ -523,7 +595,11 @@ py_read_resource(PyObject *self __unused
|
||||
goto exit_fail;
|
||||
|
||||
/* fill the dictionary information: resource */
|
||||
+#ifdef IS_PY3K
|
||||
+ if ((rs_entry = PyBytes_FromString(rs->name)) == NULL)
|
||||
+#else
|
||||
if ((rs_entry = PyString_FromString(rs->name)) == NULL)
|
||||
+#endif
|
||||
goto exit_fail;
|
||||
rv = PyDict_SetItemString(rs_info, "resource", rs_entry);
|
||||
Py_DECREF(rs_entry);
|
||||
@@ -804,7 +880,11 @@ py_get_lockspaces(PyObject *self __unuse
|
||||
goto exit_fail;
|
||||
|
||||
/* fill the dictionary information: lockspace */
|
||||
+#ifdef IS_PY3K
|
||||
+ if ((ls_value = PyBytes_FromString(lss[i].name)) == NULL)
|
||||
+#else
|
||||
if ((ls_value = PyString_FromString(lss[i].name)) == NULL)
|
||||
+#endif
|
||||
goto exit_fail;
|
||||
rv = PyDict_SetItemString(ls_entry, "lockspace", ls_value);
|
||||
Py_DECREF(ls_value);
|
||||
@@ -812,7 +892,11 @@ py_get_lockspaces(PyObject *self __unuse
|
||||
goto exit_fail;
|
||||
|
||||
/* fill the dictionary information: host_id */
|
||||
+#ifdef IS_PY3K
|
||||
+ if ((ls_value = PyLong_FromLong(lss[i].host_id)) == NULL)
|
||||
+#else
|
||||
if ((ls_value = PyInt_FromLong(lss[i].host_id)) == NULL)
|
||||
+#endif
|
||||
goto exit_fail;
|
||||
rv = PyDict_SetItemString(ls_entry, "host_id", ls_value);
|
||||
Py_DECREF(ls_value);
|
||||
@@ -820,7 +904,11 @@ py_get_lockspaces(PyObject *self __unuse
|
||||
goto exit_fail;
|
||||
|
||||
/* fill the dictionary information: path */
|
||||
+#ifdef IS_PY3K
|
||||
+ if ((ls_value = PyBytes_FromString(lss[i].host_id_disk.path)) == NULL)
|
||||
+#else
|
||||
if ((ls_value = PyString_FromString(lss[i].host_id_disk.path)) == NULL)
|
||||
+#endif
|
||||
goto exit_fail;
|
||||
rv = PyDict_SetItemString(ls_entry, "path", ls_value);
|
||||
Py_DECREF(ls_value);
|
||||
@@ -828,7 +916,11 @@ py_get_lockspaces(PyObject *self __unuse
|
||||
goto exit_fail;
|
||||
|
||||
/* fill the dictionary information: offset */
|
||||
+#ifdef IS_PY3K
|
||||
+ if ((ls_value = PyLong_FromLong(lss[i].host_id_disk.offset)) == NULL)
|
||||
+#else
|
||||
if ((ls_value = PyInt_FromLong(lss[i].host_id_disk.offset)) == NULL)
|
||||
+#endif
|
||||
goto exit_fail;
|
||||
rv = PyDict_SetItemString(ls_entry, "offset", ls_value);
|
||||
Py_DECREF(ls_value);
|
||||
@@ -836,7 +928,11 @@ py_get_lockspaces(PyObject *self __unuse
|
||||
goto exit_fail;
|
||||
|
||||
/* fill the dictionary information: flags */
|
||||
+#ifdef IS_PY3K
|
||||
+ if ((ls_value = PyLong_FromLong(lss[i].flags)) == NULL)
|
||||
+#else
|
||||
if ((ls_value = PyInt_FromLong(lss[i].flags)) == NULL)
|
||||
+#endif
|
||||
goto exit_fail;
|
||||
rv = PyDict_SetItemString(ls_entry, "flags", ls_value);
|
||||
Py_DECREF(ls_value);
|
||||
@@ -958,7 +1054,11 @@ py_acquire(PyObject *self __unused, PyOb
|
||||
/* prepare the resource version */
|
||||
if (version != Py_None) {
|
||||
res->flags |= SANLK_RES_LVER;
|
||||
+#ifdef IS_PY3K
|
||||
+ res->lver = PyLong_AsUnsignedLongMask(version);
|
||||
+#else
|
||||
res->lver = PyInt_AsUnsignedLongMask(version);
|
||||
+#endif
|
||||
if (res->lver == -1) {
|
||||
__set_exception(EINVAL, "Unable to convert the version value");
|
||||
goto exit_fail;
|
||||
@@ -1074,7 +1174,11 @@ py_request(PyObject *self __unused, PyOb
|
||||
flags = SANLK_REQUEST_NEXT_LVER;
|
||||
} else {
|
||||
res->flags |= SANLK_RES_LVER;
|
||||
+#ifdef IS_PY3K
|
||||
+ res->lver = PyLong_AsUnsignedLongMask(version);
|
||||
+#else
|
||||
res->lver = PyInt_AsUnsignedLongMask(version);
|
||||
+#endif
|
||||
if (res->lver == -1) {
|
||||
__set_exception(EINVAL, "Unable to convert the version value");
|
||||
goto exit_fail;
|
||||
@@ -1189,7 +1293,11 @@ py_killpath(PyObject *self __unused, PyO
|
||||
size_t arg_len;
|
||||
|
||||
item = PyList_GetItem(argslist, i);
|
||||
+#ifdef IS_PY3K
|
||||
+ p = PyBytes_AsString(item);
|
||||
+#else
|
||||
p = PyString_AsString(item);
|
||||
+#endif
|
||||
|
||||
if (p == NULL) {
|
||||
__set_exception(EINVAL, "Killpath argument not a string");
|
||||
@@ -1578,32 +1686,83 @@ exit_fail:
|
||||
return excp;
|
||||
}
|
||||
|
||||
+#ifdef IS_PY3K
|
||||
+static int sanlock_traverse(PyObject *m, visitproc visit, void *arg) {
|
||||
+ Py_VISIT(GETSTATE(m)->error);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int sanlock_clear(PyObject *m) {
|
||||
+ Py_CLEAR(GETSTATE(m)->error);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct PyModuleDef moduledef = {
|
||||
+ PyModuleDef_HEAD_INIT,
|
||||
+ "sanlock",
|
||||
+ pydoc_sanlock,
|
||||
+ sizeof(struct module_state),
|
||||
+ sanlock_methods,
|
||||
+ NULL,
|
||||
+ sanlock_traverse,
|
||||
+ sanlock_clear,
|
||||
+ NULL
|
||||
+};
|
||||
+
|
||||
+#define INITERROR return NULL
|
||||
+
|
||||
+PyMODINIT_FUNC
|
||||
+PyInit_sanlock(void)
|
||||
+
|
||||
+#else
|
||||
+#define INITERROR return
|
||||
+
|
||||
PyMODINIT_FUNC
|
||||
initsanlock(void)
|
||||
+#endif
|
||||
{
|
||||
PyObject *py_module, *sk_constant;
|
||||
+ struct module_state *st;
|
||||
|
||||
+#ifdef IS_PY3K
|
||||
+ py_module = PyModule_Create(&moduledef);
|
||||
+#else
|
||||
py_module = Py_InitModule4("sanlock",
|
||||
sanlock_methods, pydoc_sanlock, NULL, PYTHON_API_VERSION);
|
||||
+#endif
|
||||
|
||||
if (py_module == NULL)
|
||||
- return;
|
||||
+ INITERROR;
|
||||
|
||||
py_exception = initexception();
|
||||
|
||||
- if (py_exception == NULL)
|
||||
- return;
|
||||
+ if (py_exception == NULL) {
|
||||
+ Py_DECREF(py_module);
|
||||
+ INITERROR;
|
||||
+ }
|
||||
+
|
||||
+ st = GETSTATE(py_module);
|
||||
+ st->error = py_exception;
|
||||
|
||||
if (PyModule_AddObject(py_module, "SanlockException", py_exception) == 0) {
|
||||
Py_INCREF(py_exception);
|
||||
}
|
||||
|
||||
+#ifdef IS_PY3K
|
||||
+#define PYSNLK_INIT_ADD_CONSTANT(x, y) \
|
||||
+ if ((sk_constant = PyLong_FromLong(x)) != NULL) { \
|
||||
+ if (PyModule_AddObject(py_module, y, sk_constant)) { \
|
||||
+ Py_DECREF(sk_constant); \
|
||||
+ } \
|
||||
+ }
|
||||
+#else
|
||||
#define PYSNLK_INIT_ADD_CONSTANT(x, y) \
|
||||
if ((sk_constant = PyInt_FromLong(x)) != NULL) { \
|
||||
if (PyModule_AddObject(py_module, y, sk_constant)) { \
|
||||
Py_DECREF(sk_constant); \
|
||||
} \
|
||||
}
|
||||
+#endif
|
||||
|
||||
/* lockspaces list flags */
|
||||
PYSNLK_INIT_ADD_CONSTANT(SANLK_LSF_ADD, "LSFLAG_ADD");
|
||||
@@ -1628,4 +1787,8 @@ initsanlock(void)
|
||||
PYSNLK_INIT_ADD_CONSTANT(SANLK_SETEV_ALL_HOSTS, "SETEV_ALL_HOSTS");
|
||||
|
||||
#undef PYSNLK_INIT_ADD_CONSTANT
|
||||
+
|
||||
+#ifdef IS_PY3K
|
||||
+ return py_module;
|
||||
+#endif
|
||||
}
|
@ -1,3 +1,25 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 26 16:36:05 UTC 2018 - jfehlig@suse.com
|
||||
|
||||
- Fix module initialization to work with both python2 and python3
|
||||
Updated sanlock-python3.patch
|
||||
bsc#1076414
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 21 12:58:08 UTC 2018 - tchvatal@suse.com
|
||||
|
||||
- Add code to build with both python2 and python3 bindings with
|
||||
provided condition so we can later on optionalize python2 builds
|
||||
sanlock-python3.patch
|
||||
bsc#1076414
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 21 12:44:29 UTC 2018 - tchvatal@suse.com
|
||||
|
||||
- Cleanup with spec-cleaner (only support SLE12 and newer)
|
||||
- Add -fno-strict-aliasing to python subpkg
|
||||
- Create rcsanlk-resetd link for the service control
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Dec 5 18:53:41 UTC 2017 - jfehlig@suse.com
|
||||
|
||||
|
155
sanlock.spec
155
sanlock.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package sanlock
|
||||
#
|
||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -16,43 +16,24 @@
|
||||
#
|
||||
|
||||
|
||||
#Compat macro for new _fillupdir macro introduced in Nov 2017
|
||||
%if ! %{defined _fillupdir}
|
||||
%define _fillupdir /var/adm/fillup-templates
|
||||
%endif
|
||||
|
||||
%define with_fence_sanlockd 0
|
||||
%define with_sanlk_reset 0
|
||||
|
||||
%if 0%{?suse_version} > 1320
|
||||
%define with_fence_sanlockd 1
|
||||
%define with_sanlk_reset 1
|
||||
%endif
|
||||
|
||||
#Compat macro for new _fillupdir macro introduced in Nov 2017
|
||||
%if ! %{defined _fillupdir}
|
||||
%define _fillupdir %{_localstatedir}/adm/fillup-templates
|
||||
%endif
|
||||
%bcond_without python2
|
||||
Name: sanlock
|
||||
Version: 3.6.0
|
||||
Release: 0
|
||||
Summary: A shared disk lock manager
|
||||
License: GPL-2.0 and GPL-2.0+ and LGPL-2.1+
|
||||
License: GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-or-later
|
||||
Group: System/Base
|
||||
|
||||
Url: https://pagure.io/sanlock
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildRequires: libaio-devel
|
||||
BuildRequires: libblkid-devel
|
||||
BuildRequires: python
|
||||
BuildRequires: python-devel
|
||||
BuildRequires: systemd
|
||||
%{?systemd_requires}
|
||||
BuildRequires: xz
|
||||
Requires(pre): %fillup_prereq
|
||||
%if 0%{?suse_version} > 1320
|
||||
Requires(pre): group(disk)
|
||||
%endif
|
||||
Requires(pre): %{_sbindir}/groupadd
|
||||
Requires(pre): %{_sbindir}/useradd
|
||||
Requires: %{name}-lib = %{version}-%{release}
|
||||
Recommends: logrotate
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
Source1: sysconfig.sanlock
|
||||
Source2: sysconfig.wdmd
|
||||
@ -66,8 +47,20 @@ Patch103: suse-systemd.patch
|
||||
Patch104: suse-no-date-time.patch
|
||||
# bsc#1030060
|
||||
Patch105: suse-fix-link-errors.patch
|
||||
|
||||
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
||||
Patch106: sanlock-python3.patch
|
||||
BuildRequires: %{python_module devel}
|
||||
BuildRequires: libaio-devel
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: python-rpm-macros
|
||||
BuildRequires: systemd-rpm-macros
|
||||
BuildRequires: pkgconfig(blkid)
|
||||
Requires(pre): %fillup_prereq
|
||||
Requires(pre): shadow
|
||||
Recommends: logrotate
|
||||
%{?systemd_requires}
|
||||
%if 0%{?suse_version} >= 1500
|
||||
Requires(pre): group(disk)
|
||||
%endif
|
||||
|
||||
%description
|
||||
sanlock uses disk paxos to manage leases on shared storage.
|
||||
@ -75,25 +68,36 @@ Hosts connected to a common SAN can use this to synchronize their
|
||||
access to the shared disks.
|
||||
|
||||
%package -n libsanlock1
|
||||
Provides: sanlock-lib
|
||||
Summary: A shared disk lock manager library
|
||||
Group: Development/Libraries/C and C++
|
||||
Provides: sanlock-lib = %{version}
|
||||
|
||||
%description -n libsanlock1
|
||||
The runtime libraries for sanlock, a shared disk lock manager.
|
||||
Hosts connected to a common SAN can use this to synchronize their
|
||||
access to the shared disks.
|
||||
|
||||
%package -n python-%name
|
||||
%package -n python2-%{name}
|
||||
Summary: Python bindings for the sanlock library
|
||||
Group: Development/Libraries/Python
|
||||
Requires: libsanlock1 = %{version}-%{release}
|
||||
Provides: python-%{name}
|
||||
Provides: sanlock-python
|
||||
|
||||
%description -n python2-%{name}
|
||||
A module that permits applications written in the Python programming
|
||||
language to use the interface supplied by the sanlock library.
|
||||
|
||||
%package -n python3-%{name}
|
||||
Summary: Python bindings for the sanlock library
|
||||
Group: Development/Libraries/Python
|
||||
Requires: libsanlock1 = %{version}-%{release}
|
||||
|
||||
%description -n python-%name
|
||||
%description -n python3-%{name}
|
||||
A module that permits applications written in the Python programming
|
||||
language to use the interface supplied by the sanlock library.
|
||||
|
||||
|
||||
%package devel
|
||||
Summary: Development files for %{name}
|
||||
Group: Development/Libraries/C and C++
|
||||
@ -131,69 +135,65 @@ common sanlock lockspace.
|
||||
%patch103 -p1
|
||||
%patch104 -p1
|
||||
%patch105 -p1
|
||||
%patch106 -p1
|
||||
|
||||
%build
|
||||
# upstream does not require configure
|
||||
# upstream does not support _smp_mflags
|
||||
CFLAGS="%{optflags}" make -C wdmd
|
||||
CFLAGS="%{optflags}" make -C src
|
||||
CFLAGS="%{optflags}" make -C python
|
||||
CFLAGS="%{optflags}" make -j1 -C wdmd
|
||||
CFLAGS="%{optflags}" make -j1 -C src
|
||||
pushd python
|
||||
CFLAGS="%{optflags} -fno-strict-aliasing" %python_build
|
||||
popd
|
||||
%if %{with_fence_sanlockd}
|
||||
CFLAGS="%{optflags}" make -C fence_sanlock
|
||||
CFLAGS="%{optflags}" make -j1 -C fence_sanlock
|
||||
%endif
|
||||
%if %{with_sanlk_reset}
|
||||
CFLAGS="%{optflags}" make -C reset
|
||||
CFLAGS="%{optflags}" make -j1 -C reset
|
||||
%endif
|
||||
|
||||
%install
|
||||
make -C src \
|
||||
install LIBDIR=%{_libdir} \
|
||||
DESTDIR="%{buildroot}"
|
||||
make -C wdmd \
|
||||
install LIBDIR=%{_libdir} \
|
||||
DESTDIR="%{buildroot}"
|
||||
make -C python \
|
||||
install LIBDIR=%{_libdir} \
|
||||
DESTDIR="%{buildroot}" PREFIX=%_prefix
|
||||
%make_install LIBDIR=%{_libdir} -C src
|
||||
%make_install LIBDIR=%{_libdir} -C wdmd
|
||||
pushd python
|
||||
%python_install
|
||||
popd
|
||||
%if %{with_fence_sanlockd}
|
||||
make -C fence_sanlock \
|
||||
install LIBDIR=%{_libdir} \
|
||||
DESTDIR="%{buildroot}"
|
||||
%make_install LIBDIR=%{_libdir} -C fence_sanlock
|
||||
%endif
|
||||
%if %{with_sanlk_reset}
|
||||
make -C reset \
|
||||
install LIBDIR=%{_libdir} \
|
||||
DESTDIR="%{buildroot}"
|
||||
%make_install LIBDIR=%{_libdir} -C reset
|
||||
%endif
|
||||
|
||||
install -D -m 644 src/sanlock.conf %{buildroot}/%{_sysconfdir}/sanlock/sanlock.conf
|
||||
install -D -m 644 %SOURCE1 %{buildroot}/%{_fillupdir}/sysconfig.sanlock
|
||||
install -D -m 644 %SOURCE2 %{buildroot}/%{_fillupdir}/sysconfig.wdmd
|
||||
install -D -m 644 %{SOURCE1} %{buildroot}/%{_fillupdir}/sysconfig.sanlock
|
||||
install -D -m 644 %{SOURCE2} %{buildroot}/%{_fillupdir}/sysconfig.wdmd
|
||||
|
||||
install -D -m 644 init.d/sanlock.service %{buildroot}/%{_unitdir}/sanlock.service
|
||||
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcsanlock
|
||||
ln -s service %{buildroot}%{_sbindir}/rcsanlock
|
||||
install -D -m 644 init.d/wdmd.service %{buildroot}/%{_unitdir}/wdmd.service
|
||||
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcwdmd
|
||||
ln -s service %{buildroot}%{_sbindir}/rcwdmd
|
||||
%if %{with_fence_sanlockd}
|
||||
install -D -m 0755 %SOURCE3 %{buildroot}/usr/lib/systemd/systemd-fence_sanlockd
|
||||
install -D -m 0755 %{SOURCE3} %{buildroot}%{_prefix}/lib/systemd/systemd-fence_sanlockd
|
||||
install -D -m 0644 init.d/fence_sanlockd.service %{buildroot}/%{_unitdir}/fence_sanlockd.service
|
||||
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcfence_sanlockd
|
||||
ln -s service %{buildroot}%{_sbindir}/rcfence_sanlockd
|
||||
%endif
|
||||
%if %{with_sanlk_reset}
|
||||
install -D -m 0644 init.d/sanlk-resetd.service %{buildroot}/%{_unitdir}/sanlk-resetd.service
|
||||
ln -s service %{buildroot}%{_sbindir}/rcsanlk-resetd
|
||||
%endif
|
||||
|
||||
install -Dm 0644 src/logrotate.sanlock \
|
||||
%{buildroot}/etc/logrotate.d/sanlock
|
||||
%{buildroot}%{_sysconfdir}/logrotate.d/sanlock
|
||||
|
||||
install -Dd -m 0755 %{buildroot}/etc/wdmd.d
|
||||
install -Dd -m 0755 %{buildroot}%{_sysconfdir}/wdmd.d
|
||||
|
||||
%pre
|
||||
%{_bindir}/getent group sanlock > /dev/null || %{_sbindir}/groupadd \
|
||||
getent group sanlock > /dev/null || groupadd \
|
||||
-g 179 sanlock
|
||||
%{_bindir}/getent passwd sanlock > /dev/null || %{_sbindir}/useradd \
|
||||
getent passwd sanlock > /dev/null || useradd \
|
||||
-u 179 -c "sanlock" -s /sbin/nologin -r \
|
||||
-g 179 -G disk -d /var/run/sanlock sanlock
|
||||
-g 179 -G disk -d %{_localstatedir}/run/sanlock sanlock
|
||||
|
||||
%service_add_pre wdmd.service
|
||||
%service_add_pre sanlock.service
|
||||
@ -215,15 +215,10 @@ install -Dd -m 0755 %{buildroot}/etc/wdmd.d
|
||||
%if %{with_fence_sanlockd}
|
||||
%post -n fence-sanlock
|
||||
%service_add_post fence_sanlockd.service
|
||||
%restart_on_update fence_sanlockd
|
||||
#if [ $1 -eq 1 ] ; then
|
||||
#ccs_update_schema > /dev/null 2>&1 ||:
|
||||
#fi
|
||||
%endif
|
||||
|
||||
%post -n sanlk-reset
|
||||
%service_add_post sanlk-resetd.service
|
||||
%restart_on_update sanlk-resetd
|
||||
|
||||
%preun
|
||||
%service_del_preun wdmd.service sanlock.service
|
||||
@ -238,7 +233,6 @@ install -Dd -m 0755 %{buildroot}/etc/wdmd.d
|
||||
%service_del_postun wdmd.service sanlock.service
|
||||
|
||||
%postun -n libsanlock1 -p /sbin/ldconfig
|
||||
|
||||
%postun -n fence-sanlock
|
||||
%service_del_postun fence_sanlockd.service
|
||||
|
||||
@ -246,7 +240,6 @@ install -Dd -m 0755 %{buildroot}/etc/wdmd.d
|
||||
%service_del_postun sanlk-resetd.service
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%dir %attr(0700, root, root) %{_sysconfdir}/wdmd.d/
|
||||
%dir %attr(0700, root, root) %{_sysconfdir}/sanlock/
|
||||
%config(noreplace) %{_sysconfdir}/sanlock/sanlock.conf
|
||||
@ -262,19 +255,20 @@ install -Dd -m 0755 %{buildroot}/etc/wdmd.d
|
||||
%{_mandir}/man8/sanlock*
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/sanlock
|
||||
|
||||
%files -n libsanlock1
|
||||
%defattr(-,root,root,-)
|
||||
%files -n libsanlock1
|
||||
%{_libdir}/libsanlock.so.*
|
||||
%{_libdir}/libsanlock_client.so.*
|
||||
%{_libdir}/libwdmd.so.*
|
||||
|
||||
%files -n python-%name
|
||||
%defattr(-,root,root,-)
|
||||
%{python_sitearch}/sanlock_python-%{version}_-py*.egg-info
|
||||
%{python_sitearch}/sanlock.so
|
||||
%if %{with python2}
|
||||
%files -n python2-%{name}
|
||||
%{python2_sitearch}/*
|
||||
%endif
|
||||
|
||||
%files -n python3-%{name}
|
||||
%{python3_sitearch}/*
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
%{_libdir}/libwdmd.so
|
||||
%{_includedir}/wdmd.h
|
||||
%{_libdir}/libsanlock.so
|
||||
@ -289,9 +283,8 @@ install -Dd -m 0755 %{buildroot}/etc/wdmd.d
|
||||
|
||||
%if %{with_fence_sanlockd}
|
||||
%files -n fence-sanlock
|
||||
%defattr(-,root,root,-)
|
||||
%{_sbindir}/fence_sanlockd
|
||||
/usr/lib/systemd/systemd-fence_sanlockd
|
||||
%{_prefix}/lib/systemd/systemd-fence_sanlockd
|
||||
%{_unitdir}/fence_sanlockd.service
|
||||
%{_sbindir}/fence_sanlock
|
||||
%{_sbindir}/fence_sanlockd
|
||||
@ -301,12 +294,12 @@ install -Dd -m 0755 %{buildroot}/etc/wdmd.d
|
||||
|
||||
%if %{with_sanlk_reset}
|
||||
%files -n sanlk-reset
|
||||
%defattr(-,root,root,-)
|
||||
%{_sbindir}/sanlk-reset
|
||||
%{_sbindir}/sanlk-resetd
|
||||
%{_sbindir}/rcsanlk-resetd
|
||||
%{_unitdir}/sanlk-resetd.service
|
||||
%{_mandir}/man8/sanlk-reset.8.gz
|
||||
%{_mandir}/man8/sanlk-resetd.8.gz
|
||||
%{_mandir}/man8/sanlk-reset.8%{?ext_man}
|
||||
%{_mandir}/man8/sanlk-resetd.8%{?ext_man}
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
|
Loading…
Reference in New Issue
Block a user