summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--cmd/podman/info.go3
-rw-r--r--cmd/podman/version.go2
-rw-r--r--libpod/version.go10
-rw-r--r--pkg/varlinkapi/system.go13
5 files changed, 18 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index b3e2fcc26..d8a870fa2 100644
--- a/Makefile
+++ b/Makefile
@@ -36,7 +36,8 @@ PACKAGES ?= $(shell $(GO) list -tags "${BUILDTAGS}" ./... | grep -v github.com/c
COMMIT_NO ?= $(shell git rev-parse HEAD 2> /dev/null || true)
GIT_COMMIT ?= $(if $(shell git status --porcelain --untracked-files=no),"${COMMIT_NO}-dirty","${COMMIT_NO}")
BUILD_INFO ?= $(shell date +%s)
-LDFLAGS_PODMAN ?= $(LDFLAGS) -X main.gitCommit=$(GIT_COMMIT) -X main.buildInfo=$(BUILD_INFO)
+LIBPOD := ${PROJECT}/libpod
+LDFLAGS_PODMAN ?= $(LDFLAGS) -X $(LIBPOD).gitCommit=$(GIT_COMMIT) -X $(LIBPOD).buildInfo=$(BUILD_INFO)
ISODATE ?= $(shell date --iso-8601)
LIBSECCOMP_COMMIT := release-2.3
diff --git a/cmd/podman/info.go b/cmd/podman/info.go
index 563e63ba3..c0639725e 100644
--- a/cmd/podman/info.go
+++ b/cmd/podman/info.go
@@ -81,6 +81,7 @@ func debugInfo(c *cli.Context) map[string]interface{} {
info["compiler"] = runtime.Compiler
info["go version"] = runtime.Version()
info["podman version"] = c.App.Version
- info["git commit"] = libpod.GitCommit
+ version, _ := libpod.GetVersion()
+ info["git commit"] = version.GitCommit
return info
}
diff --git a/cmd/podman/version.go b/cmd/podman/version.go
index f896229c4..d80f24a14 100644
--- a/cmd/podman/version.go
+++ b/cmd/podman/version.go
@@ -21,7 +21,7 @@ func versionCmd(c *cli.Context) error {
fmt.Println("Git Commit: ", output.GitCommit)
}
// Prints out the build time in readable format
- if libpod.BuildInfo != "" {
+ if output.Built != 0 {
fmt.Println("Built: ", time.Unix(output.Built, 0).Format(time.ANSIC))
}
diff --git a/libpod/version.go b/libpod/version.go
index 5e7cd83c9..966588ae9 100644
--- a/libpod/version.go
+++ b/libpod/version.go
@@ -11,10 +11,10 @@ import (
var (
// GitCommit is the commit that the binary is being built from.
// It will be populated by the Makefile.
- GitCommit string
+ gitCommit string
// BuildInfo is the time at which the binary was built
// It will be populated by the Makefile.
- BuildInfo string
+ buildInfo string
)
//Version is an output struct for varlink
@@ -30,9 +30,9 @@ type Version struct {
func GetVersion() (Version, error) {
var err error
var buildTime int64
- if BuildInfo != "" {
+ if buildInfo != "" {
// Converts unix time from string to int64
- buildTime, err = strconv.ParseInt(BuildInfo, 10, 64)
+ buildTime, err = strconv.ParseInt(buildInfo, 10, 64)
if err != nil {
return Version{}, err
@@ -41,7 +41,7 @@ func GetVersion() (Version, error) {
return Version{
Version: podmanVersion.Version,
GoVersion: runtime.Version(),
- GitCommit: GitCommit,
+ GitCommit: gitCommit,
Built: buildTime,
OsArch: runtime.GOOS + "/" + runtime.GOARCH,
}, nil
diff --git a/pkg/varlinkapi/system.go b/pkg/varlinkapi/system.go
index 287f42209..a29d22e7d 100644
--- a/pkg/varlinkapi/system.go
+++ b/pkg/varlinkapi/system.go
@@ -34,6 +34,10 @@ func (i *LibpodAPI) Ping(call iopodman.VarlinkCall) error {
// GetInfo returns details about the podman host and its stores
func (i *LibpodAPI) GetInfo(call iopodman.VarlinkCall) error {
+ versionInfo, err := libpod.GetVersion()
+ if err != nil {
+ return err
+ }
var (
registries, insecureRegistries []string
)
@@ -64,11 +68,10 @@ func (i *LibpodAPI) GetInfo(call iopodman.VarlinkCall) error {
podmanInfo.Host = infoHost
store := info[1].Data
pmaninfo := iopodman.InfoPodmanBinary{
- Compiler: goruntime.Compiler,
- Go_version: goruntime.Version(),
- // TODO : How are we going to get this here?
- //Podman_version:
- Git_commit: libpod.GitCommit,
+ Compiler: goruntime.Compiler,
+ Go_version: goruntime.Version(),
+ Podman_version: versionInfo.Version,
+ Git_commit: versionInfo.GitCommit,
}
graphStatus := iopodman.InfoGraphStatus{