-
Notifications
You must be signed in to change notification settings - Fork 2
/
transform_binary.sh
executable file
·49 lines (41 loc) · 1.41 KB
/
transform_binary.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
VERSION=$1
if [[ -z "${VERSION}" ]]
then
echo >&2 "Fatal error: VERSION not set"
echo >&2 "Fatal error: Need to provide version, example: 5.62.0"
exit 2
fi
CBMC_STRING="CbmcAT"
VERSION_PROCESSED="${VERSION//./}"
FORMULA_VERSION="${CBMC_STRING}${VERSION_PROCESSED}"
echo " bottle do"
echo " root_url \"https://github.com/diffblue/homebrew-cbmc/releases/download/bag-of-goodies\""
for TAG in "arm64_sonoma" "arm64_ventura" "arm64_monterey" "sonoma" "ventura" "monterey" "x86_64_linux"
do
#echo "Processing bottle for $VERSION -- $TAG"
OUTPUT=$(brew fetch cbmc --bottle-tag="${TAG}")
OUTPUT=$(echo "${OUTPUT}" | tail -n -2)
pat1='Downloaded to: (.*\.{1})(tgz|tar\.gz)'
pat2='Already downloaded: (.*\.{1})(tgz|tar\.gz)'
if [[ ${OUTPUT} =~ ${pat1} ]]
then
BOTTLE_NAME=${BASH_REMATCH[1]}
elif [[ ${OUTPUT} =~ ${pat2} ]]
then
BOTTLE_NAME=${BASH_REMATCH[1]}
else
continue
fi
BOTTLE_NAME+="tar.gz"
tar -xzf "${BOTTLE_NAME}"
mv cbmc cbmc@"${VERSION}"
sed -iu "s/class Cbmc/class ${FORMULA_VERSION}/g" "cbmc@${VERSION}/${VERSION}/.brew/cbmc.rb"
tar czf "cbmc@${VERSION}-${VERSION}.${TAG}.bottle.tar.gz" cbmc@"${VERSION}"
rm -rf cbmc@"${VERSION}"
SHA=$(shasum -a 256 "cbmc@${VERSION}-${VERSION}.${TAG}.bottle.tar.gz")
TAG_SPACED=$(printf "%-60s" " sha256 cellar: :any_skip_relocation, ${TAG}:")
LINE="${TAG_SPACED}\"${SHA%%[[:space:]]*}\""
echo "${LINE}"
done
echo " end"