move build.rs and friends to pbs-buildcfg
with this the main crate won't be re-compiled every time a *binary* is modified Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
@ -4,5 +4,6 @@ version = "0.1.0"
|
||||
authors = ["Proxmox Support Team <support@proxmox.com>"]
|
||||
edition = "2018"
|
||||
description = "macros used for pbs related paths such as configdir and rundir"
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
|
24
pbs-buildcfg/build.rs
Normal file
24
pbs-buildcfg/build.rs
Normal file
@ -0,0 +1,24 @@
|
||||
// build.rs
|
||||
use std::env;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
let repoid = match env::var("REPOID") {
|
||||
Ok(repoid) => repoid,
|
||||
Err(_) => {
|
||||
match Command::new("git")
|
||||
.args(&["rev-parse", "HEAD"])
|
||||
.output()
|
||||
{
|
||||
Ok(output) => {
|
||||
String::from_utf8(output.stdout).unwrap()
|
||||
}
|
||||
Err(err) => {
|
||||
panic!("git rev-parse failed: {}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
println!("cargo:rustc-env=REPOID={}", repoid);
|
||||
}
|
@ -1,5 +1,15 @@
|
||||
//! Exports configuration data from the build system
|
||||
|
||||
pub const PROXMOX_PKG_VERSION: &str =
|
||||
concat!(
|
||||
env!("CARGO_PKG_VERSION_MAJOR"),
|
||||
".",
|
||||
env!("CARGO_PKG_VERSION_MINOR"),
|
||||
);
|
||||
pub const PROXMOX_PKG_RELEASE: &str = env!("CARGO_PKG_VERSION_PATCH");
|
||||
pub const PROXMOX_PKG_REPOID: &str = env!("REPOID");
|
||||
|
||||
|
||||
/// The configured configuration directory
|
||||
pub const CONFIGDIR: &str = "/etc/proxmox-backup";
|
||||
pub const JS_DIR: &str = "/usr/share/javascript/proxmox-backup";
|
||||
|
Reference in New Issue
Block a user