diff --git a/ofborg/src/commentparser.rs b/ofborg/src/commentparser.rs index 68f9ffe..70add03 100644 --- a/ofborg/src/commentparser.rs +++ b/ofborg/src/commentparser.rs @@ -21,7 +21,7 @@ pub fn parse(text: &str) -> Option> { let (left, right) = command.split_at(1); match left[0].as_ref() { "build" => { - instructions.push(Instruction::Build(right.to_vec())) + instructions.push(Instruction::Build(Subset::Nixpkgs, right.to_vec())) } "eval" => { instructions.push(Instruction::Eval) @@ -35,11 +35,17 @@ pub fn parse(text: &str) -> Option> { #[derive(PartialEq, Debug)] pub enum Instruction { - Build(Vec), + Build(Subset, Vec), Eval } +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub enum Subset { + Nixpkgs, + NixOS, +} + #[cfg(test)] mod tests { diff --git a/ofborg/src/message/buildjob.rs b/ofborg/src/message/buildjob.rs index f11ddb7..2cefb6f 100644 --- a/ofborg/src/message/buildjob.rs +++ b/ofborg/src/message/buildjob.rs @@ -1,5 +1,6 @@ use ofborg::message::{Pr,Repo}; use ofborg::message::buildresult; +use ofborg::commentparser::Subset; use ofborg::worker; use serde_json; @@ -11,12 +12,6 @@ pub struct BuildJob { pub attrs: Vec, } -#[derive(Serialize, Deserialize, Debug)] -pub enum Subset { - Nixpkgs, - NixOS, -} - pub fn from(data: &Vec) -> Result { return serde_json::from_slice(&data); } diff --git a/ofborg/src/tasks/githubcommentfilter.rs b/ofborg/src/tasks/githubcommentfilter.rs index 4348a84..098d7cd 100644 --- a/ofborg/src/tasks/githubcommentfilter.rs +++ b/ofborg/src/tasks/githubcommentfilter.rs @@ -99,11 +99,11 @@ impl worker::SimpleWorker for GitHubCommentWorker { if let Some(instructions) = instructions { for instruction in instructions { match instruction { - commentparser::Instruction::Build(attrs) => { + commentparser::Instruction::Build(subset, attrs) => { let msg = buildjob::BuildJob{ repo: repo_msg.clone(), pr: pr_msg.clone(), - subset: Some(buildjob::Subset::Nixpkgs), + subset: Some(subset), attrs: attrs, }; diff --git a/ofborg/src/tasks/massrebuilder.rs b/ofborg/src/tasks/massrebuilder.rs index 2fc37bb..049c8da 100644 --- a/ofborg/src/tasks/massrebuilder.rs +++ b/ofborg/src/tasks/massrebuilder.rs @@ -10,7 +10,7 @@ use std::path::Path; use std::path::PathBuf; use ofborg::checkout; use ofborg::message::massrebuildjob; -use ofborg::nix; +use ofborg::nix::Nix; use ofborg::worker; use ofborg::tagger::{StdenvTagger,RebuildTagger}; @@ -22,12 +22,12 @@ use hubcaps; pub struct MassRebuildWorker { cloner: checkout::CachedCloner, - nix: nix::Nix, + nix: Nix, github: hubcaps::Github, } impl MassRebuildWorker { - pub fn new(cloner: checkout::CachedCloner, nix: nix::Nix, github: hubcaps::Github) -> MassRebuildWorker { + pub fn new(cloner: checkout::CachedCloner, nix: Nix, github: hubcaps::Github) -> MassRebuildWorker { return MassRebuildWorker{ cloner: cloner, nix: nix, @@ -330,7 +330,7 @@ pub enum System { #[derive(Debug, PartialEq)] struct Stdenvs { - nix: nix::Nix, + nix: Nix, co: PathBuf, linux_stdenv_before: Option, @@ -341,7 +341,7 @@ struct Stdenvs { } impl Stdenvs { - fn new(nix: nix::Nix, co: PathBuf) -> Stdenvs { + fn new(nix: Nix, co: PathBuf) -> Stdenvs { return Stdenvs { nix: nix, co: co, @@ -496,7 +496,7 @@ mod tests { #[test] fn stdenv_checking() { - let nix = nix::new(String::from("x86_64-linux"), String::from("daemon")); + let nix = Nix::new(String::from("x86_64-linux"), String::from("daemon"), 1200); let mut stdenv = Stdenvs::new(nix.clone(), PathBuf::from("/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs")); stdenv.identify(System::X8664Linux, StdenvFrom::Before); stdenv.identify(System::X8664Darwin, StdenvFrom::Before);