File tree Expand file tree Collapse file tree 3 files changed +5
-21
lines changed Expand file tree Collapse file tree 3 files changed +5
-21
lines changed Original file line number Diff line number Diff line change @@ -108,12 +108,12 @@ querySubstitutablePathInfos ps = do
108108 cnt <- sockGetInt
109109 forM (take cnt $ cycle [(0 :: Int )]) $ pure $ do
110110 _pth <- sockGetPath
111- drv <- sockGetStr
111+ drv <- sockGetPath
112112 refs <- sockGetPaths
113113 dlSize <- sockGetInt
114114 narSize' <- sockGetInt
115115 return $ SubstitutablePathInfo {
116- deriver = mkPath drv
116+ deriver = drv
117117 , references = refs
118118 , downloadSize = dlSize
119119 , narSize = narSize'
@@ -128,7 +128,7 @@ queryPathInfoUncached path = do
128128 valid <- sockGetBool
129129 unless valid $ error " Path is not valid"
130130
131- deriver <- mkPath <$> sockGetStr
131+ deriver <- sockGetPath
132132 narHash <- lBSToText <$> sockGetStr
133133 references <- sockGetPaths
134134 registrationTime <- sockGet getTime
Original file line number Diff line number Diff line change @@ -95,29 +95,12 @@ putText = putByteStringLen . textToLBS
9595putTexts :: [Text ] -> Put
9696putTexts = putByteStrings . (map textToLBS)
9797
98- mkPath :: LBS. ByteString -> Maybe Path
99- mkPath p = case (pathName $ lBSToText p) of
100- Just x -> Just $ Path (Hash. hash $ LBS. toStrict p) x
101- Nothing -> Nothing
102-
103- mkPathText :: T. Text -> Maybe Path
104- mkPathText p = case pathName p of
105- Just x -> Just $ Path (Hash. hash $ BSC. pack $ T. unpack p) x
106- Nothing -> Nothing
107-
10898getPath :: Get (Maybe Path )
10999getPath = parsePath <$> getByteStringLen
110100
111101getPaths :: Get PathSet
112102getPaths = HashSet. fromList . catMaybes . map parsePath <$> getByteStrings
113103
114- {-
115- putPath :: Path -> Put
116- putPath (Path _digest name) = putText $ pathNameContents name
117-
118- putPaths :: PathSet -> Put
119- putPaths = putByteStrings . HashSet.map (\(Path _digest name) -> textToLBS $ pathNameContents name)
120- -}
121104putPath :: StoreDir -> Path -> Put
122105putPath sd = putText . storedToText . makeStored sd
123106
Original file line number Diff line number Diff line change @@ -142,6 +142,7 @@ withPath action = do
142142 (Just path) <- addTextToStore " hnix-store" " test" (HS. fromList [] ) False
143143 action path
144144
145+ invalidPath = Path (hash " invalid" ) $ fromJust $ pathName " invalid"
145146{-
146147 - broken
147148
@@ -233,7 +234,7 @@ spec_protocol = Hspec.around withNixDaemon $ do
233234 context " isValidPathUncached" $ do
234235 itRights " validates path" $ withPath $ \ path -> do
235236 (isValidPathUncached path) `shouldReturn` True
236- itLefts " fails on invalid path" $ isValidPathUncached $ fromJust $ mkPath " nopez "
237+ itLefts " fails on invalid path" $ isValidPathUncached $ invalidPath
237238
238239 context " queryAllValidPaths" $ do
239240 itRights " empty query" $ queryAllValidPaths
You can’t perform that action at this time.
0 commit comments