-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migration to other tap broken #17290
Comments
I think your {
"example": "pe/new-tap/example"
} |
Looking at other examples I don't think so: https://github.com/brewsci/homebrew-science/blob/5d14d2fda3934c0eb8243c1cbdb9fb4621ec110b/tap_migrations.json I tried it with pe/homebrew-old-tap@cc86591. Same error. |
I think I found the source of the issue. The same cask is found twice. Once in the new tap and once in the old but mapped to the new tap. If I inspect brew/Library/Homebrew/cask/cask_loader.rb Lines 459 to 461 in 5e6a43e
I get this:
The only difference is the object_id. Changing the above code like so fixes the issue. loaders = Tap.select { |tap| tap.installed? && !tap.core_cask_tap? }
.filter_map { |tap| super("#{tap}/#{token}", warn:) }
.select { |tap| tap.path.exist? }
.uniq{ |cask| cask.tap } # this line was added by me But my knowledge of this codebase is none and my ruby is very limited. I can't judge if this is a good idea or not. How to proceed? Should I just create a PR and we'll discuss there? Would you want any tests for this change? Where? Are there other places where this is also necessary? |
My Ruby-fu is limited too, but I'm pretty sure that:
|
Yes, this. You should delete the formula/cask from the old file or it won't work as expected. |
Yes, this would be best.
Ideally the corresponding |
I don't think that the order matters because both casks are identical (except for the object_id). The cask from the old tap was already migrated to the new one, that's why they are identical.
I did delete it in the old tap and get this error nevertheless. See What were you trying to do (and why)?.
OK. Will do. |
brew/Library/Homebrew/cask/cask_loader.rb Lines 459 to 461 in ff950e6
I suspect what's happening here is that we're getting identical cask loaders because the call to brew/Library/Homebrew/cask/cask_loader.rb Lines 205 to 212 in ff950e6
The Ideally, we'd figure out how to refactor this so that this doesn't happen in this sort of situation but I'm not really sure what that would look like. |
While playing around, I just noticed that the same error also applies to formulae, not only to casks. Step-by-step reproduction instructions (by running brew commands)https://github.com/pe/homebrew-old-tap/blob/5a0e91e527c5962096e62fa277c896a1c285faef/tap_migrations.json#L3 ~ ❯ brew install examplef --verbose --debug
Warning: Formula pe/old-tap/examplef was renamed to pe/new-tap/examplef.
Error: Formulae found in multiple taps:
* pe/new-tap/examplef
* pe/new-tap/examplef
Please use the fully-qualified name (e.g. pe/new-tap/examplef) to refer to a specific formula.
/opt/homebrew/Library/Homebrew/formulary.rb:837:in `try_new'
/opt/homebrew/Library/Homebrew/formulary.rb:1227:in `block in loader_for'
/opt/homebrew/Library/Homebrew/formulary.rb:1226:in `each'
/opt/homebrew/Library/Homebrew/formulary.rb:1226:in `loader_for'
/opt/homebrew/Library/Homebrew/formulary.rb:1008:in `factory'
/opt/homebrew/Library/Homebrew/cli/parser.rb:709:in `block in formulae'
/opt/homebrew/Library/Homebrew/cli/parser.rb:705:in `each'
/opt/homebrew/Library/Homebrew/cli/parser.rb:705:in `filter_map'
/opt/homebrew/Library/Homebrew/cli/parser.rb:705:in `formulae'
/opt/homebrew/Library/Homebrew/cli/parser.rb:363:in `parse'
/opt/homebrew/Library/Homebrew/abstract_command.rb:53:in `initialize'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11385/lib/types/private/abstract/declare.rb:37:in `new'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11385/lib/types/private/abstract/declare.rb:37:in `block in declare_abstract'
/opt/homebrew/Library/Homebrew/brew.rb:90:in `<main>' The exact same code also exists here: brew/Library/Homebrew/formulary.rb Lines 829 to 831 in f1a7d97
|
@reitermarkus Could you take a look at this if you get a chance as you did a bunch of migration work recently? Thanks ❤️ |
Fixed by #17385 |
brew doctor
outputVerification
brew doctor
output" above saysYour system is ready to brew.
and am still able to reproduce my issue.brew update
twice and am still able to reproduce my issue.brew install wget
. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.brew config
outputWhat were you trying to do (and why)?
I am trying to migrate a cask from one tap to another tap. For this, I followed Migrating a Formula to a Tap.
To reproduce, I created two repositories. And migrated a sample cask (a copy of AnyBar).
As per the instructions I
tap_migrations.json
in the old tap pe/homebrew-old-tap@3bb7e45What happened (include all command output)?
Working with the migrated cask returns errors.
There are two warnings instead of one. One for a cask and one for a formula. But there is only a cask.
The error list the same tap twice.
It can only be uninstalled with the full name.
It can only be installed with the full name.
What did you expect to happen?
The migrated cask can be used without errors and without having to specify the full name (=excluding the tap)
Step-by-step reproduction instructions (by running
brew
commands)The text was updated successfully, but these errors were encountered: