| CARVIEW |
Select Language
HTTP/2 200
date: Sat, 17 Jan 2026 11:55:46 GMT
content-type: text/html; charset=utf-8
cache-control: no-cache
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com github.githubassets.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com wss://alive-staging.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com marketplace-screenshots.githubusercontent.com/ copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com github.githubassets.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
referrer-policy: no-referrer-when-downgrade
server-timing: pull_request_layout-fragment;desc="pull_request_layout fragment";dur=353.299752,conversation_content-fragment;desc="conversation_content fragment";dur=652.154269,conversation_sidebar-fragment;desc="conversation_sidebar fragment";dur=249.408794,nginx;desc="NGINX";dur=0.726495,glb;desc="GLB";dur=104.826571
strict-transport-security: max-age=31536000; includeSubdomains; preload
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-content-type-options: nosniff
x-frame-options: deny
x-voltron-version: 69ef6d1
x-xss-protection: 0
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=nrKSWrtGUNejQQFCNzutZHYTmVQFB%2FSaV8LB0Wk1GMKLLwYA4AN%2FnVtjQHWAgHqqplVnCzWERsLderyhw4GuReLXRfzsf9cYC%2F7E9zBRphU8RXsjGbgcZaeq%2Bou3ziiQq0luY2rlGCdVdyu%2FtjfMYdgVHy6R0tIB9%2F1E4WoHPk8e4pmAILf%2BifDnueKXmC5UwHYpSm%2BaGr0IiG5SNkipGfV8wHVq%2FUlTMoTMIc6K3A3Bv%2BfNFNWqPr7qEmJL8KLlE%2BJbS7%2BYg1dz7QqtDeE8VQ%3D%3D--tLUhMe4RuECf3tqo--Q4MUIwCVTFD2D79DaD6JYQ%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.425412916.1768650945; Path=/; Domain=github.com; Expires=Sun, 17 Jan 2027 11:55:45 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Sun, 17 Jan 2027 11:55:45 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: 8B2C:38CA81:12A1DE5:15D1483:696B78C1
Cabal lib for nix local build by dcoutts · Pull Request #2948 · haskell/cabal · GitHub
Copy link
Copy link
Copy link
Copy link
Copy link
Copy link
Copy link
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 722
Cabal lib for nix local build #2948
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
Merged
dcoutts
merged 28 commits into
haskell:master
from
dcoutts:cabal-lib-for-nix-local-build
Dec 16, 2015
Merged
Cabal lib for nix local build #2948
dcoutts
merged 28 commits into
haskell:master
from
dcoutts:cabal-lib-for-nix-local-build
Dec 16, 2015
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Most types have these already. This just adds a few more.
To be used in cabal-install. Also use it in one place in Cabal.
It's used three times already. This isn't important on it's own, but simplifies subsequent changes, when we add yet another use of it.
UHC's version of registerPackage is the only one that makes use of the PackageDescription and inplace :: Bool args, and it's quite wrong for doing so. Registering a package should depend on the content of the InstalledPackageInfo and the PackageDBStack to register into and the Compiler to register with. It should not depend on the original source PackageDescription, and should not need a separate inplace arg. The location is determined by the PackageDBStack. UHC was not following this pattern and thereby forcing the general compiler independent registerPackage to take annoying and unnecessary arguments. With this patch, the register location is determined by the PackageDBStack. The source package id also comes from the InstalledPackageInfo rather than the source PackageDescription. This patch does not yet change the registerPackage type.
Remove the now-unused PackageDescription and inplace :: Bool args. Not yet changed the compiler-independent registerPackage.
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.
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.
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.
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).
Add doesPackageDBExist and deletePackageDB, and export the new createPackageDB. This gives a more complete compiler-independent API for package db manipulation.
And fix up the db path for UHC. UHC cannot just register anywhere, like compilers that have a hc-pkg can. It has to be special locations. Now that registerPackage no longer takes the inplace :: Bool arg, UHC's impl of registerPackage has to get the dir from the PackageDbStack without knowing if it's implace or not. So the correct inplace location has to be set earlier for the inplace package db, which is what this does.
Prior to further extension. Just share the common args calculation.
Part 1: just add the fields and fill them in for each HcPkg user.
Invocation support but not used yet.
This supports the feature of newer ghc-pkg version which have the register --enable-multi-instance flag. This allows registering multiple instances of the same version of a package into a single database. In addition, to support the same feature on some older ghc-pkg versions, the HcPkgInfo has a recacheMultiInstance capability, which tells us if the trick of registering multiple instances by running ghc-pkg recache works. This is known to work for all versions of ghc-pkg that support the recache command at all. Then HcPkg.registerMultiInstance will use one of the two methods depending on which is supported, or fail if neither is. Currently only registering into specific package dbs is supported, not global or user. This new multi-instance feature is needed for cabal-install.
With support for GHC and GHCJS. All Cabal lib internal uses remain traditional single instance, so there's no change of behaviour.
It provides a way to find out what files need to be monitored to detect changes in a compiler's package database. This is not used within the Cabal lib.
The findProgramOnSearchPath function is what we use in most places to implement the Program abstraction's programFindLocation method. Re-export it via Program module. The only place that was still using the old findProgramLocation instead was in HaskellSuite. Deprecate findProgramLocation which is now no longer used. This is in preparation for changing the return type of findProgramOnSearchPath.
But in this patch, don't actually return them yet, so not yet changing the resturn type. The purpose here is change monitoring. In cabal-install we want to be able to automatically re-run various actions when the build environment changes, including when programs have changed (e.g. due to a $PATH change, finding the compiler in a different location). The basic information required for such change monitoring is not only the location where a program was ultimately found, but all the locations where it was looked for and not found. Otherwise one will miss the case where having previously found the program in one location, later on the program appears earlier in the search path. In this case a build system should notice and react, but if it only monitors the ultimate location where the program was found then this is impossible. The build system also needs to monitor the locations where the program was not found, to make sure it is still not there. This principle actually applies anytime we have a file search (e.g. hs-source-dirs), programs are just one example.
This is to allow monitoring programs for changes. The combination of the location where the program was found, and all the other locations where the program was looked for gives the full set of files to monitor for changes in that program. The Program programFindLocation method is extended to return the locations looked at but where the prog was not found. The default implementation of programFindLocation, findProgramOnSearchPath, is extended to return those locations. Other places have to change, mostly just the type. In a couple places in GHC & GHCJS where there is additional searching done, the not-found locations have to be collected and returned.
The ProgramDb Binary instance is a bit odd by leaving out the Programs, only including the ConfiguredPrograms. Of course this is because the Programs contain functions. But the ProgramSearchPath is concrete and should be included.
Member
|
@dcoutts Thanks, will take a look later today. Can you fix the Travis failure? |
For some reason my cpp does not fail with #if THING_NOT_DEFINED but the travis one does, so use #ifdef instead.
For supporting multi instance registrations on older GHC versions.
Contributor
|
Let's ship it! |
About the ghc package dbs in particular.
Contributor
Author
|
So I think I've addressed everything except for tests for |
Contributor
|
I wouldn't block on it! |
Member
|
LGTM as well, let's merge! |
Member
|
👍 |
Contributor
Author
|
Woo! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
You can’t perform that action at this time.
@23Skidoo @hvr ping
A series of patches to the Cabal lib that are needed for the nix-local-build branch of cabal-install.
There's quite a few patches here because I've tried to make each one be clear and do one thing.
Summary: