blob: ff79ce12d22b4e219c3b5d0d792701bdac2796d3 [file] [log] [blame]
Brian Silvermancce76582015-10-31 23:38:52 +00001#!/bin/bash
2
3# This script builds a Debian package from a Bazel source tree with the
4# correct version.
5# The only argument is the path to a Bazel source tree.
6
7set -e
8set -u
9
10BAZEL_SOURCE="$1"
11
12VERSION="$(date +%Y%m%d%H%M)+$(GIT_DIR="${BAZEL_SOURCE}/.git" git rev-parse --short HEAD)"
Brian Silvermand1c19fb2016-07-07 00:10:57 -070013DEB="bazel_${VERSION}_amd64.deb"
Brian Silvermancce76582015-10-31 23:38:52 +000014
15"${BAZEL_SOURCE}/compile.sh" compile
16(
17cd "${BAZEL_SOURCE}"
Brian Silvermanb200c172017-01-02 17:35:35 -080018./output/bazel build -c opt //scripts/packages:bazel-debian --embed_label="${VERSION}" --stamp=yes
Brian Silvermancce76582015-10-31 23:38:52 +000019)
20
21cp "${BAZEL_SOURCE}/bazel-bin/scripts/packages/bazel-debian.deb" "${DEB}"
22
23echo "Output is at ${DEB}"