avoid injecting ENV vars from Makefile

So that we can run "cargo build" without setting vars manually.
This commit is contained in:
Dietmar Maurer 2019-09-09 10:51:08 +02:00
parent d21ae955a6
commit 4a7de56e2f
6 changed files with 16 additions and 15 deletions

View File

@ -32,13 +32,6 @@ endif
COMPILED_BINS := \ COMPILED_BINS := \
$(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN)) $(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 DEB=${PACKAGE}_${PKGVER}-${PKGREL}_${ARCH}.deb
DSC=${PACKAGE}_${PKGVER}-${PKGREL}.dsc DSC=${PACKAGE}_${PKGVER}-${PKGREL}.dsc

View File

@ -4,7 +4,7 @@ pub mod admin;
pub mod backup; pub mod backup;
pub mod reader; pub mod reader;
pub mod node; pub mod node;
mod version; pub mod version;
mod subscription; mod subscription;
mod access; mod access;

View File

@ -4,9 +4,14 @@ use crate::api_schema::*;
use crate::api_schema::router::*; use crate::api_schema::router::*;
use serde_json::{json, Value}; use serde_json::{json, Value};
const PROXMOX_PKG_VERSION: &'static str = env!("PROXMOX_PKG_VERSION"); pub const PROXMOX_PKG_VERSION: &'static str =
const PROXMOX_PKG_RELEASE: &'static str = env!("PROXMOX_PKG_RELEASE"); concat!(
const PROXMOX_PKG_REPOID: &'static str = env!("PROXMOX_PKG_REPOID"); 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( fn get_version(
_param: Value, _param: Value,

View File

@ -12,6 +12,7 @@ use proxmox_backup::server;
use proxmox_backup::tools::daemon; use proxmox_backup::tools::daemon;
use proxmox_backup::auth_helpers::*; use proxmox_backup::auth_helpers::*;
use proxmox_backup::config; use proxmox_backup::config;
use proxmox_backup::buildcfg;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
@ -48,7 +49,7 @@ async fn run() -> Result<(), Error> {
} }
let config = ApiConfig::new( let config = ApiConfig::new(
env!("PROXMOX_JSDIR"), &ROUTER, RpcEnvironmentType::PRIVILEGED); buildcfg::JS_DIR, &ROUTER, RpcEnvironmentType::PRIVILEGED);
let rest_server = RestServer::new(config); let rest_server = RestServer::new(config);

View File

@ -1,4 +1,5 @@
use proxmox_backup::configdir; use proxmox_backup::configdir;
use proxmox_backup::buildcfg;
use proxmox_backup::server; use proxmox_backup::server;
use proxmox_backup::tools::daemon; use proxmox_backup::tools::daemon;
use proxmox_backup::api_schema::router::*; use proxmox_backup::api_schema::router::*;
@ -41,7 +42,7 @@ async fn run() -> Result<(), Error> {
} }
let mut config = ApiConfig::new( 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 // add default dirs which includes jquery and bootstrap
// my $base = '/usr/share/libpve-http-server-perl'; // my $base = '/usr/share/libpve-http-server-perl';

View File

@ -1,7 +1,8 @@
//! Exports configuration data from the build system //! Exports configuration data from the build system
/// The configured configuration directory /// 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 /// Prepend configuration directory to a file name
/// ///
@ -13,5 +14,5 @@ pub const CONFIGDIR: &'static str = env!("PROXMOX_CONFIGDIR");
/// ``` /// ```
#[macro_export] #[macro_export]
macro_rules! configdir { macro_rules! configdir {
($subdir:expr) => (concat!(env!("PROXMOX_CONFIGDIR"), $subdir)) ($subdir:expr) => (concat!("/etc/proxmox-backup", $subdir))
} }