mirror of
https://github.com/haskell-nix/hnix-store.git
synced 2024-09-11 18:05:56 +03:00
prefix BuildMode and BuildResult constructors
This commit is contained in:
parent
a3e3840d9b
commit
5ea5b82b59
@ -15,25 +15,28 @@ import GHC.Generics (Generic)
|
||||
|
||||
-- keep the order of these Enums to match enums from reference implementations
|
||||
-- src/libstore/store-api.hh
|
||||
data BuildMode = Normal | Repair | Check
|
||||
data BuildMode
|
||||
= BuildMode_Normal
|
||||
| BuildMode_Repair
|
||||
| BuildMode_Check
|
||||
deriving (Eq, Generic, Ord, Enum, Show)
|
||||
|
||||
data BuildStatus =
|
||||
Built
|
||||
| Substituted
|
||||
| AlreadyValid
|
||||
| PermanentFailure
|
||||
| InputRejected
|
||||
| OutputRejected
|
||||
| TransientFailure -- possibly transient
|
||||
| CachedFailure -- no longer used
|
||||
| TimedOut
|
||||
| MiscFailure
|
||||
| DependencyFailed
|
||||
| LogLimitExceeded
|
||||
| NotDeterministic
|
||||
| ResolvesToAlreadyValid
|
||||
| NoSubstituters
|
||||
BuildStatus_Built
|
||||
| BuildStatus_Substituted
|
||||
| BuildStatus_AlreadyValid
|
||||
| BuildStatus_PermanentFailure
|
||||
| BuildStatus_InputRejected
|
||||
| BuildStatus_OutputRejected
|
||||
| BuildStatus_TransientFailure -- possibly transient
|
||||
| BuildStatus_CachedFailure -- no longer used
|
||||
| BuildStatus_TimedOut
|
||||
| BuildStatus_MiscFailure
|
||||
| BuildStatus_DependencyFailed
|
||||
| BuildStatus_LogLimitExceeded
|
||||
| BuildStatus_NotDeterministic
|
||||
| BuildStatus_ResolvesToAlreadyValid
|
||||
| BuildStatus_NoSubstituters
|
||||
deriving (Eq, Generic, Ord, Enum, Show)
|
||||
|
||||
-- | Result of the build
|
||||
@ -55,4 +58,8 @@ data BuildResult = BuildResult
|
||||
|
||||
buildSuccess :: BuildResult -> Bool
|
||||
buildSuccess BuildResult {..} =
|
||||
status `elem` [Built, Substituted, AlreadyValid]
|
||||
status `elem`
|
||||
[ BuildStatus_Built
|
||||
, BuildStatus_Substituted
|
||||
, BuildStatus_AlreadyValid
|
||||
]
|
||||
|
@ -236,15 +236,15 @@ spec_protocol = Hspec.around withNixDaemon $
|
||||
context "buildPaths" $ do
|
||||
itRights "build Normal" $ withPath $ \path -> do
|
||||
let pathSet = HS.fromList [path]
|
||||
buildPaths pathSet Normal
|
||||
buildPaths pathSet BuildMode_Normal
|
||||
|
||||
itRights "build Check" $ withPath $ \path -> do
|
||||
let pathSet = HS.fromList [path]
|
||||
buildPaths pathSet Check
|
||||
buildPaths pathSet BuildMode_Check
|
||||
|
||||
itLefts "build Repair" $ withPath $ \path -> do
|
||||
let pathSet = HS.fromList [path]
|
||||
buildPaths pathSet Repair
|
||||
buildPaths pathSet BuildMode_Repair
|
||||
|
||||
context "roots" $ context "findRoots" $ do
|
||||
itRights "empty roots" (findRoots `shouldReturn` M.empty)
|
||||
|
@ -21,7 +21,7 @@ import qualified Data.Time.Clock.POSIX
|
||||
import qualified System.Nix.Build
|
||||
|
||||
import System.Nix.Arbitrary ()
|
||||
import System.Nix.Build (BuildMode, BuildStatus)
|
||||
import System.Nix.Build (BuildMode(..), BuildStatus(..))
|
||||
import System.Nix.Derivation (Derivation(..))
|
||||
import System.Nix.Store.Remote.Arbitrary ()
|
||||
import System.Nix.Store.Remote.Serialize (getDerivation, putDerivation)
|
||||
@ -114,27 +114,27 @@ spec = do
|
||||
|
||||
describe "Enums" $ do
|
||||
let it' name constr value = it name $ runPut (put constr) `shouldBe` runPut (putInt value)
|
||||
describe "Build enum order matches Nix" $ do
|
||||
it' "Normal" System.Nix.Build.Normal 0
|
||||
it' "Repair" System.Nix.Build.Repair 1
|
||||
it' "Check" System.Nix.Build.Check 2
|
||||
describe "BuildMode enum order matches Nix" $ do
|
||||
it' "Normal" BuildMode_Normal 0
|
||||
it' "Repair" BuildMode_Repair 1
|
||||
it' "Check" BuildMode_Check 2
|
||||
|
||||
describe "BuildStatus enum order matches Nix" $ do
|
||||
it' "Built" System.Nix.Build.Built 0
|
||||
it' "Substituted" System.Nix.Build.Substituted 1
|
||||
it' "AlreadyValid" System.Nix.Build.AlreadyValid 2
|
||||
it' "PermanentFailure" System.Nix.Build.PermanentFailure 3
|
||||
it' "InputRejected" System.Nix.Build.InputRejected 4
|
||||
it' "OutputRejected" System.Nix.Build.OutputRejected 5
|
||||
it' "TransientFailure" System.Nix.Build.TransientFailure 6
|
||||
it' "CachedFailure" System.Nix.Build.CachedFailure 7
|
||||
it' "TimedOut" System.Nix.Build.TimedOut 8
|
||||
it' "MiscFailure" System.Nix.Build.MiscFailure 9
|
||||
it' "DependencyFailed" System.Nix.Build.DependencyFailed 10
|
||||
it' "LogLimitExceeded" System.Nix.Build.LogLimitExceeded 11
|
||||
it' "NotDeterministic" System.Nix.Build.NotDeterministic 12
|
||||
it' "ResolvesToAlreadyValid" System.Nix.Build.ResolvesToAlreadyValid 13
|
||||
it' "NoSubstituters" System.Nix.Build.NoSubstituters 14
|
||||
it' "Built" BuildStatus_Built 0
|
||||
it' "Substituted" BuildStatus_Substituted 1
|
||||
it' "AlreadyValid" BuildStatus_AlreadyValid 2
|
||||
it' "PermanentFailure" BuildStatus_PermanentFailure 3
|
||||
it' "InputRejected" BuildStatus_InputRejected 4
|
||||
it' "OutputRejected" BuildStatus_OutputRejected 5
|
||||
it' "TransientFailure" BuildStatus_TransientFailure 6
|
||||
it' "CachedFailure" BuildStatus_CachedFailure 7
|
||||
it' "TimedOut" BuildStatus_TimedOut 8
|
||||
it' "MiscFailure" BuildStatus_MiscFailure 9
|
||||
it' "DependencyFailed" BuildStatus_DependencyFailed 10
|
||||
it' "LogLimitExceeded" BuildStatus_LogLimitExceeded 11
|
||||
it' "NotDeterministic" BuildStatus_NotDeterministic 12
|
||||
it' "ResolvesToAlreadyValid" BuildStatus_ResolvesToAlreadyValid 13
|
||||
it' "NoSubstituters" BuildStatus_NoSubstituters 14
|
||||
|
||||
describe "Verbosity enum order matches Nix" $ do
|
||||
it' "Error" Verbosity_Error 0
|
||||
|
Loading…
Reference in New Issue
Block a user