mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Use -X ldflags to set dockerversion package vars
This eliminates the need to lay down an auto-generated file. IIRC this was originally hadded for gccgo which we no longer support. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -17,8 +17,6 @@ autogen/
|
|||||||
bundles/
|
bundles/
|
||||||
cmd/dockerd/dockerd
|
cmd/dockerd/dockerd
|
||||||
contrib/builder/rpm/*/changelog
|
contrib/builder/rpm/*/changelog
|
||||||
dockerversion/version_autogen.go
|
|
||||||
dockerversion/version_autogen_unix.go
|
|
||||||
vendor/pkg/
|
vendor/pkg/
|
||||||
go-test-report.json
|
go-test-report.json
|
||||||
profile.out
|
profile.out
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
package dockerversion // import "github.com/docker/docker/dockerversion"
|
package dockerversion // import "github.com/docker/docker/dockerversion"
|
||||||
|
|
||||||
// Default build-time variable for library-import.
|
// Default build-time variable for library-import.
|
||||||
// This file is overridden on build with build-time information.
|
// These variables are overridden on build with build-time information.
|
||||||
const (
|
var (
|
||||||
GitCommit = "library-import"
|
GitCommit = "library-import"
|
||||||
Version = "library-import"
|
Version = "library-import"
|
||||||
BuildTime = "library-import"
|
BuildTime = "library-import"
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ LDFLAGS_STATIC=''
|
|||||||
EXTLDFLAGS_STATIC='-static'
|
EXTLDFLAGS_STATIC='-static'
|
||||||
# ORIG_BUILDFLAGS is necessary for the cross target which cannot always build
|
# ORIG_BUILDFLAGS is necessary for the cross target which cannot always build
|
||||||
# with options like -race.
|
# with options like -race.
|
||||||
ORIG_BUILDFLAGS=( -tags "autogen netgo osusergo static_build $DOCKER_BUILDTAGS" -installsuffix netgo )
|
ORIG_BUILDFLAGS=( -tags "netgo osusergo static_build $DOCKER_BUILDTAGS" -installsuffix netgo )
|
||||||
# see https://github.com/golang/go/issues/9369#issuecomment-69864440 for why -installsuffix is necessary here
|
# see https://github.com/golang/go/issues/9369#issuecomment-69864440 for why -installsuffix is necessary here
|
||||||
|
|
||||||
BUILDFLAGS=( ${BUILDFLAGS} "${ORIG_BUILDFLAGS[@]}" )
|
BUILDFLAGS=( ${BUILDFLAGS} "${ORIG_BUILDFLAGS[@]}" )
|
||||||
|
|||||||
@@ -6,41 +6,16 @@ source hack/dockerfile/install/runc.installer
|
|||||||
source hack/dockerfile/install/tini.installer
|
source hack/dockerfile/install/tini.installer
|
||||||
source hack/dockerfile/install/containerd.installer
|
source hack/dockerfile/install/containerd.installer
|
||||||
|
|
||||||
cat > dockerversion/version_autogen.go <<DVEOF
|
LDFLAGS="${LDFALGS} \
|
||||||
// +build autogen
|
-X github.com/docker/docker/dockerversion.Version=${VERSION} \
|
||||||
|
-X github.com/docker/docker/dockerversion.GitCommit=${GITCOMMIT} \
|
||||||
// Package dockerversion is auto-generated at build-time
|
-X github.com/docker/docker/dockerversion.BuildTime=${BUILDTIME} \
|
||||||
package dockerversion
|
-X github.com/docker/docker/dockerversion.IAmStatic=${IAMSTATIC:-true} \
|
||||||
|
-X github.com/docker/docker/dockerversion.PlatformName=${PLATFORM} \
|
||||||
// Default build-time variable for library-import.
|
-X github.com/docker/docker/dockerversion.ProductName=${PRODUCT} \
|
||||||
// This file is overridden on build with build-time information.
|
-X github.com/docker/docker/dockerversion.DefaultProductLicense=${DEFAULT_PRODUCT_LICENSE} \
|
||||||
const (
|
-X github.com/docker/docker/dockerversion.InitCommitID=${TINI_COMMIT} \
|
||||||
GitCommit string = "$GITCOMMIT"
|
"
|
||||||
Version string = "$VERSION"
|
|
||||||
BuildTime string = "$BUILDTIME"
|
|
||||||
IAmStatic string = "${IAMSTATIC:-true}"
|
|
||||||
PlatformName string = "${PLATFORM}"
|
|
||||||
ProductName string = "${PRODUCT}"
|
|
||||||
DefaultProductLicense string = "${DEFAULT_PRODUCT_LICENSE}"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Code generated by hack/make/.go-autogen. DO NOT EDIT.
|
|
||||||
DVEOF
|
|
||||||
|
|
||||||
cat > dockerversion/version_autogen_unix.go <<DVEOF
|
|
||||||
// +build autogen,!windows
|
|
||||||
|
|
||||||
// Package dockerversion is auto-generated at build-time
|
|
||||||
package dockerversion
|
|
||||||
|
|
||||||
// Default build-time variable for library-import.
|
|
||||||
// This file is overridden on build with build-time information.
|
|
||||||
const (
|
|
||||||
InitCommitID string = "${TINI_COMMIT}"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Code generated by hack/make/.go-autogen. DO NOT EDIT.
|
|
||||||
DVEOF
|
|
||||||
|
|
||||||
# Compile the Windows resources into the sources
|
# Compile the Windows resources into the sources
|
||||||
if [ "$(go env GOOS)" = "windows" ]; then
|
if [ "$(go env GOOS)" = "windows" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user