Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ghcup: support vanilla and cross compilers #126

Merged
merged 2 commits into from
Dec 25, 2024
Merged
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
13 changes: 13 additions & 0 deletions ghcup/ghcupsync.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,22 @@ parseVersionFromFileName :: FilePath -> Maybe Version
parseVersionFromFileName filename = do
let basename = takeBaseName filename
noPrefix <- stripPrefix "ghcup-prereleases-" basename
<|> stripPrefix "ghcup-cross-" basename
<|> stripPrefix "ghcup-vanilla-" basename
<|> stripPrefix "ghcup-" basename
listToMaybe $ map fst . filter (\(_, rem) -> null rem) $ readP_to_S parseVersion noPrefix

-- This version of parseVersionFromFileName may have more forward compatability
-- but poorer performance
-- parseVersionFromFileName filename = do
-- let basename = takeBaseName filename
-- case find isJust . map tryParse $ tails basename of
-- (Just m) -> m -- if found, it will be a double Just, i.e. (Just (Just Version))
-- Nothing -> Nothing
-- where
-- tryParse :: String -> Maybe Version
-- tryParse = listToMaybe . map fst . reverse . readP_to_S parseVersion

------------------------------------------------------------------------
syncByMetadata :: FilePath -> FilePath -> IO ()
syncByMetadata basedir mdpath = do
Expand Down
Loading