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

Make stack clean be more thorough by default #4385

Merged
merged 11 commits into from
Mar 8, 2019

Conversation

vanceism7
Copy link
Contributor

@vanceism7 vanceism7 commented Nov 2, 2018

Fixes #3863 and potentially fixes #2278

Please include the following checklist in your PR:

  • Any changes that could be relevant to users have been recorded in the ChangeLog.md
  • The documentation has been updated, if necessary.

I tested out stack clean and stack purge. It seems like theyre doing what they should be. Also added a small spot in the guide.md explaining the commands a little more indepth.

Copy link
Contributor

@dbaynard dbaynard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I like the approach you've taken.

In my comment on the issue I asked whether my example description was accurate, but never received an answer. I shall ask again, now that you have submitted this PR.

Specifically, I'll get another person to review this.

doc/GUIDE.md Outdated Show resolved Hide resolved
doc/GUIDE.md Outdated
### `stack purge`
`stack purge` Deletes the local stack working directory, including extra-deps, git dependencies and the compiler output.
It does not delete any snapshot packages, compilers or installed programs. -- This essentially
reverts your project to a completely fresh state, as if it had never been built.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This last bit could be more precise. It isn't obvious what a 'completely fresh state' is. I'd have to study that part of the code to offer something that could be written here instead.

I suspect the list I wrote in my comment on the issue may not be comprehensive, so I'll get somebody else to check.

@@ -54,12 +55,17 @@ dirsToDelete cleanOpts = do
-- | Options for @stack clean@.
data CleanOpts
= CleanShallow [PackageName]
-- ^ Delete the "dist directories" as defined in 'Stack.Constants.distRelativeDir'
-- ^ Delete the "dist directories" as defined in 'Stack.Constants.Config.distRelativeDir'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😀

@@ -19,4 +19,6 @@ cleanOptsParser = CleanShallow <$> packages <|> doFullClean
flag'
CleanFull
(long "full" <>
help "Delete all work directories (.stack-work by default) in the project")
help "Delete the local stack working directory (.stack-work by default).")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah — this is a subtle change in meaning (probably my fault). It is possible for a project to have multiple .stack-work directories. The old description indicates all are deleted; this implies only one is deleted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh my bad, I wasn't aware that you could have multiple .stack-work directories. Ill fix that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how stack actually behaves, mind.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ok, perhaps I'll wait until this is reviewed further before I run off changing things haha

@dbaynard
Copy link
Contributor

dbaynard commented Nov 7, 2018

Also to fix #2278 the documentation changes would need merging to stable not master — though I'd prefer to see the whole PR merged in to stable for the next minor release, if the API addition is acceptable.

doc/GUIDE.md Outdated Show resolved Hide resolved
@dbaynard
Copy link
Contributor

It would be good to get an integration test, for this, too, but don't worry too much about it, @vanceism7, if you don't have a chance — it should be fairly straightforward.

@dbaynard
Copy link
Contributor

Also I have a directory tree diff listing what has been deleted by each of these commands, which I still need to check. It's in progress! Thanks for bearing with me 👍

@vanceism7
Copy link
Contributor Author

Oh no problem, thanks for taking the time to address this issue @dbaynard. Id be happy to put the integration test in, but I'll be a bit busy for the next week or so. If there's no rush, I'll try to get to that soon, otherwise, I'm fine if someone else finishes that up too.

Thanks!

@vanceism7
Copy link
Contributor Author

Hey just posting an update, I'm back and finished with my prior obligations so I'll work on getting those integration tests in

@mihaimaruseac mihaimaruseac changed the title Fix #3863 - Stack clean should be more thorough by default Make stack clean be more thorough by default Jan 22, 2019
@dbaynard
Copy link
Contributor

We've had various issues with stack clean — I'll take a look at this shortly and see whether this can be merged. Thanks for your patience, @vanceism7!

@dbaynard
Copy link
Contributor

I've rebased, and fixed a conflict (I thought there might be more). Given this doesn't actually affect the operation of clean (just the interface) if it passes CI & integration tests are ok then I'll merge this ASAP.

-  The integration test ensures the correct directories are present,
then deleted, for a project with only one package, not in a
subdirectory.
@dbaynard
Copy link
Contributor

Note: the integration test fails. The behaviour of stack clean has changed on master, at some point — see #4480.

@vanceism7
Copy link
Contributor Author

Oh ok np, I'll fix that integration test as soon as I can

@dbaynard
Copy link
Contributor

@vanceism7 To be clear, it's not failing because of your changes! There's an issue with clean on master.

@snoyberg
Copy link
Contributor

snoyberg commented Mar 6, 2019

I've opened up #4607, which fixes the clean problems. I've pushed a new commit (1cabb98) to a separate branch, which merges this branch and the branch for #4607, together with a minor doc fix. Assuming #4607 is merged, I believe 1cabb98 can be merged into this PR.

@snoyberg snoyberg merged commit 893a8b7 into commercialhaskell:master Mar 8, 2019
snoyberg added a commit that referenced this pull request Mar 8, 2019
Make stack clean be more thorough by default (supersedes #4385)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stack clean should be more thorough by default stack clean should be documented better
4 participants