Permalink
Browse files

build: include git shortcommit in devel versions

This commit populates rkt versions (both in the go binary and in the
generated stage1) with current git shortcommit.
  • Loading branch information...
krnowak authored and iaguis committed Aug 5, 2015
1 parent 0d51cc2 commit 27a4432d5743ccfaa7095e6a119c9be738ac9810
Showing with 29 additions and 11 deletions.
  1. +1 −0 .gitignore
  2. +18 −5 configure.ac
  3. +5 −2 makelib/variables.mk.in
  4. +1 −1 rkt/rkt.mk
  5. +2 −2 stage1/aci/{aci-manifest → aci-manifest.in}
  6. +2 −1 version/version.go
@@ -6,3 +6,4 @@
/configure
/makelib/variables.mk
/build-rkt-*
/stage1/aci/aci-manifest
@@ -1,6 +1,17 @@
AC_PREREQ([2.68])
AC_INIT([rkt], [0.7.0+git], [https://github.com/coreos/rkt/issues])
dnl if version ends with +git, append a short git-hash.
AS_IF([test `expr match 'AC_PACKAGE_VERSION' '.*+git$'` -gt 0],
dnl version has +git suffix
[RKT_VERSION="AC_PACKAGE_VERSION`git rev-parse --short HEAD`"],
dnl version has no +git suffix
[RKT_VERSION="AC_PACKAGE_VERSION"])
RKT_VERSION_LDFLAGS="-X github.com/coreos/rkt/version.Version '${RKT_VERSION}'"
AC_SUBST(RKT_VERSION)
AC_SUBST(RKT_VERSION_LDFLAGS)
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
@@ -57,7 +68,6 @@ AS_CASE([${RKT_STAGE1_USR_FROM}],
AC_SUBST(RKT_STAGE1_USR_FROM)
m4_define(DEFAULT_STAGE1_NAME,coreos.com/rkt/stage1)
m4_define(DEFAULT_STAGE1_VERSION,AC_PACKAGE_VERSION)
AC_ARG_WITH(stage1-default-name,
AS_HELP_STRING([--with-stage1-default-name=stage1_name],
[default name of stage1, default: DEFAULT_STAGE1_NAME]),
@@ -66,7 +76,7 @@ AC_ARG_WITH(stage1-default-name,
AC_ARG_WITH(stage1-default-version,
AS_HELP_STRING([--with-stage1-default-version=stage1_version],
[default version of stage1, default: DEFAULT_STAGE1_VERSION]),
[default version of stage1, default: same as rkt version]),
[RKT_STAGE1_DEFAULT_VERSION="${withval}"],
[RKT_STAGE1_DEFAULT_VERSION=auto])
@@ -91,10 +101,12 @@ AS_VAR_IF([RKT_STAGE1_USR_FROM], [none],
AS_VAR_IF([RKT_STAGE1_DEFAULT_NAME], [auto],
[RKT_STAGE1_DEFAULT_NAME=DEFAULT_STAGE1_NAME])
AS_VAR_IF([RKT_STAGE1_DEFAULT_VERSION], [auto],
[RKT_STAGE1_DEFAULT_VERSION=DEFAULT_STAGE1_VERSION])
[RKT_STAGE1_DEFAULT_VERSION=${RKT_VERSION}])
RKT_STAGE1_DEFAULT_ACI_LDFLAGS="-X main.defaultStage1Name '${RKT_STAGE1_DEFAULT_NAME}' -X main.defaultStage1Version '${RKT_STAGE1_DEFAULT_VERSION}'"
AC_SUBST(RKT_STAGE1_DEFAULT_NAME)
AC_SUBST(RKT_STAGE1_DEFAULT_VERSION)
AC_SUBST(RKT_STAGE1_DEFAULT_ACI_LDFLAGS)
## STAGE1: Systemd git path for src flavor
@@ -228,10 +240,11 @@ RKT_REQ_PROG([GIT],[git],[git])
RKT_REQ_PROG([GOBINARY],[go],[go])
RKT_REQ_PROG([GOFMTBINARY],[gofmt],[gofmt])
AC_CONFIG_FILES([makelib/variables.mk])
AC_CONFIG_FILES([makelib/variables.mk
stage1/aci/aci-manifest])
AC_OUTPUT
AC_MSG_RESULT([
AC_PACKAGE_NAME AC_PACKAGE_VERSION
AC_PACKAGE_NAME ${RKT_VERSION}
stage1 flavor: '${RKT_STAGE1_USR_FROM}'
stage1 image path: '${RKT_STAGE1_IMAGE}'
@@ -2,9 +2,10 @@
# package specific substitution names
package := @PACKAGE_NAME@
version := @PACKAGE_VERSION@
plain_version := @PACKAGE_VERSION@
version := @RKT_VERSION@
tarname := @PACKAGE_TARNAME@
distdir := $(tarname)-$(version)
distdir := $(tarname)-$(plain_version)
# prefix-specific substitution names
prefix := @prefix@
@@ -50,6 +51,8 @@ RKT_STAGE1_IMAGE_LDFLAGS := @RKT_STAGE1_IMAGE_LDFLAGS@
RKT_RUN_FUNCTIONAL_TESTS := @RKT_RUN_FUNCTIONAL_TESTS@
# ld flags for default stage1 name and version
RKT_STAGE1_DEFAULT_ACI_LDFLAGS := @RKT_STAGE1_DEFAULT_ACI_LDFLAGS@
# ld flags for version
RKT_VERSION_LDFLAGS := @RKT_VERSION_LDFLAGS@
# build-related directories and binaries
BUILDDIR ?= $(MK_TOPLEVEL_ABS_SRCDIR)/build-$(distdir)
@@ -7,7 +7,7 @@ RKT_BINARY := $(BINDIR)/$(LOCAL_NAME)
# variables for makelib/build_go_bin.mk
BGB_BINARY := $(RKT_BINARY)
BGB_PKG_IN_REPO := $(subst $(MK_TOPLEVEL_SRCDIR)/,,$(MK_SRCDIR))
BGB_GO_FLAGS := $(strip -ldflags "$(RKT_STAGE1_DEFAULT_ACI_LDFLAGS) $(RKT_STAGE1_IMAGE_LDFLAGS)" $(RKT_TAGS))
BGB_GO_FLAGS := $(strip -ldflags "$(RKT_STAGE1_DEFAULT_ACI_LDFLAGS) $(RKT_STAGE1_IMAGE_LDFLAGS) $(RKT_VERSION_LDFLAGS)" $(RKT_TAGS))
CLEAN_FILES += $(BGB_BINARY)
TOPLEVEL_STAMPS += $(RKT_STAMP)
@@ -1,11 +1,11 @@
{
"acKind": "ImageManifest",
"acVersion": "0.6.1",
"name": "coreos.com/rkt/stage1",
"name": "@RKT_STAGE1_DEFAULT_NAME@",
"labels": [
{
"name": "version",
"value": "0.7.0+git"
"value": "@RKT_STAGE1_DEFAULT_VERSION@"
},
{
"name": "arch",
@@ -14,4 +14,5 @@
package version
const Version = "0.7.0+git"
var Version string // value set with linker flags
// don't you dare modifying this value!

0 comments on commit 27a4432

Please sign in to comment.