Skip to content

cabal-testsuite tests can access the Hackage package index on Windows #5187

Closed

Description

@sebright

T4154 failed on Windows in #5186 because it accessed the package index from Hackage, and the output showed more versions of time than expected:

stderr:
*** Exception: Expected cabal to reject the setup dependency on the installed time,
actual output:
"C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.0.2\bin\ghc.exe" "--print-global-package-db"
Reading available packages of hackage.haskell.org...
Using most recent state specified from most recent cabal update
index-state(hackage.haskell.org) = 2018-03-05T01:59:08Z
Failed to query pkg-config, Cabal will continue without solving for pkg-config constraints: dieVerbatim: user error (CallStack (from HasCallStack):
  die', called at .\Distribution\Simple\Program\Db.hs:423:28 in Cabal-2.3.0.0-6e1C1nBFJd7KTLWUhJzMW6:Distribution.Simple.Program.Db
  requireProgram, called at .\Distribution\Solver\Types\PkgConfigDb.hs:65:21 in cabal-install-2.3.0.0-87cSSu67wwjHwxtCcREn7E:Distribution.Solver.Types.PkgConfigDb
cabal.exe: The program 'pkg-config' is required but it could not be found.
)
-----BEGIN CABAL OUTPUT-----
Resolving dependencies...
-----END CABAL OUTPUT-----
CallStack (from HasCallStack):
  die', called at .\Distribution\Client\ProjectPlanning.hs:550:42 in cabal-install-2.3.0.0-87cSSu67wwjHwxtCcREn7E:Distribution.Client.ProjectPlanning
-----BEGIN CABAL OUTPUT-----
cabal.exe: Could not resolve dependencies:
[__0] trying: time-99999 (user goal)
[__1] trying: time:setup.Cabal-1.24.2.0/installed-1.2... (dependency of time)
[__2] next goal: time:setup.time (dependency of time:setup.Cabal)
[__2] rejecting: time:setup.time~>time-99999 (conflict: time:setup.Cabal => time:setup.time==1.6.0.1/installed-1.6...)
[__2] rejecting: time:setup.time-99999 (multiple instances)
[__2] rejecting: time:setup.time-1.9.1, time:setup.time-1.9, time:setup.time-1.8.0.4, time:setup.time-1.8.0.3, time:setup.time-1.8.0.2, time:setup.time-1.8.0.1, time:setup.time-1.8, time:setup.time-1.7.0.1, time:setup.time-1.7, time:setup.time-1.6.0.1/installed-1.6..., time:setup.time-1.6.0.1, time:setup.time-1.6, time:setup.time-1.5.0.1, time:setup.time-1.5, time:setup.time-1.4.2, time:setup.time-1.4.1, time:setup.time-1.4.0.2, time:setup.time-1.4.0.1, time:setup.time-1.4, time:setup.time-1.3, time:setup.time-1.2.0.5, time:setup.time-1.2.0.4, time:setup.time-1.2.0.3, time:setup.time-1.2.0.2, time:setup.time-1.2.0.1, time:setup.time-1.2, time:setup.time-1.1.4, time:setup.time-1.1.3, time:setup.time-1.1.2.4, time:setup.time-1.1.2.3, time:setup.time-1.1.2.2, time:setup.time-1.1.2.1, time:setup.time-1.1.2.0, time:setup.time-1.0 (constraint from command line flag requires ==99999)
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: time:setup.time (222), time:setup.Cabal (61), time (44), time:setup.base (28), base (27)
-----END CABAL OUTPUT-----



*** unexpected failure for PackageTests\Regression\T4154\install-time-with-constraint.test.hs

Full AppVeyor log: https://ci.appveyor.com/project/23Skidoo/cabal/build/%234991%20(master)
Travis log (Linux, GHC 8.0.2): https://travis-ci.org/haskell/cabal/jobs/349104904

I didn't have time to look into this further, but I saw that cabal-testsuite avoids creating the default repository configuration for tests:

-- NB: it's important to initialize this ourselves, as
-- the default configuration hardcodes Hackage, which we do
-- NOT want to assume for these tests (no test should
-- hit Hackage.)
liftIO $ createDirectoryIfMissing True (testHomeDir env </> ".cabal")

Activity

  1. hvr commented on Mar 5, 2018

    @hvr
    Member

    The program 'pkg-config' is required but it could not be found.

    that's btw something that can easily be avoided on Appveyor, since appveyor has pkg-config installed; iirc all one needs to make sure is that C:\msys64\mingw64\bin;C:\msys64\usr\bin is added to PATH.

  2. sebright commented on Mar 12, 2018

    @sebright
    CollaboratorAuthor

    I think the problem is that cabal uses the APPDATA directory to locate the config file, so it reads the user's config file, which points to Hackage. This is similar to #2678. We could set the CABAL_CONFIG environment variable, unless the tests also need to access other files from the cabal directory. Maybe we should add a way to override the location of the whole directory.

  3. added a commit that references this issue on Mar 18, 2018
    33074ba
  4. added 2 commits that reference this issue on Mar 29, 2018
    dbf20c7
    a880c85
  5. added 2 commits that reference this issue on Apr 29, 2018
    f7427ae
    8945eba
  6. added a commit that references this issue on May 9, 2018
    fcc5382
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions