From 4c7c68772c14a455bba77e25f6b4c1391054ed01 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 16 Sep 2015 12:08:30 -0700 Subject: [PATCH 1/5] travis: enable go 1.5 --- .travis.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 911ead28fa..16041c50dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,18 +2,19 @@ language: go -go: - - 1.4 +matrix: + include: + - go: 1.4.3 + install: + - go get golang.org/x/tools/cmd/cover + - go get golang.org/x/tools/cmd/vet + - go: 1.5.2 before_install: - sudo apt-get update -qq - sudo apt-get install -y cpio realpath squashfs-tools - sudo apt-get install -y build-essential -install: - - go get golang.org/x/tools/cmd/cover - - go get golang.org/x/tools/cmd/vet - script: - ./autogen.sh - ./configure --with-stage1-default-name="example.com/some-stage1-for-rkt" --with-stage1-default-version="0.0.1" From 4f3748308afc7f6c94ee93550fa36f1de8dfaeab Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Mon, 21 Dec 2015 13:36:18 +0100 Subject: [PATCH 2/5] functional tests: Use go 1.5 in semaphore --- tests/install-deps.sh | 6 ------ tests/run-build.sh | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/tests/install-deps.sh b/tests/install-deps.sh index bcf155162f..f5919146f5 100755 --- a/tests/install-deps.sh +++ b/tests/install-deps.sh @@ -29,12 +29,6 @@ if [ "${CI-}" == true ] ; then #sudo apt-get update -qq || true - # Fix for go 1.4.3: see https://github.com/coreos/rkt/issues - # GOPATH is only needed to allow go to work; the actual - # binaries are installed in GOROOT for these commands - sudo -E GOPATH=/tmp go get golang.org/x/tools/cmd/vet - sudo -E GOPATH=/tmp go get golang.org/x/tools/cmd/cover - # libmount: https://github.com/systemd/systemd/pull/986#issuecomment-138451264 # sudo add-apt-repository --yes ppa:pitti/systemd-semaphore # sudo apt-get update -qq || true diff --git a/tests/run-build.sh b/tests/run-build.sh index a7d7ed2d87..16fd8f9d03 100755 --- a/tests/run-build.sh +++ b/tests/run-build.sh @@ -34,7 +34,7 @@ if [ "${SEMAPHORE-}" == true ] ; then # Set up go environment on semaphore if [ -f /opt/change-go-version.sh ]; then . /opt/change-go-version.sh - change-go-version 1.4 + change-go-version 1.5 fi fi From 394308b11761458c4a0da1f7568d99bd0326e456 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Mon, 21 Dec 2015 13:38:37 +0100 Subject: [PATCH 3/5] build: Require go 1.4 or newer This was actually a case for some time already, but it wasn't coded in configure. This also cleans up the awful regexes munged by autoconf. --- configure.ac | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac index 37de3dc4d5..19953da12c 100644 --- a/configure.ac +++ b/configure.ac @@ -476,24 +476,36 @@ RKT_REQ_ABS_PROG([ABS_GO], [go]) #### LINKER FLAGS -dnl Detect go version. Go 1.4 and earlier support only "-X variable -dnl 'value'" format of assigning values to variables via linker -dnl flags. Go 1.5 deprecates this format in favor of "-X -dnl 'variable=value'" format. Drop this ugliness when we drop support -dnl for Go older than 1.5. -GO_VERSION=`$ABS_GO version | grep -o 'go@<:@@<:@:digit:@:>@@:>@\+\.@<:@@<:@:digit:@:>@@:>@\+' | grep -o '@<:@@<:@:digit:@:>@@:>@\+\.@<:@@<:@:digit:@:>@@:>@\+'` -GO_MAJOR=`echo $GO_VERSION | grep -o '^@<:@@<:@:digit:@:>@@:>@\+'` -GO_MINOR=`echo $GO_VERSION | grep -o '@<:@@<:@:digit:@:>@@:>@\+$'` - -AS_IF([test $GO_MAJOR -gt 1 -o $GO_MINOR -gt 4], - dnl We have Go 1.5 or greater. - [RKT_XF() { +dnl Digits regexp class. Square brackets are used by m4 for quoting, +dnl so to get literal square brackets, m4 provides ugly @<:@ and @:>@ +dnl for [ and ]. +m4_define([DIGITS],[@<:@0-9@:>@]) + +dnl Detect go version. Go 1.4 support only "-X variable 'value'" +dnl format of assigning values to variables via linker flags. Go 1.5 +dnl deprecates this format in favor of "-X 'variable=value'" +dnl format. Drop this ugliness when we drop support for Go 1.4. +GO_VERSION=`"${ABS_GO}" version | sed -e 's/^go version go\(DIGITS*\.DIGITS*\).*/\1/'` +GO_MAJOR=`echo "${GO_VERSION}" | grep -o '^DIGITS\+'` +GO_MINOR=`echo "${GO_VERSION}" | grep -o 'DIGITS\+$'` + +GO_BEST_MAJOR=1 +GO_BEST_MINOR=5 +GO_BEST_VERSION="${GO_BEST_MAJOR}.${GO_BEST_MINOR}" +AC_MSG_CHECKING([whether we have go ${GO_BEST_VERSION} or newer]) +AS_IF([test "${GO_MAJOR}" -gt "${GO_BEST_MAJOR}" || test "${GO_MAJOR}" -eq "${GO_BEST_MAJOR}" -a "${GO_MINOR}" -ge "${GO_BEST_MINOR}"], + [AC_MSG_RESULT([yes]) + RKT_XF() { echo "-X '$1=$2'" }], - dnl We have Go 1.4 or lesser. - [RKT_XF() { - echo "-X $1 '$2'" - }]) + [AC_MSG_RESULT([no]) + AC_MSG_CHECKING([whether we have go 1.4]) + AS_VAR_IF([GO_VERSION],[1.4], + [AC_MSG_RESULT([yes]) + RKT_XF() { + echo "-X $1 '$2'" + }], + [AC_MSG_ERROR([*** go is too old (${GO_VERSION})])])]) RKT_STAGE1_DEFAULT_NAME_LDFLAGS=`RKT_XF main.defaultStage1Name "${RKT_STAGE1_DEFAULT_NAME}"` RKT_STAGE1_DEFAULT_VERSION_LDFLAGS=`RKT_XF main.defaultStage1Version "${RKT_STAGE1_DEFAULT_VERSION}"` From 9a95f9c5afcbf9304017f9e8baa2a1820f2b6b1b Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Mon, 21 Dec 2015 13:39:47 +0100 Subject: [PATCH 4/5] docs, scripts: Prefer go 1.5 to 1.4. --- Documentation/hacking.md | 2 +- scripts/install-go.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/hacking.md b/Documentation/hacking.md index 38fe62a8f8..762c14e707 100644 --- a/Documentation/hacking.md +++ b/Documentation/hacking.md @@ -68,7 +68,7 @@ Alternatively, you can build rkt in a Docker container with the following comman Replace $SRC with the absolute path to your rkt source code: ``` -# docker run -v $SRC:/opt/rkt -i -t golang:1.4 /bin/bash -c "apt-get update && apt-get install -y coreutils cpio squashfs-tools realpath autoconf file xz-utils patch bc && cd /opt/rkt && go get github.com/appc/spec/... && ./autogen.sh && ./configure && make" +# docker run -v $SRC:/opt/rkt -i -t golang:1.5 /bin/bash -c "apt-get update && apt-get install -y coreutils cpio squashfs-tools realpath autoconf file xz-utils patch bc && cd /opt/rkt && go get github.com/appc/spec/... && ./autogen.sh && ./configure && make" ``` ### Building systemd in stage1 from the sources diff --git a/scripts/install-go.sh b/scripts/install-go.sh index 4dfbb25fc1..0b4ab8e419 100755 --- a/scripts/install-go.sh +++ b/scripts/install-go.sh @@ -3,7 +3,7 @@ set -e export DEBIAN_FRONTEND=noninteractive -VERSION=1.4.3 +VERSION=1.5.2 OS=linux ARCH=amd64 From d0bcb9444db4d92e5d63aa39f7a380bd9c18a8c2 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Mon, 21 Dec 2015 13:40:16 +0100 Subject: [PATCH 5/5] functional tests: Stylistic fixes --- tests/run-build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/run-build.sh b/tests/run-build.sh index 16fd8f9d03..860061b9b9 100755 --- a/tests/run-build.sh +++ b/tests/run-build.sh @@ -44,7 +44,7 @@ if [[ ${HEAD} == ${MASTER} ]]; then SRC_CHANGES=1 DOC_CHANGES=1 elif [[ ${SRC_CHANGES} -eq 0 && ${DOC_CHANGES} -eq 0 ]]; then - echo No changes detected and HEAD is not origin/master + echo "No changes detected and HEAD is not origin/master" exit 0 fi @@ -59,8 +59,8 @@ cd builds git clone ../ "${BUILD_DIR}" pushd "${BUILD_DIR}" -if [ ${SRC_CHANGES} -gt 0 ]; then - echo Changes in sources detected. Running functional tests. +if [ ${SRC_CHANGES} -gt 0 ]; then + echo "Changes in sources detected. Running functional tests." ./autogen.sh case "${RKT_STAGE1_USR_FROM}" in coreos|kvm)