Skip to content

Refactor of PackageIndex and InstallPlan #3525

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

Closed
wants to merge 30 commits into from

Conversation

ezyang
Copy link
Contributor

@ezyang ezyang commented Jul 6, 2016

The point of this PR is to (1) split InstallPlan into two separate, decoupled data types, InstallPlan (for installing things) and SolverInstallPlan (the output of the solver, which we run consistency checks on) and (2) switch PackageIndex, InstallPlan, and SolverInstallPlan to use the new Graph data type introduced in #3523. Yes there are more lines of code, but they are less coupled and can support future evolution.

CC @dcoutts, @23Skidoo

@23Skidoo
Copy link
Member

23Skidoo commented Jul 11, 2016

Haven't reviewed in detail, but looks good so far.

ezyang added 5 commits July 19, 2016 10:41
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
This is a preparatory commit for giving SolverInstallPlan
its own type.  We first start by moving the type synonyms
for SolverInstallPlan into their own module, and update
module references to point to them.

TODO: Maybe this module should go in the Solver hierarchy
rather than the client hierarchy?

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Now we copy-paste the contents of InstallPlan into SolverInstallPlan,
thus giving it a separate set of types.  For now, we don't do anything
else, e.g., remove unnecessary functions or specialize.

We need a new function 'fromSolverInstallPlan' akin to
'mapPreservingGraph' which can take an InstallPlan from the
old solver install plan to the new one.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Now we monomorphize SolverInstallPlan so that its data structures
are non-parametric, and delete functions that are not needed.
Specifically:

    - GenericPlanPackage -> SolverPlanPackage, lose the
      type parameters, lose the Processing/Installed/Failed
      constructors (this makes some partial functions total! Yay!)

    - GenericInstallPlan -> SolverInstallPlan

    - PlanProblem -> SolverPlanProblem

    - Deleted ready, processing, completed, failed,
      preexisting

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Critically, InstallPlan no longer levies solver-style sanity checks
(e.g., whether or not the packages are consistent); it's assumed
the SolverInstallPlan checks this, and that processing an InstallPlan
is unlikely to cause problems here.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
@ezyang
Copy link
Contributor Author

ezyang commented Jul 19, 2016

I realized this changeset has one BC-breaking change: the PackageIndex type constructor got removed. I suppose there isn't any good reason why we should remove it, so I suppose I should bring it back.

ezyang added 9 commits July 19, 2016 15:45
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
cabal-install still broken, but less so!

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
This is a bit more accurate and doesn't require any
fake UnitIds anymore. (But to-do: axe fake UnitIds!)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
The main point is solver packages don't HasUnitId; now that the
solver install plan is separate from install plan the knock-on
changes are quite localized and pleasing.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
See also haskell#3528.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
@ezyang
Copy link
Contributor Author

ezyang commented Jul 20, 2016

Ugh, Mac OS X GHC 8.0 build is timing out.

@ezyang ezyang force-pushed the pr/plan-refactor branch 3 times, most recently from b12e07d to 29f3c02 Compare July 20, 2016 17:41
ezyang added 6 commits July 20, 2016 17:55
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Lots of changes:

    - When possible, we use the container infrastructure (sudo: false)
      rather than Google Compute Engine infrastructure (sudo: required).
      Unfortunately, we can't use GCE for the Linux builds, where
      reduced RAM available hoses are GHC build.

    - Switched from using ./Setup and old-style cabal to new-build.
      There are numerous great benefits but the best is that
      .cabal/store can be cached on Travis, leading to huge speedups
      on the build.  Downside is we need to string-and-ceiling-wax
      support for test/haddock/etc.

    - I stopped bootstrapping on every build we do; instead there
      is a separate bootstrap build we do to make sure that that
      is working.  This also speeds up the basic builds since
      we are not building Cabal/cabal-install multiple times.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
@ezyang ezyang force-pushed the pr/plan-refactor branch from 1b3576f to 1225293 Compare July 21, 2016 01:08
ezyang added 7 commits July 20, 2016 18:37
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added 2 commits July 20, 2016 21:42
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
@ezyang
Copy link
Contributor Author

ezyang commented Jul 21, 2016

Merged.

@ezyang ezyang closed this Jul 21, 2016
@phadej
Copy link
Collaborator

phadej commented Jul 21, 2016

It might be only me, but I'd realy like a bit more tidied up history.

- Swizzle
- travis fixes
- Minor fixes.
- I think this should fix all the bugs
- Try this
- Fix up
- Hack
- Hmmmm

I'm very sorry, but that doesn't look very professional. Consider using --fixup: http://fle.github.io/git-tip-keep-your-branch-clean-with-fixup-and-autosquash.html

@ezyang
Copy link
Contributor Author

ezyang commented Jul 21, 2016

Ugh, this is the "GitHub is bad at noticing what you actually pushed to master" bug (aka I forgot to push to the topic branch after rebasing.) If you look at the integrated history in master these commits are all gone. This branch was somewhat of a strange outlier because I was debugging Travis issues and needed to keep pushing to CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants