diff --git a/.bazelrc b/.bazelrc index d3110f0b56..f82e028344 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,3 +1,4 @@ +build --stamp ### common options for all subcommands (help, query, build, ...) common --show_timestamps --enable_platform_specific_config diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index 13ccb7e58a..77ca2546a6 100755 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -30,10 +30,12 @@ rm -f $HOME/.bazelrc # --nostamp is required for better caching (only on non-release jobs). if [ "$BUILDKITE_PIPELINE_SLUG" == "scion" ]; then echo "build --nostamp" > $HOME/.bazelrc - # Shorten the git version to omit commit information, improving cache reuse. - # The format of git-version is "--" - # This will be shortened to "-modified-ci" - export GIT_VERSION=$(tools/git-version | sed 's/-.*/-modified-ci/') + if [ -z ${SCION_VERSION+x} ]; then + # Shorten the git version to omit commit information, improving cache reuse. + # The format of git-version is "--" + # This will be shortened to "-modified-ci" + export SCION_VERSION=$(tools/git-version | sed 's/-.*/-modified-ci/') + fi else echo "build --stamp" > $HOME/.bazelrc fi diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index b2862ed65d..ef10701d48 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -25,7 +25,7 @@ steps: - wait - label: "Package :debian: :openwrt:" command: - - version="$(tools/git-version)" + - version=${SCION_VERSION:-$(tools/git-version)} - make dist-deb BFLAGS="--file_name_version=${version}" - make dist-openwrt BFLAGS="--file_name_version=${version}" - cd installables; diff --git a/dist/openwrt/ipk.bzl b/dist/openwrt/ipk.bzl index db298ad798..1469135215 100644 --- a/dist/openwrt/ipk.bzl +++ b/dist/openwrt/ipk.bzl @@ -92,10 +92,11 @@ def _ipk_impl(ctx): r"scripts/feeds install -a -p scion", r"make IB=1 defconfig", # IB=1 bypasses various unnecessary prerequisites r"IFS='-' read tag count commit dirty < ${execroot_abspath}/$5", + r"pkgver=${tag}", r'pkgrel=${count}${dirty:+".dirty$(date +%s)"}', r"make package/feeds/scion/${2}/compile EXECROOT=${execroot_abspath}" + - ' PKG_VERSION="${tag}" PKG_RELEASE="${pkgrel}"', - r"cp bin/packages/${6}/scion/${2}_${tag}-${pkgrel}_${6}.ipk ${execroot_abspath}/${4}", + ' PKG_VERSION="${pkgver}" PKG_RELEASE="${pkgrel}"', + r"cp bin/packages/${6}/scion/${2}_${pkgver}${pkgrel:+-}${pkgrel}_${6}.ipk ${execroot_abspath}/${4}", ]), ) diff --git a/tools/bazel-build-env b/tools/bazel-build-env index ba993c60a1..139b586b45 100755 --- a/tools/bazel-build-env +++ b/tools/bazel-build-env @@ -4,8 +4,7 @@ ROOTDIR=$(dirname "$0")/.. -# When building inside a docker container GIT_VERSION is set by the creator of the container. -# When building locally, use the version reported by git. -VERSION=${GIT_VERSION:-$($ROOTDIR/tools/git-version)} +# Use the version reported by git, unless SCION_VERSION is set to override this. +VERSION=${SCION_VERSION:-$($ROOTDIR/tools/git-version)} echo "STABLE_GIT_VERSION $VERSION"