mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-05-01 21:24:36 +00:00
make: Export VERSION and COMMIT
These will be consumed by kata-ctl, so export these so that they can be used to replace variables available to the rust binary. Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
This commit is contained in:
parent
2f81f48dae
commit
9a94f1f149
@ -12,10 +12,10 @@ PROJECT_COMPONENT = kata-ctl
|
|||||||
TARGET = $(PROJECT_COMPONENT)
|
TARGET = $(PROJECT_COMPONENT)
|
||||||
|
|
||||||
VERSION_FILE := ./VERSION
|
VERSION_FILE := ./VERSION
|
||||||
VERSION := $(shell grep -v ^\# $(VERSION_FILE))
|
export VERSION := $(shell grep -v ^\# $(VERSION_FILE))
|
||||||
COMMIT_NO := $(shell git rev-parse HEAD 2>/dev/null || true)
|
COMMIT_NO := $(shell git rev-parse HEAD 2>/dev/null || true)
|
||||||
COMMIT_NO_SHORT := $(shell git rev-parse --short HEAD 2>/dev/null || true)
|
COMMIT_NO_SHORT := $(shell git rev-parse --short HEAD 2>/dev/null || true)
|
||||||
COMMIT := $(if $(shell git status --porcelain --untracked-files=no 2>/dev/null || true),${COMMIT_NO}-dirty,${COMMIT_NO})
|
export COMMIT := $(if $(shell git status --porcelain --untracked-files=no 2>/dev/null || true),${COMMIT_NO}-dirty,${COMMIT_NO})
|
||||||
|
|
||||||
# Exported to allow cargo to see it
|
# Exported to allow cargo to see it
|
||||||
export KATA_CTL_VERSION := $(if $(COMMIT),$(VERSION)-$(COMMIT),$(VERSION))
|
export KATA_CTL_VERSION := $(if $(COMMIT),$(VERSION)-$(COMMIT),$(VERSION))
|
||||||
@ -23,7 +23,9 @@ export KATA_CTL_VERSION := $(if $(COMMIT),$(VERSION)-$(COMMIT),$(VERSION))
|
|||||||
GENERATED_CODE = src/ops/version.rs
|
GENERATED_CODE = src/ops/version.rs
|
||||||
|
|
||||||
GENERATED_REPLACEMENTS= \
|
GENERATED_REPLACEMENTS= \
|
||||||
KATA_CTL_VERSION
|
KATA_CTL_VERSION \
|
||||||
|
VERSION \
|
||||||
|
COMMIT
|
||||||
|
|
||||||
GENERATED_FILES := $(GENERATED_CODE)
|
GENERATED_FILES := $(GENERATED_CODE)
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
use clap::crate_version;
|
use clap::crate_version;
|
||||||
|
|
||||||
const KATA_CTL_VERSION: &str = "@KATA_CTL_VERSION@";
|
const KATA_CTL_VERSION: &str = "@KATA_CTL_VERSION@";
|
||||||
|
pub const VERSION: &str = "@VERSION@";
|
||||||
|
pub const COMMIT: &str = "@COMMIT@";
|
||||||
|
|
||||||
pub fn get() -> Result<String, String> {
|
pub fn get() -> Result<String, String> {
|
||||||
if KATA_CTL_VERSION.trim().is_empty() {
|
if KATA_CTL_VERSION.trim().is_empty() {
|
||||||
|
Loading…
Reference in New Issue
Block a user