Skip to content

Skip upgrade of pinned dependency if it's outdated#864

Merged
MikeMcQuaid merged 5 commits intoHomebrew:masterfrom
vladshablinsky:skip-upgrade
Sep 8, 2016
Merged

Skip upgrade of pinned dependency if it's outdated#864
MikeMcQuaid merged 5 commits intoHomebrew:masterfrom
vladshablinsky:skip-upgrade

Conversation

@vladshablinsky
Copy link
Contributor

@vladshablinsky vladshablinsky commented Sep 3, 2016

  • 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?

Description:

A fix for #831 was introduced in #846 but the behaviour of install process should have been reconsidered anyway. This PR implements the ideas being discussed in #846.

Idea: Don't upgrade dependency of formula if this dependency is pinned while installing the formula.

Let's suppose A depends on B and then do the following:
      * install B with version 0.1.
      * pin B with version 0.1.
      * bump new version of B, e.g. 1.0
      * install A

    B shouldn't get upgraded while we installing A if it's pinned and
    installed with the proper options. This commit implements such
    behaviour.

TODO?

I'm not sure about two things here:

  1. Do I need to add a test for the change. And if we need a test, then where should I put it. Possible variants are test_integration_cmds, test_formula_installer or test_dependency?
  2. Do we need to repin formula B if it's pinned and installation of A that depends on B requires different options from ones being used in pinned keg of B, so we eventually upgrade/reinstall B, but don't repin it.

CC @MikeMcQuaid @ilovezfs

@vladshablinsky vladshablinsky changed the title [RFC] Skip upgrade of pinned dependency if it's outdated Skip upgrade of pinned dependency if it's outdated Sep 3, 2016
@MikeMcQuaid
Copy link
Member

Do I need to add a test for the change. And if we need a test, then where should I put it. Possible variants are test_integration_cmds, test_formula_installer or test_dependency?

Ideally yes. Add it to test_formula_installer or test_dependency, whichever you think is best 👍

Do we need to repin formula B if it's pinned and installation of A that depends on B requires different options from ones being used in pinned keg of B, so we eventually upgrade/reinstall B, but don't repin it.

I think if it's pinned we should probably just refuse to do anything with it (reinstall or upgrade) and require the user to manually uninstall/unpin/upgrade to resolve it.

Copy link
Member

Choose a reason for hiding this comment

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

This is a bit different to what I think we want. Instead of considering this satisfied it should be considered unsatisfied, refuse to upgrade and print out a message telling the user to unpin.

Copy link
Contributor Author

@vladshablinsky vladshablinsky Sep 5, 2016

Choose a reason for hiding this comment

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

Ah, I see, will change it this way, then and ask for the comments later.

@vladshablinsky vladshablinsky force-pushed the skip-upgrade branch 2 times, most recently from cd985ba to 682e902 Compare September 5, 2016 21:27
@vladshablinsky
Copy link
Contributor Author

@MikeMcQuaid how does the current implementation look?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: remove.

@vladshablinsky vladshablinsky added the in progress Maintainers are working on this label Sep 6, 2016
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if it's worth making this an onoe and using next so it'll print a warning for all of them rather than just the first?

@MikeMcQuaid
Copy link
Member

A few small comments but I like the approach 👍

@vladshablinsky
Copy link
Contributor Author

vladshablinsky commented Sep 7, 2016

Changed the logic a bit, as we don't need to fail if dependency is statisfied? even if it's pinned.

@ilovezfs
Copy link
Contributor

ilovezfs commented Sep 8, 2016

We don't? Since most things go through opt now I think we do indeed need to fail …

@vladshablinsky
Copy link
Contributor Author

vladshablinsky commented Sep 8, 2016

@ilovezfs if a pinned dependency is satisfied doesn't it mean that if we unpin it then it won't be reinstalled anyway?

https://github.com/Homebrew/brew/blob/master/Library/Homebrew/formula_installer.rb#L385-L386

@MikeMcQuaid MikeMcQuaid merged commit f37d004 into Homebrew:master Sep 8, 2016
@BrewTestBot BrewTestBot removed the in progress Maintainers are working on this label Sep 8, 2016
@MikeMcQuaid
Copy link
Member

Thanks again @vladshablinsky!

@vladshablinsky vladshablinsky deleted the skip-upgrade branch September 9, 2016 00:34
@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.

4 participants