From 7453ba9edd9441b4c60b54c468fc8b2c8ec7b76b Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Mon, 13 Mar 2023 16:04:12 -0700 Subject: [PATCH] gopath: switch to the archive mode With the link mode, we see stale files from previous runs in bazel-bin/gopath. --- .buildkite/hooks/pre-command | 2 +- BUILD | 2 +- tools/go_branch.sh | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index 27b3b6df0..2943b0382 100644 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -24,7 +24,7 @@ function install_pkgs() { } install_pkgs make linux-libc-dev graphviz jq curl binutils gnupg gnupg-agent \ gcc pkg-config apt-transport-https ca-certificates \ - software-properties-common rsync kmod systemd + software-properties-common rsync kmod systemd unzip # Install headers, only if available. if test -n "$(apt-cache search --names-only "^linux-headers-$(uname -r)$")"; then diff --git a/BUILD b/BUILD index a63fc75a0..21d5e51c7 100644 --- a/BUILD +++ b/BUILD @@ -120,7 +120,7 @@ build_test( # The files in this tree are symlinks to the true sources. go_path( name = "gopath", - mode = "link", + mode = "archive", deps = [ # Main binaries. # diff --git a/tools/go_branch.sh b/tools/go_branch.sh index 67d808f89..8a82ed0b0 100755 --- a/tools/go_branch.sh +++ b/tools/go_branch.sh @@ -45,13 +45,10 @@ origpwd=$(pwd) othersrc=("go.mod" "go.sum" "AUTHORS" "LICENSE") readonly module origpwd othersrc -# Build a full gopath. Before copying, this scans the generated directory -# and removes broken symbolic links. It's not clear what conditions this bug -# is hit with bazel, but it happens on occasion. +# Build a full gopath. declare -r go_output="${tmp_dir}/output" make build BAZEL_OPTIONS="" TARGETS="//:gopath" -find bazel-bin/gopath/ -xtype l -delete # See above. -rsync --recursive --delete --copy-links bazel-bin/gopath/ "${go_output}" +unzip bazel-bin/gopath.zip -d "${go_output}" # We expect to have an existing go branch that we will use as the basis for this # commit. That branch may be empty, but it must exist. We search for this branch