summaryrefslogtreecommitdiff
path: root/src/Eval.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-12-03 21:07:53 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2025-12-03 21:07:53 +0100
commit62ed9f15b8d62767f915ccfed1fecc9ee8ae8695 (patch)
tree1ff9b7cf55c550da4390a6fc0fb47a3ad06f878f /src/Eval.hs
parent0e729be7340b5e7c8d1c055523b6a338bdaa0d07 (diff)
Rewrite given job name evaluation using evalJobSet
Diffstat (limited to 'src/Eval.hs')
-rw-r--r--src/Eval.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Eval.hs b/src/Eval.hs
index b73f0f3..f6781a1 100644
--- a/src/Eval.hs
+++ b/src/Eval.hs
@@ -162,7 +162,13 @@ evalRepo (Just name) = asks (lookup name . eiOtherRepos) >>= \case
canonicalJobName :: [ Text ] -> Config -> Maybe Tree -> Eval JobSet
canonicalJobName (r : rs) config mbDefaultRepo = do
let name = JobName r
- dset = JobSet () (Just config) Nothing [] $ Right $ configJobs config
+ dset = JobSet
+ { jobsetId = ()
+ , jobsetConfig = Just config
+ , jobsetCommit = Nothing
+ , jobsetExplicitlyRequested = []
+ , jobsetJobsEither = Right $ configJobs config
+ }
case find ((name ==) . jobName) (configJobs config) of
Just djob -> do
otherRepos <- collectOtherRepos dset djob
@@ -177,14 +183,8 @@ canonicalJobName (r : rs) config mbDefaultRepo = do
case rs' of
(r' : _) -> throwError $ OtherEvalError $ "unexpected job ref part ‘" <> r' <> "’"
_ -> return ()
- ( job, sid ) <- evalJob (maybe id ((:) . ( Nothing, )) mbDefaultRepo $ overrides) dset djob
- return JobSet
- { jobsetId = sid
- , jobsetConfig = Just config
- , jobsetCommit = Nothing
- , jobsetExplicitlyRequested = []
- , jobsetJobsEither = Right [ job ]
- }
+ eset <- evalJobSet (maybe id ((:) . ( Nothing, )) mbDefaultRepo $ overrides) dset
+ return eset { jobsetJobsEither = fmap (filter ((name ==) . jobName)) $ jobsetJobsEither eset }
Nothing -> throwError $ OtherEvalError $ "job ‘" <> r <> "’ not found"
canonicalJobName [] _ _ = throwError $ OtherEvalError "expected job name"