From 94434ff5ca2d26b84668900e9dfb0ff2ba09fcf3 Mon Sep 17 00:00:00 2001
From: Thomas Given-Wilson <thomas.givenwilson@diffblue.com>
Date: Fri, 2 Dec 2022 11:57:33 +0000
Subject: [PATCH 1/3] Add cleaner script for extracting binaries and producing
 bottle text

This adds a new script that extracts the binaries in the same
manner as transform_binary.sh, but outputs the exact text
needed for the formula.
---
 extract_binaries.sh | 54 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100755 extract_binaries.sh

diff --git a/extract_binaries.sh b/extract_binaries.sh
new file mode 100755
index 0000000..6e1e45e
--- /dev/null
+++ b/extract_binaries.sh
@@ -0,0 +1,54 @@
+#!/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_monterey" "arm64_big_sur" "monterey" "big_sur" "catalina" "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]}
+        BOTTLE_NAME+="tar.gz"
+
+        tar -xzf $BOTTLE_NAME
+        mv cbmc cbmc@$1
+        sed -iu "s/class Cbmc/class $FORMULA_VERSION/g" cbmc@$1/$1/.brew/cbmc.rb
+        tar czf cbmc@$1-$1.$TAG.bottle.tar.gz cbmc@$1
+        rm -rf cbmc@$1
+        #SHA=$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz)
+        #echo "$SHA"
+        LINE="  sha256 cellar: :any_skip_relocation, $TAG: \"$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz | awk '{print $1}')\""
+        echo "$LINE"
+    elif [[ $OUTPUT =~ $pat2 ]]; then
+        BOTTLE_NAME=${BASH_REMATCH[1]}
+        BOTTLE_NAME+="tar.gz"
+
+        tar -xzf $BOTTLE_NAME
+        mv cbmc cbmc@$1
+        sed -iu "s/class Cbmc/class $FORMULA_VERSION/g" cbmc@$1/$1/.brew/cbmc.rb
+        tar czf cbmc@$1-$1.$TAG.bottle.tar.gz cbmc@$1
+        rm -rf cbmc@$1
+        #SHA=$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz)
+        #echo "$SHA"
+        LINE="  sha256 cellar: :any_skip_relocation, $TAG: \"$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz | awk '{print $1}')\""
+        echo "$LINE"
+    fi
+done
+echo end

From 4638a5aa9a975ac2012cff6e5f02dddf4f3f4021 Mon Sep 17 00:00:00 2001
From: Thomas Given-Wilson <thomas.givenwilson@diffblue.com>
Date: Fri, 2 Dec 2022 11:57:33 +0000
Subject: [PATCH 2/3] Add cleaner script for extracting binaries and producing
 bottle text

This adds a new script that extracts the binaries in the same
manner as transform_binary.sh, but outputs the exact text
needed for the formula.
---
 extract_binaries.sh | 54 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100755 extract_binaries.sh

diff --git a/extract_binaries.sh b/extract_binaries.sh
new file mode 100755
index 0000000..6e1e45e
--- /dev/null
+++ b/extract_binaries.sh
@@ -0,0 +1,54 @@
+#!/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_monterey" "arm64_big_sur" "monterey" "big_sur" "catalina" "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]}
+        BOTTLE_NAME+="tar.gz"
+
+        tar -xzf $BOTTLE_NAME
+        mv cbmc cbmc@$1
+        sed -iu "s/class Cbmc/class $FORMULA_VERSION/g" cbmc@$1/$1/.brew/cbmc.rb
+        tar czf cbmc@$1-$1.$TAG.bottle.tar.gz cbmc@$1
+        rm -rf cbmc@$1
+        #SHA=$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz)
+        #echo "$SHA"
+        LINE="  sha256 cellar: :any_skip_relocation, $TAG: \"$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz | awk '{print $1}')\""
+        echo "$LINE"
+    elif [[ $OUTPUT =~ $pat2 ]]; then
+        BOTTLE_NAME=${BASH_REMATCH[1]}
+        BOTTLE_NAME+="tar.gz"
+
+        tar -xzf $BOTTLE_NAME
+        mv cbmc cbmc@$1
+        sed -iu "s/class Cbmc/class $FORMULA_VERSION/g" cbmc@$1/$1/.brew/cbmc.rb
+        tar czf cbmc@$1-$1.$TAG.bottle.tar.gz cbmc@$1
+        rm -rf cbmc@$1
+        #SHA=$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz)
+        #echo "$SHA"
+        LINE="  sha256 cellar: :any_skip_relocation, $TAG: \"$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz | awk '{print $1}')\""
+        echo "$LINE"
+    fi
+done
+echo end

