Skip to content

Commit

Permalink
Whitespace changes to make brew style happy
Browse files Browse the repository at this point in the history
  • Loading branch information
tautschnig committed Sep 19, 2024
1 parent 697a1f6 commit 92f1547
Showing 1 changed file with 30 additions and 27 deletions.
57 changes: 30 additions & 27 deletions transform_binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

VERSION=$1

if [[ -z "${VERSION}" ]]; then
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
Expand All @@ -16,31 +17,33 @@ 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}"
#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

0 comments on commit 92f1547

Please sign in to comment.