Skip to content

Commit 5537d3b

Browse files
committed
Refactor bottle transformation script to handle arbitrary versions
1 parent 84ab342 commit 5537d3b

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

transform_binary.sh

+16-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
VERSION=$1
44

5+
if [ -z "${VERSION}" ]; then
6+
echo >&2 "Fatal error: VERSION not set"
7+
echo >&2 "Fatal error: Need to provide version, example: 5.62.0"
8+
exit 2
9+
fi
10+
11+
CBMC_STRING="CbmcAT"
12+
VERSION_PROCESSED="${VERSION//./}"
13+
FORMULA_VERSION="$CBMC_STRING$VERSION_PROCESSED"
14+
515
for TAG in "arm64_monterey" "arm64_big_sur" "monterey" "big_sur" "catalina" "x86_64_linux"
616
do
717
echo "Processing bottle for $VERSION -- $TAG"
@@ -17,21 +27,21 @@ do
1727

1828
tar -xzf $BOTTLE_NAME
1929
mv cbmc cbmc@$1
20-
sed -iu 's/class Cbmc/class CbmcAT5610/g' cbmc@$1/$1/.brew/cbmc.rb
21-
tar czf cbmc-$1-$TAG.bottle.tar.gz cbmc@$1
30+
sed -iu "s/class Cbmc/class $FORMULA_VERSION/g" cbmc@$1/$1/.brew/cbmc.rb
31+
tar czf cbmc@$1-$1.$TAG.bottle.tar.gz cbmc@$1
2232
rm -rf cbmc@$1
23-
SHA=$(shasum -a 256 cbmc-$1-$TAG.bottle.tar.gz)
33+
SHA=$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz)
2434
echo "$SHA"
2535
elif [[ $OUTPUT =~ $pat2 ]]; then
2636
BOTTLE_NAME=${BASH_REMATCH[1]}
2737
BOTTLE_NAME+="tar.gz"
2838

2939
tar -xzf $BOTTLE_NAME
3040
mv cbmc cbmc@$1
31-
sed -iu 's/class Cbmc/class CbmcAT5610/g' cbmc@$1/$1/.brew/cbmc.rb
32-
tar czf cbmc-$1-$TAG.bottle.tar.gz cbmc@$1
41+
sed -iu "s/class Cbmc/class $FORMULA_VERSION/g" cbmc@$1/$1/.brew/cbmc.rb
42+
tar czf cbmc@$1-$1.$TAG.bottle.tar.gz cbmc@$1
3343
rm -rf cbmc@$1
34-
SHA=$(shasum -a 256 cbmc-$1-$TAG.bottle.tar.gz)
44+
SHA=$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz)
3545
echo "$SHA"
3646
fi
3747
done

0 commit comments

Comments
 (0)