This project is mirrored from https://github.com/haskell/Cabal. Pull mirroring updated .
  1. 24 Sep, 2016 3 commits
    • Duncan Coutts's avatar
      Start using new InstallPlan.Installed state · 0de4177c
      Duncan Coutts authored
      Change improvement and --dry-run phases to use Installed state rather
      than the PreExisting state. This means that PreExisting is now only used
      for installed packages from the global db, and never for installed
      packages from the store.
      0de4177c
    • Duncan Coutts's avatar
      Update encodePlanAsJson for Installed package state · 9d6205e6
      Duncan Coutts authored
      The change in how we use the PreExisting vs Installed states means that
      we'll now have full details for all packages, rather than installed
      ones having only the subset of info available from the
      InstalledPackageInfo. So the 'type' field now can take the values
      "pre-existing", "configured" or "installed".
      
      Also do a little bit of tidying up.
      9d6205e6
    • Duncan Coutts's avatar
      Add an Installed state to InstallPlan packages · 435725ef
      Duncan Coutts authored
      This patch just adds the state without yet using it. That'll follow in
      subsequent patches.
      
      So why add an Installed state? Didn't we just remove the Installed,
      Processing and Failed states? Those states were used when we followed
      the approach of updating the InstallPlan as a build progressed (whereas
      we now do traversals without altering the InstallPlan).
      
      The idea of adding an Installed state now is that we can more usefully
      represent the state of the plan when we "improve" the plan with packages
      from the store or when we update the plan having checked if inplace
      packages are up to date. Currently in these two places we replace
      Configured source packages with PreExisting packages. There's a couple
      problems with this. Firstly the PreExisting state only contains an
      InstalledPackageInfo which means we loose information compared to all
      the detail in the Configured source package. This is relevant for things
      like plan.json output or other features that want to know the status of
      a project. Secondly we have to fake things for executables since they
      are not properly represented by InstalledPackageInfo.
      435725ef
  2. 23 Sep, 2016 3 commits
    • Duncan Coutts's avatar
      New Rebuild monad utils and use in ProjectPlanning · c7d55c3c
      Duncan Coutts authored
      Monitored variants of createDirectory and getDirectoryContents.
      Define thee wrappers in the RebuildMonad module so we have fewer
      open-coded tricky monitorFiles calls.
      
      In particular replace a glob monitor on the content of the store with a
      monitor on the store directory itself. This is valid based on the
      behaviour of directory mtimes, which is specified by posix and we have a
      sanity check for it in the unit tests.
      c7d55c3c
    • Duncan Coutts's avatar
      Add a sanity unit test for dir mtime behaviour · 5a880c07
      Duncan Coutts authored
      We rely on posix & ntfs directory mtime semantics, which is that a dir
      mtime changes if the set of names in the dir changes.
      
      We rely on this both for the meaning of monitorDirectory but also we
      rely on it as an optimisation within the glob checking code.
      
      So this test should always pass on posix-compliant file systems.
      Apparently it may not hold on FAT file systems.
      5a880c07
    • Duncan Coutts's avatar
      Fix the FileMonitor to keep multiple monitors for the same file · 1f9c6674
      Duncan Coutts authored
      Rather than doing any fancy merging of monitor kinds, we just do the
      simple thing and keep each monitor spec separately, so each one will be
      checked when the file system is probed. Internally, rather than keeping
      a Map indexed by FilePath we just keep a list.
      
      Add a regression test for this.
      1f9c6674
  3. 22 Sep, 2016 5 commits
  4. 21 Sep, 2016 6 commits
    • Mikhail Glushenkov's avatar
      Merge pull request #3879 from ezyang/pr/no-legacy-exe-solving · c18974b9
      Mikhail Glushenkov authored
      Don't solve for executables in legacy code path.
      c18974b9
    • Mikhail Glushenkov's avatar
      Merge pull request #3874 from 23Skidoo/user-config-init-remote-repo · 99c7c221
      Mikhail Glushenkov authored
      'user-config init': Print the default 'remote-repo' correctly.
      99c7c221
    • Edward Z. Yang's avatar
      Don't solve for executables in legacy code path. · 9e99b3f4
      Edward Z. Yang authored
      
      
      There is a bug in `cabal configure`'s invocation of the solver in
      Distribution/Client/Configure.hs:
      
          standardInstallPolicy
              installedPkgIndex
              (SourcePackageDb mempty packagePrefs)
              [SpecificSourcePackage localPkg]
      
      We can see that the solver is given an EMPTY source package database.
      This is because we assume that everything you need from cabal configure
      is taken from the installed package index.
      
      But this is NOT true for executables, which never have an entry in the
      installed package index. So we SHOULD NOT solve for
      executables in the legacy codepath, since there isn't anything useful we
      can do with the info anyway.  This gets toggled using a new solver
      parameter SolveExecutables.
      
      I didn't bother with a test because this will be obsoleted by
      nix-local-build.
      
      Fixes #3875
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      9e99b3f4
    • Edward Z. Yang's avatar
      Merge pull request #3873 from ezyang/pr/nix-local-build-prof · da71f1c8
      Edward Z. Yang authored
      Never use --enable-profiling when invoking Setup.
      da71f1c8
    • Herbert Valerio Riedel's avatar
      Merge pull request #3878 from hvr/pr/extended-01-index-cache · b1dd85f0
      Herbert Valerio Riedel authored
      - Extend `01-index.cache` with timestamps in preparation of `--index-state`
      - Use 'Binary' encoding for `01-index.cache`
      b1dd85f0
    • Herbert Valerio Riedel's avatar
      Refactor & optimise construction of index cache · db1ef505
      Herbert Valerio Riedel authored
      This commit was motivated by @dcoutts' code-review comment:
      
      > Originally with using the `Sec.directoryEntries` that gave us only the
      > final version of each file, ie not all intermediate revisions. And
      > previously our strategy was to go through the final versions of each
      > file, in file order, and lookup just the ones we're interested in (which
      > in practice is 99% of them).
      >
      > Now for the new cache we want to go through all revisions, which means
      > all entries in file order. So instead of using `Sec.directoryEntries`
      > which reads from the tar index, we go straight for `Sec.directoryFirst`
      > which is block 0 and iterate through, using `lazyUnfold`.
      >
      > But we can now significantly simplify this and do it more
      > efficiently. Note that `indexLookupEntry` and `indexLookupFileEntry` are
      > expensive operations that seek in the tar file and read the tar entry at
      > that point. So lets do it exactly once per entry. The current code does
      > it once in the `lazyUnfold indexLookupEntry` and then again in `mk`. But
      > the old `mk` only did that because it had not previously looked up the
      > entry.
      db1ef505
  5. 20 Sep, 2016 14 commits
  6. 19 Sep, 2016 9 commits
    • Edward Z. Yang's avatar
      Never use --enable-profiling when invoking Setup. · bf3d3e68
      Edward Z. Yang authored
      
      
      In Cabal 1.22.5.0, the semantics of
      --disable-profiling/--enable-profiling depend on ordering (because there
      is a hack that operates by looking at the current flag assignment and
      doing something). In particular, if I specify --enable-library-profiling
      --disable-profiling, I end up with library profiling DISABLED.
      
      The fix is that we NEVER pass --enable-profiling or --disable-profiling
      to Cabal. At the moment, and according to my historical analysis, Cabal
      ONLY uses configProf to affect the effective library/executable
      profiling, which means that anything we do with --enable-profiling, we
      can do using the library/executable profiling individually. Since these
      are always flags for the versions of Cabal library we support, we will
      get order invariance. Historical versions have varied on whether or not
      setting executable profiling implies library profiling, but if we set
      both explicitly this change in behavior doesn't matter.
      
      This patch is difficult to test because the bad profiling flags
      can't be induced on an inplace build.  I tested by hand by building
      a package that depended on 'distributive' by hand.
      
      Fixes #3790.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      bf3d3e68
    • Duncan Coutts's avatar
      4dc5b1f2
    • Duncan Coutts's avatar
      Refactor implementation of InstallPlan.installed · 66ed37a2
      Duncan Coutts authored
      All the use sites (currently only two but soon to be three) use
      InstallPlan.installed to do a bulk change of states, differing only in
      the filter condition. So it simplifies things and shares more code if
      we make the main one be the bulk version. The InstallPlan.remove already
      works similarly.
      66ed37a2
    • Duncan Coutts's avatar
      Simplify plan improvement, avoid reading store ghc-pkg db · 5584569c
      Duncan Coutts authored
      Install plan improvement is the process of replacing configured source
      packages with installed instances from the store. Originally we did this
      by reading the ghc-pkg db to get the InstalledPackageInfo for all the
      packages in the store. We had to do that because when we replaced
      configured source packages by installed instances we used the
      PreExisting constructor which requires an InstalledPackageInfo, which we
      get from the installed package db. But now that we no longer use
      PreExisting for packages from the store we also no longer need the
      InstalledPackageInfo. All we need is a set of UnitIds. Also, once
      support for depending on executables was added then we needed a way to
      do plan improvement for executable packages/components. We did this by
      the simple approach of grabbing the dir listing for the store and using
      that as a set of UnitIds.
      
      So this patch extends the approach we use for executables and uses it
      for all packages. This means we no longer load the package db for the
      store. Note that we still have to create the package db in the store.
      
      This also relates to the locking protocol in the store. The goal for the
      store is to be able to access and update it concurrently. The locking
      protocol will include checking membership by checking if the directory
      entry for the package is present. So this patch gets us to the right
      point for the reading side, leaving the writing side to do.
      5584569c
    • Duncan Coutts's avatar
      Clarify the differences with the GetOpt from base · 7399850e
      Duncan Coutts authored
      And invite anyone to have a go at merging. Also re-export the types from
      the GetOpt from base rather than re-defining locally. In particular this
      means we gain a few instances.
      
      The changes wrt base GetOpt are:
      
      One change to allow us to treat "cabal --flag command" as
      "cabal command --flag" e.g. "cabal -v configure" to mean
      "cabal configure -v" for flags that are not recognised as global flags,
      pass them on to the sub-command. See the difference in 'shortOpt'.
      
      Line wrapping in the 'usageInfo' output, plus a more compact rendering
      of short options, and slightly less padding.
      7399850e
    • Edward Z. Yang's avatar
    • Edward Z. Yang's avatar
      Merge pull request #3828 from ezyang/pr/output-profiling · 56cff2d2
      Edward Z. Yang authored
      Print profiling status when displaying install plan.
      56cff2d2
    • Edward Z. Yang's avatar
      Merge pull request #3859 from ezyang/pr/refactor-enabled-spec · 757e84fd
      Edward Z. Yang authored
      Use enabledBuildInfos rather than allBuildInfo
      757e84fd
    • Edward Z. Yang's avatar
      Print that we are building all due to Custom setup. · 512648fd
      Edward Z. Yang authored
      
      
      Previously the output was:
      
          Building profunctors-5.2 lib...
          Building semigroupoids-5.1...
      
      Now it is:
      
          Building profunctors-5.2 (lib)...
          Building semigroupoids-5.1 (all, due to Custom setup)...
      
      Fixes #3808.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      512648fd