]> git.proxmox.com Git - proxmox-backup.git/commitdiff
avoid injecting ENV vars from Makefile
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 9 Sep 2019 08:51:08 +0000 (10:51 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 9 Sep 2019 08:51:08 +0000 (10:51 +0200)
So that we can run "cargo build" without setting vars manually.

Makefile
src/api2.rs
src/api2/version.rs
src/bin/proxmox-backup-api.rs
src/bin/proxmox-backup-proxy.rs
src/buildcfg.rs

index 27b33d04e85be927a09437a1bbec3263365d54e7..7dfbb656ccf697271ae50d89e2ddabbff69ca829 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -32,13 +32,6 @@ endif
 COMPILED_BINS := \
        $(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN))
 
-export PROXMOX_PKG_VERSION=${PKGVER}
-export PROXMOX_PKG_RELEASE=${PKGREL}
-export PROXMOX_PKG_REPOID=${GITVERSION}
-
-export PROXMOX_JSDIR := $(JSDIR)
-export PROXMOX_CONFIGDIR := $(SYSCONFDIR)/proxmox-backup
-
 DEB=${PACKAGE}_${PKGVER}-${PKGREL}_${ARCH}.deb
 DSC=${PACKAGE}_${PKGVER}-${PKGREL}.dsc
 
index 046edfc98e61e720e87d2abc46f818b290381831..c44fa6168916a4acb974412fc707b68a5225962c 100644 (file)
@@ -4,7 +4,7 @@ pub mod admin;
 pub mod backup;
 pub mod reader;
 pub mod node;
-mod version;
+pub mod version;
 mod subscription;
 mod access;
 
index 8c18debe951481fbbca7e6727650061269aeab1f..a000fe37bcc3a313c93bacccc6e69eddaddb4ad2 100644 (file)
@@ -4,9 +4,14 @@ use crate::api_schema::*;
 use crate::api_schema::router::*;
 use serde_json::{json, Value};
 
-const PROXMOX_PKG_VERSION: &'static str = env!("PROXMOX_PKG_VERSION");
-const PROXMOX_PKG_RELEASE: &'static str = env!("PROXMOX_PKG_RELEASE");
-const PROXMOX_PKG_REPOID: &'static str = env!("PROXMOX_PKG_REPOID");
+pub const PROXMOX_PKG_VERSION: &'static str =
+    concat!(
+        env!("CARGO_PKG_VERSION_MAJOR"),
+        ".",
+        env!("CARGO_PKG_VERSION_MINOR"),
+    );
+pub const PROXMOX_PKG_RELEASE: &'static str = env!("CARGO_PKG_VERSION_PATCH");
+pub const PROXMOX_PKG_REPOID: &'static str = env!("CARGO_PKG_REPOSITORY");
 
 fn get_version(
     _param: Value,
index 1537503f782da3e103044634c1e9a3a280918985..ff6fe1b405356590a2d80a17a295b66e95c1ab12 100644 (file)
@@ -12,6 +12,7 @@ use proxmox_backup::server;
 use proxmox_backup::tools::daemon;
 use proxmox_backup::auth_helpers::*;
 use proxmox_backup::config;
+use proxmox_backup::buildcfg;
 
 #[tokio::main]
 async fn main() {
@@ -48,7 +49,7 @@ async fn run() -> Result<(), Error> {
     }
 
     let config = ApiConfig::new(
-        env!("PROXMOX_JSDIR"), &ROUTER, RpcEnvironmentType::PRIVILEGED);
+        buildcfg::JS_DIR, &ROUTER, RpcEnvironmentType::PRIVILEGED);
 
     let rest_server = RestServer::new(config);
 
index 9c052f096b18c1492e77a10f2fbdff688aac8dbc..f7a8b740cf31f1e9e30411f288f89fe4135267d7 100644 (file)
@@ -1,4 +1,5 @@
 use proxmox_backup::configdir;
+use proxmox_backup::buildcfg;
 use proxmox_backup::server;
 use proxmox_backup::tools::daemon;
 use proxmox_backup::api_schema::router::*;
@@ -41,7 +42,7 @@ async fn run() -> Result<(), Error> {
     }
 
     let mut config = ApiConfig::new(
-        env!("PROXMOX_JSDIR"), &ROUTER, RpcEnvironmentType::PUBLIC);
+        buildcfg::JS_DIR, &ROUTER, RpcEnvironmentType::PUBLIC);
 
     // add default dirs which includes jquery and bootstrap
     // my $base = '/usr/share/libpve-http-server-perl';
index 83ee0605e1875f30c33f24280bd3abee6c25d4b8..847e1d4cf7cd034bc753f6dfb2b896b5ca5f283a 100644 (file)
@@ -1,7 +1,8 @@
 //! Exports configuration data from the build system
 
 /// The configured configuration directory
-pub const CONFIGDIR: &'static str = env!("PROXMOX_CONFIGDIR");
+pub const CONFIGDIR: &'static str = "/etc/proxmox-backup";
+pub const JS_DIR: &str = "/usr/share/javascript/proxmox-backup";
 
 /// Prepend configuration directory to a file name
 ///
@@ -13,5 +14,5 @@ pub const CONFIGDIR: &'static str = env!("PROXMOX_CONFIGDIR");
 /// ```
 #[macro_export]
 macro_rules! configdir {
-    ($subdir:expr) => (concat!(env!("PROXMOX_CONFIGDIR"), $subdir))
+    ($subdir:expr) => (concat!("/etc/proxmox-backup", $subdir))
 }