Skip to content

migrator: allow new cellar to exist already#2359

Merged
ilovezfs merged 1 commit into
Homebrew:masterfrom
ilovezfs:migrator-allow-new-cellar-to-exist-already
Mar 23, 2017
Merged

migrator: allow new cellar to exist already#2359
ilovezfs merged 1 commit into
Homebrew:masterfrom
ilovezfs:migrator-allow-new-cellar-to-exist-already

Conversation

@ilovezfs

@ilovezfs ilovezfs commented Mar 17, 2017

Copy link
Copy Markdown
Contributor
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew tests with your changes locally?

Lets us migrate a formula to a name that may have previously been used.

If gnupg 1.x is installed as "gnupg" and gnupg 2.x is installed as
"gnupg2," it's currently not possible to rename gnupg2 -> gnupg, since
the 1.4 keg will already be installed in the gnupg cellar, so in order
to reclaim the name "gnupg" to be used for 2.1, either 1.x must be
manually uninstalled, or the new cellar needs to be allowed to exist
already.

The other choice here would be to continue using the name "gnupg2" for
the 2.1 series, and not reclaim the name "gnupg" from 1.x, which,
incidentally, would open up the possibility of a gnupg -> gnupg@1.4
rename.

@MikeMcQuaid

Copy link
Copy Markdown
Member

CC @vladshablinsky for review and thoughts here.

@ilovezfs in cases like this I'd have thought the best thing would be to create a new gnupg@1 formula and upgrade the existing gnupg formula to be 2.X. Thoughts?

@ilovezfs

Copy link
Copy Markdown
Contributor Author

That's what we're doing.

@MikeMcQuaid

Copy link
Copy Markdown
Member

Ok, I reread and I think I understand now, thanks.

@vladshablinsky

vladshablinsky commented Mar 19, 2017

Copy link
Copy Markdown
Contributor

@ilovezfs do we really need that gnupg2 -> gnupg rename? I think I need some time to revise how all that things with versions work but something doesn't feel right for now. I think we can eventually end up with a rename that will probably break things, but I'm not sure. Will answer as soon as I can.

Also, I hope we'll allow any types of renames and deletions sooner or later so we're able to rename anything to anything if that't name is free at specific moment of time. So probably we need to be careful with complicating renames logic. Now when versioned formulae have arrived it got really more complicated than it used to be.

@ilovezfs

Copy link
Copy Markdown
Contributor Author

@ilovezfs do we really need that gnupg2 -> gnupg rename?

If we want to upgrade all gnupg 1.0.x and 2.0.x users to 2.1.x, then yes.

Note that we also have been sitting on Homebrew/homebrew-core#8334 and not shipping it for three months for the same reason.

@MikeMcQuaid

Copy link
Copy Markdown
Member

do we really need that gnupg2 -> gnupg rename?

I think if there are any known problems we should fix them but if there's none specifically known then it's fine to 🚢 this.

Note that we also have been sitting on Homebrew/homebrew-core#8334 and not shipping it for three months for the same reason.

Not quite right; it's blocked on #1770.

@ilovezfs

ilovezfs commented Mar 19, 2017

Copy link
Copy Markdown
Contributor Author

Not quite right; it's blocked on #1770.

So does 1770 affect the gpg upgrades too then? Not sure I see a difference between the situations really.

@ilovezfs

Copy link
Copy Markdown
Contributor Author

Not quite right; it's blocked on #1770.

Also, let me re-phrase then. Regardless of the disposition of #1770, which I did see existed, this PR also seems to be a requirement for the qt5 -> qt rename to proceed. Whether that had been realized heretofore or not isn't especially relevant.

@MikeMcQuaid

Copy link
Copy Markdown
Member

So does 1770 affect the gpg upgrades too then?

I have no idea. I've still not been able to debug that problem yet.

@ilovezfs

Copy link
Copy Markdown
Contributor Author

@vladshablinsky

vladshablinsky commented Mar 20, 2017

Copy link
Copy Markdown
Contributor

@ilovezfs #1772 (comment)

vladshablinsky
vladshablinsky previously approved these changes Mar 20, 2017

@vladshablinsky vladshablinsky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only concern I have is what if somehow we got a different formula installed under newname cellar? I think it can be possible if we allow multiple renames.

@ilovezfs

Copy link
Copy Markdown
Contributor Author

@vladshablinsky I think it's link_newname's decision which of the kegs to link.

@vladshablinsky

vladshablinsky commented Mar 20, 2017

Copy link
Copy Markdown
Contributor

