What's the best way to migrate internal taps? #6829
-
|
My ideal experience is that the user can tap the new repo, run at most one command, and then untap the old repo as soon as they're not using anything that wasn't migrated to the new tap. I think I can achieve this with My org is moving from a GitHub Enterprise Server at, e.g., We had a tap set up at Users must use SSH to clone, so they've used and will use: # old tap
brew tap mycorp/brewhouse git@git.mycorp.com:brew/house
# new tap
brew tap my-corp/brew-house git@github.com:my-corp/brew-houseTo the new tap, I added an exact copy of a formula, let's just call it After deleting that formula from a branch on the old tap, I also added a {
"docker-tools": "my-corp/brew-house"
}I switched to that branch in my local tap clone. I tapped the new tap and ran
However, when I ran another script that runs
brew doctor outputThe workaround for this problem I'm having is to do exactly as the above says: direct the user to uninstall the old tap packages and install new tap packages. I'd like to minimize this or make it a one-shot command that handles all packages installed from the old that are available in the new— not all will be migrated. I could basically do something like old=mycorp/brewhouse
new=my-corp/brew-house
for pkg in `brew list --full-name | grep ${old}`; do
brew uninstall ${pkg}
brew install ${pkg/$old/$new}
doneAt this point, my questions are:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
We ended up recommending this approach: OLD_TAP_PREFIX=mycorp/brewhouse
NEW_TAP_PREFIX=my-corp/brew-house
NEW_TAP_URL=git@github.com:my-corp/homebrew-brew-house.git
# get a list of packages installed on the old tap
declare -a pkgs=($(brew list --full-name | grep $(brew tap | grep ${OLD_TAP_PREFIX})))
# uninstall them
brew uninstall --force ${pkgs[*]}
# tap the new one, use --custom-remote to overwrite the URL
# if they already have it tapped so that *this cannot fail*
brew tap --custom-remote ${NEW_TAP_PREFIX} ${NEW_TAP_URL}
# 5.1.15+ requires this now?
brew trust ${NEW_TAP_PREFIX}
# install each previously installed package from the new tap using the new tap's full-name package
brew install ${pkgs[*]/${OLD_TAP_PREFIX}/${NEW_TAP_PREFIX}}
# remove the old tap
brew untap ${OLD_TAP_PREFIX}Side note: Initially, the new tap was named |
Beta Was this translation helpful? Give feedback.
We ended up recommending this approach: