cherry-pick: Separate front- and back- end builds
Merge in DNS/adguard-home from imp-bamboo-specs to master
Squashed commit of the following:
commit 3415b650e48aefef3ad16030be3d797de4015403
Merge: e37c0a2b f58265ec
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Mon Aug 15 18:42:42 2022 +0300
Merge branch 'master' into imp-bamboo-specs
commit e37c0a2bb52fab98e133332e8f54d500d0f96b06
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Aug 15 18:30:33 2022 +0300
scripts: replace find with loop
commit 826a02f6a11000cce4b3205229d6bbb050c8dd73
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Mon Aug 15 18:00:41 2022 +0300
all: ...again
commit 54aebf5d4aeba35e3dc320436236759f4d1ccdad
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Mon Aug 15 17:59:24 2022 +0300
all: fix spec yaml
commit 87b92b30504f2427c40303265354afba4855e0bb
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Mon Aug 15 17:48:19 2022 +0300
all: separate front- and back-end builds
This commit is contained in:
committed by
Ainar Garipov
parent
6ea4788f56
commit
30b2b85ff1
@@ -109,17 +109,17 @@ log "checking tools"
|
||||
|
||||
# Make sure we fail gracefully if one of the tools we need is missing. Use
|
||||
# alternatives when available.
|
||||
sha256sum_cmd='sha256sum'
|
||||
for tool in gpg gzip sed "$sha256sum_cmd" snapcraft tar zip
|
||||
use_shasum='0'
|
||||
for tool in gpg gzip sed sha256sum snapcraft tar zip
|
||||
do
|
||||
if ! command -v "$tool" > /dev/null
|
||||
then
|
||||
if [ "$tool" = "$sha256sum_cmd" ] && command -v 'shasum' > /dev/null
|
||||
if [ "$tool" = 'sha256sum' ] && command -v 'shasum' > /dev/null
|
||||
then
|
||||
# macOS doesn't have sha256sum installed by default, but
|
||||
# it does have shasum.
|
||||
# macOS doesn't have sha256sum installed by default, but it does
|
||||
# have shasum.
|
||||
log 'replacing sha256sum with shasum -a 256'
|
||||
sha256sum_cmd='shasum -a 256'
|
||||
use_shasum='1'
|
||||
else
|
||||
log "pieces don't fit, '$tool' not found"
|
||||
|
||||
@@ -127,7 +127,7 @@ do
|
||||
fi
|
||||
fi
|
||||
done
|
||||
readonly sha256sum_cmd
|
||||
readonly use_shasum
|
||||
|
||||
# Data section. Arrange data into space-separated tables for read -r to read.
|
||||
# Use a hyphen for missing values.
|
||||
@@ -332,15 +332,40 @@ log "$build_archive"
|
||||
|
||||
log "calculating checksums"
|
||||
|
||||
# calculate_checksums uses the previously detected SHA-256 tool to calculate
|
||||
# checksums. Do not use find with -exec, since shasum requires arguments.
|
||||
calculate_checksums() {
|
||||
if [ "$use_shasum" -eq '0' ]
|
||||
then
|
||||
sha256sum "$@"
|
||||
else
|
||||
shasum -a 256 "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# Calculate the checksums of the files in a subshell with a different working
|
||||
# directory. Don't use ls, because files matching one of the patterns may be
|
||||
# absent, which will make ls return with a non-zero status code.
|
||||
#
|
||||
# TODO(a.garipov): Consider calculating these as the build goes.
|
||||
(
|
||||
set +f
|
||||
|
||||
cd "./${dist}"
|
||||
|
||||
find . ! -name . -prune \( -name '*.tar.gz' -o -name '*.zip' \)\
|
||||
-exec "$sha256sum_cmd" {} +\
|
||||
> ./checksums.txt
|
||||
: > ./checksums.txt
|
||||
|
||||
for archive in ./*.zip ./*.tar.gz
|
||||
do
|
||||
# Make sure that we don't try to calculate a checksum for a glob pattern
|
||||
# that matched no files.
|
||||
if [ ! -f "$archive" ]
|
||||
then
|
||||
continue
|
||||
fi
|
||||
|
||||
calculate_checksums "$archive" >> ./checksums.txt
|
||||
done
|
||||
)
|
||||
|
||||
log "writing versions"
|
||||
|
||||
Reference in New Issue
Block a user