This project is mirrored from https://github.com/haskell/Cabal. Pull mirroring updated .
  1. 16 Dec, 2015 5 commits
    • Duncan Coutts's avatar
      Extend HcPkg.init support for dir-style package dbs · 12b222af
      Duncan Coutts authored
      The HcPkgInfo useSingleFileDb is split into two: supportsDirDbs and
      requiresDirDbs. Then rather than HcPkg.init callers having to do the
      writeFile [] thing, HcPkg.init does it itself automatically based on the
      HcPkgInfo. In the case that supportsDirDbs is True but requiresDirDbs is
      False then we have a choice, to use dir style or file style. For
      compatability reasons, when using ghc/ghc-pkg for the inplace package db
      we want to use the old file style, even though dir style is supported.
      However in other circumstances (e.g. in places in cabal-install) we
      would like to use the dir style if it's supported, and there are no
      backwards compat issues. So HcPkg.init gains a new Bool arg to request
      using the file style if it's still supported. Only this mode is used
      within Cabal itself, but the non-compat mode is available for other
      users.
      
      The compiler-independent initPackageDB is left with the same old
      behaviour, but a new createPackageDB has the extra compat argument
      (which is only passed to hc-pkg for ghc-pkg).
      12b222af
    • Duncan Coutts's avatar
      Change regiserPackage to not require so much info · dee7e0a5
      Duncan Coutts authored
      Drop the now-unused PackageDescription and inplace :: Bool args. And
      instead of taking the whole LocalBuildInfo, just take the bits we need:
      the compiler and program db. The package db stack was already passed in
      separately. Also reorder args to follow standard conventions.
      dee7e0a5
    • Duncan Coutts's avatar
      Don't pass LocalBuildInfo to per-compiler registerPackage functions · b0b57da9
      Duncan Coutts authored
      Rather, pass the individual bits we need, which is the program db
      and in some cases the compiler. This is a step towards having the main
      registerPackage not take the LocalBuildInfo. That is useful in contexts
      like cabal-install where we do not have a full LocalBuildInfo, but we
      still want to be able to register packages in a compiler-agnostic way.
      b0b57da9
    • Duncan Coutts's avatar
      Move user logging out of registerPackage and into some callers · 27dd76a0
      Duncan Coutts authored
      The main reason is to stop using the pkg and inplace args so that we
      can drop them entirely. A side benefit is that we don't actually want
      to emit a setupMessage for inplace registering, since that's a rather
      uninteresting internal action. We only want it for the explicit
      register command. So only one caller gains a call to setupMessage.
      27dd76a0
    • Duncan Coutts's avatar
      Change the interface to the per-compiler registerPackage functions · f1ca9680
      Duncan Coutts authored
      Remove the now-unused PackageDescription and inplace :: Bool args.
      
      Not yet changed the compiler-independent registerPackage.
      f1ca9680
  2. 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
  3. 17 Aug, 2015 1 commit
  4. 16 Aug, 2015 1 commit
  5. 21 Jul, 2015 1 commit
    • Edward Z. Yang's avatar
      Refactor Cabal around the idea of "library names". · f47732a5
      Edward Z. Yang authored
      
      
      In GHC 7.10, Cabal always generate package keys, including in
      cases where Backpack was involved (e.g. --instantiated-with).
      In fact, in these case, GHC needs to be able to generate the
      package key (because it will often make a substitution on the
      instantiation, and needs to know if this identity coincides with
      anything else we've seen previously).
      
      Thus, we introduce a new notion, the 'LibraryName', which
      is JUST the non-Backpack portion of a package key.  For ordinary
      packages that are definite, a 'LibraryName' is simply
      the 'PackageId' plus 'PackageKey'; for indefinite Backpack packages,
      when a package gets instantiatied, it may end up with different
      'PackageKey's even though the 'LibraryName' stays the same.
      'LibraryName's can be computed purely by Cabal.
      
      This patch:
      
          - Defines library name, which are the source package ID plus
            a hash of all the source package ID and the library names of external,
            textual dependencies,
      
          - Redefines the package key to be JUST the hash portion of a
            library name, in the case that Backpack is not used,
      
          - Records the library name in InstalledPackageInfo.
      
      Note: the source package ID is included both externally (so the library
      name is a useful handle to refer to package) and internally (so the
      hash can stand alone as the package key.)
      
      A major refactoring which is part of this commit is moving package keys/library
      names from LocalBuildInfo to LibComponentBuildInfo.  If you have an LBI, you can
      still extract a package key/library name using the new
      localPackageKey/localLibraryName function (which looks through the
      ComponentBuildInfos of a LocalBuildInfo for the library in question).  This is
      conceptually cleaner for two reasons:
      
          1. Only dependencies of the *library* are counted as part
          of the library name, as opposed to *all* dependencies which
          we previously used.
      
          2. A library name doesn't really mean much for an executable,
          or a test suite, since no one else will have to link against
          them.  So we can fall back on something simpler.
      
      A more minor refactoring is the 'LibraryName' type, which was
      previously defined by LocalBuildInfo and generally looked something
      like "HSprocess-0.1-XXXX".  We change the meaning of 'LibraryName'
      to be "process-0.1-XXXX" (thus we have to insert some HS additions
      in the code) and eliminate componentLibraries, thus assuming that
      there is only ONE Haskell library (which was the case.)  So
      we remove a little bit of generality and in return get code
      that is much easier to read.  (The only downside is GHC's hack
      to split DLLs into multiples has to be adjusted slightly, but
      this is not a big price to pay.)
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      f47732a5
  6. 18 Dec, 2014 1 commit
  7. 12 Dec, 2014 7 commits
  8. 03 Dec, 2014 1 commit
  9. 26 Nov, 2014 1 commit
    • Edward Z. Yang's avatar
      Preliminary support for compiling signature files, using --instantiate-with. · 0ef39071
      Edward Z. Yang authored
      
      
      There's no chrome here, but some of the guts for Cabal supporting compiling
      signatures.  The key UI is a new --instantiate-with flag for ./Setup (no support
      cabal-install side!) which properly modifies the package key, calculates extra
      hole dependencies for a package, and ensures an appropriately
      translated -sig-of is passed to GHC.  The UI here is supremely user-unfriendly:
      the intent is that users will use cabal-install to calculate these parameters
      for them.
      
      ToDo: Cabal's inconsistency check in ./Setup needs to be adjusted to be
      less zealous.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      0ef39071
  10. 18 Nov, 2014 1 commit
    • Luite Stegeman's avatar
      add data-dir to InstalledPackageInfo · 7fa8f884
      Luite Stegeman authored
      the datadir location for the inplace InstallDirs was pointing to the top directory
      of the package instead of the directory containing the data. this has been fixed.
      since templates have already been expanded at this point, datasubdir raises an
      exception an cannot be used in generalInstalledPackageInfo. therefore the
      full path is stored in datadir.
      7fa8f884
  11. 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
  12. 19 Oct, 2014 1 commit
  13. 27 Aug, 2014 1 commit
    • 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
  14. 04 Aug, 2014 2 commits
    • Edward Z. Yang's avatar
      Implement package keys, distinguishing packages built with different deps/flags · 41610a0b
      Edward Z. Yang authored
      
      
      Previously, the GHC ecosystem assumed that for any package ID (foo-0.1), there
      would only be one instance of it in the installed packages database.  This
      posed problems for situations where you want a package compiled twice against
      different sets of dependencies: they could not both exist in the package
      database.
      
      Package keys are a hash of the package ID and package
      dependencies, which identify a package more uniquely than a package ID, but less
      uniquely than an installed package ID. Unlike installed package IDs, these can
      be computed immediately after dependency resolution, rather than after
      compilation.  Package keys require support from the compiler.  At the moment,
      only GHC 7.10 supports package keys (the reason is that old versions of GHC
      do a sannity check to see that the <pkg-name>-<pkg-version> stored in the
      package database matches with the -package-name embedded in an hi file; so
      the format is fixed.) We fallback to package keys == package IDs for old
      versions.
      
      Note: the ./Setup configure fallback script does not try particularly hard to
      pick consistent sets of dependencies.  If your package database is too difficult
      for it to resolve, manually provide installed package IDs or use cabal-install's
      dependency solver.
      
      Note: This patch *suspends* the reinstall check unless it would result in
      a different package, so cabal-install will now happily reinstall foo-0.1
      compiled against bar-0.2 if foo-0.1 already exists.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      41610a0b
    • Edward Z. Yang's avatar
  15. 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
  16. 12 May, 2014 1 commit
  17. 14 Apr, 2014 1 commit
  18. 02 Feb, 2014 1 commit
  19. 03 Oct, 2013 1 commit
  20. 19 Apr, 2013 1 commit
  21. 20 Mar, 2013 1 commit
  22. 15 Mar, 2013 1 commit
  23. 12 Mar, 2013 1 commit
  24. 26 Nov, 2012 1 commit
  25. 22 Aug, 2012 1 commit
  26. 11 Aug, 2012 1 commit
  27. 24 Jun, 2012 2 commits
  28. 23 Oct, 2011 1 commit