all: partially sync with master; upd chlog
This commit is contained in:
@@ -51,12 +51,12 @@ readonly channel
|
||||
|
||||
case "$channel"
|
||||
in
|
||||
('development'|'edge'|'beta'|'release')
|
||||
('development'|'edge'|'beta'|'release'|'candidate')
|
||||
# All is well, go on.
|
||||
;;
|
||||
(*)
|
||||
echo "invalid channel '$channel', supported values are\
|
||||
'development', 'edge', 'beta', and 'release'" 1>&2
|
||||
'development', 'edge', 'beta', 'release', and 'candidate'" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -30,33 +30,6 @@ set -f -u
|
||||
|
||||
|
||||
|
||||
# Warnings
|
||||
|
||||
go_version="$( "${GO:-go}" version )"
|
||||
readonly go_version
|
||||
|
||||
go_min_version='go1.20.12'
|
||||
go_version_msg="
|
||||
warning: your go version (${go_version}) is different from the recommended minimal one (${go_min_version}).
|
||||
if you have the version installed, please set the GO environment variable.
|
||||
for example:
|
||||
|
||||
export GO='${go_min_version}'
|
||||
"
|
||||
readonly go_min_version go_version_msg
|
||||
|
||||
case "$go_version"
|
||||
in
|
||||
('go version'*"$go_min_version"*)
|
||||
# Go on.
|
||||
;;
|
||||
(*)
|
||||
echo "$go_version_msg" 1>&2
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
# Simple analyzers
|
||||
|
||||
# blocklist_imports is a simple check against unwanted packages. The following
|
||||
@@ -74,18 +47,24 @@ esac
|
||||
#
|
||||
# See https://github.com/golang/go/issues/45200.
|
||||
#
|
||||
# * Package sort is replaced by golang.org/x/exp/slices.
|
||||
# * Package sort is replaced by package slices.
|
||||
#
|
||||
# * Package unsafe is… unsafe.
|
||||
#
|
||||
# * Package golang.org/x/exp/slices has been moved into stdlib.
|
||||
#
|
||||
# * Package golang.org/x/net/context has been moved into stdlib.
|
||||
#
|
||||
# Currently, the only standard exception are files generated from protobuf
|
||||
# schemas, which use package reflect. If your project needs more exceptions,
|
||||
# add and document them.
|
||||
#
|
||||
# TODO(a.garipov): Add deprecated packages golang.org/x/exp/maps and
|
||||
# golang.org/x/exp/slices once all projects switch to Go 1.21.
|
||||
# TODO(a.garipov): Add golibs/log.
|
||||
#
|
||||
# TODO(a.garipov): Add "golang.org/x/exp/slices" back after a release.
|
||||
#
|
||||
# TODO(a.garipov): Add deprecated package golang.org/x/exp/maps once all
|
||||
# projects switch to Go 1.22.
|
||||
blocklist_imports() {
|
||||
git grep\
|
||||
-e '[[:space:]]"errors"$'\
|
||||
@@ -124,12 +103,10 @@ underscores() {
|
||||
underscore_files="$(
|
||||
git ls-files '*_*.go'\
|
||||
| grep -F\
|
||||
-e '_big.go'\
|
||||
-e '_bsd.go'\
|
||||
-e '_darwin.go'\
|
||||
-e '_freebsd.go'\
|
||||
-e '_linux.go'\
|
||||
-e '_little.go'\
|
||||
-e '_next.go'\
|
||||
-e '_openbsd.go'\
|
||||
-e '_others.go'\
|
||||
|
||||
@@ -51,9 +51,9 @@ readonly count_flags cover_flags shuffle_flags timeout_flags
|
||||
"$go" test\
|
||||
"$count_flags"\
|
||||
"$cover_flags"\
|
||||
"$shuffle_flags"\
|
||||
"$race_flags"\
|
||||
"$shuffle_flags"\
|
||||
"$timeout_flags"\
|
||||
"$x_flags"\
|
||||
"$v_flags"\
|
||||
"$x_flags"\
|
||||
./...
|
||||
|
||||
@@ -30,8 +30,6 @@ set -e -f -u
|
||||
go="${GO:-go}"
|
||||
readonly go
|
||||
|
||||
# TODO(a.garipov): Add goconst?
|
||||
|
||||
# Remove only the actual binaries in the bin/ directory, as developers may add
|
||||
# their own scripts there. Most commonly, a script named “go” for tools that
|
||||
# call the go binary and need a particular version.
|
||||
|
||||
33
scripts/make/go-upd-tools.sh
Normal file
33
scripts/make/go-upd-tools.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This comment is used to simplify checking local copies of the script. Bump
|
||||
# this number every time a significant change is made to this script.
|
||||
#
|
||||
# AdGuard-Project-Version: 1
|
||||
|
||||
verbose="${VERBOSE:-0}"
|
||||
readonly verbose
|
||||
|
||||
if [ "$verbose" -gt '1' ]
|
||||
then
|
||||
env
|
||||
set -x
|
||||
x_flags='-x=1'
|
||||
elif [ "$verbose" -gt '0' ]
|
||||
then
|
||||
set -x
|
||||
x_flags='-x=0'
|
||||
else
|
||||
set +x
|
||||
x_flags='-x=0'
|
||||
fi
|
||||
readonly x_flags
|
||||
|
||||
set -e -f -u
|
||||
|
||||
go="${GO:-go}"
|
||||
readonly go
|
||||
|
||||
cd ./internal/tools/
|
||||
"$go" get -u
|
||||
"$go" mod tidy
|
||||
@@ -43,7 +43,7 @@ bump_minor='/^v[0-9]+\.[0-9]+\.0$/ {
|
||||
}
|
||||
|
||||
{
|
||||
printf("invalid release version: \"%s\"\n", $0);
|
||||
printf("invalid minor release version: \"%s\"\n", $0);
|
||||
|
||||
exit 1;
|
||||
}'
|
||||
@@ -74,8 +74,16 @@ readonly channel
|
||||
case "$channel"
|
||||
in
|
||||
('development')
|
||||
# Use the dummy version for development builds.
|
||||
version='v0.0.0'
|
||||
# commit_number is the number of current commit within the branch.
|
||||
commit_number="$( git rev-list --count master..HEAD )"
|
||||
readonly commit_number
|
||||
|
||||
# The development builds are described with a combination of unset semantic
|
||||
# version, the commit's number within the branch, and the commit hash, e.g.:
|
||||
#
|
||||
# v0.0.0-dev.5-a1b2c3d4
|
||||
#
|
||||
version="v0.0.0-dev.${commit_number}+$( git rev-parse --short HEAD )"
|
||||
;;
|
||||
('edge')
|
||||
# last_minor_zero is the last new minor release.
|
||||
@@ -120,15 +128,40 @@ in
|
||||
|
||||
version="$last_tag"
|
||||
;;
|
||||
('candidate')
|
||||
# This pseudo-channel is used to set a proper versions into release
|
||||
# candidate builds.
|
||||
|
||||
# last_tag is expected to be the latest release tag.
|
||||
last_tag="$( git describe --abbrev=0 )"
|
||||
readonly last_tag
|
||||
|
||||
# current_branch is the name of the branch currently checked out.
|
||||
current_branch="$( git rev-parse --abbrev-ref HEAD )"
|
||||
readonly current_branch
|
||||
|
||||
# The branch should be named like:
|
||||
#
|
||||
# rc-v12.34.56
|
||||
#
|
||||
if ! echo "$current_branch" | grep -E -e '^rc-v[0-9]+\.[0-9]+\.[0-9]+$' -q
|
||||
then
|
||||
echo "invalid release candidate branch name '$current_branch'" 1>&2
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version="${current_branch#rc-}-rc.$( git rev-list --count "$last_tag"..HEAD )"
|
||||
;;
|
||||
(*)
|
||||
echo "invalid channel '$channel', supported values are\
|
||||
'development', 'edge', 'beta', and 'release'" 1>&2
|
||||
'development', 'edge', 'beta', 'release' and 'candidate'" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Finally, make sure that we don't output invalid versions.
|
||||
if ! echo "$version" | grep -E -e '^v[0-9]+\.[0-9]+\.[0-9]+(-[ab]\.[0-9]+)?(\+[[:xdigit:]]+)?$' -q
|
||||
if ! echo "$version" | grep -E -e '^v[0-9]+\.[0-9]+\.[0-9]+(-(a|b|dev|rc)\.[0-9]+)?(\+[[:xdigit:]]+)?$' -q
|
||||
then
|
||||
echo "generated an invalid version '$version'" 1>&2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user