blob: 0184ce937543c22b61a2aadff6d1793ee8c0fd6a [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
Brian Silvermancce76582015-10-31 23:38:52 +000015(
16cd "${BAZEL_SOURCE}"
Austin Schuh4f857292018-02-15 23:42:04 -080017bazel build -c opt //scripts/packages/debian:bazel-debian --embed_label="${VERSION}" --stamp=yes --experimental_sandbox_base=/dev/shm
Brian Silvermancce76582015-10-31 23:38:52 +000018)
19
Austin Schuh4f857292018-02-15 23:42:04 -080020cp "${BAZEL_SOURCE}/bazel-bin/scripts/packages/debian/bazel-debian.deb" "${DEB}"
Brian Silvermancce76582015-10-31 23:38:52 +000021
22echo "Output is at ${DEB}"