Skip to content

Commit e2b0896

Browse files
committedJun 2, 2017
Merge remote-tracking branch 'upstream/master' into HEAD
2 parents 2f12902 + 68faf5d commit e2b0896

File tree

14 files changed

+768
-76
lines changed

14 files changed

+768
-76
lines changed
 

‎nixos/modules/services/network-filesystems/glusterfs.nix

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
with lib;
44

55
let
6-
inherit (pkgs) glusterfs;
6+
inherit (pkgs) glusterfs rsync;
77

88
cfg = config.services.glusterfs;
99

@@ -50,8 +50,11 @@ in
5050
after = [ "rpcbind.service" "network.target" "local-fs.target" ];
5151
before = [ "network-online.target" ];
5252

53+
# The copying of hooks is due to upstream bug https://bugzilla.redhat.com/show_bug.cgi?id=1452761
5354
preStart = ''
5455
install -m 0755 -d /var/log/glusterfs
56+
mkdir -p /var/lib/glusterd/hooks/
57+
${rsync}/bin/rsync -a ${glusterfs}/var/lib/glusterd/hooks/ /var/lib/glusterd/hooks/
5558
'';
5659

5760
serviceConfig = {

‎nixos/modules/services/networking/i2pd.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ in
212212
type = with types; nullOr int;
213213
default = null;
214214
description = ''
215-
Set a router bandwidth limit integer in kbps or letters: L (32), O (256), P (2048), X (>9000)
215+
Set a router bandwidth limit integer in KBps.
216+
If not set, i2pd defaults to 32KBps.
216217
'';
217218
};
218219

‎pkgs/applications/altcoins/seth.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
stdenv.mkDerivation rec {
55
name = "seth-${version}";
6-
version = "0.5.0";
6+
version = "0.5.1";
77

88
src = fetchFromGitHub {
99
owner = "dapphub";
1010
repo = "seth";
1111
rev = "v${version}";
12-
sha256 = "0bgygvilhbabb0y9pv9cn8cx7cj513w9is4vh6v69h2czknrjmgz";
12+
sha256 = "1qph1gldj24r8l6aswb1w133lrm8zsxmmxl4krjik0a73bm4ghdm";
1313
};
1414

1515
nativeBuildInputs = [makeWrapper];

‎pkgs/development/go-modules/generic/default.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ go.stdenv.mkDerivation (
198198
ln -s "${dep.src}" "$d/src/${dep.goPackagePath}"
199199
''
200200
) goPath) + ''
201-
export GOPATH="$d:$GOPATH"
201+
export GOPATH=${lib.concatStringsSep ":" ( ["$d"] ++ ["$GOPATH"] ++ ["$PWD"] ++ extraSrcPaths)}
202202
'';
203203

