Repository navigation
Freeze remote repos as well - #8
Merged
Merged
Conversation
hasufell
force-pushed
the
remote-freeze
branch
from
September 29, 2020 21:16
ac1ba34 to
cf666e0
Compare
hasufell
commented
Sep 30, 2020
| -- of a git repository. | ||
| getPackageIdent :: Git -> IO [PackageIdentifier] | ||
| getPackageIdent (Git (T.unpack -> repo) (T.unpack -> commit) (fmap T.unpack -> subdirs)) = | ||
| withSystemTempDirectory "stack2cabal" $ \dir -> do |
Owner
Author
There was a problem hiding this comment.
We clone into a temp dir and reset to the "offending" commit, then use cabal to parse the .cabal file and get PackageIdentifier. This is semi-expensive, hence optional from the cli. It would be cool to re-use the repos cloned by cabal already, but that would probably require far more work.
hasufell
commented
Sep 30, 2020
| freezeRemoteRepos :: Project -> Freeze -> IO Freeze | ||
| freezeRemoteRepos (Project { srcs }) (Freeze deps flags) = do | ||
| clonedDeps <- fmap concat $ forM srcs $ \src -> getPackageIdent src | ||
| let newDeps = fromHM $ H.union (toHM clonedDeps) (toHM deps) |
Owner
Author
There was a problem hiding this comment.
Here's the magic: we merge the freeze files.
hasufell
commented
Sep 30, 2020
| ) | ||
| ) | ||
| ) <*> | ||
| (switch (short 'r' <> long "freeze-remotes" <> help "Additionally freeze all remote repos (slower, but more correct, because remote repos also can be hackage deps)") |
Owner
Author
There was a problem hiding this comment.
I hope this is understandable enough.
Collaborator
There was a problem hiding this comment.
What should be "understandable" in this context? The code or the help text?
KtorZ
reviewed
Sep 30, 2020
This also fixes #1, because if a remote repo is a hackage dep, it will replace the version from the statically stack-generated freeze info now.
hasufell
force-pushed
the
remote-freeze
branch
from
September 30, 2020 18:08
cf666e0 to
451036f
Compare
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
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.
This also fixes #1, because if
a remote repo is a hackage dep, it will
replace the version from the statically stack-generated
freeze info now.
@KtorZ