matching preferred content before key is known

This will let import try to match preferred content expressions before
downloading the content and generating its key.

If an expression needs a key, it preferredContentParser with
preferredContentKeylessTokens will fail to parse it.

standard and groupwanted are not in preferredContentKeylessTokens
because they may refer to an expression that refers to a key.
That needs further work to support them.
This commit is contained in:
Joey Hess 2019-05-14 14:01:09 -04:00
parent aa7710982b
commit 9411a7c93c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 97 additions and 43 deletions

View file

@ -76,8 +76,15 @@ seek :: MatchExpressionOptions -> CommandSeek
seek o = do
parser <- if largeFilesExpression o
then mkLargeFilesParser
else preferredContentParser
matchAll matchAll groupMap M.empty . Just <$> getUUID
else do
u <- getUUID
pure $ preferredContentParser $ preferredContentTokens $ PCD
{ matchStandard = matchAll
, matchGroupWanted = matchAll
, getGroupMap = groupMap
, configMap = M.empty
, repoUUID = Just u
}
case parsedToMatcher $ parser ((matchexpr o)) of
Left e -> liftIO $ bail $ "bad expression: " ++ e
Right matcher -> ifM (checkmatcher matcher)