nix fallout

This commit is contained in:
Graham Christensen 2017-11-24 14:01:11 -05:00
parent b2701ec763
commit 0d71f72fcf
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C
4 changed files with 17 additions and 16 deletions

View file

@ -21,7 +21,7 @@ pub fn parse(text: &str) -> Option<Vec<Instruction>> {
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<Vec<Instruction>> {
#[derive(PartialEq, Debug)]
pub enum Instruction {
Build(Vec<String>),
Build(Subset, Vec<String>),
Eval
}
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub enum Subset {
Nixpkgs,
NixOS,
}
#[cfg(test)]
mod tests {

View file

@ -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<String>,
}
#[derive(Serialize, Deserialize, Debug)]
pub enum Subset {
Nixpkgs,
NixOS,
}
pub fn from(data: &Vec<u8>) -> Result<BuildJob, serde_json::error::Error> {
return serde_json::from_slice(&data);
}

View file

@ -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,
};

View file

@ -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<String>,
@ -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);