forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
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 NixOS#186 from ryantm/nixpkgsreview
optionally run nixpkgs-review
- Loading branch information
Showing
15 changed files
with
128 additions
and
29 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
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,48 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
module NixpkgsReview | ||
( cacheDir, | ||
runReport, | ||
) | ||
where | ||
|
||
import Data.Text as T | ||
import qualified File as F | ||
import OurPrelude | ||
import qualified Process as P | ||
import System.Environment.XDG.BaseDir (getUserCacheDir) | ||
import Prelude hiding (log) | ||
|
||
cacheDir :: IO FilePath | ||
cacheDir = getUserCacheDir "nixpkgs-review" | ||
|
||
revDir :: FilePath -> Text -> FilePath | ||
revDir cache commit = cache <> "/rev-" <> T.unpack commit | ||
|
||
run :: | ||
Members '[F.File, P.Process] r => | ||
FilePath -> | ||
Text -> | ||
Sem r Text | ||
run cache commit = do | ||
-- TODO: probably just skip running nixpkgs-review if the directory | ||
-- already exists | ||
void $ ourReadProcessInterleavedSem $ | ||
proc "rm" ["-rf", revDir cache commit] | ||
void $ ourReadProcessInterleavedSem $ | ||
proc "nixpkgs-review" ["rev", T.unpack commit, "--no-shell"] | ||
F.read $ (revDir cache commit) <> "/report.md" | ||
|
||
-- Assumes we are already in nixpkgs dir | ||
runReport :: (Text -> IO ()) -> Text -> IO Text | ||
runReport log commit = do | ||
log "[check][nixpkgs-review]" | ||
c <- cacheDir | ||
msg <- | ||
runFinal | ||
. embedToFinal | ||
. F.runIO | ||
. P.runIO | ||
$ NixpkgsReview.run c commit | ||
log msg | ||
return msg |
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