From 62d0a9ef0ab594efbee5fd542206919bb145476b Mon Sep 17 00:00:00 2001
From: Thomas Given-Wilson <thomas.givenwilson@diffblue.com>
Date: Wed, 14 Dec 2022 15:45:48 +0000
Subject: [PATCH 3/3] Replace old file

---
 extract_binaries.sh | 54 ---------------------------------------------
 transform_binary.sh | 17 +++++++++-----
 2 files changed, 12 insertions(+), 59 deletions(-)
 delete mode 100755 extract_binaries.sh

diff --git a/extract_binaries.sh b/extract_binaries.sh
deleted file mode 100755
index 6e1e45e..0000000
--- a/extract_binaries.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/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_monterey" "arm64_big_sur" "monterey" "big_sur" "catalina" "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]}
-        BOTTLE_NAME+="tar.gz"
-
-        tar -xzf $BOTTLE_NAME
-        mv cbmc cbmc@$1
-        sed -iu "s/class Cbmc/class $FORMULA_VERSION/g" cbmc@$1/$1/.brew/cbmc.rb
-        tar czf cbmc@$1-$1.$TAG.bottle.tar.gz cbmc@$1
-        rm -rf cbmc@$1
-        #SHA=$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz)
-        #echo "$SHA"
-        LINE="  sha256 cellar: :any_skip_relocation, $TAG: \"$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz | awk '{print $1}')\""
-        echo "$LINE"
-    elif [[ $OUTPUT =~ $pat2 ]]; then
-        BOTTLE_NAME=${BASH_REMATCH[1]}
-        BOTTLE_NAME+="tar.gz"
-
-        tar -xzf $BOTTLE_NAME
-        mv cbmc cbmc@$1
-        sed -iu "s/class Cbmc/class $FORMULA_VERSION/g" cbmc@$1/$1/.brew/cbmc.rb
-        tar czf cbmc@$1-$1.$TAG.bottle.tar.gz cbmc@$1
-        rm -rf cbmc@$1
-        #SHA=$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz)
-        #echo "$SHA"
-        LINE="  sha256 cellar: :any_skip_relocation, $TAG: \"$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz | awk '{print $1}')\""
-        echo "$LINE"
-    fi
-done
-echo end
diff --git a/transform_binary.sh b/transform_binary.sh
index 95419d4..00bbce4 100755
--- a/transform_binary.sh
+++ b/transform_binary.sh
@@ -12,9 +12,11 @@ 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_ventura" "arm64_monterey" "arm64_big_sur" "ventura" "monterey" "big_sur" "x86_64_linux"
 do
-    echo "Processing bottle for $VERSION -- $TAG"
+    #echo "Processing bottle for $VERSION -- $TAG"
     OUTPUT=$(brew fetch cbmc --bottle-tag=$TAG)
     OUTPUT=$(echo "$OUTPUT" | tail -n -2)
 
@@ -30,8 +32,10 @@ do
         sed -iu "s/class Cbmc/class $FORMULA_VERSION/g" cbmc@$1/$1/.brew/cbmc.rb
         tar czf cbmc@$1-$1.$TAG.bottle.tar.gz cbmc@$1
         rm -rf cbmc@$1
-        SHA=$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz)
-        echo "$SHA"
+        #SHA=$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz)
+        #echo "$SHA"
+        LINE="  sha256 cellar: :any_skip_relocation, $TAG: \"$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz | awk '{print $1}')\""
+        echo "$LINE"
     elif [[ $OUTPUT =~ $pat2 ]]; then
         BOTTLE_NAME=${BASH_REMATCH[1]}
         BOTTLE_NAME+="tar.gz"
@@ -41,7 +45,10 @@ do
         sed -iu "s/class Cbmc/class $FORMULA_VERSION/g" cbmc@$1/$1/.brew/cbmc.rb
         tar czf cbmc@$1-$1.$TAG.bottle.tar.gz cbmc@$1
         rm -rf cbmc@$1
-        SHA=$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz)
-        echo "$SHA"
+        #SHA=$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz)
+        #echo "$SHA"
+        LINE="  sha256 cellar: :any_skip_relocation, $TAG: \"$(shasum -a 256 cbmc@$1-$1.$TAG.bottle.tar.gz | awk '{print $1}')\""
+        echo "$LINE"
     fi
 done
+echo end
