sqitchers / homebrew-sqitch

Homebrew Formulas for Sqitch
22 stars 10 forks source link

master/sqitch.rb: fix Homebrew death on all operations #49

Closed gromgit closed 4 years ago

gromgit commented 4 years ago

Homebrew will load all formulae during most operations, so a user still on the master branch can't follow your upgrade instructions, because odie kills brew prematurely.

Addresses https://discourse.brew.sh/t/stuck-with-sqitch/8614

theory commented 4 years ago

Yikes! I don't suppose there's a way to get it to fail only itself, is there? Or does opoo do that?

gromgit commented 4 years ago

If you define an install stanza like every other formula, and odie inside it, that should only trigger on a brew install/upgrade. opoo basically does print WARNING, which odie is print ERROR; exit 1.

That said, I think the way you're doing it now is probably better, since it keeps bugging the user to take corrective action. Otherwise, if you decide (reasonably) to remove the master branch at some point, everyone who's still on the master branch will be stuck. With the current formula, you can simply update the text to say that you'll be removing the master branch on a certain date, and everyone gets "blasted" with that message after a brew update.

theory commented 4 years ago

I imagine a bunch of projects are going to run into this; I myself copied it from twilio (See #48) for details. Might be useful for there to be some way to tell homebrew that a project has moved to a new location and/or branch. If, for example, there was a file I could just stick in the master branch that tells homebrew that the project has moved,, and brew would know to either change to the new branch or to clone from a different location, updating the reference automatically.

OTOH, that could also be the vector for abuse, in case someone took over a project and put in a redirect without the author's knowledge. Even if the author eventually noticed and fixed/removed the redirect, the project would be stuck with the exploit URL. :-(