Skip to content

Use standard graph construction in PlanIndex - #2504

Merged
dcoutts merged 14 commits into
haskell:masterfrom
edsko:pr/use-standard-graph-construction
May 21, 2015
Merged

dcoutts merged 14 commits into
haskell:masterfrom
edsko:pr/use-standard-graph-construction

Conversation

@edsko

@edsko edsko commented Mar 28, 2015

Copy link
Copy Markdown
Contributor

In the definition of dependencyGraph we constructed the graph manually, rather than using the standard library funciton graphFromEdges. I don't know why we did this, perhaps it predates that function; but it makes the function a bit hard to modify. In particular, once we start introducing fine-grained dependencies (next PR), we will want an edge-labeled graph and having manual graph construction here makes that awkward to do.

This commit lives in a branch forked from #2500, so it looks like a big PR, but actually it's just one commit ac47cbc on top of that branch, which is really quite independent of the changes in that branch; this commit can be reviewed completely in isolation. Submitting as a separate PR so that perhaps @ezyang and/or @23Skidoo can take a quick look at this before I start to take advantage of this new definition in the next PR.

As a sanity check, I ran cabal-install 1.22.0.0 (built with Cabal 1.22.0.0) against a sizeable portion of Hackage (the latest versions of all packages alphebatically up to NXT-DST), and compared against HEAD with this patch in, and found that the install plans were identical in both cases (with similar performance).

Also /cc @kosmikus .

(PS. We could also make the corresponding change in Cabal; I haven't done that yet but we could. It's less important because that graph will not change.)

dcoutts and others added 14 commits March 27, 2015 15:38
It turns out not to be the right solution for general private
dependencies and is just complicated. However we keep qualified
goals, just much simpler. Now dependencies simply inherit the
qualification of their parent goal. This gets us closer to the
intended behaviour for the --independent-goals feature, and for
the simpler case of private dependencies for setup scripts.

When not using --independent-goals, the solver behaves exactly as
before (tested by comparing solver logs for a hard hackage goal).
When using --independent-goals, now every dep of each independent
goal is qualified, so the dependencies are solved completely
independently (which is actually too much still).
POption annotates a package choice with a "linked to" field. This commit
just introduces the datatype and deals with the immediate fallout, it doesn't
actually use the field for anything.
This is implemented as a separate pass so that it can be understood
independently of the rest of the solver.
In particular, in the definition of dependencyInconsistencies.

One slightly annoying thing is that in order to validate an install plan, we
need to know if the goals are to be considered independent. This means we need
to pass an additional Bool to a few functions; to limit the number of functions
where this is necessary, also recorded whether or not goals are independent as
part of the InstallPlan itself.
Since we didn't really have a unit test setup for the solver yet, this
introduces some basic tests for solver, as well as tests for independent goals
specifically.
I don't know why we we constructed this graph manually here rather than calling
`graphFromEdges`; it doesn't really matter except that we will want to change
the structure of this graph somewhat once we have more fine-grained
dependencies, and then the manual construction becomes a bit more painful;
easier to use the standard construction.
@ezyang

ezyang commented Mar 29, 2015

Copy link
Copy Markdown
Contributor

OK, approve of using the library function. Haven't looked at the patches yet.

@ezyang

ezyang commented Mar 29, 2015

Copy link
Copy Markdown
Contributor

It looks like I got confused by the PR. If you just want to submit one patch it would be better to interactively rebase it to the top

@edsko

edsko commented Mar 29, 2015

Copy link
Copy Markdown
Contributor Author

Sorry for the confusion @ezyang , I did try to make that clear in the description.

That doesn't mean that reviewing the other patches wasn't useful, they make up #2500 :) As for why the solved goals plan doesn't work, I have no idea -- that patch is @dcoutts 's, and it was my starting point for implementing linking. FWIW, the design of this is all @dcoutts ' and @kosmikus '.

@dcoutts
dcoutts merged commit ac47cbc into haskell:master May 21, 2015
@edsko
edsko deleted the pr/use-standard-graph-construction branch June 1, 2015 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants