More 2018-ification and minor formatting changes

2018-ification changes include:
* replacing `extern crate` imports (except for ones annotated with
`#[macro_use]` to prevent touching more files; maybe in a follow-up)
* removing standalone imports; for example, `use serde_json;` -- the
code already uses `serde_json::*` where necessary

Minor formatting changes include:
* collapsing imports from the same root (e.g. `use std::io::Read; use
std::io::BufRead` -> `use std::io::{BufRead, Read};`
* separating `crate` imports from external imports from `std` imports --
this is how many project seem to order their imports, most notably the
official Rust repo
* moving some `use`s from the first line to below the file's doc comment
* changing file-level doc comments from `///` to `//!` (so they actually
show up as documentation)
* `rustfmt` messing with the `nom` macros in `src/commentparser.rs`

Most of the 2018-ification was done by `cargo fix --edition-idioms`, but
all changes were manually inspected to catch any detrimental changes,
and `cargo test`/`cargo check` still succeed.
This commit is contained in:
Cole Helbling 2020-03-31 18:59:43 -07:00
parent c7978aca74
commit cbe2e62162
No known key found for this signature in database
GPG key ID: B37E0F2371016A4C
45 changed files with 125 additions and 254 deletions

View file

@ -4,7 +4,7 @@ version = "0.1.8"
authors = ["Graham Christensen <graham@grahamc.com>"] authors = ["Graham Christensen <graham@grahamc.com>"]
include = ["Cargo.toml", "Cargo.lock", "src", "test-srcs", "build.rs"] include = ["Cargo.toml", "Cargo.lock", "src", "test-srcs", "build.rs"]
build = "build.rs" build = "build.rs"
edition = "2018"
[dependencies] [dependencies]
either = "1.4.0" either = "1.4.0"

View file

@ -1,18 +1,8 @@
use std::thread;
use std::collections::HashMap; use std::collections::HashMap;
use std::io; use std::io::{self, BufRead, BufReader, Read};
use std::io::BufRead; use std::process::{Child, Command, ExitStatus, Stdio};
use std::io::BufReader; use std::sync::mpsc::{self, sync_channel, Receiver, SyncSender};
use std::io::Read; use std::thread::{self, JoinHandle};
use std::process::Child;
use std::process::Command;
use std::process::ExitStatus;
use std::process::Stdio;
use std::sync::mpsc;
use std::sync::mpsc::sync_channel;
use std::sync::mpsc::{Receiver, SyncSender};
use std::thread::JoinHandle;
// Specifically set to fall under 1/2 of the AMQP library's // Specifically set to fall under 1/2 of the AMQP library's
// SyncSender limitation. // SyncSender limitation.

View file

@ -1,22 +1,12 @@
extern crate amqp;
extern crate env_logger;
extern crate ofborg;
extern crate hubcaps;
extern crate hyper;
extern crate hyper_native_tls;
use std::env;
use ofborg::commentparser; use ofborg::commentparser;
use ofborg::config; use ofborg::config;
use ofborg::easyamqp; use ofborg::easyamqp;
use ofborg::message::buildjob; use ofborg::message::{buildjob, Pr, Repo};
use ofborg::message::{Pr, Repo}; use ofborg::notifyworker::{self, NotificationReceiver};
use ofborg::notifyworker;
use ofborg::notifyworker::NotificationReceiver;
use ofborg::worker; use ofborg::worker;
use std::env;
fn main() { fn main() {
let cfg = config::load(env::args().nth(1).unwrap().as_ref()); let cfg = config::load(env::args().nth(1).unwrap().as_ref());
ofborg::setup_log(); ofborg::setup_log();

View file

@ -1,19 +1,12 @@
extern crate amqp;
extern crate env_logger;
extern crate ofborg;
#[macro_use]
extern crate log;
use std::env;
use amqp::Basic; use amqp::Basic;
use log::{log, warn};
use ofborg::checkout; use ofborg::checkout;
use ofborg::config; use ofborg::config;
use ofborg::easyamqp; use ofborg::easyamqp::{self, TypedWrappers};
use ofborg::easyamqp::TypedWrappers;
use ofborg::notifyworker; use ofborg::notifyworker;
use ofborg::tasks; use ofborg::tasks;
use std::env;
use std::path::Path; use std::path::Path;
fn main() { fn main() {

View file

@ -1,21 +1,11 @@
extern crate amqp;
extern crate env_logger;
extern crate ofborg;
extern crate hubcaps;
extern crate hyper;
extern crate hyper_native_tls;
use std::env;
use amqp::Basic; use amqp::Basic;
use ofborg::config; use ofborg::config;
use ofborg::easyamqp; use ofborg::easyamqp::{self, TypedWrappers};
use ofborg::easyamqp::TypedWrappers;
use ofborg::tasks; use ofborg::tasks;
use ofborg::worker; use ofborg::worker;
use std::env;
fn main() { fn main() {
let cfg = config::load(env::args().nth(1).unwrap().as_ref()); let cfg = config::load(env::args().nth(1).unwrap().as_ref());
ofborg::setup_log(); ofborg::setup_log();

View file

@ -1,21 +1,11 @@
extern crate amqp;
extern crate env_logger;
extern crate ofborg;
extern crate hubcaps;
extern crate hyper;
extern crate hyper_native_tls;
use std::env;
use amqp::Basic; use amqp::Basic;
use ofborg::config; use ofborg::config;
use ofborg::easyamqp; use ofborg::easyamqp::{self, TypedWrappers};
use ofborg::easyamqp::TypedWrappers;
use ofborg::tasks; use ofborg::tasks;
use ofborg::worker; use ofborg::worker;
use std::env;
fn main() { fn main() {
let cfg = config::load(env::args().nth(1).unwrap().as_ref()); let cfg = config::load(env::args().nth(1).unwrap().as_ref());
ofborg::setup_log(); ofborg::setup_log();

View file

@ -1,21 +1,11 @@
extern crate amqp;
extern crate env_logger;
extern crate ofborg;
extern crate hubcaps;
extern crate hyper;
extern crate hyper_native_tls;
use std::env;
use amqp::Basic; use amqp::Basic;
use ofborg::config; use ofborg::config;
use ofborg::easyamqp; use ofborg::easyamqp::{self, TypedWrappers};
use ofborg::easyamqp::TypedWrappers;
use ofborg::tasks; use ofborg::tasks;
use ofborg::worker; use ofborg::worker;
use std::env;
fn main() { fn main() {
let cfg = config::load(env::args().nth(1).unwrap().as_ref()); let cfg = config::load(env::args().nth(1).unwrap().as_ref());
ofborg::setup_log(); ofborg::setup_log();

View file

@ -1,16 +1,11 @@
extern crate amqp; use ofborg::config;
extern crate env_logger; use ofborg::easyamqp::{self, TypedWrappers};
extern crate ofborg; use ofborg::tasks;
use ofborg::worker;
use std::env; use std::env;
use std::path::PathBuf; use std::path::PathBuf;
use ofborg::config;
use ofborg::easyamqp;
use ofborg::easyamqp::TypedWrappers;
use ofborg::tasks;
use ofborg::worker;
fn main() { fn main() {
let cfg = config::load(env::args().nth(1).unwrap().as_ref()); let cfg = config::load(env::args().nth(1).unwrap().as_ref());
ofborg::setup_log(); ofborg::setup_log();

View file

@ -1,19 +1,13 @@
extern crate amqp; use ofborg::config;
extern crate env_logger; use ofborg::easyamqp;
extern crate ofborg; use ofborg::message::{buildjob, Pr, Repo};
use ofborg::notifyworker;
use ofborg::tasks::build;
use std::env; use std::env;
use std::thread; use std::thread;
use std::time::Duration; use std::time::Duration;
use ofborg::message::{Pr, Repo};
use ofborg::config;
use ofborg::easyamqp;
use ofborg::message::buildjob;
use ofborg::notifyworker;
use ofborg::tasks::build;
fn main() { fn main() {
let cfg = config::load(env::args().nth(1).unwrap().as_ref()); let cfg = config::load(env::args().nth(1).unwrap().as_ref());
ofborg::setup_log(); ofborg::setup_log();

View file

@ -1,21 +1,15 @@
extern crate amqp; use amqp::Basic;
extern crate env_logger;
extern crate ofborg;
extern crate sys_info;
use ofborg::checkout; use ofborg::checkout;
use ofborg::config; use ofborg::config;
use ofborg::easyamqp::{self, TypedWrappers};
use ofborg::stats;
use ofborg::tasks; use ofborg::tasks;
use ofborg::worker;
use std::env; use std::env;
use std::path::Path; use std::path::Path;
use std::process; use std::process;
use amqp::Basic;
use ofborg::easyamqp;
use ofborg::easyamqp::TypedWrappers;
use ofborg::stats;
use ofborg::worker;
fn main() { fn main() {
let memory_info = sys_info::mem_info().expect("Unable to get memory information from OS"); let memory_info = sys_info::mem_info().expect("Unable to get memory information from OS");

View file

@ -1,11 +1,7 @@
extern crate amqp;
extern crate env_logger;
extern crate ofborg;
use std::env;
use ofborg::config; use ofborg::config;
use ofborg::nix; use ofborg::nix;
use std::env;
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
use std::path::Path; use std::path::Path;

View file

@ -1,14 +1,9 @@
extern crate amqp;
extern crate hyper;
extern crate ofborg;
use ofborg::{config, easyamqp, stats, tasks, worker};
use std::env;
use amqp::Basic; use amqp::Basic;
use hyper::server::{Request, Response, Server}; use hyper::server::{Request, Response, Server};
use ofborg::easyamqp::TypedWrappers; use ofborg::easyamqp::TypedWrappers;
use ofborg::{config, easyamqp, stats, tasks, worker};
use std::env;
use std::thread; use std::thread;
fn main() { fn main() {

View file

@ -1,8 +1,6 @@
use crate::clone; use crate::clone::{self, GitClonable};
use crate::clone::GitClonable;
use md5; use std::ffi::{OsStr, OsString};
use std::ffi::OsStr;
use std::ffi::OsString;
use std::fs; use std::fs;
use std::io::{Error, ErrorKind}; use std::io::{Error, ErrorKind};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};

View file

@ -1,4 +1,5 @@
use fs2::FileExt; use fs2::FileExt;
use std::ffi::OsStr; use std::ffi::OsStr;
use std::fs; use std::fs;
use std::io::{Error, ErrorKind}; use std::io::{Error, ErrorKind};

View file

@ -16,16 +16,21 @@ pub fn parse(text: &str) -> Option<Vec<Instruction>> {
} }
} }
named!(normal_token(CompleteStr) -> CompleteStr, named!(
verify!(take_while1!(|c: char| c.is_ascii_graphic()), normal_token(CompleteStr) -> CompleteStr,
|s: CompleteStr| !s.0.eq_ignore_ascii_case("@grahamcofborg")) verify!(
take_while1!(|c: char| c.is_ascii_graphic()),
|s: CompleteStr| !s.0.eq_ignore_ascii_case("@grahamcofborg")
)
); );
named!(parse_line_impl(CompleteStr) -> Option<Vec<Instruction>>, alt!( named!(
do_parse!( parse_line_impl(CompleteStr) -> Option<Vec<Instruction>>,
res: ws!(many1!(ws!(preceded!( alt!(
alt!(tag_no_case!("@grahamcofborg") | tag_no_case!("@ofborg")), do_parse!(
alt!( res: ws!(many1!(ws!(preceded!(
ws!(do_parse!( alt!(tag_no_case!("@grahamcofborg") | tag_no_case!("@ofborg")),
alt!(
ws!(do_parse!(
tag!("build") >> tag!("build") >>
pkgs: ws!(many1!(map!(normal_token, |s| s.0.to_owned()))) >> pkgs: ws!(many1!(map!(normal_token, |s| s.0.to_owned()))) >>
(Some(Instruction::Build(Subset::Nixpkgs, pkgs))) (Some(Instruction::Build(Subset::Nixpkgs, pkgs)))
@ -40,13 +45,12 @@ named!(parse_line_impl(CompleteStr) -> Option<Vec<Instruction>>, alt!(
// it would be better to return an error so that the caller would know one of the // it would be better to return an error so that the caller would know one of the
// commands couldn't be handled? // commands couldn't be handled?
value!(None, many_till!(take!(1), tag_no_case!("@grahamcofborg"))) value!(None, many_till!(take!(1), tag_no_case!("@grahamcofborg")))
) )
)))) >> )))) >> eof!()
eof!() >> >> (Some(res.into_iter().filter_map(|x| x).collect()))
(Some(res.into_iter().filter_map(|x| x).collect())) ) | value!(None)
) | )
value!(None) );
));
pub fn parse_line(text: &str) -> Option<Vec<Instruction>> { pub fn parse_line(text: &str) -> Option<Vec<Instruction>> {
match parse_line_impl(CompleteStr(text)) { match parse_line_impl(CompleteStr(text)) {

View file

@ -1,8 +1,3 @@
extern crate amqp;
extern crate env_logger;
use hubcaps;
pub struct CommitStatus<'a> { pub struct CommitStatus<'a> {
api: hubcaps::statuses::Statuses<'a>, api: hubcaps::statuses::Statuses<'a>,
sha: String, sha: String,

View file

@ -1,10 +1,11 @@
use crate::acl; use crate::acl;
use crate::nix::Nix; use crate::nix::Nix;
use hubcaps::{Credentials, Github, InstallationTokenGenerator, JWTCredentials}; use hubcaps::{Credentials, Github, InstallationTokenGenerator, JWTCredentials};
use hyper::net::HttpsConnector; use hyper::net::HttpsConnector;
use hyper::Client; use hyper::Client;
use hyper_native_tls::NativeTlsClient; use hyper_native_tls::NativeTlsClient;
use serde_json;
use std::collections::HashMap; use std::collections::HashMap;
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;

View file

@ -1,6 +1,6 @@
use crate::config::RabbitMQConfig; use crate::config::RabbitMQConfig;
use crate::ofborg; use crate::ofborg;
use amqp;
use amqp::Basic; use amqp::Basic;
pub struct ConsumeConfig { pub struct ConsumeConfig {

View file

@ -1,7 +1,5 @@
extern crate amqp;
extern crate env_logger;
use crate::nix; use crate::nix;
use std::fs::File; use std::fs::File;
use std::path::Path; use std::path::Path;

View file

@ -7,9 +7,6 @@
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
extern crate serde;
extern crate serde_json;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
@ -17,20 +14,6 @@ extern crate log;
#[macro_use] #[macro_use]
extern crate nom; extern crate nom;
extern crate amqp;
extern crate chrono;
extern crate either;
extern crate env_logger;
extern crate fs2;
extern crate hubcaps;
extern crate hyper;
extern crate hyper_native_tls;
extern crate lru_cache;
extern crate md5;
extern crate separator;
extern crate tempfile;
extern crate uuid;
use std::env; use std::env;
pub mod acl; pub mod acl;

View file

@ -1,4 +1,5 @@
use fs2::FileExt; use fs2::FileExt;
use std::fs; use std::fs;
use std::io::Error; use std::io::Error;
use std::path::PathBuf; use std::path::PathBuf;

View file

@ -1,8 +1,10 @@
use crate::nix::Nix; use crate::nix::Nix;
use tempfile::NamedTempFile;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use std::io::Write; use std::io::Write;
use std::path::Path; use std::path::Path;
use tempfile::NamedTempFile;
#[derive(Deserialize, Debug, Eq, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct ImpactedMaintainers(HashMap<Maintainer, Vec<Package>>); pub struct ImpactedMaintainers(HashMap<Maintainer, Vec<Package>>);

View file

@ -1,6 +1,5 @@
use crate::commentparser::Subset; use crate::commentparser::Subset;
use crate::message::{Pr, Repo}; use crate::message::{Pr, Repo};
use serde_json;
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct BuildJob { pub struct BuildJob {

View file

@ -1,4 +1,5 @@
use crate::message::{Pr, Repo}; use crate::message::{Pr, Repo};
use hubcaps::checks::Conclusion; use hubcaps::checks::Conclusion;
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] #[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]

View file

@ -1,6 +1,5 @@
use crate::message::{Pr, Repo}; use crate::message::{Pr, Repo};
use crate::worker; use crate::worker;
use serde_json;
pub fn from(data: &[u8]) -> Result<EvaluationJob, serde_json::error::Error> { pub fn from(data: &[u8]) -> Result<EvaluationJob, serde_json::error::Error> {
serde_json::from_slice(&data) serde_json::from_slice(&data)

View file

@ -1,17 +1,16 @@
use crate::asynccmd::{AsyncCmd, SpawnedAsyncCmd}; use crate::asynccmd::{AsyncCmd, SpawnedAsyncCmd};
use crate::ofborg::partition_result; use crate::ofborg::partition_result;
use tempfile::tempfile;
use std::collections::HashMap; use std::collections::HashMap;
use std::env; use std::env;
use std::ffi::OsStr; use std::ffi::OsStr;
use std::fmt; use std::fmt;
use std::fs; use std::fs;
use std::io::BufRead; use std::io::{BufRead, BufReader, Seek, SeekFrom};
use std::io::BufReader;
use std::io::Seek;
use std::io::SeekFrom;
use std::path::Path; use std::path::Path;
use std::process::{Command, Stdio}; use std::process::{Command, Stdio};
use tempfile::tempfile;
#[derive(Clone, Copy, Debug, PartialEq)] #[derive(Clone, Copy, Debug, PartialEq)]
pub enum File { pub enum File {

View file

@ -1,16 +1,11 @@
//! Evaluates the expression like Hydra would, with regards to
//! architecture support and recursed packages.
use crate::nix; use crate::nix;
/// Evaluates the expression like Hydra would, with regards to
/// architecture support and recursed packages.
use crate::nixstats::EvaluationStats; use crate::nixstats::EvaluationStats;
use crate::outpathdiff; use crate::outpathdiff;
use serde_json;
use std::fs; use std::fs::{self, File};
use std::fs::File; use std::io::{BufRead, BufReader, Read, Seek, SeekFrom, Write};
use std::io::Read;
use std::io::Seek;
use std::io::SeekFrom;
use std::io::Write;
use std::io::{BufRead, BufReader};
use std::path::PathBuf; use std::path::PathBuf;
pub struct HydraNixEnv { pub struct HydraNixEnv {

View file

@ -1,5 +1,6 @@
//! Statistics emitted by Nix when NIX_SHOW_STATS=1
use separator::Separatable; use separator::Separatable;
/// Statistics emitted by Nix when NIX_SHOW_STATS=1
use std::collections::HashMap; use std::collections::HashMap;
#[derive(Deserialize)] #[derive(Deserialize)]

View file

@ -1,7 +1,8 @@
use crate::worker::Action; use crate::worker::Action;
use amqp::protocol::basic::{BasicProperties, Deliver}; use amqp::protocol::basic::{BasicProperties, Deliver};
use amqp::Basic; use amqp::{Basic, Channel, Consumer};
use amqp::{Channel, Consumer};
use std::marker::Send; use std::marker::Send;
pub struct NotifyWorker<T: SimpleNotifyWorker> { pub struct NotifyWorker<T: SimpleNotifyWorker> {

View file

@ -1,7 +1,7 @@
use crate::nix; use crate::nix;
use crate::nixenv::Error as NixEnvError; use crate::nixenv::{Error as NixEnvError, HydraNixEnv};
use crate::nixenv::HydraNixEnv;
use crate::nixstats::{EvaluationStats, EvaluationStatsDiff}; use crate::nixstats::{EvaluationStats, EvaluationStatsDiff};
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use std::io::BufRead; use std::io::BufRead;
use std::path::PathBuf; use std::path::PathBuf;

View file

@ -1,7 +1,5 @@
use amqp::protocol::basic::BasicProperties; use amqp::protocol::basic::BasicProperties;
use amqp::Basic; use amqp::{Basic, Channel};
use amqp::Channel;
use serde_json;
include!(concat!(env!("OUT_DIR"), "/events.rs")); include!(concat!(env!("OUT_DIR"), "/events.rs"));

View file

@ -1,6 +1,7 @@
use crate::maintainers::{Maintainer, MaintainersByPackage}; use crate::maintainers::{Maintainer, MaintainersByPackage};
use crate::outpathdiff::PackageArch; use crate::outpathdiff::PackageArch;
use crate::tasks; use crate::tasks;
use std::collections::HashMap; use std::collections::HashMap;
pub struct StdenvTagger { pub struct StdenvTagger {

View file

@ -1,7 +1,3 @@
extern crate amqp;
extern crate env_logger;
extern crate uuid;
use crate::checkout; use crate::checkout;
use crate::commentparser; use crate::commentparser;
use crate::message::buildresult::{BuildResult, BuildStatus, V1Tag}; use crate::message::buildresult::{BuildResult, BuildStatus, V1Tag};
@ -9,10 +5,12 @@ use crate::message::{buildjob, buildlogmsg};
use crate::nix; use crate::nix;
use crate::notifyworker; use crate::notifyworker;
use crate::worker; use crate::worker;
use amqp::protocol::basic::{BasicProperties, Deliver}; use amqp::protocol::basic::{BasicProperties, Deliver};
use std::collections::VecDeque;
use uuid::Uuid; use uuid::Uuid;
use std::collections::VecDeque;
pub struct BuildWorker { pub struct BuildWorker {
cloner: checkout::CachedCloner, cloner: checkout::CachedCloner,
nix: nix::Nix, nix: nix::Nix,

View file

@ -2,6 +2,7 @@ use crate::checkout::CachedProjectCo;
use crate::commitstatus::CommitStatus; use crate::commitstatus::CommitStatus;
use crate::evalchecker::EvalChecker; use crate::evalchecker::EvalChecker;
use crate::tasks::eval::{EvaluationComplete, EvaluationStrategy, StepResult}; use crate::tasks::eval::{EvaluationComplete, EvaluationStrategy, StepResult};
use std::path::Path; use std::path::Path;
#[derive(Default)] #[derive(Default)]

View file

@ -1,14 +1,17 @@
pub mod stdenvs;
pub use self::stdenvs::Stdenvs;
mod nixpkgs;
pub use self::nixpkgs::NixpkgsStrategy;
mod generic; mod generic;
mod nixpkgs;
pub mod stdenvs;
pub use self::generic::GenericStrategy; pub use self::generic::GenericStrategy;
pub use self::nixpkgs::NixpkgsStrategy;
pub use self::stdenvs::Stdenvs;
use crate::checkout::CachedProjectCo; use crate::checkout::CachedProjectCo;
use crate::commitstatus::{CommitStatus, CommitStatusError}; use crate::commitstatus::{CommitStatus, CommitStatusError};
use crate::evalchecker::EvalChecker; use crate::evalchecker::EvalChecker;
use crate::message::buildjob::BuildJob; use crate::message::buildjob::BuildJob;
use hubcaps::checks::CheckRunOptions; use hubcaps::checks::CheckRunOptions;
use std::path::Path; use std::path::Path;
pub trait EvaluationStrategy { pub trait EvaluationStrategy {

View file

@ -2,29 +2,29 @@ use crate::checkout::CachedProjectCo;
use crate::commentparser::Subset; use crate::commentparser::Subset;
use crate::commitstatus::CommitStatus; use crate::commitstatus::CommitStatus;
use crate::evalchecker::EvalChecker; use crate::evalchecker::EvalChecker;
use crate::maintainers; use crate::maintainers::{self, ImpactedMaintainers};
use crate::maintainers::ImpactedMaintainers;
use crate::message::buildjob::BuildJob; use crate::message::buildjob::BuildJob;
use crate::message::evaluationjob::EvaluationJob; use crate::message::evaluationjob::EvaluationJob;
use crate::nix; use crate::nix::{self, Nix};
use crate::nix::Nix;
use crate::nixenv::HydraNixEnv; use crate::nixenv::HydraNixEnv;
use crate::outpathdiff::{OutPathDiff, PackageArch}; use crate::outpathdiff::{OutPathDiff, PackageArch};
use crate::tagger::{MaintainerPRTagger, PathsTagger, RebuildTagger}; use crate::tagger::{
use crate::tagger::{PkgsAddedRemovedTagger, StdenvTagger}; MaintainerPRTagger, PathsTagger, PkgsAddedRemovedTagger, RebuildTagger, StdenvTagger,
};
use crate::tasks::eval::{ use crate::tasks::eval::{
stdenvs::Stdenvs, Error, EvaluationComplete, EvaluationStrategy, StepResult, stdenvs::Stdenvs, Error, EvaluationComplete, EvaluationStrategy, StepResult,
}; };
use crate::tasks::evaluate::make_gist; use crate::tasks::evaluate::{make_gist, update_labels};
use crate::tasks::evaluate::update_labels;
use chrono::Utc; use chrono::Utc;
use hubcaps::checks::{CheckRunOptions, CheckRunState, Conclusion, Output}; use hubcaps::checks::{CheckRunOptions, CheckRunState, Conclusion, Output};
use hubcaps::gists::Gists; use hubcaps::gists::Gists;
use hubcaps::issues::{Issue, IssueRef}; use hubcaps::issues::{Issue, IssueRef};
use hubcaps::repositories::Repository; use hubcaps::repositories::Repository;
use uuid::Uuid;
use std::collections::HashMap; use std::collections::HashMap;
use std::path::Path; use std::path::Path;
use uuid::Uuid;
pub struct NixpkgsStrategy<'a> { pub struct NixpkgsStrategy<'a> {
job: &'a EvaluationJob, job: &'a EvaluationJob,

View file

@ -1,5 +1,6 @@
use crate::files::file_to_str; use crate::files::file_to_str;
use crate::nix; use crate::nix;
use std::path::PathBuf; use std::path::PathBuf;
enum StdenvFrom { enum StdenvFrom {

View file

@ -1,8 +1,4 @@
/// This is what evaluates every pull-request /// This is what evaluates every pull-request
extern crate amqp;
extern crate env_logger;
extern crate uuid;
use crate::acl::ACL; use crate::acl::ACL;
use crate::checkout; use crate::checkout;
use crate::commitstatus::{CommitStatus, CommitStatusError}; use crate::commitstatus::{CommitStatus, CommitStatusError};
@ -10,16 +6,16 @@ use crate::config::GithubAppVendingMachine;
use crate::files::file_to_str; use crate::files::file_to_str;
use crate::message::{buildjob, evaluationjob}; use crate::message::{buildjob, evaluationjob};
use crate::nix; use crate::nix;
use crate::stats; use crate::stats::{self, Event};
use crate::stats::Event;
use crate::systems; use crate::systems;
use crate::tasks::eval; use crate::tasks::eval;
use crate::worker; use crate::worker;
use amqp::protocol::basic::{BasicProperties, Deliver}; use amqp::protocol::basic::{BasicProperties, Deliver};
use hubcaps;
use hubcaps::checks::CheckRunOptions; use hubcaps::checks::CheckRunOptions;
use hubcaps::gists::Gists; use hubcaps::gists::Gists;
use hubcaps::issues::Issue; use hubcaps::issues::Issue;
use std::collections::HashMap; use std::collections::HashMap;
use std::path::Path; use std::path::Path;
use std::sync::RwLock; use std::sync::RwLock;

View file

@ -1,12 +1,9 @@
extern crate amqp;
extern crate env_logger;
use crate::acl; use crate::acl;
use crate::ghevent; use crate::ghevent;
use crate::message::{evaluationjob, Pr, Repo}; use crate::message::{evaluationjob, Pr, Repo};
use crate::worker; use crate::worker;
use amqp::protocol::basic::{BasicProperties, Deliver}; use amqp::protocol::basic::{BasicProperties, Deliver};
use serde_json;
pub struct EvaluationFilterWorker { pub struct EvaluationFilterWorker {
acl: acl::ACL, acl: acl::ACL,

View file

@ -1,15 +1,10 @@
extern crate amqp;
extern crate env_logger;
extern crate uuid;
use crate::acl; use crate::acl;
use crate::commentparser; use crate::commentparser;
use crate::ghevent; use crate::ghevent;
use crate::message::{buildjob, evaluationjob, Pr, Repo}; use crate::message::{buildjob, evaluationjob, Pr, Repo};
use crate::worker; use crate::worker;
use amqp::protocol::basic::{BasicProperties, Deliver}; use amqp::protocol::basic::{BasicProperties, Deliver};
use hubcaps;
use serde_json;
use uuid::Uuid; use uuid::Uuid;
pub struct GitHubCommentWorker { pub struct GitHubCommentWorker {

View file

@ -1,15 +1,12 @@
extern crate amqp;
extern crate env_logger;
use crate::config::GithubAppVendingMachine; use crate::config::GithubAppVendingMachine;
use crate::message::buildjob::{BuildJob, QueuedBuildJobs}; use crate::message::buildjob::{BuildJob, QueuedBuildJobs};
use crate::message::buildresult::{BuildResult, BuildStatus, LegacyBuildResult}; use crate::message::buildresult::{BuildResult, BuildStatus, LegacyBuildResult};
use crate::message::Repo; use crate::message::Repo;
use crate::worker; use crate::worker;
use amqp::protocol::basic::{BasicProperties, Deliver}; use amqp::protocol::basic::{BasicProperties, Deliver};
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use hubcaps::checks::{CheckRunOptions, CheckRunState, Conclusion, Output}; use hubcaps::checks::{CheckRunOptions, CheckRunState, Conclusion, Output};
use serde_json;
pub struct GitHubCommentPoster { pub struct GitHubCommentPoster {
github_vend: GithubAppVendingMachine, github_vend: GithubAppVendingMachine,

View file

@ -1,15 +1,12 @@
extern crate amqp;
extern crate env_logger;
use crate::message::buildlogmsg::{BuildLogMsg, BuildLogStart}; use crate::message::buildlogmsg::{BuildLogMsg, BuildLogStart};
use crate::message::buildresult::BuildResult; use crate::message::buildresult::BuildResult;
use crate::worker; use crate::worker;
use crate::writetoline::LineWriter; use crate::writetoline::LineWriter;
use amqp::protocol::basic::{BasicProperties, Deliver}; use amqp::protocol::basic::{BasicProperties, Deliver};
use lru_cache::LruCache; use lru_cache::LruCache;
use serde_json;
use std::fs; use std::fs::{self, File, OpenOptions};
use std::fs::{File, OpenOptions};
use std::io::Write; use std::io::Write;
use std::path::{Component, PathBuf}; use std::path::{Component, PathBuf};

View file

@ -1,10 +1,7 @@
extern crate amqp;
extern crate env_logger;
use crate::stats; use crate::stats;
use crate::worker; use crate::worker;
use amqp::protocol::basic::{BasicProperties, Deliver}; use amqp::protocol::basic::{BasicProperties, Deliver};
use serde_json;
pub struct StatCollectorWorker<E> { pub struct StatCollectorWorker<E> {
events: E, events: E,

View file

@ -1,8 +1,7 @@
use amqp::protocol::basic::{BasicProperties, Deliver}; use amqp::protocol::basic::{BasicProperties, Deliver};
use amqp::Basic; use amqp::{Basic, Channel, Consumer};
use amqp::{Channel, Consumer};
use serde::Serialize; use serde::Serialize;
use serde_json;
use std::marker::Send; use std::marker::Send;
pub struct Worker<T: SimpleWorker> { pub struct Worker<T: SimpleWorker> {

View file

@ -1,9 +1,5 @@
use std::fs::File; use std::fs::File;
use std::io::BufRead; use std::io::{BufRead, BufReader, Seek, SeekFrom, Write};
use std::io::BufReader;
use std::io::Seek;
use std::io::SeekFrom;
use std::io::Write;
pub struct LineWriter { pub struct LineWriter {
file: File, file: File,