From 345bbc715db133a02b30ffd28248d743376d186b Mon Sep 17 00:00:00 2001 From: Benjamin Canou Date: Wed, 14 Feb 2018 16:24:08 +0100 Subject: [PATCH] Client: move protocol injection commands to the admin client --- .gitlab-ci.yml | 5 +++++ src/bin_client/jbuild | 2 +- src/bin_client/main_client.ml | 1 - src/bin_client/test/jbuild | 4 ++++ src/bin_client/test/test_injection.sh | 5 +++-- src/bin_client/test/test_lib.inc.sh | 3 ++- src/bin_client/tezos-init-sandboxed-client.sh | 6 +++++- 7 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 346dd69eb..4bdd1795f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -401,6 +401,11 @@ opam:37:tezos-unix-signers: variables: package: tezos-unix-signers +opam:38:tezos-client-commands: + <<: *opam_definition + variables: + package: tezos-client-commands + ##END_OPAM## diff --git a/src/bin_client/jbuild b/src/bin_client/jbuild index cb787221f..f7cb3d5f9 100644 --- a/src/bin_client/jbuild +++ b/src/bin_client/jbuild @@ -2,7 +2,7 @@ (executables ((names (main_client main_admin)) - (public_names (tezos-client tezos-admin)) + (public_names (tezos-client tezos-admin-client)) (libraries (tezos-base tezos-rpc-http tezos-shell-services diff --git a/src/bin_client/main_client.ml b/src/bin_client/main_client.ml index 45aacbd98..353fd402a 100644 --- a/src/bin_client/main_client.ml +++ b/src/bin_client/main_client.ml @@ -44,7 +44,6 @@ let select_commands ctxt { block ; protocol } = Client_rpc_commands.commands @ Client_network_commands.commands () @ Client_keys_commands.commands () @ - Client_protocols.commands () @ Client_helpers_commands.commands () @ commands_for_version diff --git a/src/bin_client/test/jbuild b/src/bin_client/test/jbuild index e7835d587..30bcab81f 100644 --- a/src/bin_client/test/jbuild +++ b/src/bin_client/test/jbuild @@ -13,6 +13,7 @@ ${bin:tezos-node} ${bin:tezos-init-sandboxed-client.sh} ${bin:tezos-client} + ${bin:tezos-admin-client} )))) (alias @@ -28,6 +29,7 @@ ${bin:tezos-node} ${bin:tezos-init-sandboxed-client.sh} ${bin:tezos-client} + ${bin:tezos-admin-client} )))) (alias @@ -45,6 +47,7 @@ ${bin:tezos-node} ${bin:tezos-init-sandboxed-client.sh} ${bin:tezos-client} + ${bin:tezos-admin-client} )))) (alias @@ -60,6 +63,7 @@ ${bin:tezos-node} ${bin:tezos-init-sandboxed-client.sh} ${bin:tezos-client} + ${bin:tezos-admin-client} )))) (alias diff --git a/src/bin_client/test/test_injection.sh b/src/bin_client/test/test_injection.sh index 3aceab8ff..858f9334c 100755 --- a/src/bin_client/test/test_injection.sh +++ b/src/bin_client/test/test_injection.sh @@ -8,8 +8,9 @@ source $test_dir/test_lib.inc.sh "$@" start_node 1 sleep 2 -$client inject protocol "$test_dir/demo" -$client list protocols + +$admin_client inject protocol "$test_dir/demo" +$admin_client list protocols echo echo End of test diff --git a/src/bin_client/test/test_lib.inc.sh b/src/bin_client/test/test_lib.inc.sh index 471e5b028..9526aa9d0 100755 --- a/src/bin_client/test/test_lib.inc.sh +++ b/src/bin_client/test/test_lib.inc.sh @@ -9,7 +9,8 @@ sandbox_file="$test_dir/sandbox.json" tezos_sandboxed_node="${1:-$test_dir/../../bin_node/tezos-sandboxed-node.sh}" local_node="${2:-$test_dir/../../../_build/default/src/bin_node/main.exe}" tezos_init_sandboxed_client="${3:-$test_dir/../../bin_client/tezos-init-sandboxed-client.sh}" -local_client="${4:-$test_dir/../../../_build/default/src/bin_client/main.exe}" +local_client="${4:-$test_dir/../../../_build/default/src/bin_client/main_client.exe}" +local_admin_client="${5:-$test_dir/../../../_build/default/src/bin_client/main_admin.exe}" contract_dir="contracts" diff --git a/src/bin_client/tezos-init-sandboxed-client.sh b/src/bin_client/tezos-init-sandboxed-client.sh index 68535d49b..2f8cbae58 100755 --- a/src/bin_client/tezos-init-sandboxed-client.sh +++ b/src/bin_client/tezos-init-sandboxed-client.sh @@ -4,6 +4,7 @@ set -e client_dir="${client_dir:=$HOME/.tezos-client}" client="${client:=tezos-client -base-dir $client_dir}" +admin_client="${client:=tezos-admin-client -base-dir $client_dir}" client_dirs=() @@ -16,6 +17,7 @@ init_sandboxed_client() { client_dir="$(mktemp -d -t tezos-tmp-client.XXXXXXXX)" client_dirs+=("$client_dir") client="$local_client -base-dir $client_dir -addr 127.0.0.1 -port $rpc" + admin_client="$local_admin_client -base-dir $client_dir -addr 127.0.0.1 -port $rpc" } @@ -215,8 +217,10 @@ main () { local bin_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")" if [ $(basename "$bin_dir") = "bin_client" ]; then local_client="${local_client:-$bin_dir/../../_build/default/src/bin_client/main_client.exe}" + local_admin_client="${local_admin_client:-$bin_dir/../../_build/default/src/bin_client/main_admin.exe}" else local_client="${local_client:-tezos-client}" + local_admin_client="${local_admin_client:-tezos-admin-client}" fi if [ $# -lt 1 ] || [ "$1" -le 0 ] || [ 10 -le "$1" ]; then @@ -233,7 +237,7 @@ main () { echo "exec $client \"\$@\"" >> $client_dir/bin/tezos-client chmod +x $client_dir/bin/tezos-client echo '#!/bin/sh' > $client_dir/bin/tezos-admin-client - echo "exec $client \"\$@\"" | sed s/main_client/main_admin/g >> $client_dir/bin/tezos-admin-client + echo "exec $admin_client \"\$@\"" >> $client_dir/bin/tezos-admin-client chmod +x $client_dir/bin/tezos-admin-client cat <