glusterfs: 4.0 -> 6.5

* remove patches (fixed upstream)
* python2 -> python3
This commit is contained in:
Markus Kowalewski 2019-08-16 23:27:30 +02:00
parent 21a9aa0fcc
commit 830218cc64
No known key found for this signature in database
GPG Key ID: D865C8A91D7025EB
5 changed files with 20 additions and 364 deletions

View File

@ -1,4 +1,4 @@
{stdenv, fetchurl, fuse, bison, flex_2_5_35, openssl, python2, ncurses, readline, {stdenv, fetchurl, fuse, bison, flex_2_5_35, openssl, python3, ncurses, readline,
autoconf, automake, libtool, pkgconfig, zlib, libaio, libxml2, acl, sqlite, autoconf, automake, libtool, pkgconfig, zlib, libaio, libxml2, acl, sqlite,
liburcu, attr, makeWrapper, coreutils, gnused, gnugrep, which, liburcu, attr, makeWrapper, coreutils, gnused, gnugrep, which,
openssh, gawk, findutils, utillinux, lvm2, btrfs-progs, e2fsprogs, xfsprogs, systemd, openssh, gawk, findutils, utillinux, lvm2, btrfs-progs, e2fsprogs, xfsprogs, systemd,
@ -15,25 +15,26 @@ let
# The command # The command
# find /nix/store/...-glusterfs-.../ -name '*.py' -executable # find /nix/store/...-glusterfs-.../ -name '*.py' -executable
# can help with finding new Python scripts. # can help with finding new Python scripts.
version = "4.0.0"; version = "6.5";
name="${baseName}-${version}"; name="${baseName}-${version}";
url="https://github.com/gluster/glusterfs/archive/v${version}.tar.gz"; url="https://github.com/gluster/glusterfs/archive/v${version}.tar.gz";
sha256 = "0af3fwiixddds6gdwhkyq3l214mmjl2wpjc2qayp5rpz79lnclq3"; sha256 = "17vdrw71ys1n5g9pdmzipmr706bslq0gbxxjhacxnrgsz8r4rl6a";
}; };
buildInputs = [ buildInputs = [
fuse bison flex_2_5_35 openssl ncurses readline fuse bison flex_2_5_35 openssl ncurses readline
autoconf automake libtool pkgconfig zlib libaio libxml2 autoconf automake libtool pkgconfig zlib libaio libxml2
acl sqlite liburcu attr makeWrapper acl sqlite liburcu attr makeWrapper utillinux
(python2.withPackages (pkgs: [ (python3.withPackages (pkgs: [
pkgs.flask pkgs.flask
pkgs.prettytable pkgs.prettytable
pkgs.requests pkgs.requests
pkgs.pyxattr pkgs.pyxattr
])) ]))
# NOTE: `python2` has to be *AFTER* the above `python2.withPackages`, # NOTE: `python3` has to be *AFTER* the above `python3.withPackages`,
# to ensure that the packages are available but the `toPythonPath` # to ensure that the packages are available but the `toPythonPath`
# shell function used in `postFixup` is also still available. # shell function used in `postFixup` is also still available.
python2 python3
]; ];
# Some of the headers reference acl # Some of the headers reference acl
propagatedBuildInputs = [ propagatedBuildInputs = [
@ -65,21 +66,15 @@ rec {
inherit (s) name version; inherit (s) name version;
inherit buildInputs propagatedBuildInputs; inherit buildInputs propagatedBuildInputs;
patches = [
# Remove when https://bugzilla.redhat.com/show_bug.cgi?id=1489610 is fixed
./glusterfs-fix-bug-1489610-glusterfind-var-data-under-prefix.patch
];
postPatch = '' postPatch = ''
sed -e '/chmod u+s/d' -i contrib/fuse-util/Makefile.am sed -e '/chmod u+s/d' -i contrib/fuse-util/Makefile.am
''; '';
patches = [
# Remove when https://bugzilla.redhat.com/show_bug.cgi?id=1450546 is fixed
./glusterfs-use-PATH-instead-of-hardcodes.patch
# Remove when https://bugzilla.redhat.com/show_bug.cgi?id=1450593 is fixed
./glusterfs-python-remove-find_library.patch
# Remove when https://bugzilla.redhat.com/show_bug.cgi?id=1489610 is fixed
./glusterfs-fix-bug-1489610-glusterfind-var-data-under-prefix.patch
# Remove when https://bugzilla.redhat.com/show_bug.cgi?id=1559130 is fixed
./glusterfs-glusterfind-log-remote-node_cmd-error.patch
];
# Note that the VERSION file is something that is present in release tarballs # Note that the VERSION file is something that is present in release tarballs
# but not in git tags (at least not as of writing in v3.10.1). # but not in git tags (at least not as of writing in v3.10.1).
# That's why we have to create it. # That's why we have to create it.
@ -92,6 +87,7 @@ rec {
preConfigure = '' preConfigure = ''
echo "v${s.version}" > VERSION echo "v${s.version}" > VERSION
./autogen.sh ./autogen.sh
export PYTHON=${python3}/bin/python
''; '';
configureFlags = [ configureFlags = [
@ -178,6 +174,9 @@ rec {
# on a real TTY for testing purposes. # on a real TTY for testing purposes.
echo "" | (mkdir -p nix-test-dir-for-gfid_to_path && touch b && $out/libexec/glusterfs/gfind_missing_files/gfid_to_path.py nix-test-dir-for-gfid_to_path) echo "" | (mkdir -p nix-test-dir-for-gfid_to_path && touch b && $out/libexec/glusterfs/gfind_missing_files/gfid_to_path.py nix-test-dir-for-gfid_to_path)
$out/share/glusterfs/scripts/eventsdash.py --help $out/share/glusterfs/scripts/eventsdash.py --help
# this gets falsely loaded as module by glusterfind
rm -r $out/bin/conf.py
''; '';
src = fetchurl { src = fetchurl {

View File

@ -18,7 +18,7 @@ index f87d8a454..b4d3f5d10 100644
fi fi
GLUSTERFS_LIBEXECDIR="$(eval echo $libexecdir)/glusterfs" GLUSTERFS_LIBEXECDIR="$(eval echo $libexecdir)/glusterfs"
-GLUSTERFSD_MISCDIR="$(eval echo $prefix)/var/lib/misc/glusterfsd" -GLUSTERFSD_MISCDIR="$(eval echo $prefix)/var/lib/misc/glusterfsd"
+GLUSTERFSD_MISCDIR="$(eval echo $localstatedir)/var/lib/misc/glusterfsd" +GLUSTERFSD_MISCDIR="$(eval echo $localstatedir)/lib/misc/glusterfsd"
prefix=$old_prefix prefix=$old_prefix
exec_prefix=$old_exec_prefix exec_prefix=$old_exec_prefix

View File

@ -1,49 +0,0 @@
From 92a6b84a37e7e2e0ec0655ca45cedb64ab72080e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= <mail@nh2.me>
Date: Fri, 8 Sep 2017 02:40:01 +0200
Subject: [PATCH] glusterfind: Log remote stderr on `node_cmd` error.
The problem of lost stderr was introduced in
commit feea851fad4f89b48bfe89fe3b75250cc7bd6501.
Change-Id: Ic98f9bc9682ae3bd9c3ebea3855667fc8ba2843d
---
tools/glusterfind/src/main.py | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/tools/glusterfind/src/main.py b/tools/glusterfind/src/main.py
index c125f970a..6fffce4b3 100644
--- a/tools/glusterfind/src/main.py
+++ b/tools/glusterfind/src/main.py
@@ -75,12 +75,27 @@ def node_cmd(host, host_uuid, task, cmd, args, opts):
cmd = ["ssh",
"-oNumberOfPasswordPrompts=0",
"-oStrictHostKeyChecking=no",
+ # We force TTY allocation (-t -t) so that Ctrl+C is handed
+ # through; see:
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1382236
+ # Note that this turns stderr of the remote `cmd`
+ # into stdout locally.
"-t",
"-t",
"-i", pem_key_path,
"root@%s" % host] + cmd
- execute(cmd, exit_msg="%s - %s failed" % (host, task), logger=logger)
+ (returncode, err, out) = execute(cmd, logger=logger)
+ if returncode != 0:
+ # Because the `-t -t` above turns the remote stderr into
+ # local stdout, we need to log both stderr and stdout
+ # here to print all error messages.
+ fail("%s - %s failed; stdout (including remote stderr):\n"
+ "%s\n"
+ "stderr:\n"
+ "%s" % (host, task, out, err),
+ returncode,
+ logger=logger)
if opts.get("copy_outfile", False) and not localdir:
cmd_copy = ["scp",
--
2.12.0

View File

@ -1,156 +0,0 @@
From e6293e367f56833457291e32a4df7b21a52365a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= <mail@nh2.me>
Date: Sat, 13 May 2017 18:54:36 +0200
Subject: [PATCH] python: Remove all uses of find_library. Fixes #1450593
`find_library()` doesn't consider LD_LIBRARY_PATH on Python < 3.6.
Change-Id: Iee26085cb5d14061001f19f032c2664d69a378a8
---
api/examples/getvolfile.py | 2 +-
geo-replication/syncdaemon/libcxattr.py | 3 +--
geo-replication/syncdaemon/libgfchangelog.py | 6 ++----
tests/features/ipctest.py | 10 ++--------
tests/utils/libcxattr.py | 5 ++---
tools/glusterfind/src/libgfchangelog.py | 3 +--
.../features/changelog/lib/examples/python/libgfchangelog.py | 3 +--
7 files changed, 10 insertions(+), 22 deletions(-)
diff --git a/api/examples/getvolfile.py b/api/examples/getvolfile.py
index 0c95213f0..32c2268b3 100755
--- a/api/examples/getvolfile.py
+++ b/api/examples/getvolfile.py
@@ -3,7 +3,7 @@
import ctypes
import ctypes.util
-api = ctypes.CDLL(ctypes.util.find_library("gfapi"))
+api = ctypes.CDLL("libgfapi.so")
api.glfs_get_volfile.argtypes = [ctypes.c_void_p,
ctypes.c_void_p,
ctypes.c_ulong]
diff --git a/geo-replication/syncdaemon/libcxattr.py b/geo-replication/syncdaemon/libcxattr.py
index 3671e102c..f576648b7 100644
--- a/geo-replication/syncdaemon/libcxattr.py
+++ b/geo-replication/syncdaemon/libcxattr.py
@@ -10,7 +10,6 @@
import os
from ctypes import CDLL, create_string_buffer, get_errno
-from ctypes.util import find_library
class Xattr(object):
@@ -25,7 +24,7 @@ class Xattr(object):
sizes we expect
"""
- libc = CDLL(find_library("c"), use_errno=True)
+ libc = CDLL("libc.so.6", use_errno=True)
@classmethod
def geterrno(cls):
diff --git a/geo-replication/syncdaemon/libgfchangelog.py b/geo-replication/syncdaemon/libgfchangelog.py
index 334f5e9ea..093ae157a 100644
--- a/geo-replication/syncdaemon/libgfchangelog.py
+++ b/geo-replication/syncdaemon/libgfchangelog.py
@@ -9,14 +9,12 @@
#
import os
-from ctypes import CDLL, RTLD_GLOBAL, create_string_buffer, \
- get_errno, byref, c_ulong
-from ctypes.util import find_library
+from ctypes import CDLL, RTLD_GLOBAL, create_string_buffer, get_errno, byref, c_ulong
from syncdutils import ChangelogException, ChangelogHistoryNotAvailable
class Changes(object):
- libgfc = CDLL(find_library("gfchangelog"), mode=RTLD_GLOBAL,
+ libgfc = CDLL("libgfchangelog.so", mode=RTLD_GLOBAL,
use_errno=True)
@classmethod
diff --git a/tests/features/ipctest.py b/tests/features/ipctest.py
index 5aff319b8..933924861 100755
--- a/tests/features/ipctest.py
+++ b/tests/features/ipctest.py
@@ -1,14 +1,8 @@
#!/usr/bin/python
import ctypes
-import ctypes.util
-
-# find_library does not lookup LD_LIBRARY_PATH and may miss the
-# function. In that case, retry with less portable but explicit name.
-libgfapi = ctypes.util.find_library("gfapi")
-if libgfapi == None:
- libgfapi = "libgfapi.so"
-api = ctypes.CDLL(libgfapi,mode=ctypes.RTLD_GLOBAL)
+
+api = ctypes.CDLL("libgfapi.so",mode=ctypes.RTLD_GLOBAL)
api.glfs_ipc.argtypes = [ ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p, ctypes.c_void_p ]
api.glfs_ipc.restype = ctypes.c_int
diff --git a/tests/utils/libcxattr.py b/tests/utils/libcxattr.py
index 149db72e6..4e6e6c46d 100644
--- a/tests/utils/libcxattr.py
+++ b/tests/utils/libcxattr.py
@@ -11,7 +11,6 @@
import os
import sys
from ctypes import CDLL, c_int, create_string_buffer
-from ctypes.util import find_library
class Xattr(object):
@@ -28,9 +27,9 @@ class Xattr(object):
if sys.hexversion >= 0x02060000:
from ctypes import DEFAULT_MODE
- libc = CDLL(find_library("libc"), DEFAULT_MODE, None, True)
+ libc = CDLL("libc.so.6", DEFAULT_MODE, None, True)
else:
- libc = CDLL(find_library("libc"))
+ libc = CDLL("libc.so.6")
@classmethod
def geterrno(cls):
diff --git a/tools/glusterfind/src/libgfchangelog.py b/tools/glusterfind/src/libgfchangelog.py
index 0f6b40d6c..9ca3f326b 100644
--- a/tools/glusterfind/src/libgfchangelog.py
+++ b/tools/glusterfind/src/libgfchangelog.py
@@ -11,14 +11,13 @@
import os
from ctypes import CDLL, get_errno, create_string_buffer, c_ulong, byref
from ctypes import RTLD_GLOBAL
-from ctypes.util import find_library
class ChangelogException(OSError):
pass
-libgfc = CDLL(find_library("gfchangelog"), use_errno=True, mode=RTLD_GLOBAL)
+libgfc = CDLL("libgfchangelog.so", use_errno=True, mode=RTLD_GLOBAL)
def raise_oserr():
diff --git a/xlators/features/changelog/lib/examples/python/libgfchangelog.py b/xlators/features/changelog/lib/examples/python/libgfchangelog.py
index 10e73c02b..2cdbf1152 100644
--- a/xlators/features/changelog/lib/examples/python/libgfchangelog.py
+++ b/xlators/features/changelog/lib/examples/python/libgfchangelog.py
@@ -1,9 +1,8 @@
import os
from ctypes import *
-from ctypes.util import find_library
class Changes(object):
- libgfc = CDLL(find_library("gfchangelog"), mode=RTLD_GLOBAL, use_errno=True)
+ libgfc = CDLL("libgfchangelog.so", mode=RTLD_GLOBAL, use_errno=True)
@classmethod
def geterrno(cls):
--
2.12.0

View File

@ -1,138 +0,0 @@
From 616381bc25b0e90198683fb049f994e82d467d96 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= <mail@nh2.me>
Date: Sat, 13 May 2017 02:45:49 +0200
Subject: [PATCH] Don't use hardcoded /sbin, /usr/bin etc. paths. Fixes
#1450546.
Instead, rely on programs to be in PATH, as gluster already
does in many places across its code base.
Change-Id: Id21152fe42f5b67205d8f1571b0656c4d5f74246
---
contrib/fuse-lib/mount-common.c | 8 ++++----
xlators/mgmt/glusterd/src/glusterd-ganesha.c | 6 +++---
xlators/mgmt/glusterd/src/glusterd-quota.c | 6 +++---
xlators/mgmt/glusterd/src/glusterd-snapshot.c | 4 ++--
xlators/mgmt/glusterd/src/glusterd-utils.c | 14 +-------------
5 files changed, 13 insertions(+), 25 deletions(-)
diff --git a/contrib/fuse-lib/mount-common.c b/contrib/fuse-lib/mount-common.c
index e9f80fe81..6380dd867 100644
--- a/contrib/fuse-lib/mount-common.c
+++ b/contrib/fuse-lib/mount-common.c
@@ -255,16 +255,16 @@ fuse_mnt_umount (const char *progname, const char *abs_mnt,
exit (1);
}
#ifdef GF_LINUX_HOST_OS
- execl ("/bin/umount", "/bin/umount", "-i", rel_mnt,
+ execl ("umount", "umount", "-i", rel_mnt,
lazy ? "-l" : NULL, NULL);
- GFFUSE_LOGERR ("%s: failed to execute /bin/umount: %s",
+ GFFUSE_LOGERR ("%s: failed to execute umount: %s",
progname, strerror (errno));
#elif __NetBSD__
/* exitting the filesystem causes the umount */
exit (0);
#else
- execl ("/sbin/umount", "/sbin/umount", "-f", rel_mnt, NULL);
- GFFUSE_LOGERR ("%s: failed to execute /sbin/umount: %s",
+ execl ("umount", "umount", "-f", rel_mnt, NULL);
+ GFFUSE_LOGERR ("%s: failed to execute umount: %s",
progname, strerror (errno));
#endif /* GF_LINUX_HOST_OS */
exit (1);
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c
index 0e6629cf0..fcb4738b7 100644
--- a/xlators/mgmt/glusterd/src/glusterd-quota.c
+++ b/xlators/mgmt/glusterd/src/glusterd-quota.c
@@ -30,7 +30,7 @@
#ifndef _PATH_SETFATTR
# ifdef GF_LINUX_HOST_OS
-# define _PATH_SETFATTR "/usr/bin/setfattr"
+# define _PATH_SETFATTR "setfattr"
# endif
# ifdef __NetBSD__
# define _PATH_SETFATTR "/usr/pkg/bin/setfattr"
@@ -335,7 +335,7 @@ _glusterd_quota_initiate_fs_crawl (glusterd_conf_t *priv,
if (type == GF_QUOTA_OPTION_TYPE_ENABLE ||
type == GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS)
- runner_add_args (&runner, "/usr/bin/find", ".", NULL);
+ runner_add_args (&runner, "find", ".", NULL);
else if (type == GF_QUOTA_OPTION_TYPE_DISABLE) {
@@ -351,7 +351,7 @@ _glusterd_quota_initiate_fs_crawl (glusterd_conf_t *priv,
VIRTUAL_QUOTA_XATTR_CLEANUP_KEY, "1",
"{}", "\\", ";", NULL);
#else
- runner_add_args (&runner, "/usr/bin/find", ".",
+ runner_add_args (&runner, "find", ".",
"-exec", _PATH_SETFATTR, "-n",
VIRTUAL_QUOTA_XATTR_CLEANUP_KEY, "-v",
"1", "{}", "\\", ";", NULL);
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index da0152366..f0d135350 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -121,7 +121,7 @@ glusterd_build_snap_device_path (char *device, char *snapname,
}
runinit (&runner);
- runner_add_args (&runner, "/sbin/lvs", "--noheadings", "-o", "vg_name",
+ runner_add_args (&runner, "lvs", "--noheadings", "-o", "vg_name",
device, NULL);
runner_redir (&runner, STDOUT_FILENO, RUN_PIPE);
snprintf (msg, sizeof (msg), "Get volume group for device %s", device);
@@ -1982,7 +1982,7 @@ glusterd_is_thinp_brick (char *device, uint32_t *op_errno)
runinit (&runner);
- runner_add_args (&runner, "/sbin/lvs", "--noheadings", "-o", "pool_lv",
+ runner_add_args (&runner, "lvs", "--noheadings", "-o", "pool_lv",
device, NULL);
runner_redir (&runner, STDOUT_FILENO, RUN_PIPE);
runner_log (&runner, this->name, GF_LOG_DEBUG, msg);
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 51db13df0..6fa7b92f9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -6027,7 +6027,6 @@ static struct fs_info {
char *fs_tool_pattern;
char *fs_tool_pkg;
} glusterd_fs[] = {
- /* some linux have these in /usr/sbin/and others in /sbin/? */
{ "xfs", "xfs_info", NULL, "isize=", "xfsprogs" },
{ "ext3", "tune2fs", "-l", "Inode size:", "e2fsprogs" },
{ "ext4", "tune2fs", "-l", "Inode size:", "e2fsprogs" },
@@ -6048,7 +6047,6 @@ glusterd_add_inode_size_to_dict (dict_t *dict, int count)
char *trail = NULL;
runner_t runner = {0, };
struct fs_info *fs = NULL;
- char fs_tool_name[256] = {0, };
static dict_t *cached_fs = NULL;
memset (key, 0, sizeof (key));
@@ -6085,17 +6083,7 @@ glusterd_add_inode_size_to_dict (dict_t *dict, int count)
cur_word = "N/A";
goto cached;
}
-
- snprintf (fs_tool_name, sizeof (fs_tool_name),
- "/usr/sbin/%s", fs->fs_tool_name);
- if (sys_access (fs_tool_name, R_OK|X_OK) == 0)
- runner_add_arg (&runner, fs_tool_name);
- else {
- snprintf (fs_tool_name, sizeof (fs_tool_name),
- "/sbin/%s", fs->fs_tool_name);
- if (sys_access (fs_tool_name, R_OK|X_OK) == 0)
- runner_add_arg (&runner, fs_tool_name);
- }
+ runner_add_arg (&runner, fs->fs_tool_name);
break;
}
}
--
2.12.0