obb 2022-03-09

command-line-args works, and my obb script is making me very happy. Thank you @zane and@borkdude!

πŸ‘πŸ» 1

I get a SHA mismatch for obb v0.0.3 when upgrading via brew.

user=> (format "%064x", (BigInteger. "cafebabe123" 16))
"00000000000000000000000000000000000000000000000000000cafebabe123"

πŸ‘ 1

❯ brew upgrade
==> Upgrading 2 outdated packages:
babashka/brew/obb 0.0.2 -> 0.0.3
graphviz 2.50.0 -> 3.0.0
==> Downloading 
Already downloaded: /Users/philipp.meier/Library/Caches/Homebrew/downloads/32ab0db39c2cffc5046614247fa805bbba9947f9ed68b8b109fd309dfeed9aad--obb.tar.gz
Error: SHA256 mismatch
Expected: 79b6855082ab0b6bef829a4d7688dbf679c0ee832dd2e7a5bd50c177114178c9
  Actual: 0564ffc2038300fef50e074b9cd4a3fa7c426817989691c531b4032180afd731
    File: /Users/philipp.meier/Library/Caches/Homebrew/downloads/32ab0db39c2cffc5046614247fa805bbba9947f9ed68b8b109fd309dfeed9aad--obb.tar.gz
To retry an incomplete download, remove the file above.

please try again

Close, but no cigar

Expected: 564ffc2038300fef50e074b9cd4a3fa7c426817989691c531b4032180afd731
  Actual: 0564ffc2038300fef50e074b9cd4a3fa7c426817989691c531b4032180afd731

Can you make sure to purge your local brew recipes

I pushed a new one but you gotta clear your local one

The sha-1 in the formula is now: "564ffc2038300fef50e074b9cd4a3fa7c426817989691c531b4032180afd731"

maybe removing and re-installing will help

Tried uninstalling, but still having issues:

brew install babashka/brew/obb                                                                                              
==> Downloading 
==> Downloading from 
######################################################################## 100.0%
Error: obb: SHA256 mismatch
Expected: 564ffc2038300fef50e074b9cd4a3fa7c426817989691c531b4032180afd731
  Actual: 0564ffc2038300fef50e074b9cd4a3fa7c426817989691c531b4032180afd731
    File: /Users/lee/Library/Caches/Homebrew/downloads/32ab0db39c2cffc5046614247fa805bbba9947f9ed68b8b109fd309dfeed9aad--obb.tar.gz
To retry an incomplete download, remove the file above.

That extra leading zero seems suspect!

fuck, indeed

can you maybe take a look in https://github.com/babashka/homebrew-brew, if you want? I'm having dinner. The bb update-obb task creates the recipe. I'll be back in a hour...

sure, I’ll take a peek

but why are they needed by brew :(

should we format the string using leading zeroes using format ?

Ya I think that would do the trick…

fixed it by shelling out to sha256sum

I guess maybe a sha256 is 256 bits which means it is always 64 characters long?

please try installing again

$ obb --version
obb v0.0.3

πŸŽ‰

πŸŽ‰ 1

ok, the fixed hex fn:

(defn ->hex [file]
                   (let [digest (java.security.MessageDigest/getInstance "SHA-256")
                         hash (.digest digest (fs/read-all-bytes file))
                         hex (.toString (BigInteger. 1 hash) 16)
                         zeroes (str/join (repeat (- 64 (count hex)) "0"))
                         hex (str zeroes hex)]
                     hex)))

at least I don't have to worry about linux/mac this way

ya that works, and no wondering about how format might behave.