forked from the-distro/ofborg
nix fallout
This commit is contained in:
parent
b2701ec763
commit
0d71f72fcf
|
@ -21,7 +21,7 @@ pub fn parse(text: &str) -> Option<Vec<Instruction>> {
|
||||||
let (left, right) = command.split_at(1);
|
let (left, right) = command.split_at(1);
|
||||||
match left[0].as_ref() {
|
match left[0].as_ref() {
|
||||||
"build" => {
|
"build" => {
|
||||||
instructions.push(Instruction::Build(right.to_vec()))
|
instructions.push(Instruction::Build(Subset::Nixpkgs, right.to_vec()))
|
||||||
}
|
}
|
||||||
"eval" => {
|
"eval" => {
|
||||||
instructions.push(Instruction::Eval)
|
instructions.push(Instruction::Eval)
|
||||||
|
@ -35,11 +35,17 @@ pub fn parse(text: &str) -> Option<Vec<Instruction>> {
|
||||||
|
|
||||||
#[derive(PartialEq, Debug)]
|
#[derive(PartialEq, Debug)]
|
||||||
pub enum Instruction {
|
pub enum Instruction {
|
||||||
Build(Vec<String>),
|
Build(Subset, Vec<String>),
|
||||||
Eval
|
Eval
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub enum Subset {
|
||||||
|
Nixpkgs,
|
||||||
|
NixOS,
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use ofborg::message::{Pr,Repo};
|
use ofborg::message::{Pr,Repo};
|
||||||
use ofborg::message::buildresult;
|
use ofborg::message::buildresult;
|
||||||
|
use ofborg::commentparser::Subset;
|
||||||
use ofborg::worker;
|
use ofborg::worker;
|
||||||
use serde_json;
|
use serde_json;
|
||||||
|
|
||||||
|
@ -11,12 +12,6 @@ pub struct BuildJob {
|
||||||
pub attrs: Vec<String>,
|
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> {
|
pub fn from(data: &Vec<u8>) -> Result<BuildJob, serde_json::error::Error> {
|
||||||
return serde_json::from_slice(&data);
|
return serde_json::from_slice(&data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,11 +99,11 @@ impl worker::SimpleWorker for GitHubCommentWorker {
|
||||||
if let Some(instructions) = instructions {
|
if let Some(instructions) = instructions {
|
||||||
for instruction in instructions {
|
for instruction in instructions {
|
||||||
match instruction {
|
match instruction {
|
||||||
commentparser::Instruction::Build(attrs) => {
|
commentparser::Instruction::Build(subset, attrs) => {
|
||||||
let msg = buildjob::BuildJob{
|
let msg = buildjob::BuildJob{
|
||||||
repo: repo_msg.clone(),
|
repo: repo_msg.clone(),
|
||||||
pr: pr_msg.clone(),
|
pr: pr_msg.clone(),
|
||||||
subset: Some(buildjob::Subset::Nixpkgs),
|
subset: Some(subset),
|
||||||
attrs: attrs,
|
attrs: attrs,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ use std::path::Path;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use ofborg::checkout;
|
use ofborg::checkout;
|
||||||
use ofborg::message::massrebuildjob;
|
use ofborg::message::massrebuildjob;
|
||||||
use ofborg::nix;
|
use ofborg::nix::Nix;
|
||||||
|
|
||||||
use ofborg::worker;
|
use ofborg::worker;
|
||||||
use ofborg::tagger::{StdenvTagger,RebuildTagger};
|
use ofborg::tagger::{StdenvTagger,RebuildTagger};
|
||||||
|
@ -22,12 +22,12 @@ use hubcaps;
|
||||||
|
|
||||||
pub struct MassRebuildWorker {
|
pub struct MassRebuildWorker {
|
||||||
cloner: checkout::CachedCloner,
|
cloner: checkout::CachedCloner,
|
||||||
nix: nix::Nix,
|
nix: Nix,
|
||||||
github: hubcaps::Github,
|
github: hubcaps::Github,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MassRebuildWorker {
|
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{
|
return MassRebuildWorker{
|
||||||
cloner: cloner,
|
cloner: cloner,
|
||||||
nix: nix,
|
nix: nix,
|
||||||
|
@ -330,7 +330,7 @@ pub enum System {
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
struct Stdenvs {
|
struct Stdenvs {
|
||||||
nix: nix::Nix,
|
nix: Nix,
|
||||||
co: PathBuf,
|
co: PathBuf,
|
||||||
|
|
||||||
linux_stdenv_before: Option<String>,
|
linux_stdenv_before: Option<String>,
|
||||||
|
@ -341,7 +341,7 @@ struct Stdenvs {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Stdenvs {
|
impl Stdenvs {
|
||||||
fn new(nix: nix::Nix, co: PathBuf) -> Stdenvs {
|
fn new(nix: Nix, co: PathBuf) -> Stdenvs {
|
||||||
return Stdenvs {
|
return Stdenvs {
|
||||||
nix: nix,
|
nix: nix,
|
||||||
co: co,
|
co: co,
|
||||||
|
@ -496,7 +496,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn stdenv_checking() {
|
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"));
|
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::X8664Linux, StdenvFrom::Before);
|
||||||
stdenv.identify(System::X8664Darwin, StdenvFrom::Before);
|
stdenv.identify(System::X8664Darwin, StdenvFrom::Before);
|
||||||
|
|
Loading…
Reference in a new issue