@@ -59,7 +59,7 @@ import Data.Monoid
5959import Data.Set (Set )
6060import qualified Data.Set as Set
6161import qualified Data.Text as T
62- import Data.Text.Encoding (decodeUtf8 )
62+ import Data.Text.Encoding (encodeUtf8 , decodeUtf8 )
6363import Data.Text.Metrics
6464import Data.Typeable (Typeable )
6565import Data.Word (Word64 )
@@ -146,7 +146,7 @@ unpackPackages mMiniBuildPlan dest input = do
146146 ([] , x) -> return $ partitionEithers x
147147 (errs, _) -> throwM $ CouldNotParsePackageSelectors errs
148148 resolved <- resolvePackages mMiniBuildPlan
149- (Map. fromList $ map (, Nothing ) idents)
149+ (Map. fromList idents)
150150 (Set. fromList names)
151151 ToFetchResult toFetch alreadyUnpacked <- getToFetch (Just dest') resolved
152152 unless (Map. null alreadyUnpacked) $
@@ -165,8 +165,12 @@ unpackPackages mMiniBuildPlan dest input = do
165165 Right x -> Right $ Left x
166166 Left _ ->
167167 case parsePackageIdentifierFromString s of
168- Left _ -> Left s
169- Right x -> Right $ Right x
168+ Right x -> Right $ Right (x, Nothing )
169+ Left _ -> maybe (Left s) (Right . Right ) $ do
170+ (identS, ' @' : revisionS) <- return $ break (== ' @' ) s
171+ Right ident <- return $ parsePackageIdentifierFromString identS
172+ hash <- T. stripPrefix " gitsha1:" $ T. pack revisionS
173+ Just (ident, Just $ GitSHA1 $ encodeUtf8 hash)
170174
171175-- | Ensure that all of the given package idents are unpacked into the build
172176-- unpack directory, and return the paths to all of the subdirectories.
0 commit comments