Skip to content
This repository has been archived by the owner on Feb 3, 2018. It is now read-only.

GPS needs to respect flat packages #181

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

krisnova
Copy link
Contributor

@krisnova krisnova commented Mar 7, 2017

Right now dep was trying to find versions for a bmi if it was a root level package.. This PR bypasses the BMI in this case so we don't fail trying to check on ourselves

Closes golang/dep#270

Also fixes indentation in tracer

@krisnova krisnova changed the title Dep needs to respect flat packages GPS needs to respect flat packages Mar 7, 2017
@krisnova
Copy link
Contributor Author

krisnova commented Mar 7, 2017

@sdboyer

I am going to play with the tests in a little, but wanted to push this up so you could see where I was at.. Thoughts? I suppose this is a work in progress PR 😛

@sdboyer
Copy link
Owner

sdboyer commented Mar 8, 2017

(I'm very excited that someone else is poking at the actual guts of the algorithm 🎉 🎉 🎊 !!)

Hmm...let's start with a definition for "flat package" - do you mean a project containing only the single package at the project root?

@krisnova
Copy link
Contributor Author

krisnova commented Mar 8, 2017

Ah yes, so please forgive my vernacular as I am still learning all of your GPS terms.. but I will at least be consistent and will learn quickly.

So to me a flat package is a Go package that contains no other packages inside of it. So yes, a single package, at the root, no other nested packages. With of course typewriter being a great example.

@sdboyer
Copy link
Owner

sdboyer commented Mar 8, 2017

oh no worries, of course, there's a lot of verbiage in here. bimodalIdentifier itself isn't exactly great - though i think the crowning glory of unhelpfully stupid names is completeDep :P

if !bmi.fromRoot {
// Here we have a flat package, and we don't need to check any dependencies
// for it. There is nothing to check here, so remove it.
s.unsel.remove(bmi)
Copy link
Owner

Choose a reason for hiding this comment

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

This isn't doing what you want it to :)

First, if the bmi does represent a "flat package", then that doesn't guarantee anything about whether or not the package has external imports. This point in the algorithm is along the "unselected" path (!is), meaning that it's the first time we're seeing a bmi for this particular ProjectRoot. We have to follow the existing logic, because that's what will look at all of its imports, pull in its manifest, and do the satisfiability checks.

If we were on the other branch - is - then this sort of an escape hatch would make sense. We don't need it, though, because...

Hmm. Well, I'd say that it's because, in selectAtom(), we only add bmis to the unselected queue if the package set we need is unvisited. But the check there (https://github.com/sdboyer/gps/blob/master/solver.go#L1113-L1124) doesn't seem like quite what I'd expect. Let me refresh myself on it...

Copy link
Owner

Choose a reason for hiding this comment

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

Oh wait, no, it's right. It's checking rpm[pkg] == 1 because the map that's returned tells us the number of things importing on a particular pkg in the current graph.

So, anyway. Because we have that check there, it means that we only add a bmi to the unselected queue if it would add to the package set required from a given project. If there's only one package in a project, and the project's already been pulled in, then that single package has necessarily already been selected, meaning that no new bmi can enter the unselected queue...so the case you're guarding against up in the main solve loop can't occur.

I hope it was vaguely possible to follow that :)

@sdboyer
Copy link
Owner

sdboyer commented Apr 13, 2017

I can't remember if this was still needed, or if the surface problem in dep was fixed by something else...

@krisnova
Copy link
Contributor Author

krisnova commented Apr 14, 2017

Thanks for the ping @sdboyer - I completely forgot about this PR...

I am not sure either.. looks like the issue is still open - I will ping you in slack and we can figure it out

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.

dep init failed within another package and the error is unclear
2 participants