diff --git a/build/homebrew/create-homebrew-recipe.awk b/build/homebrew/create-homebrew-recipe.awk new file mode 100644 index 00000000..d01f234e --- /dev/null +++ b/build/homebrew/create-homebrew-recipe.awk @@ -0,0 +1,44 @@ +# Usage: awk -f create-homebrew-recipe.awk homebrew-metadata.txt + +BEGIN { + template = "kitops.rb.template"; + recipe = "kitops.rb"; +} + +{ + # Read relevant fields from input file + # (intended to be homebrew-metadata.txt) + shas[$3]=$1; + urls[$3]=$2; + version[$3]=$4; +} + +END { + # Read a line from template, replace special fields, + # and print result to recipe file + while ((getline ln < template) > 0) + { + sub(/url @@darwin-arm64/, "url " urls["darwin-arm64"], ln); + sub(/sha256 @@darwin-arm64/, "sha256 " shas["darwin-arm64"], ln); + + sub(/url @@darwin-x86_64/, "url " urls["darwin-x86_64"], ln); + sub(/sha256 @@darwin-x86_64/, "sha256 " shas["darwin-x86_64"], ln); + + sub(/url @@linux-arm64/, "url " urls["linux-arm64"], ln); + sub(/sha256 @@linux-arm64/, "sha256 " shas["linux-arm64"], ln); + + sub(/url @@linux-x86_64/, "url " urls["linux-x86_64"], ln); + sub(/sha256 @@linux-x86_64/, "sha256 " shas["linux-x86_64"], ln); + + sub(/url @@linux-i386/, "url " urls["linux-i386"], ln); + sub(/sha256 @@linux-i386/, "sha256 " shas["linux-i386"], ln); + + sub(/@@version/, version["darwin-arm64"], ln); + + print(ln) > recipe; + } + + # Close template and recipe fields + close(recipe); + close(template); +} \ No newline at end of file diff --git a/build/homebrew/homebrew-metadata.txt b/build/homebrew/homebrew-metadata.txt deleted file mode 100644 index 7a9f8b2e..00000000 --- a/build/homebrew/homebrew-metadata.txt +++ /dev/null @@ -1,3 +0,0 @@ -"56cebc02a0ce8c2ddad0caf668226986398dfe84b4513b600a12b4797d1a0927" "https://github.com/brett-hodges/kitops/releases/download/v0.4.19/kitops-linux-arm64.tar.gz" linux-arm64 0.4.19 -"c8420c08e8731148f464e22b4c849232de7116ee04c4cc5c0e3bd1613b87cf36" "https://github.com/brett-hodges/kitops/releases/download/v0.4.19/kitops-linux-i386.tar.gz" linux-i386 0.4.19 -"f93c6d554d810c6587a952adf91d76a8f5b1ae96d5360bd9cf551a4cc09e59c3" "https://github.com/brett-hodges/kitops/releases/download/v0.4.19/kitops-linux-x86_64.tar.gz" linux-x86_64 0.4.19