diff options
author | Adin Scannell <ascannell@google.com> | 2019-10-31 12:51:50 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-10-31 12:53:27 -0700 |
commit | fe2e0764ac600fe19a3d87069a58d7463a5223ab (patch) | |
tree | 2e42368d669ddcb8ec21aa41fe54cc7ff56b6881 /tools | |
parent | f7dbddaf77a6059c2f5a441d068a39219fe593bd (diff) |
Add LICENSE and AUTHORS to the go branch.
Also, construct the README directly so that edits can be made.
PiperOrigin-RevId: 277782095
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/go_branch.sh | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/tools/go_branch.sh b/tools/go_branch.sh index ddb9b6e7b..0ac16e266 100755 --- a/tools/go_branch.sh +++ b/tools/go_branch.sh @@ -17,9 +17,9 @@ set -eo pipefail # Discovery the package name from the go.mod file. -declare -r gomod="$(pwd)/go.mod" -declare -r module=$(cat "${gomod}" | grep -E "^module" | cut -d' ' -f2) -declare -r gosum="$(pwd)/go.sum" +declare -r module=$(cat go.mod | grep -E "^module" | cut -d' ' -f2) +declare -r origpwd=$(pwd) +declare -r othersrc=("go.mod" "go.sum" "AUTHORS" "LICENSE") # Check that gopath has been built. declare -r gopath_dir="$(pwd)/bazel-bin/gopath/src/${module}" @@ -65,10 +65,22 @@ git checkout -b go "${go_branch}" git merge --no-commit --strategy ours ${head} || \ git merge --allow-unrelated-histories --no-commit --strategy ours ${head} -# Sync the entire gopath_dir and go.mod. -rsync --recursive --verbose --delete --exclude .git --exclude README.md -L "${gopath_dir}/" . -cp "${gomod}" . -cp "${gosum}" . +# Sync the entire gopath_dir. +rsync --recursive --verbose --delete --exclude .git -L "${gopath_dir}/" . + +# Add additional files. +for file in "${othersrc[@]}"; do + cp "${origpwd}"/"${file}" . +done + +# Construct a new README.md. +cat > README.md <<EOF +# gVisor + +This branch is a synthetic branch, containing only Go sources, that is +compatible with standard Go tools. See the `master` branch for authoritative +sources and tests. +EOF # There are a few solitary files that can get left behind due to the way bazel # constructs the gopath target. Note that we don't find all Go files here |