204204
disallowedReferences = lib.optional (!allowGoReference) go
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{ buildPythonPackage
2+
, fetchPypi
3+
, numpy
4+
, pytest
5+
, pytestrunner
6+
}:
7+
8+
buildPythonPackage rec {
9+
pname = "fonttools";
10+
version = "3.13.0";
11+
name = "${pname}-${version}";
12+
13+
src = fetchPypi {
14+
inherit pname version;
15+
sha256 = "5ec278ff231d0c88afe8266e911ee0f8e66c8501c53f5f144a1a0abbc936c6b8";
16+
extension = "zip";
17+
};
18+
19+
buildInputs = [
20+
numpy
21+
];
22+
23+
checkInputs = [
24+
pytest
25+
pytestrunner
26+
];
27+
28+
meta = {
29+
homepage = "https://github.com/fonttools/fonttools";
30+
description = "A library to manipulate font files from Python";
31+
};
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{ lib
2+
, buildPythonPackage
3+
, fetchPypi
4+
, isPy26
5+
, importlib
6+
, argparse
7+
}:
8+
9+
buildPythonPackage rec {
10+
pname = "future";
11+
version = "0.16.0";
12+
name = "${pname}-${version}";
13+
14+
src = fetchPypi {
15+
inherit pname version;
16+
sha256 = "1nzy1k4m9966sikp0qka7lirh8sqrsyainyf8rk97db7nwdfv773";
17+
};
18+
19+
propagatedBuildInputs = lib.optionals isPy26 [ importlib argparse ];
20+
doCheck = false;
21+
22+
meta = {
23+
description = "Clean single-source support for Python 3 and 2";
24+
longDescription = ''
25+
python-future is the missing compatibility layer between Python 2 and
26+
Python 3. It allows you to use a single, clean Python 3.x-compatible
27+
codebase to support both Python 2 and Python 3 with minimal overhead.
28+
29+
It provides future and past packages with backports and forward ports
30+
of features from Python 3 and 2. It also comes with futurize and
31+
pasteurize, customized 2to3-based scripts that helps you to convert
32+
either Py2 or Py3 code easily to support both Python 2 and 3 in a
33+
single clean Py3-style codebase, module by module.
34+
'';
35+
homepage = https://python-future.org;
36+
downloadPage = https://github.com/PythonCharmers/python-future/releases;
37+
license = with lib.licenses; [ mit ];
38+
maintainers = with lib.maintainers; [ prikhi ];
39+
};
40+
}

‎pkgs/development/python-modules/hypothesis.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ buildPythonPackage rec {
1818
owner = "HypothesisWorks";
1919
repo = "hypothesis-python";
2020
rev = "${version}";
21-
sha256 = "5344cc3327bc7fa543fc3b42e85c55f40dda0eeaec38327f9bf373c3ece42b39";
21+
sha256 = "0damf6zbm0db2a3gfwrbbj92yal576wpmhhchc0w0np8vdnax70n";
2222
};
2323

2424
checkInputs = stdenv.lib.optionals doCheck [ pytest pytest_xdist flake8 flaky ];

‎pkgs/development/tools/misc/cgdb/default.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ stdenv, fetchurl, ncurses, readline, flex, texinfo, help2man }:
1+
{ stdenv, fetchurl, ncurses, readline, flex, texinfo }:
22

33
stdenv.mkDerivation rec {
44
name = "cgdb-${version}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
99
sha256 = "08slzg3702v5nivjhdx2bciqxc5vqcn8pc4i4lsgkcwdcrj94ymz";
1010
};
1111

12-
buildInputs = [ ncurses readline flex texinfo help2man ];
12+
buildInputs = [ ncurses readline flex texinfo ];
1313

