Merge pull request #485 from ethcore/properversion

Use proper version string.
This commit is contained in:
Gav Wood 2016-02-21 20:23:37 +01:00
commit 22ff5bb7d7
10 changed files with 19 additions and 13 deletions

3
Cargo.lock generated
View File

@ -15,7 +15,6 @@ dependencies = [
"fdlimit 0.1.0",
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
"target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -208,7 +207,6 @@ dependencies = [
"serde_codegen 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)",
"target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -234,6 +232,7 @@ dependencies = [
"rocksdb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-crypto 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)",
"sha3 0.1.0",
"slab 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -17,7 +17,6 @@ ethcore = { path = "ethcore" }
ethsync = { path = "sync" }
ethcore-rpc = { path = "rpc", optional = true }
fdlimit = { path = "util/fdlimit" }
target_info = "0.1"
daemonize = "0.2"
ethcore-devtools = { path = "devtools" }

View File

@ -29,7 +29,6 @@ extern crate log as rlog;
extern crate env_logger;
extern crate ctrlc;
extern crate fdlimit;
extern crate target_info;
extern crate daemonize;
#[cfg(feature = "rpc")]
@ -51,7 +50,6 @@ use ethcore::ethereum;
use ethcore::blockchain::CacheSize;
use ethsync::EthSync;
use docopt::Docopt;
use target_info::Target;
use daemonize::Daemonize;
const USAGE: &'static str = "
@ -146,14 +144,15 @@ fn setup_rpc_server(_client: Arc<Client>, _sync: Arc<EthSync>, _url: &str) {
fn print_version() {
println!("\
Parity version {} ({}-{}-{})
Parity
version {}
Copyright 2015, 2016 Ethcore (UK) Limited
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
By Wood/Paronyan/Kotewicz/Drwięga/Volf.\
", env!("CARGO_PKG_VERSION"), Target::arch(), Target::env(), Target::os());
", version());
}
fn die_with_message(msg: &str) -> ! {

View File

@ -17,7 +17,6 @@ ethcore-util = { path = "../util" }
ethcore = { path = "../ethcore" }
ethsync = { path = "../sync" }
clippy = { version = "0.0.42", optional = true }
target_info = "0.1.0"
rustc-serialize = "0.3"
serde_macros = { version = "0.6.13", optional = true }

View File

@ -20,7 +20,6 @@
#![cfg_attr(nightly, plugin(serde_macros, clippy))]
extern crate rustc_serialize;
extern crate target_info;
extern crate serde;
extern crate serde_json;
extern crate jsonrpc_core;

View File

@ -15,8 +15,8 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Web3 rpc implementation.
use target_info::Target;
use jsonrpc_core::*;
use util::version;
use v1::traits::Web3;
/// Web3 rpc implementation.
@ -30,7 +30,9 @@ impl Web3Client {
impl Web3 for Web3Client {
fn client_version(&self, params: Params) -> Result<Value, Error> {
match params {
Params::None => Ok(Value::String(format!("Parity/-/{}/{}-{}-{}/rust1.8-nightly", env!("CARGO_PKG_VERSION"), Target::arch(), Target::env(), Target::os()))),
Params::None => {
Ok(Value::String(version())),
}
_ => Err(Error::invalid_params())
}
}

View File

@ -29,6 +29,7 @@ serde = "0.6.7"
clippy = { version = "0.0.42", optional = true }
json-tests = { path = "json-tests" }
target_info = "0.1.0"
rustc_version = "0.1.0"
igd = "0.4.2"
ethcore-devtools = { path = "../devtools" }
libc = "0.2.7"

View File

@ -108,6 +108,7 @@ extern crate log as rlog;
extern crate igd;
extern crate ethcore_devtools as devtools;
extern crate libc;
extern crate rustc_version;
pub mod standard;
#[macro_use]

View File

@ -18,6 +18,8 @@
use std::fs::File;
use common::*;
use target_info::Target;
use rustc_version;
#[derive(Debug,Clone,PartialEq,Eq)]
/// Diff type for specifying a change (or not).
@ -62,3 +64,8 @@ pub fn contents(name: &str) -> Result<Bytes, UtilError> {
try!(file.read_to_end(&mut ret));
Ok(ret)
}
/// Get the standard version string for this software.
pub fn version() -> String {
format!("Parity/-/{}/{}-{}-{}/{}", env!("CARGO_PKG_VERSION"), Target::arch(), Target::env(), Target::os(), rustc_version::version())
}

View File

@ -26,8 +26,8 @@ use std::io::{Read, Write};
use std::fs;
use mio::*;
use mio::tcp::*;
use target_info::Target;
use hash::*;
use misc::version;
use crypto::*;
use sha3::Hashable;
use rlp::*;
@ -360,7 +360,7 @@ impl<Message> Host<Message> where Message: Send + Sync + Clone {
config: config,
nonce: H256::random(),
protocol_version: PROTOCOL_VERSION,
client_version: format!("Parity/{}/{}-{}-{}", env!("CARGO_PKG_VERSION"), Target::arch(), Target::env(), Target::os()),
client_version: version(),
listen_port: 0,
capabilities: Vec::new(),
}),