Skip to content

Commit

Permalink
consul: 0.9.3 -> 1.0.6; also upgrade python-consul...
Browse files Browse the repository at this point in the history
... to a version that can handle Consul >= 1.0.

See #35602 (comment)

Upgrading consul also requires upgrading the Ruby deps, see
#41239 (comment)

Also add instructions on how to do that, and a small patch
to improve the error message when it is forgotten.

I had to manually bump the Ruby `json` dependency from the generated
`1.8.2` to `1.8.5` to work around the
  ‘rb_cFixnum’ undeclared
problem as shown on
https://community.bitnami.com/t/gem-file-dependencies/50552.
  • Loading branch information
nh2 committed May 30, 2018
1 parent deeeb50 commit 83d90ff
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 30 deletions.
4 changes: 2 additions & 2 deletions pkgs/development/python-modules/consul/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

buildPythonPackage rec {
pname = "python-consul";
version = "0.7.2";
version = "1.0.1";

src = fetchPypi {
inherit pname version;
sha256 = "ef0b7c8a2d8efba5f9602f45aadbe5035e22a511d245624ed732af81223a6571";
sha256 = "1i0pf3yvga7kvzzkj378hhmn9qs0y0iyhs28xflvz6w6nqa7msqg";
};

buildInputs = [ requests six pytest ];
Expand Down
7 changes: 5 additions & 2 deletions pkgs/servers/consul/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ GEM
remote: https://rubygems.org/
specs:
execjs (2.3.0)
json (1.8.2)
libv8 (3.16.14.11)
json (1.8.5)
libv8 (3.16.14.15)
ref (1.0.5)
sass (3.4.11)
therubyracer (0.12.1)
Expand All @@ -20,3 +20,6 @@ DEPENDENCIES
sass
therubyracer
uglifier

BUNDLED WITH
1.12.5
14 changes: 14 additions & 0 deletions pkgs/servers/consul/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Updating consul

When updating consul, you must also update `consul-ui`'s Ruby dependencies.

Do so by downloading the source code, `cd ui`, and run

```bash
cd TEMP_DIR_WITH_CONSUL_SOURCE
cd ui
$(nix-build '<nixpkgs>' -A bundix --no-out-link)/bin/bundix --magic
cp gemset.nix Gemfile Gemfile.lock THIS_DIRECTORY
```

(As described in https://nixos.org/nixpkgs/manual/#sec-language-ruby)
4 changes: 2 additions & 2 deletions pkgs/servers/consul/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

buildGoPackage rec {
name = "consul-${version}";
version = "0.9.3";
version = "1.0.6";
rev = "v${version}";

goPackagePath = "github.com/hashicorp/consul";
Expand All @@ -11,7 +11,7 @@ buildGoPackage rec {
owner = "hashicorp";
repo = "consul";
inherit rev;
sha256 = "1176frp7kimpycsmz9wrbizf46jgxr8jq7hz5w4q1x90lswvrxv3";
sha256 = "06isx7y6nc3305d9bw61738jfmyyh0czshgfdn8dvhdhvxjs5pp2";
};

# Keep consul.ui for backward compatability
Expand Down
47 changes: 24 additions & 23 deletions pkgs/servers/consul/gemset.nix
Original file line number Diff line number Diff line change
@@ -1,59 +1,60 @@
{
execjs = {
version = "2.3.0";
source = {
type = "gem";
remotes = ["https://rubygems.org"];
sha256 = "097v02bhmzc70j7n0yyf8j0z5wms88zcmgpmggby4hnvqxf41y1h";
type = "gem";
};
version = "2.3.0";
};
json = {
version = "1.8.2";
source = {
type = "gem";
remotes = ["https://rubygems.org"];
sha256 = "0zzvv25vjikavd3b1bp6lvbgj23vv9jvmnl4vpim8pv30z8p6vr5";
type = "gem";
};
version = "1.8.5";
};
libv8 = {
version = "3.16.14.11";
source = {
remotes = ["https://rubygems.org"];
sha256 = "1j5x22v7rqdk1047k0sz4k1xhf6hkdw6h1nl7xsw694hfjdb0vyx";
type = "gem";
sha256 = "000vbiy78wk5r1f6p7qncab8ldg7qw5pjz7bchn3lw700gpaacxp";
};
version = "3.16.14.15";
};
ref = {
version = "1.0.5";
source = {
type = "gem";
remotes = ["https://rubygems.org"];
sha256 = "19qgpsfszwc2sfh6wixgky5agn831qq8ap854i1jqqhy1zsci3la";
type = "gem";
};
version = "1.0.5";
};
sass = {
version = "3.4.11";
source = {
type = "gem";
remotes = ["https://rubygems.org"];
sha256 = "10dncnv7g5v8d1xpw2aaarxjjlm68f7nm02ns2kl8nf3yxi6wzdf";
type = "gem";
};
version = "3.4.11";
};
therubyracer = {
version = "0.12.1";
dependencies = ["libv8" "ref"];
source = {
type = "gem";
remotes = ["https://rubygems.org"];
sha256 = "106fqimqyaalh7p6czbl5m2j69z8gv7cm10mjb8bbb2p2vlmqmi6";
type = "gem";
};
dependencies = [
"libv8"
"ref"
];
version = "0.12.1";
};
uglifier = {
version = "2.7.0";
dependencies = ["execjs" "json"];
source = {
type = "gem";
remotes = ["https://rubygems.org"];
sha256 = "1x1mnakx086l83a3alj690c6n8kfmb4bk243a6m6yz99s15gbxfq";
type = "gem";
};
dependencies = [
"execjs"
"json"
];
version = "2.7.0";
};
}
}
16 changes: 15 additions & 1 deletion pkgs/servers/consul/ui.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,21 @@ stdenv.mkDerivation {

buildInputs = [ ruby gems zip ];

patchPhase = "patchShebangs ./ui/scripts/dist.sh";
patchPhase = ''
patchShebangs ./ui/scripts/dist.sh
'' +
# Patch out upstream's habit of checking if all deps are available,
# hiding all error messages and installing them with `bundle install`
# if they aren't.
# That way we can easily see when upstream's deps changed but
# `bundix` wasn't run to reflect that in nixpkgs.
# This will have to be updated if
# https://github.com/hashicorp/consul/pull/4176 is merged
# (we still want to patch `bundle install` out to make the error
# message more obvious).
''
sed -i 's:bundle check >/dev/null 2>&1 || bundle install:bundle check:g' ui/scripts/dist.sh
'';

buildPhase = ''
# Build ui static files
Expand Down

0 comments on commit 83d90ff

Please sign in to comment.