1414
meta = with stdenv.lib; {
1515
description = "A curses interface to gdb";
+132-17
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,87 @@
11
{stdenv, fetchurl, fuse, bison, flex_2_5_35, openssl, python2, ncurses, readline,
2-
autoconf, automake, libtool, pkgconfig, zlib, libaio, libxml2, acl, sqlite
3-
, liburcu, attr, makeWrapper, coreutils, gnused, gnugrep, which
2+
autoconf, automake, libtool, pkgconfig, zlib, libaio, libxml2, acl, sqlite,
3+
liburcu, attr, makeWrapper, coreutils, gnused, gnugrep, which, python2Packages,
4+
openssh, gawk, findutils, utillinux, lvm2, btrfs-progs, e2fsprogs, xfsprogs, systemd,
5+
rsync, glibc
46
}:
5-
let
7+
let
68
s =
79
rec {
810
baseName="glusterfs";
9-
version = "3.10.1";
11+
# NOTE: On each glusterfs release, it should be checked if gluster added
12+
# new, or changed, Python scripts whose PYTHONPATH has to be set in
13+
# `postFixup` below, and whose runtime deps need to go into
14+
# `nativeBuildInputs`.
15+
# The command
16+
# find /nix/store/...-glusterfs-.../ -name '*.py' -executable
17+
# can help with finding new Python scripts.
18+
version = "3.10.2";
1019
name="${baseName}-${version}";
11-
url="http://download.gluster.org/pub/gluster/glusterfs/3.10/${version}/glusterfs-${version}.tar.gz";
12-
sha256 = "05qmn85lg3d1gz0fhn1v2z7nwl2qwbflvjc8nvkfyr4r57rkvhnk";
20+
url="https://github.com/gluster/glusterfs/archive/v${version}.tar.gz";
21+
sha256 = "09hpvw42sc77nc3bfv7395wjn7fxvp0n8qnmrlyxq83hf0w81gfs";
1322
};
1423
buildInputs = [
15-
fuse bison flex_2_5_35 openssl python2 ncurses readline
24+
fuse bison flex_2_5_35 openssl ncurses readline
1625
autoconf automake libtool pkgconfig zlib libaio libxml2
1726
acl sqlite liburcu attr makeWrapper
27+
(python2.withPackages (pkgs: [
28+
pkgs.flask
29+
pkgs.prettytable
30+
pkgs.requests
31+
pkgs.xattr
32+
]))
33+
# NOTE: `python2` has to be *AFTER* the above `python2.withPackages`,
34+
# to ensure that the packages are available but the `toPythonPath`
35+
# shell function used in `postFixup` is also still available.
36+
python2
1837
];
1938
# Some of the headers reference acl
2039
propagatedBuildInputs = [
2140
acl
2241
];
42+
# Packages from which GlusterFS calls binaries at run-time from PATH,
43+
# with comments on which commands are known to be called by it.
44+
runtimePATHdeps = [
45+
attr # getfattr setfattr
46+
btrfs-progs # btrfs
47+
coreutils # lots of commands in bash scripts
48+
e2fsprogs # tune2fs
49+
findutils # find
50+
gawk # awk
51+
glibc # getent
52+
gnugrep # grep
53+
gnused # sed
54+
lvm2 # lvs
55+
openssh # ssh
56+
rsync # rsync, e.g. for geo-replication
57+
systemd # systemctl
58+
utillinux # mount umount
59+
which # which
60+
xfsprogs # xfs_info
61+
];
2362
in
2463
stdenv.mkDerivation
2564
rec {
2665
inherit (s) name version;
2766
inherit buildInputs propagatedBuildInputs;
2867

29-
preConfigure = ''
68+
patches = [
69+
./glusterfs-use-PATH-instead-of-hardcodes.patch
70+
./glusterfs-fix-unsubstituted-autoconf-macros.patch
71+
./glusterfs-python-remove-find_library.patch
72+
];
73+
74+
# Note that the VERSION file is something that is present in release tarballs
75+
# but not in git tags (at least not as of writing in v3.10.1).
76+
# That's why we have to create it.
77+
# Without this, gluster (at least 3.10.1) will fail very late and cryptically,
78+
# for example when setting up geo-replication, with a message like
79+
# Staging of operation 'Volume Geo-replication Create' failed on localhost : Unable to fetch master volume details. Please check the master cluster and master volume.
80+
# What happens here is that the gverify.sh script tries to compare the versions,
81+
# but fails when the version is empty.
82+
# See upstream GlusterFS bug https://bugzilla.redhat.com/show_bug.cgi?id=1452705
83+
preConfigure = ''
84+
echo "v${s.version}" > VERSION
3085
./autogen.sh
3186
'';
3287

@@ -36,18 +91,78 @@ rec {
3691

3792
makeFlags = "DESTDIR=$(out)";
3893

39-
preInstall = ''
40-
substituteInPlace api/examples/Makefile --replace '$(DESTDIR)' $out
41-
substituteInPlace geo-replication/syncdaemon/Makefile --replace '$(DESTDIR)' $out
42-
substituteInPlace geo-replication/syncdaemon/Makefile --replace '$(DESTDIR)' $out
43-
substituteInPlace xlators/features/glupy/examples/Makefile --replace '$(DESTDIR)' $out
44-
substituteInPlace xlators/features/glupy/src/Makefile --replace '$(DESTDIR)' $out
45-
'';
94+
enableParallelBuilding = true;
4695

4796
postInstall = ''
4897
cp -r $out/$out/* $out
4998
rm -r $out/nix
50-
wrapProgram $out/sbin/mount.glusterfs --set PATH "${stdenv.lib.makeBinPath [ coreutils gnused attr gnugrep which]}"
99+
'';
100+
101+
postFixup = ''
102+
# glusterd invokes `gluster` and other utilities when telling other glusterd nodes to run commands.
103+
# For example for `peer_georep-sshkey` key generation, so `$out/bin` is needed in the PATH.
104+
# It also invokes bash scripts like `gverify.sh`.
105+
# It also invokes executable Python scripts in `$out/libexec/glusterfs`, which is why we set up PYTHONPATH accordingly.
106+
# We set up the paths for the main entry point executables.
107+
108+
GLUSTER_PATH="${stdenv.lib.makeBinPath runtimePATHdeps}:$out/bin"
109+
GLUSTER_PYTHONPATH="$(toPythonPath $out):$out/libexec/glusterfs"
110+
GLUSTER_LD_LIBRARY_PATH="$out/lib"
111+
112+
wrapProgram $out/bin/glusterd --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
113+
wrapProgram $out/bin/gluster --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
114+
wrapProgram $out/sbin/mount.glusterfs --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
115+
116+
# Set Python environment for the Python based utilities.
117+
# It would be nice if there was a better way to do this, automatically for all of them.
118+
# Also, this is brittle: If we forget a dependency or gluster adds a new one, things will break deep inside gluster.
119+
# We should better try to get an explicit list of Python dependencies from gluster and ensure all of them are in the PYTHONPATH of all these python scripts.
120+
# But at the time of writing (gluster 3.10), gluster only provides this in form of a gluster.spec file for RPM creation,
121+
# and even that one is not complete (for example it doesn't mention the `flask` dependency).
122+
123+
wrapProgram $out/bin/gluster-eventsapi --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
124+
wrapProgram $out/bin/gluster-georep-sshkey --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
125+
wrapProgram $out/bin/gluster-mountbroker --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
126+
wrapProgram $out/bin/glusterfind --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
127+
128+
# Note that we only wrap the symlinks in $out/bin, not the actual executable scripts in $out/libexec/glusterfs.
129+
# This is because those scripts use `__file__` in their program logic
130+
# (see https://github.com/gluster/glusterfs/blob/v3.10.1/extras/cliutils/cliutils.py#L116)
131+
# which would break if we changed the file name (which is what `wrapProgram` does).
132+
# Luckily, `libexec` scripts are never supposed to be invoked straight from PATH,
133+
# instead they are invoked directly from `gluster` or `glusterd`, which is why it is
134+
# sufficient to set PYTHONPATH for those executables.
135+
136+
wrapProgram $out/share/glusterfs/scripts/eventsdash.py --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
137+
'';
138+
139+
doInstallCheck = true;
140+
141+
# Below we run Python programs. That generates .pyc/.pyo files.
142+
# By default they are indeterministic because such files contain time stamps
143+
# (see https://nedbatchelder.com/blog/200804/the_structure_of_pyc_files.html).
144+
# So we use the same environment variables as in
145+
# https://github.com/NixOS/nixpkgs/blob/249b34aadca7038207492f29142a3456d0cecec3/pkgs/development/interpreters/python/mk-python-derivation.nix#L61
146+
# to make these files deterministic.
147+
# A general solution to this problem might be brought by #25707.
148+
DETERMINISTIC_BUILD = 1;
149+
PYTHONHASHSEED = 0;
150+
151+
installCheckPhase = ''
152+
# Tests that the above programs work without import errors.
153+
# For testing it manually in a shell you may want to substitute `$out` with `$(dirname $(readlink -f $(which gluster)))/../`.
154+
$out/bin/glusterd --help
155+
# $out/bin/gluster help # can't do this because even `gluster help` tries to write to `/var/log/glusterfs/cli.log`
156+
$out/bin/gluster-eventsapi --help
157+
$out/bin/gluster-georep-sshkey --help
158+
$out/bin/gluster-mountbroker --help
159+
$out/bin/glusterfind --help
160+
# gfid_to_path.py doesn't accept --help, and it requires different arguments
161+
# (a dir as single argument) than the usage prints when stdin is not a TTY.
162+
# The `echo ""` is just so that stdin is not a TTY even if you try this line
163+
# on a real TTY for testing purposes.
164+
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)
165+
$out/share/glusterfs/scripts/eventsdash.py --help
51166
'';
52167

53168
src = fetchurl {
@@ -60,7 +175,7 @@ rec {
60175
maintainers = [
61176
stdenv.lib.maintainers.raskin
62177
];
63-
platforms = with stdenv.lib.platforms;
178+
platforms = with stdenv.lib.platforms;
64179
linux ++ freebsd;
65180
};
66181
}

0 commit comments

Comments
 (0)
Please sign in to comment.