I think it's link_newname's decision which of the kegs to link.

@ilovezfs Also, let's suppose we have a non-core tap formula installed under newname and oldname -> newname core rename. What happens if we migrate oldname to newname allowing newname to exist while performing migration? Well, we'll have two different formulae sharing same name under the same Cellar. I can remember that when formula renames were implemented we only supposed that only one formula can be installed into one cellar subdirectory. So we at least need an extra check that installed formula is from the same tap as the formula we're trying to migrate. Thoughts?

@vladshablinsky vladshablinsky dismissed their stale review March 21, 2017 00:02

Check existing newname to be from the same tap as oldname renamed to newname

@ilovezfs

Copy link
Copy Markdown
Contributor Author

The tap migrations from homebrew/versions to homebrew/core all had a rename to the @ naming scheme, so I'm not sure we can require the source and destination taps to be the same.

@vladshablinsky

vladshablinsky commented Mar 21, 2017

Copy link
Copy Markdown
Contributor

The tap migrations from homebrew/versions to homebrew/core all had a rename to the @ naming scheme, so I'm not sure we can require the source and destination taps to be the same.

I might have confused you, what I meant were formula renames and migrations of renamed formula.

Let's migrate oldname2 from homebrew/version to homebrew/core, then we have
oldname2 installed and its tap is homebrew/core due to migration being performed.
Now we want to rename it to oldname@2 while Cellar/oldname@2 already exists. No problem, but if we want to perform a migration for this rename we need to be sure Cellar/oldname@2's kegs are homebrew/core's and not from some other taps that also provides oldname@2.
Am I wrong?

@ilovezfs

Copy link
Copy Markdown
Contributor Author

Yes I think that makes sense. Even though there never was a formula named gcc48 in homebrew/core, I think a lookup of the tap of a not-yet-renamed-to-gcc@4.8 gcc48 keg originally installed from homebrew/versions would return homebrew/core.

@ilovezfs

ilovezfs commented Mar 22, 2017

Copy link
Copy Markdown
Contributor Author

@vladshablinsky Yes, you are right. It looks like the from_same_taps? test doesn't consider the tap of a pre-existing new-name cellar. I'm wondering if we should tolerate that situation and defer the migration until the conflicting cellar goes away, or print a manual tap migration error of some kind, or something else.

@MikeMcQuaid

Copy link
Copy Markdown
Member

defer the migration until the conflicting cellar goes away

When would that happen?

@vladshablinsky

vladshablinsky commented Mar 22, 2017

Copy link
Copy Markdown
Contributor

defer the migration until the conflicting cellar goes away

When would that happen?

Probably when user eventually uninstalls it.

it looks like the from_same_taps? test doesn't consider the tap of a pre-existing new-name cellar.

@ilovezfs even though what you say is true, please notice that this is not the case we're discussing.

from_same_taps? checks if oldname installed is from the same tap as Formula for oldname however the case we're discussing is if Formula for newname (for which we migrate its old Cellar) is from the same tap as newname installed.

UPD: probably you meant same things I said, though.

@MikeMcQuaid

Copy link
Copy Markdown
Member

Probably when user eventually uninstalls it.

I'm wondering if we should uninstall it for the user in a case like this (or at least prompt them to do so before migration?).

@vladshablinsky

vladshablinsky commented Mar 23, 2017

Copy link
Copy Markdown
Contributor

I'm wondering if we should uninstall it for the user in a case like this (or at least prompt them to do so before migration?).

IMO, migration must be impossible unless --force given. With force we should either uninstall it and perform migration or merge several formulae's kegs under Cellar/newname.

👍 for prompting.

Lets us migrate a formula to a name that may have previously been used.

If gnupg 1.x is installed as "gnupg" and gnupg 2.x is installed as
"gnupg2," it's currently not possible to rename gnupg2 -> gnupg, since
the 1.4 keg will already be installed in the "gnupg" Cellar, so in order
to reclaim the name "gnupg" to be used for 2.1, either 1.x must be
manually uninstalled, or the new cellar needs to be allowed to exist
already.
@ilovezfs ilovezfs force-pushed the migrator-allow-new-cellar-to-exist-already branch from 9f9a2de to 845d083 Compare March 23, 2017 11:10
@ilovezfs

Copy link
Copy Markdown
Contributor Author

PR refreshed.

@ilovezfs ilovezfs merged commit 54abadb into Homebrew:master Mar 23, 2017
@Homebrew Homebrew locked and limited conversation to collaborators May 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants