Skip to content
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

Have the standard commands use the sandbox, if present. #1256

Closed
wants to merge 16 commits into from

Conversation

23Skidoo
Copy link
Member

Fixes #1104.

I decided not to add support for subcommands to D.S.Command for the time being (cost/benefit considerations).

23Skidoo added 13 commits March 22, 2013 16:29
Preparation for merging sandbox commands with their normal counterparts.
We use userInstallDirs in sandbox mode to prevent cabal-install from doing
unnecessary things like invoking itself via 'sudo' (see commit
7b2e363 and 'rootCmd' in D.C.Install), but in
this particular case we want userInstall to be False to prevent UserPackageDB
from being added to the package DB stack (see haskell#1183 and interpretPackageDbFlags
in D.S.Configure).
These allow us to work uniformly with @PackageEnvironment@ and @SavedConfig@,
thus reducing boilerplate.
The commands that are implemented with 'wrapperAction' (haddock, hscolour,
register, clean, copy) don't require 'withSandboxDirOnPath', so their code is
not modified.
@tibbe
Copy link
Member

tibbe commented Mar 25, 2013

The only bigger concern I have with the implementation is all this maybe/Maybe business. It feels like the caller (e.g. build) should be more explicit in that we return a useSandbox :: Bool and have things like:

when useSandbox $
    createBlaBla

instead of returning an opaque value from the Sandbox module that later gets passed back to that module.

Replace the confusing MaybePkgEnv type with a (UseSandbox, SavedConfig)
tuple. Code in Main.hs is a bit uglier now.
@23Skidoo
Copy link
Member Author

@tibbe I refactored the code based on your suggestions. Should be less confusing now.

@tibbe
Copy link
Member

tibbe commented Mar 25, 2013

It's clearer to me now at least. I think @dcoutts might have something to say, otherwise I'm happy with the changes (which are really important for the Haskell community!)

@23Skidoo
Copy link
Member Author

Nice. I'll wait for @dcoutts's input then.

Rationale: consistency with existing precedent ('isJust'/'isNothing').
Makes sense because they're basically doing 'cabal build' on each invocation.
@tibbe
Copy link
Member

tibbe commented Apr 3, 2013

@dcoutts I would like to get a cabal release out the door with this feature included. What do you think?

@23Skidoo
Copy link
Member Author

23Skidoo commented Apr 3, 2013

@tibbe

I would like to get a cabal release out the door with this feature included.

I also want the next release to include sandbox add-source --snapshot (#1143). I'm a bit busy right now, but I think that that feature will be ready in a week or two.

@tibbe
Copy link
Member

tibbe commented Apr 9, 2013

@dcoutts Did you want to take a look? Otherwise I will get this merged this week.

@tibbe
Copy link
Member

tibbe commented Apr 12, 2013

Merged! Merge commit: 9b77f56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Have the standard commands use the sandbox, if present
2 participants