devlog 11

🐢 Let’s move slowly. Let’s create a brew project first.

🦊 There is a brew create command but could we really copy it from someone else?

🐢 I read the espanso example, and I’ll start by adding a repository. Welcome https://github.com/iesahin/homebrew-xvc

🦊 We can search to automate this for Rust stuff first. Maybe it’s easier to automate then do it manually with examples.

🐢 Let’s search “how to automate homebrew tap formula updates with github actions”

🐲 There is a shell script that updates the brew repo with a shell script. It fires this the action from the main repository with a command like

gh workflow run release.yml -f version=${{ env.VERSION }} -R itspriddle/homebrew-slack-notify

🐢 It looks a little brittle though.

🐲 There is also a Github action: https://github.com/marketplace/actions/homebrew-tap But it looks not very popular. There is another one https://github.com/marketplace/actions/bump-homebrew-formula but this is for formulas, or the default settings are those.

🐢 There is an example https://github.com/marketplace/actions/bump-homebrew-formula#examples for taps as well.

🐲 This one is simpler and probably we can just add this first: https://github.com/marketplace/actions/homebrew-bump-formula Most of the fields are optional.

🐇 I think this is much easier than the other. Let’s start with this.

🐢 Now let’s add token to Xvc repo. ✅

🦊 Add a branch to Xvc to add the release action file.

🐢 Added the release action file ~/github.com/iesahin/xvc/.github/workflows/homebrew.yml but we still don’t have a tap, so maybe we can just add one.

🦊 Can you check espanso’s for example?

🐢 It has a cask and is in the core. We need a tap example.

🐲 I believe we need to clone homebrew-xvc and run gh workflow run

🐢 Yes, let’s clone the repo and try to run it manually.

🐇 We don’t have a formula yet

🦊 What’s the directory structure of homebrew tap project?

🐢 It’s something like but we don’t need tests for this I believe.

.
├── Formula
│   └── <formula_name>.rb
├── LICENSE
├── README.md
└── .github
    └── workflows
        └── tests.yml

🐇 What goes into the Formula?

🦊 Let’s take a look at ripgrep’s example:

class Ripgrep < Formula
  desc "Search tool like grep and The Silver Searcher"
  homepage "https://github.com/BurntSushi/ripgrep"
  url "https://github.com/BurntSushi/ripgrep/archive/refs/tags/14.1.1.tar.gz"
  sha256 "4dad02a2f9c8c3c8d89434e47337aa654cb0e2aa50e806589132f186bf5c2b66"
  license "Unlicense"
  head "https://github.com/BurntSushi/ripgrep.git", branch: "master"

  livecheck do
    url :stable
    strategy :github_latest
  end

  bottle do
    sha256 cellar: :any,                 arm64_sequoia:  "b8bf5e73c9c9b441de067ec86ac167b071ecc2078dcb1d89d2cebbb151feab35"
    sha256 cellar: :any,                 arm64_sonoma:   "47b9c3515c866b147f0e98735cab165d6471b9f28fab1ba2c57e59c43da5c10b"
    sha256 cellar: :any,                 arm64_ventura:  "e14a94e84c028ff53c1be3b106fdeb5aca4d7c893a819e7fb967e0719b946a28"
    sha256 cellar: :any,                 arm64_monterey: "ad8dc4ab475c84e2a1e60f5b3107f52dd59e33f84a08284b19681d8b98508fd7"
    sha256 cellar: :any,                 sonoma:         "71d434eeabc2af220285b037f7264563ce9bc77a41af35eabe2213276a37ec2b"
    sha256 cellar: :any,                 ventura:        "0cdb547c696992d08c6613c40934218964f4a061b5413c4b2f013c3f0c3ed253"
    sha256 cellar: :any,                 monterey:       "2ce54302e4524ad28389aca5a16333d4193128e911de2881e6b0e953559d89cd"
    sha256 cellar: :any_skip_relocation, x86_64_linux:   "97d7cbd33b4d0ed09551e3dbc07f830d3df018c2aefbb2222a12ccfb829aae30"
  end

  depends_on "asciidoctor" => :build
  depends_on "pkgconf" => :build
  depends_on "rust" => :build
  depends_on "pcre2"

  def install
    system "cargo", "install", "--features", "pcre2", *std_cargo_args

    generate_completions_from_executable(bin/"rg", "--generate", shell_parameter_format: "complete-")
    (man1/"rg.1").write Utils.safe_popen_read(bin/"rg", "--generate", "man")
  end

  test do
    (testpath/"Hello.txt").write("Hello World!")
    system bin/"rg", "Hello World!", testpath
  end
end

🐇 What’s in that tar file?

