-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #272 from haskell-nix/srk/daemon
Server side
- Loading branch information
Showing
87 changed files
with
4,568 additions
and
2,041 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,34 +5,40 @@ Maintainer : srk <[email protected]> | |
module System.Nix.Build | ||
( BuildMode(..) | ||
, BuildStatus(..) | ||
, BuildResult(..) | ||
, buildSuccess | ||
, BuildResult(..) | ||
) where | ||
|
||
import Data.Map (Map) | ||
import Data.Time (UTCTime) | ||
import Data.Text (Text) | ||
import GHC.Generics (Generic) | ||
|
||
-- keep the order of these Enums to match enums from reference implementations | ||
import System.Nix.OutputName (OutputName) | ||
import System.Nix.Realisation (DerivationOutput, Realisation) | ||
|
||
-- | Mode of the build operation | ||
-- Keep the order of these Enums to match enums from reference implementations | ||
-- src/libstore/store-api.hh | ||
data BuildMode | ||
= BuildMode_Normal | ||
| BuildMode_Repair | ||
| BuildMode_Check | ||
= BuildMode_Normal -- ^ Perform normal build | ||
| BuildMode_Repair -- ^ Try to repair corrupted or missing paths by re-building or re-downloading them | ||
| BuildMode_Check -- ^ Check if the build is reproducible (rebuild and compare to previous build) | ||
deriving (Eq, Generic, Ord, Enum, Show) | ||
|
||
-- | Build result status | ||
data BuildStatus = | ||
BuildStatus_Built | ||
| BuildStatus_Substituted | ||
| BuildStatus_AlreadyValid | ||
BuildStatus_Built -- ^ Build performed successfully | ||
| BuildStatus_Substituted -- ^ Path substituted from cache | ||
| BuildStatus_AlreadyValid -- ^ Path is already valid (available in local store) | ||
| BuildStatus_PermanentFailure | ||
| BuildStatus_InputRejected | ||
| BuildStatus_OutputRejected | ||
| BuildStatus_TransientFailure -- possibly transient | ||
| BuildStatus_CachedFailure -- no longer used | ||
| BuildStatus_TimedOut | ||
| BuildStatus_TransientFailure -- ^ Possibly transient build failure | ||
| BuildStatus_CachedFailure -- ^ Obsolete | ||
| BuildStatus_TimedOut -- ^ Build timed out | ||
| BuildStatus_MiscFailure | ||
| BuildStatus_DependencyFailed | ||
| BuildStatus_DependencyFailed -- ^ Build dependency failed to build | ||
| BuildStatus_LogLimitExceeded | ||
| BuildStatus_NotDeterministic | ||
| BuildStatus_ResolvesToAlreadyValid | ||
|
@@ -41,24 +47,27 @@ data BuildStatus = | |
|
||
-- | Result of the build | ||
data BuildResult = BuildResult | ||
{ -- | build status, MiscFailure should be default | ||
status :: !BuildStatus | ||
, -- | possible build error message | ||
errorMessage :: !(Maybe Text) | ||
, -- | How many times this build was performed | ||
timesBuilt :: !Int | ||
, -- | If timesBuilt > 1, whether some builds did not produce the same result | ||
isNonDeterministic :: !Bool | ||
, -- Start time of this build | ||
startTime :: !UTCTime | ||
, -- Stop time of this build | ||
stopTime :: !UTCTime | ||
{ buildResultStatus :: BuildStatus | ||
-- ^ Build status, MiscFailure should be the default | ||
, buildResultErrorMessage :: Maybe Text | ||
-- ^ Possible build error message | ||
, buildResultTimesBuilt :: Maybe Int | ||
-- ^ How many times this build was performed (since 1.29) | ||
, buildResultIsNonDeterministic :: Maybe Bool | ||
-- ^ If timesBuilt > 1, whether some builds did not produce the same result (since 1.29) | ||
, buildResultStartTime :: Maybe UTCTime | ||
-- ^ Start time of this build (since 1.29) | ||
, buildResultStopTime :: Maybe UTCTime | ||
-- ^ Stop time of this build (since 1.29) | ||
, buildResultBuiltOutputs :: Maybe (Map (DerivationOutput OutputName) Realisation) | ||
-- ^ Mapping of the output names to @Realisation@s (since 1.28) | ||
-- (paths with additional info and their dependencies) | ||
} | ||
deriving (Eq, Generic, Ord, Show) | ||
|
||
buildSuccess :: BuildResult -> Bool | ||
buildSuccess BuildResult {..} = | ||
status `elem` | ||
buildSuccess :: BuildStatus -> Bool | ||
buildSuccess x = | ||
x `elem` | ||
[ BuildStatus_Built | ||
, BuildStatus_Substituted | ||
, BuildStatus_AlreadyValid | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{-# LANGUAGE DeriveAnyClass #-} | ||
{-| | ||
Description : Derived path output names | ||
-} | ||
|
||
module System.Nix.OutputName | ||
( OutputName(..) | ||
, mkOutputName | ||
-- * Re-exports | ||
, System.Nix.StorePath.InvalidNameError(..) | ||
, System.Nix.StorePath.parseNameText | ||
) where | ||
|
||
import Data.Hashable (Hashable) | ||
import Data.Text (Text) | ||
import GHC.Generics (Generic) | ||
import System.Nix.StorePath (InvalidNameError) | ||
|
||
import qualified System.Nix.StorePath | ||
|
||
-- | Name of the derived path output | ||
-- Typically used for "dev", "doc" sub-outputs | ||
newtype OutputName = OutputName | ||
{ -- | Extract the contents of the name. | ||
unOutputName :: Text | ||
} deriving (Eq, Generic, Hashable, Ord, Show) | ||
|
||
mkOutputName :: Text -> Either InvalidNameError OutputName | ||
mkOutputName = fmap OutputName . System.Nix.StorePath.parseNameText |
Oops, something went wrong.