This project is mirrored from https://github.com/haskell/Cabal. Pull mirroring updated .
  1. 06 Oct, 2016 1 commit
    • Edward Z. Yang's avatar
      Introduce the new representation of UnitId · d7bd9078
      Edward Z. Yang authored
      'SimpleUnitId' constructor renamed to 'UnitId', and augmented
      with a new field 'Maybe String' recording a hash that uniquely
      identifies an instantiated unit of the library 'ComponentId'.
      'UnitId' can't be used to represent partially instantiated
      unit identifiers; see Distribution.Backpack for how we handle that.
      
      Previous uses of 'SimpleUnitId' should now use 'newSimpleUnitId'.
      'unitIdComponentId' folded into a record selector for 'ComponentId'.
      d7bd9078
  2. 27 Sep, 2016 1 commit
    • Herbert Valerio Riedel's avatar
      Make `PackageName` type opaque (#3896) · dabd9d98
      Herbert Valerio Riedel authored
      When looking at heap-profiles of `cabal-install`, the `(:)` constructor
      stands out as the most-allocated constructor on the heap.
      
      Having to handle 10k+ package names contributes to the allocation
      numbers, especially on 64bit archs where ASCII `String`s have a 24 byte
      per character footprint.
      
      This commit is a preparatory commit to pave the way for changing
      `PackageName`'s internal representation to something like
      `ShortByteString` (which is essentially a thin wrapper around primitive
      `ByteArray#`s which themselves have have an overhead of 2 words + one
      byte per ASCII character rounded up to nearest word) which would allow
      to reduce the memory footprint by a full order of magnitude, as well as
      reduce pointer chasing and GC overhead.
      dabd9d98
  3. 21 Aug, 2016 2 commits
  4. 26 Jul, 2016 1 commit
  5. 05 Apr, 2016 1 commit
  6. 31 Mar, 2016 2 commits
  7. 23 Feb, 2016 1 commit
  8. 30 Jan, 2016 1 commit
  9. 25 Jan, 2016 1 commit
  10. 23 Jan, 2016 1 commit
  11. 16 Jan, 2016 2 commits
    • Edward Z. Yang's avatar
      Distinguish between component ID and unit ID. · ef41f44e
      Edward Z. Yang authored
      GHC 8.0 is switching the state sponsored way to specify
      linker names from -this-package-key to -this-unit-id, so
      it behooves us to use the right one.  But it didn't make
      much sense to pass ComponentIds to a flag named UnitId,
      so I went ahead and finished a (planned) refactoring
      to distinguish ComponentIds from UnitIds.
      
      At the moment, there is NO difference between a ComponentId
      and a UnitId; they are identical.  But semantically, a
      component ID records what sources/flags we chose (giving us enough
      information to typecheck a package), whereas a unit ID records
      the component ID as well as how holes were instantiated
      (giving us enough information to build it.)  MOST code
      in the Cabal library wants unit IDs, but there are a few
      places (macros and configuration) where we really do
      want a component ID.
      
      Some other refactorings that got caught up in here:
      
          - Changed the type of componentCompatPackageKey to String, reflecting the
            fact that it's not truly a UnitId or ComponentId.
      
          - Changed the behavior of CURRENT_PACKAGE_KEY to unconditionally
            give the compatibility package key, which is actually what you
            want if you're using it for the template Haskell trick.  I also
            added a CURRENT_COMPONENT_ID macro for the actual component ID,
            which is something that the Cabal test-suite will find useful.
      
          - Added the correct feature test for GHC 8.0 ("Uses unit IDs").
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      ef41f44e
    • Edward Z. Yang's avatar
  12. 08 Jan, 2016 1 commit
    • Edward Z. Yang's avatar
      Remove same-package import lists, fixes #2835. · 639cd007
      Edward Z. Yang authored
      Instead of qualifying, in some cases I just added an extra
      'hiding' pragma to squelch errors.  Common conflicts
      (just grep for hiding):
      
          - Flag
              - Distribution.Simple.Compiler
              - Distribution.PackageDescription
              - Distribution.Simple.Setup
          - installedComponentId
              - Distribution.Package
              - Distribution.InstalledPackageInfo
          - doesFileExist
              - Distribution.PackageDescription.Check
          - instantiatedWith
              - I renamed the field in InstalledPackageInfo.  But
                it's probably going away with Backpack bits; I
                migth just excise it soon.
          - absoluteInstallDirs and substPathTemplate
              - Distribution.Simple.InstallDirs
              - Distribution.Simple.LocalBuildInfo
      
      I fixed some shadowing errors by renaming local variables in some cases.
      Common shadowings (we should perhaps consider not using these as
      method/field names):
      
          - freeVars
          - components
          - noVersion
          - verbosity
          - get
          - description
          - name
      
      Some data structures were moved around (IPIConvert and ABIHash)
      to make it easier to handle import lists.
      
      Some functions in Utils could be turned into reexports of standard
      library functions.
      
      No explicit imports were removed from non-Cabal imports.  These
      imports help maintain warning cleanliness across versions of GHC,
      so I don't recommend removing them.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      639cd007
  13. 17 Dec, 2015 1 commit
    • Herbert Valerio Riedel's avatar
      Define semigroup instances · f6428740
      Herbert Valerio Riedel authored
      This makes the code `-Wcompat`-clean with GHC 8.0
      
      Due to the amount of `Monoid` instances, a compat-layer is used
      rather than flooding the code-base with CPP conditionals.
      f6428740
  14. 16 Dec, 2015 1 commit
  15. 01 Nov, 2015 1 commit
  16. 09 Oct, 2015 1 commit
    • Edward Z. Yang's avatar
      Implement ComponentId, replacing PackageKey and InstalledPackageId. · b083151f
      Edward Z. Yang authored
      Today in Cabal, when you build and install a package, it is
      uniquely identified using an InstalledPackageId which is computed
      using the ABI hash of the library that was installed.  There
      are few problems with doing it this way:
      
          - In a Nix-like world, we should instead uniquely identify
            build products by some sort of hash on the inputs to the
            compilation (source files, dependencies, flags).  The ABI
            hash doesn't capture any of this!
      
          - An InstalledPackageId suggests that we can uniquely identify
            build products by hashing the source and dependencies of
            a package as a whole.  But Cabal packages contain many components:
            a library, test suite, executables, etc.  Currently, when
            we say InstalledPackageId, we are really just talking about
            the dependencies of the library; however, this is unacceptable
            if a Cabal package can install multiple libraries; we need
            different identifiers for each.
      
          - We've also needed to compute another ID, which we've called
            the "package key", which is to be used for linker symbols
            and type equality GHC-side.  It is confusing what the distinction
            between this ID and InstalledPackageIds are; the main reason
            we needed another ID was because the package key was needed
            prior to compilation, whereas the ABI hash was only available
            afterwards.
      
      This patch replaces InstalledPackageId and PackageKey with a
      new identifier called ComponentId, which has the following
      properties:
      
          - It is computed per-component, and consists of a package
            name, package version, hash of the ComponentIds
            of the dependencies it is built against, and the name
            of the component.  For example, "foo-0.1-abcdef" continues
            to identify the library of package foo-0.1, but
            "foo-0.1-123455-foo.exe" would identify the executable,
            and "foo-0.1-abcdef-bar" would identify a private sub-library
            named bar.
      
          - It is passed to GHC to be used for linker symbols and
            type equality.  So as far as GHC is concerned, this is
            the end-all be-all identifier.
      
          - Cabal the library has a simple, default routine for computing
            a ComponentId which DOES NOT hash source code;
            in a later patch Duncan is working on, cabal-install can
            specify a more detailed ComponentId for a package
            to be built with.
      
      Here are some knock-on effects:
      
          - 'id' is a ComponentId
      
          - 'depends' is now a list of ComponentIds
      
          - New 'abi' field to record what the ABI of a unit is (as it is no longer
            computed by looking at the output of ghc --abi-hash).
      
          - The 'HasInstalledPackageId' typeclass is renamed to
            'HasComponentId'.
      
          - GHC 7.10 has explicit compatibility handling with
            a 'compatPackageKey' (an 'ComponentId') which is
            in a compatible format.  The value of this is read out
            from the 'key' field.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      b083151f
  17. 26 Mar, 2015 3 commits
  18. 21 Mar, 2015 1 commit
    • Edsko de Vries's avatar
      Split the PackageInstalled class · 2ea3dde1
      Edsko de Vries authored
      Introduce a new superclass HasInstalledPackageId:
      
          class Package pkg => HasInstalledPackageId pkg where
            installedPackageId :: pkg -> InstalledPackageId
      
          class HasInstalledPackageId pkg => PackageInstalled pkg where
            installedDepends :: pkg -> [InstalledPackageId]
      
      Most functions that deal with the package index now just require
      HasInstalledPackageId; only the functions that actually require the
      dependencies still rely on PackageInstalled.
      
      The point is that a ConfiguredPackage/ReadyPackage/PlanPackage can reasonably
      be made an instance of HasInstalledPackageId, but not of PackageInstalled; that
      will be the topic of the next, much larger, pull request.
      2ea3dde1
  19. 06 Mar, 2015 2 commits
  20. 08 Jan, 2015 1 commit
    • ttuegel's avatar
      D.Compat.Binary: backport binary generics to binary-0.5 · c650e347
      ttuegel authored
      GHC generics are used to derive binary instances for types appearing
      in the persistent build config, which requires GHC >= 7.2 and
      binary >= 0.7. Unfortunately, GHC < 7.8 ships with binary == 0.5.*.
      The missing module is Data.Binary.Generics, which we have copied from
      binary-0.7.2.3 to Distribution.Compat.Binary.Generics. To provide
      generic implementations for the Binary class, we also have to provide
      our own implementation, which is copied from binary-0.7.2.3 to
      Distribution.Compat.Binary.Class. The interface required by Cabal is
      exported from Distribution.Compat.Binary. This is only done if
      bootstrapping Cabal with GHC < 7.8 or if binary >= 0.7 is not available,
      otherwise Distribution.Compat.Binary simply re-exports Data.Binary.
      c650e347
  21. 04 Nov, 2014 1 commit
    • Edward Z. Yang's avatar
      Consolidate exposed-modules and reexported-modules in InstalledPackageInfo. · 1f8a0a20
      Edward Z. Yang authored
      A note first: this patch does NOT modify the user-facing experience in Cabal
      files; it only changes how we register information in the installed package
      database.
      
      This patch takes the exposed-modules and reexported-modules fields in
      the InstalledPackageInfo structure and consolidates them into just the
      exposed module fields, which now has a Maybe flag indicating if a
      module is reexported and, if it is, what the original module was.  I've
      also added in a field for signatures although it is currently unused.
      
      The big benefit of this change is that it will make processing at the GHC level
      much more uniform when we add signatures: signatures can also be reexported
      and the new representation means we can share the code.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      1f8a0a20
  22. 03 Oct, 2014 1 commit
    • Edward Z. Yang's avatar
      Switch InstallPlan over to using IPID-indexed PackageIndex. · ff6c718b
      Edward Z. Yang authored
      While this doesn't let us get rid of Distribution.Client.PackageIndex,
      it does make InstallPlan more flexible, so we can have the same
      package name-package version in the install plan multiple times.
      We do this by synthesizing fake installed package IDs to act
      as placeholders prior to compilation.
      
      There is some shindig with 'FakeMap' in PackageIndex, check out
      the Note in that file for more details.
      
      This reverts commit a5a0f8e1959003ee702c04a23375a60d48f03f90, with
      a bugfix for linearizeInstallPlan.
      
      Fixes #2123
      ff6c718b
  23. 23 Sep, 2014 1 commit
  24. 22 Sep, 2014 1 commit
    • Edward Z. Yang's avatar
      Fix three bugs with fake-map implementation for PackageIndex. · f59bab10
      Edward Z. Yang authored
      1. When we union PackageIndexes together, prefer the later one.
         This idiom is used when we update the processing-state of
         packages in an InstallPlan.
      
      2. dependencyInconsistencies' was missing a number of indirections
         through the fakeMap, so in some cases we incorrectly concluded
         packages were not equal when they were.
      
      3. We need to initialize the fakeMap with any pre-installed packages,
         otherwise the invariant check for configured-packages will fail.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      f59bab10
  25. 30 Aug, 2014 1 commit
  26. 27 Aug, 2014 3 commits
    • Edward Z. Yang's avatar
      Switch InstallPlan over to using IPID-indexed PackageIndex. · 6465d174
      Edward Z. Yang authored
      While this doesn't let us get rid of Distribution.Client.PackageIndex,
      it does make InstallPlan more flexible, so we can have the same
      package name-package version in the install plan multiple times.
      We do this by synthesizing fake installed package IDs to act
      as placeholders prior to compilation.
      
      There is some shindig with 'FakeMap' in PackageIndex, check out
      the Note in that file for more details.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      6465d174
    • Edward Z. Yang's avatar
      Make Distribution.Simple.PackageIndex polymorphic in package storage. · 4e8c6ecc
      Edward Z. Yang authored
      BC note: renamed type PackageIndex :: * to InstalledPackageIndex.
      
      The intent is to have cabal-install use this package index in order to
      track information about compilation in progress.  We introduce a new
      PackageInstalled type-class to keep track of data types which have their
      IDs and dependency graphs in InstalledPackageId.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      4e8c6ecc
    • Duncan Coutts's avatar
      Change rep of module re-exports, and do resolution ourselves · a3d3273a
      Duncan Coutts authored
      The initial support for module re-exports relied on ghc-pkg to resolve
      user-specified re-exports to references to specific installed packages.
      This resolution is something that can fail so it's better for Cabal to
      do it during the package configure phase.
      
      In addition, it is inconvenient in ghc-pkg to be doing this resolution,
      and it just seems fishy as a design. Also, the same ModuleExport type
      was being used both for user-specified source re-exports and also for
      the specific re-exports in the package db.
      
      This patch splits the type into two: one for source level, and one for
      resolved ones for use in the package db. The configure phase resolves
      one to the other.
      
      One minor change: it is now possible to re-export a module defined in
      the same package that is not itself exported (ie it's in other-modules,
      rather than exposed-modules). Previously for modules definied in the
      same package they had to be themselves exported. Of course for
      re-exports from other packages they have to be exposed.
      a3d3273a
  27. 16 Jul, 2014 1 commit
    • Edward Z. Yang's avatar
      Implement "reexported-modules" field, towards fixing GHC bug #8407. · 62450f9a
      Edward Z. Yang authored
      Re-exported modules allow packages to reexport modules from their
      dependencies without having to create stub files.  Reexports of the same
      original module don't count as ambiguous imports when module finding
      occurs.  The syntax is:
      
          "orig-pkg" OrigName as NewName
      
      You can omit 'as NewName', in which case it is reexported as the same
      name.  Self referential aliases work too; however, they're only visible
      to packages which depend on this package.
      
      Left to future work: just provide a module name 'OrigName', where ghc-pkg
      figures out what the source package is.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      62450f9a
  28. 14 Apr, 2014 1 commit
  29. 07 Sep, 2013 1 commit
  30. 25 Jun, 2012 1 commit
    • Duncan Coutts's avatar
      Fix impl of PackageIndex.allPackagesByName · 6192dbf4
      Duncan Coutts authored
      Fixes the problem with generating the haddock documentation contents page for
      all installed packages. Previously we were (accidentally) telling haddock to
      use all versions of each package and haddock would pick the first (lowest
      version). Now we correctly do what we were trying to do all along, which is
      to pick only the highest version of each package.
      6192dbf4
  31. 23 Oct, 2011 1 commit
  32. 19 Jun, 2011 1 commit