wget https://github.com/BurntSushi/ripgrep/archive/refs/tags/14.1.1.tar.gz 
--2025-01-03 06:28:07--  https://github.com/BurntSushi/ripgrep/archive/refs/tags/14.1.1.tar.gz
Resolving github.com (github.com)... 140.82.121.3
Connecting to github.com (github.com)|140.82.121.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/BurntSushi/ripgrep/tar.gz/refs/tags/14.1.1 [following]
--2025-01-03 06:28:08--  https://codeload.github.com/BurntSushi/ripgrep/tar.gz/refs/tags/14.1.1
Resolving codeload.github.com (codeload.github.com)... 140.82.121.10
Connecting to codeload.github.com (codeload.github.com)|140.82.121.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘14.1.1.tar.gz’

     0K .......... .......... .......... .......... ..........  355K
    50K .......... .......... .......... .......... .......... 1.05M
   100K .......... .......... .......... .......... .......... 1.35M
   150K .......... .......... .......... .......... .......... 3.61M
   200K .......... .......... .......... .......... ..........  876K
   250K .......... .......... .......... .......... .......... 6.50M
   300K .......... .......... .......... .......... .......... 1.15M
   350K .......... .......... .......... .......... .......... 1.65M
   400K .......... .......... .......... .......... .......... 4.88M
   450K .......... .......... .......... .......... .......... 1.22M
   500K .......... .......... .......... .......... .......... 1.56M
   550K .......... .......                                     3.62M=0.5s

2025-01-03 06:28:09 (1.21 MB/s) - ‘14.1.1.tar.gz’ saved [581402]

mv 14.1.1.tar.gz $HOME/Downloads/ripgrep-14.1.1.tar.gz

tar xvzf $HOME/Downloads/ripgrep-14.1.1.tar.gz 

🐢 It’s a source distribution. It doesn’t contain any binaries.

🦊 We can use the same URL format it looks. Let’s try this:

wget https://github.com/iesahin/xvc/archive/refs/tags/0.6.13.tar.gz 
--2025-01-03 06:34:00--  https://github.com/iesahin/xvc/archive/refs/tags/0.6.13.tar.gz
Resolving github.com (github.com)... 140.82.121.4
Connecting to github.com (github.com)|140.82.121.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/iesahin/xvc/tar.gz/refs/tags/0.6.13 [following]
--2025-01-03 06:34:01--  https://codeload.github.com/iesahin/xvc/tar.gz/refs/tags/0.6.13
Resolving codeload.github.com (codeload.github.com)... 140.82.121.9
Connecting to codeload.github.com (codeload.github.com)|140.82.121.9|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2025-01-03 06:34:01 ERROR 404: Not Found.

🐢 Our source should be in another location

🐇 We had an unpublished release. Didn’t we release the binaries a few days ago?

🐢 Umm, there must be something about gh command that we set the draft=false but seemingly it didn’t work out.

🐇 Ok, the url is something like

wget https://github.com/iesahin/xvc/archive/refs/tags/v0.6.13.tar.gz 

🐢 Ok, this works. We’ll use this one for the URL.

🐇 What to put for SHA256?

🦊 Let’s check ripgrep’s again?

🐢 Downloading and using xvcfh

wget https://github.com/BurntSushi/ripgrep/archive/refs/tags/14.1.1.tar.gz 
...

xvc file hash -a sha2 14.1.1.tar.gz
4dad02a2f9c8c3c8d89434e47337aa654cb0e2aa50e806589132f186bf5c2b66	14.1.1.tar.gz

🐢 Yep, this matches the source.

🦊 Then we can use just use the same.

🐇 I want to learn how to download to $TMPDIR with wget

🐢 -P option is used for this.

wget -P $TMPDIR https://github.com/iesahin/xvc/archive/refs/tags/v0.6.13.tar.gz 
--2025-01-03 06:55:02--  https://github.com/iesahin/xvc/archive/refs/tags/v0.6.13.tar.gz
Resolving github.com (github.com)... 140.82.121.4
Connecting to github.com (github.com)|140.82.121.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/iesahin/xvc/tar.gz/refs/tags/v0.6.13 [following]
--2025-01-03 06:55:03--  https://codeload.github.com/iesahin/xvc/tar.gz/refs/tags/v0.6.13
Resolving codeload.github.com (codeload.github.com)... 140.82.121.9
Connecting to codeload.github.com (codeload.github.com)|140.82.121.9|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘/var/folders/gf/18gghtz15_zf0cr8v6dymglw0000gn/T/v0.6.13.tar.gz’
...
2025-01-03 06:55:07 (2.59 MB/s) - ‘/var/folders/gf/18gghtz15_zf0cr8v6dymglw0000gn/T/v0.6.13.tar.gz’ saved [8785449]
xvcfh -a sha2 $TMPDIR/v0.6.13.tar.gz
01bee5d840eefec7be1f52cc75546e1ffd7e332dfac83d875655f84e61e3a9f6	/var/folders/gf/18gghtz15_zf0cr8v6dymglw0000gn/T//v0.6.13.tar.gz

🐇 According to documentation, bottles are produced by brew itself and the documentation around bottling taps is limited.

🦊 We can just start with the source distribution. We can test it now.

🐢 The source distribution seems to work, but it requires Rust and brew downloads everything related to it.

🐇 I think that may be enough for the time being. With 0.6.14, we can work on to provide bottles.

🐢 Umm, yes. I’m already bored from this stuff.

/homebrew/ /espanso/ /ripgrep/ /gh/ /wget/