This commit is contained in:
Graham Christensen 2017-11-19 19:05:15 -05:00
parent 4ae086fca8
commit 01f1685400
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C
4 changed files with 16 additions and 22 deletions

View file

@ -7,9 +7,7 @@ extern crate log;
use std::env; use std::env;
use std::path::Path; use std::path::Path;
use ofborg::worker::SimpleWorker;
use ofborg::tasks; use ofborg::tasks;
use ofborg::message;
use ofborg::config; use ofborg::config;
use ofborg::checkout; use ofborg::checkout;
use ofborg::nix; use ofborg::nix;
@ -54,8 +52,7 @@ fn main() {
let mrw = tasks::massrebuilder::MassRebuildWorker::new( let mrw = tasks::massrebuilder::MassRebuildWorker::new(
cloner, cloner,
nix, nix,
cfg.github(), cfg.github()
cfg.checkout.root.clone()
); );
/* /*
println!("{:?}", mrw.consumer(&message::massrebuildjob::MassRebuildJob{ println!("{:?}", mrw.consumer(&message::massrebuildjob::MassRebuildJob{

View file

@ -22,4 +22,11 @@ impl Actions {
worker::Action::Ack worker::Action::Ack
]; ];
} }
pub fn done(&mut self, _job: &MassRebuildJob) -> worker::Actions {
return vec![
worker::Action::Ack
];
}
} }

View file

@ -4,20 +4,12 @@ extern crate env_logger;
use std::collections::HashMap; use std::collections::HashMap;
use std::fs::File; use std::fs::File;
use std::fs; use std::fs;
use std::io::Read;
use std::io::BufRead; use std::io::BufRead;
use std::io::BufReader; use std::io::BufReader;
use std::path::Path;
use std::path::PathBuf; use std::path::PathBuf;
use ofborg::checkout;
use ofborg::message::massrebuildjob;
use ofborg::nix; use ofborg::nix;
use std::io::Write; use std::io::Write;
use ofborg::worker;
use ofborg::evalchecker::EvalChecker; use ofborg::evalchecker::EvalChecker;
use ofborg::commitstatus::CommitStatus;
use amqp::protocol::basic::{Deliver,BasicProperties};
use hubcaps;
pub struct OutPathDiff { pub struct OutPathDiff {
path: PathBuf, path: PathBuf,

View file

@ -24,16 +24,14 @@ pub struct MassRebuildWorker {
cloner: checkout::CachedCloner, cloner: checkout::CachedCloner,
nix: nix::Nix, nix: nix::Nix,
github: hubcaps::Github, github: hubcaps::Github,
tmp_root: String,
} }
impl MassRebuildWorker { impl MassRebuildWorker {
pub fn new(cloner: checkout::CachedCloner, nix: nix::Nix, github: hubcaps::Github, tmp_root: String) -> MassRebuildWorker { pub fn new(cloner: checkout::CachedCloner, nix: nix::Nix, github: hubcaps::Github) -> MassRebuildWorker {
return MassRebuildWorker{ return MassRebuildWorker{
cloner: cloner, cloner: cloner,
nix: nix, nix: nix,
github: github, github: github,
tmp_root: tmp_root,
}; };
} }
@ -296,12 +294,12 @@ impl worker::SimpleWorker for MassRebuildWorker {
update_labels(&issue, stdenvtagger.tags_to_add(), update_labels(&issue, stdenvtagger.tags_to_add(),
stdenvtagger.tags_to_remove()); stdenvtagger.tags_to_remove());
let mut rebuildTags = RebuildTagger::new(); let mut rebuild_tags = RebuildTagger::new();
if let Some(attrs) = rebuildsniff.calculate_rebuild() { if let Some(attrs) = rebuildsniff.calculate_rebuild() {
rebuildTags.parse_attrs(attrs); rebuild_tags.parse_attrs(attrs);
} }
update_labels(&issue, rebuildTags.tags_to_add(), update_labels(&issue, rebuild_tags.tags_to_add(),
rebuildTags.tags_to_remove()); rebuild_tags.tags_to_remove());
overall_status.set_with_description( overall_status.set_with_description(
"^.^!", "^.^!",
@ -315,7 +313,7 @@ impl worker::SimpleWorker for MassRebuildWorker {
); );
} }
return vec![]; return self.actions().done(&job);
} }
} }
@ -448,10 +446,10 @@ pub fn update_labels(issue: &hubcaps::issues::IssueRef, add: Vec<String>, remove
.collect(); .collect();
info!("Removing labels: {:?}", to_remove); info!("Removing labels: {:?}", to_remove);
l.add(to_add); l.add(to_add).expect("Failed to add tags");
for label in to_remove { for label in to_remove {
l.remove(&label); l.remove(&label).expect("Failed to remove tag");
} }
} }