Skip to content

Commit

Permalink
Recognize more tarball extensions (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmicklas authored Oct 24, 2024
1 parent e80fc8f commit 9e0a818
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Niv/GitHub.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,17 @@ 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 9e0a818

Please sign in to comment.