From ea187253a23d7394720d3b071d5888d30f2227d0 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 21 Feb 2016 21:14:09 +0100 Subject: [PATCH 1/2] Include git commit date & hash. --- Cargo.lock | 21 +++++++++++++++------ util/Cargo.toml | 6 +++++- util/build.rs | 6 ++++++ util/src/lib.rs | 2 +- util/src/misc.rs | 5 +++-- 5 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 util/build.rs diff --git a/Cargo.lock b/Cargo.lock index 16b41d0e8..8bf4a3764 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -52,6 +52,11 @@ name = "bitflags" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "blastfig" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "bytes" version = "0.3.0" @@ -236,9 +241,9 @@ dependencies = [ "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)", - "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", "tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "vergen 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -687,11 +692,6 @@ dependencies = [ "unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "target_info" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "term" version = "0.2.14" @@ -788,6 +788,15 @@ dependencies = [ "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "vergen" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "blastfig 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "winapi" version = "0.2.5" diff --git a/util/Cargo.toml b/util/Cargo.toml index 29d820760..aae6a3d85 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -5,6 +5,7 @@ license = "GPL-3.0" name = "ethcore-util" version = "0.9.99" authors = ["Ethcore "] +build = "build.rs" [dependencies] log = "0.3" @@ -28,12 +29,15 @@ sha3 = { path = "sha3" } 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" +vergen = "*" [features] default = [] dev = ["clippy"] + +[build-dependencies] +vergen = "*" diff --git a/util/build.rs b/util/build.rs new file mode 100644 index 000000000..32ee30472 --- /dev/null +++ b/util/build.rs @@ -0,0 +1,6 @@ +extern crate vergen; +use vergen::*; + +fn main() { + vergen(OutputFns::all()).unwrap(); +} \ No newline at end of file diff --git a/util/src/lib.rs b/util/src/lib.rs index b91e2d65b..07593e5eb 100644 --- a/util/src/lib.rs +++ b/util/src/lib.rs @@ -82,7 +82,6 @@ //! cargo build --release //! ``` -extern crate target_info; extern crate slab; extern crate rustc_serialize; extern crate mio; @@ -109,6 +108,7 @@ extern crate igd; extern crate ethcore_devtools as devtools; extern crate libc; extern crate rustc_version; +extern crate vergen; pub mod standard; #[macro_use] diff --git a/util/src/misc.rs b/util/src/misc.rs index fdbaa0b49..075da476d 100644 --- a/util/src/misc.rs +++ b/util/src/misc.rs @@ -18,9 +18,10 @@ use std::fs::File; use common::*; -use target_info::Target; use rustc_version; +include!(concat!(env!("OUT_DIR"), "/version.rs")); + #[derive(Debug,Clone,PartialEq,Eq)] /// Diff type for specifying a change (or not). pub enum Diff where T: Eq { @@ -67,5 +68,5 @@ pub fn contents(name: &str) -> Result { /// 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()) + format!("Parity/{}/{}-{}/{}/rustc{}", env!("CARGO_PKG_VERSION"), short_sha(), commit_date(), target(), rustc_version::version()) } \ No newline at end of file From 0c832853b6624fd9df0e36cee94ace83c48d23a9 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 21 Feb 2016 21:22:11 +0100 Subject: [PATCH 2/2] Avoid the dep = "*" --- util/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/Cargo.toml b/util/Cargo.toml index aae6a3d85..da4f8e34e 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -33,7 +33,7 @@ rustc_version = "0.1.0" igd = "0.4.2" ethcore-devtools = { path = "../devtools" } libc = "0.2.7" -vergen = "*" +vergen = "0.1" [features] default = []