Skip to content

Commit

Permalink
Recognize more tarball extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
kmicklas committed Oct 19, 2024
1 parent e80fc8f commit 3d1e72c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Niv/GitHub.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,15 @@ githubUpdate prefetch latestRev ghRepo = proc () -> do
-<
()
url <- update "url" -< urlTemplate
let isTarGuess = (\u -> "tar.gz" `T.isSuffixOf` u || ".tgz" `T.isSuffixOf` u) <$> url
type' <- useOrSet "type" -< bool "file" "tarball" <$> isTarGuess :: Box T.Text
let isTarGuess u = any (`T.isSuffixOf` u)
[ ".tar"
, ".tar.gz"
, ".tgz"
, ".tar.bz2"
, ".tar.xz"
, ".tar.zst"
]
type' <- useOrSet "type" -< bool "file" "tarball" . isTarGuess <$> url :: Box T.Text
let doUnpack = (== "tarball") <$> type'
_sha256 <- update "sha256" <<< run (\(up, u) -> prefetch up u) -< (,) <$> doUnpack <*> url
returnA -< ()
Expand Down

0 comments on commit 3d1e72c

Please sign in to comment.