mirror of
https://github.com/nmattia/niv.git
synced 2024-11-12 23:06:35 +03:00
Parse ref and rev in git
This commit is contained in:
parent
5faeb0a621
commit
dfc838aba2
@ -19,7 +19,7 @@ let
|
|||||||
pkgs.fetchzip { inherit (spec) url sha256; };
|
pkgs.fetchzip { inherit (spec) url sha256; };
|
||||||
|
|
||||||
fetch_git = spec:
|
fetch_git = spec:
|
||||||
builtins.fetchGit { url = spec.repo; inherit (spec) rev; };
|
builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; };
|
||||||
|
|
||||||
fetch_builtin-tarball = spec:
|
fetch_builtin-tarball = spec:
|
||||||
builtins.trace
|
builtins.trace
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
module Niv.Git.Cmd (gitCmd) where
|
module Niv.Git.Cmd (gitCmd) where
|
||||||
|
|
||||||
import Control.Arrow
|
import Control.Arrow
|
||||||
|
import Control.Applicative
|
||||||
import Data.String.QQ (s)
|
import Data.String.QQ (s)
|
||||||
import Data.Text.Extended as T
|
import Data.Text.Extended as T
|
||||||
import Niv.Cmd
|
import Niv.Cmd
|
||||||
@ -32,14 +33,24 @@ gitCmd = Cmd
|
|||||||
-- TODO: don't hardcode here
|
-- TODO: don't hardcode here
|
||||||
parseGitPackageSpec :: Opts.Parser PackageSpec
|
parseGitPackageSpec :: Opts.Parser PackageSpec
|
||||||
parseGitPackageSpec =
|
parseGitPackageSpec =
|
||||||
(PackageSpec . HMS.singleton "repo") <$>
|
(PackageSpec . HMS.fromList) <$>
|
||||||
parseRepo
|
many (parseRepo <|> parseRef <|> parseRev)
|
||||||
where
|
where
|
||||||
parseRepo =
|
parseRepo =
|
||||||
Aeson.String <$> Opts.strOption
|
("repo", ) . Aeson.String <$> Opts.strOption
|
||||||
( Opts.long "repo" <>
|
( Opts.long "repo" <>
|
||||||
Opts.metavar "URL"
|
Opts.metavar "URL"
|
||||||
)
|
)
|
||||||
|
parseRev =
|
||||||
|
("rev", ) . Aeson.String <$> Opts.strOption
|
||||||
|
( Opts.long "rev" <>
|
||||||
|
Opts.metavar "SHA"
|
||||||
|
)
|
||||||
|
parseRef =
|
||||||
|
("ref", ) . Aeson.String <$> Opts.strOption
|
||||||
|
( Opts.long "ref" <>
|
||||||
|
Opts.metavar "REF"
|
||||||
|
)
|
||||||
|
|
||||||
describeGit :: Opts.InfoMod a
|
describeGit :: Opts.InfoMod a
|
||||||
describeGit = mconcat
|
describeGit = mconcat
|
||||||
|
@ -176,7 +176,7 @@ sourcesVersionToMD5 = \case
|
|||||||
V9 -> "87149616c1b3b1e5aa73178f91c20b53"
|
V9 -> "87149616c1b3b1e5aa73178f91c20b53"
|
||||||
V10 -> "d8625c0a03dd935e1c79f46407faa8d3"
|
V10 -> "d8625c0a03dd935e1c79f46407faa8d3"
|
||||||
V11 -> "8a95b7d93b16f7c7515d98f49b0ec741"
|
V11 -> "8a95b7d93b16f7c7515d98f49b0ec741"
|
||||||
V12 -> "b42c201152bb6d93c6c24388e3cf3249"
|
V12 -> "2f9629ad9a8f181ed71d2a59b454970c"
|
||||||
|
|
||||||
-- | The MD5 sum of ./nix/sources.nix
|
-- | The MD5 sum of ./nix/sources.nix
|
||||||
sourcesNixMD5 :: IO T.Text
|
sourcesNixMD5 :: IO T.Text
|
||||||
|
Loading…
Reference in New Issue
Block a user