Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ Other enhancements:
* MinGW bin folder now is searched for dynamic libraries. See [#3126](https://github.com/commercialhaskell/stack/issues/3126)
* When using Nix, nix-shell now depends always on git to prevent runtime errors
while fetching metadata
* The `stack unpack` command now accepts a form where an explicit
Hackage revision hash is specified, e.g. `stack unpack
foo-1.2.3@gitsha1:deadbeef`. Note that this should be considered
_experimental_, Stack will likely move towards a different hash
format in the future.

Bug fixes:

Expand Down
12 changes: 8 additions & 4 deletions src/Stack/Fetch.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import Data.Monoid
import Data.Set (Set)
import qualified Data.Set as Set
import qualified Data.Text as T
import Data.Text.Encoding (decodeUtf8)
import Data.Text.Encoding (encodeUtf8, decodeUtf8)
import Data.Text.Metrics
import Data.Typeable (Typeable)
import Data.Word (Word64)
Expand Down Expand Up @@ -146,7 +146,7 @@ unpackPackages mMiniBuildPlan dest input = do
([], x) -> return $ partitionEithers x
(errs, _) -> throwM $ CouldNotParsePackageSelectors errs
resolved <- resolvePackages mMiniBuildPlan
(Map.fromList $ map (, Nothing) idents)
(Map.fromList idents)
(Set.fromList names)
ToFetchResult toFetch alreadyUnpacked <- getToFetch (Just dest') resolved
unless (Map.null alreadyUnpacked) $
Expand All @@ -165,8 +165,12 @@ unpackPackages mMiniBuildPlan dest input = do
Right x -> Right $ Left x
Left _ ->
case parsePackageIdentifierFromString s of
Left _ -> Left s
Right x -> Right $ Right x
Right x -> Right $ Right (x, Nothing)
Left _ -> maybe (Left s) (Right . Right) $ do
(identS, '@':revisionS) <- return $ break (== '@') s
Right ident <- return $ parsePackageIdentifierFromString identS
hash <- T.stripPrefix "gitsha1:" $ T.pack revisionS
Just (ident, Just $ GitSHA1 $ encodeUtf8 hash)

-- | Ensure that all of the given package idents are unpacked into the build
-- unpack directory, and return the paths to all of the subdirectories.
Expand Down