add version info for ~~xous~~ to the shellchat command

this took...way too long to figure out. Latest versions
of `vergen` for whatever reason seem totally broken for
my build hosts.
This commit is contained in:
bunnie 2022-01-25 16:37:50 +08:00
parent 077a286b42
commit e55154be69
7 changed files with 40 additions and 20 deletions

11
Cargo.lock generated
View file

@ -1185,9 +1185,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
version = "0.2.106"
version = "0.2.113"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a60553f9a9e039a333b4e9b20573b9e9b9c0bb3a11e201ccc48ef4283456d673"
checksum = "eef78b64d87775463c549fbd80e19249ef436ea3bf1de2a1eb7e717ec7fab1e9"
[[package]]
name = "libloading"
@ -1266,7 +1266,6 @@ dependencies = [
"num-derive",
"num-traits",
"utralib",
"vergen",
"xous",
"xous-ipc",
]
@ -2570,12 +2569,13 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "vergen"
version = "3.1.0"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ce50d8996df1f85af15f2cd8d33daae6e479575123ef4314a51a70a230739cb"
checksum = "e7141e445af09c8919f1d5f8a20dae0b20c3b57a45dee0d5823c6ed5d237f15a"
dependencies = [
"bitflags",
"chrono",
"rustc_version 0.4.0",
]
[[package]]
@ -2929,6 +2929,7 @@ dependencies = [
"curl",
"filetime",
"rustc_version 0.4.0",
"vergen",
"zip",
]

View file

@ -13,8 +13,8 @@ num-traits = {version = "0.2.14", default-features = false}
xous = {path = "../../xous-rs"}
xous-ipc = {path = "../../xous-ipc"}
[build-dependencies]
vergen = "3"
#[build-dependencies]
#vergen = "3"
[target.'cfg(not(any(windows,unix)))'.dependencies]
utralib = {path = "../../utralib"}

View file

@ -1,8 +1,8 @@
// NOTE: Adapted from cortex-m/build.rs
use std::env;
extern crate vergen;
use vergen::{generate_cargo_keys, ConstantsFlags};
//extern crate vergen;
//use vergen::{generate_cargo_keys, ConstantsFlags};
fn main() {
let target = env::var("TARGET").unwrap();
@ -16,10 +16,11 @@ fn main() {
println!("cargo:rustc-cfg=baremetal");
}
generate_cargo_keys(
ConstantsFlags::SHA, /*| ConstantsFlags::BUILD_TIMESTAMP*/
)
.unwrap();
//generate_cargo_keys(
// ConstantsFlags::SHA, /*| ConstantsFlags::BUILD_TIMESTAMP*/
//)
//.unwrap();
// BUILD_TIMESTAMP doesn't work -- it doesn't update because of the below line
// removing the below line causes a lengthy full-rebuild just to capture a timestamp.
// so, we're removing the timestamp.

View file

@ -379,19 +379,17 @@ fn reader_thread(arg: usize) {
env!("VERGEN_SHA")
)
.unwrap();
// time stamp isn't actually the time stamp of the build, unfortunately. It's the time stamp of the
// last time you managed to force a rebuild that also causes log-server to be rebuilt, not necessarily
// capturing the build time of the very most recent change!
// writeln!(output, "LOG: *** Built: {:49} ***", env!("VERGEN_BUILD_TIMESTAMP")).unwrap();
writeln!(output, "LOG: *** Built: {:49} ***", env!("VERGEN_BUILD_TIMESTAMP")).unwrap();
writeln!(output, "LOG: *** Semver: {:48} ***", env!("VERGEN_SEMVER")).unwrap();
writeln!(
output,
"LOG: ****************************************************************"
)
.unwrap();
println!("LOG: my PID is {}", xous::process::id());
let server_addr = xous::create_server_with_address(b"xous-log-server ").unwrap();
writeln!(output, "LOG: Server listening on address {:?}", server_addr).unwrap();
println!("LOG: my PID is {}", xous::process::id());
let mut counter: usize = 0;
loop {
if counter.trailing_zeros() >= 12 {

View file

@ -11,7 +11,7 @@ impl<'a> ShellCmdApi<'a> for Ver {
fn process(&mut self, args: String::<1024>, env: &mut CommonEnv) -> Result<Option<String::<1024>>, xous::Error> {
use core::fmt::Write;
let mut ret = String::<1024>::new();
let helpstring = "ver options: ec, wf200, soc, dna";
let helpstring = "ver options: ec, wf200, soc, dna, xous";
let mut tokens = args.as_str().unwrap().split(' ');
@ -36,6 +36,13 @@ impl<'a> ShellCmdApi<'a> for Ver {
"dna" => {
write!(ret, "SoC silicon DNA: 0x{:x}", env.llio.soc_dna().unwrap()).unwrap();
}
"xous" => {
write!(ret, "{}\n{}\n{}\n{}",
env!("VERGEN_SEMVER"),
env!("VERGEN_BRANCH"),
env!("VERGEN_SHA_SHORT"),
env!("VERGEN_BUILD_TIMESTAMP")).unwrap();
}
_ => {
write!(ret, "{}", helpstring).unwrap();
}

View file

@ -11,4 +11,7 @@ curl = "0.4.35"
atty = "0.2.14"
filetime = "0.2.14"
rustc_version = "0.4.0"
zip = "0.5.13"
zip = "0.5.13"
[build-dependencies]
vergen = "3.2.0"

10
xtask/build.rs Normal file
View file

@ -0,0 +1,10 @@
use vergen::{ConstantsFlags, generate_cargo_keys};
fn main() {
// Setup the flags, toggling off the 'SEMVER_FROM_CARGO_PKG' flag
let mut flags = ConstantsFlags::all();
flags.toggle(ConstantsFlags::SEMVER_FROM_CARGO_PKG);
// Generate the 'cargo:' key output
generate_cargo_keys(flags).expect("Unable to generate the cargo keys!");
}