rustfmt
This commit is contained in:
parent
cda4fa9e77
commit
cb42c4fa08
|
@ -12,8 +12,11 @@ impl ACL {
|
|||
};
|
||||
}
|
||||
|
||||
pub fn build_job_destinations_for_user_repo(&self, user: &str, repo: &str)
|
||||
-> Vec<(Option<String>, Option<String>)> {
|
||||
pub fn build_job_destinations_for_user_repo(
|
||||
&self,
|
||||
user: &str,
|
||||
repo: &str,
|
||||
) -> Vec<(Option<String>, Option<String>)> {
|
||||
if self.can_build_unrestricted(user, repo) {
|
||||
vec![(Some("build-jobs".to_owned()), None)]
|
||||
} else if self.can_build_restricted(user, repo) {
|
||||
|
|
|
@ -166,11 +166,13 @@ impl CachedProjectCo {
|
|||
String::from_utf8_lossy(&result.stdout)
|
||||
.lines()
|
||||
.map(|l| l.to_owned())
|
||||
.collect()
|
||||
.collect(),
|
||||
);
|
||||
} else {
|
||||
return Err(Error::new(ErrorKind::Other,
|
||||
String::from_utf8_lossy(&result.stderr).to_lowercase()));
|
||||
return Err(Error::new(
|
||||
ErrorKind::Other,
|
||||
String::from_utf8_lossy(&result.stderr).to_lowercase(),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -259,15 +261,17 @@ mod tests {
|
|||
|
||||
let cloner = cached_cloner(&workingdir.path());
|
||||
let project = cloner.project("commit-msg-list".to_owned(), bare.string());
|
||||
let working_co = project.clone_for("testing-commit-msgs".to_owned(), "123".to_owned()).expect("clone should work");
|
||||
let working_co = project
|
||||
.clone_for("testing-commit-msgs".to_owned(), "123".to_owned())
|
||||
.expect("clone should work");
|
||||
working_co.checkout_origin_ref(OsStr::new("master"));
|
||||
|
||||
let expect: Vec<String> = vec![
|
||||
"check out this cool PR".to_owned()
|
||||
];
|
||||
let expect: Vec<String> = vec!["check out this cool PR".to_owned()];
|
||||
|
||||
assert_eq!(
|
||||
working_co.commit_messages_from_head(&hash).expect("fetching messages should work"),
|
||||
working_co.commit_messages_from_head(&hash).expect(
|
||||
"fetching messages should work",
|
||||
),
|
||||
expect
|
||||
);
|
||||
}
|
||||
|
|
|
@ -17,12 +17,14 @@ type Exchange = String;
|
|||
type RoutingKey = String;
|
||||
|
||||
impl BuildJob {
|
||||
pub fn new(repo: Repo,
|
||||
pr: Pr,
|
||||
subset: Subset,
|
||||
attrs: Vec<String>,
|
||||
logs: Option<ExchangeQueue>,
|
||||
statusreport: Option<ExchangeQueue>) -> BuildJob {
|
||||
pub fn new(
|
||||
repo: Repo,
|
||||
pr: Pr,
|
||||
subset: Subset,
|
||||
attrs: Vec<String>,
|
||||
logs: Option<ExchangeQueue>,
|
||||
statusreport: Option<ExchangeQueue>,
|
||||
) -> BuildJob {
|
||||
|
||||
let logbackrk = format!(
|
||||
"{}.{}",
|
||||
|
@ -36,7 +38,9 @@ impl BuildJob {
|
|||
subset: Some(subset),
|
||||
attrs: attrs,
|
||||
logs: Some(logs.unwrap_or((Some("logs".to_owned()), Some(logbackrk)))),
|
||||
statusreport: Some(statusreport.unwrap_or((Some("build-results".to_owned()), None))),
|
||||
statusreport: Some(statusreport.unwrap_or(
|
||||
(Some("build-results".to_owned()), None),
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,11 @@ impl Actions {
|
|||
return vec![worker::Action::Ack];
|
||||
}
|
||||
|
||||
pub fn done(&mut self, _job: &MassRebuildJob, mut response: worker::Actions) -> worker::Actions {
|
||||
pub fn done(
|
||||
&mut self,
|
||||
_job: &MassRebuildJob,
|
||||
mut response: worker::Actions,
|
||||
) -> worker::Actions {
|
||||
response.push(worker::Action::Ack);
|
||||
return response;
|
||||
}
|
||||
|
|
|
@ -277,16 +277,21 @@ mod tests {
|
|||
fn safe_command_environment() {
|
||||
let nix = nix();
|
||||
|
||||
let ret: Result<File, File> = nix.run(nix.safe_command(
|
||||
"./environment.sh",
|
||||
build_path().as_path(),
|
||||
vec![],
|
||||
), true);
|
||||
let ret: Result<File, File> =
|
||||
nix.run(
|
||||
nix.safe_command("./environment.sh", build_path().as_path(), vec![]),
|
||||
true,
|
||||
);
|
||||
|
||||
assert_run(
|
||||
ret,
|
||||
Expect::Pass,
|
||||
vec!["HOME=/homeless-shelter", "NIX_PATH=nixpkgs=", "NIX_REMOTE=", "PATH="],
|
||||
vec![
|
||||
"HOME=/homeless-shelter",
|
||||
"NIX_PATH=nixpkgs=",
|
||||
"NIX_REMOTE=",
|
||||
"PATH=",
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -294,11 +299,10 @@ mod tests {
|
|||
fn safe_command_options() {
|
||||
let nix = nix();
|
||||
|
||||
let ret: Result<File, File> = nix.run(nix.safe_command(
|
||||
"echo",
|
||||
build_path().as_path(),
|
||||
vec![],
|
||||
), true);
|
||||
let ret: Result<File, File> = nix.run(
|
||||
nix.safe_command("echo", build_path().as_path(), vec![]),
|
||||
true,
|
||||
);
|
||||
|
||||
assert_run(
|
||||
ret,
|
||||
|
|
|
@ -113,7 +113,7 @@ impl worker::SimpleWorker for GitHubCommentWorker {
|
|||
subset,
|
||||
attrs,
|
||||
None,
|
||||
None
|
||||
None,
|
||||
);
|
||||
|
||||
for (exch, rk) in build_destinations.clone() {
|
||||
|
|
|
@ -194,9 +194,10 @@ impl<E: stats::SysEvents> worker::SimpleWorker for MassRebuildWorker<E> {
|
|||
return self.actions().skip(&job);
|
||||
}
|
||||
|
||||
let possibly_touched_packages = parse_commit_messages(
|
||||
co.commit_messages_from_head(&job.pr.head_sha).unwrap_or(vec!["".to_owned()])
|
||||
);
|
||||
let possibly_touched_packages =
|
||||
parse_commit_messages(co.commit_messages_from_head(&job.pr.head_sha).unwrap_or(
|
||||
vec!["".to_owned()],
|
||||
));
|
||||
|
||||
overall_status.set_with_description("Merging PR", hubcaps::statuses::State::Pending);
|
||||
|
||||
|
@ -380,12 +381,9 @@ impl<E: stats::SysEvents> worker::SimpleWorker for MassRebuildWorker<E> {
|
|||
state = hubcaps::statuses::State::Success;
|
||||
gist_url = None;
|
||||
|
||||
let mut try_build: Vec<String> = pkgs
|
||||
.keys()
|
||||
let mut try_build: Vec<String> = pkgs.keys()
|
||||
.map(|pkgarch| pkgarch.package.clone())
|
||||
.filter(|pkg| {
|
||||
possibly_touched_packages.contains(&pkg)
|
||||
})
|
||||
.filter(|pkg| possibly_touched_packages.contains(&pkg))
|
||||
.collect();
|
||||
try_build.sort();
|
||||
try_build.dedup();
|
||||
|
@ -678,9 +676,11 @@ fn parse_commit_messages(messages: Vec<String>) -> Vec<String> {
|
|||
None
|
||||
}
|
||||
})
|
||||
.flat_map(|line| { let pkgs: Vec<&str> = line.split(",").collect(); pkgs })
|
||||
.flat_map(|line| {
|
||||
let pkgs: Vec<&str> = line.split(",").collect();
|
||||
pkgs
|
||||
})
|
||||
.map(|line| line.trim().to_owned())
|
||||
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
@ -720,7 +720,8 @@ mod tests {
|
|||
"bar",
|
||||
];
|
||||
assert_eq!(
|
||||
parse_commit_messages("
|
||||
parse_commit_messages(
|
||||
"
|
||||
firefox{-esr,}: fix failing build due to the google-api-key
|
||||
Merge pull request #34483 from andir/dovecot-cve-2017-15132
|
||||
firefox: enable official branding
|
||||
|
@ -733,7 +734,11 @@ mod tests {
|
|||
Merge pull request #34188 from dotlambda/home-assistant
|
||||
Merge pull request #34414 from dotlambda/postfix
|
||||
foo,bar: something here: yeah
|
||||
".lines().map(|l| l.to_owned()).collect()),
|
||||
"
|
||||
.lines()
|
||||
.map(|l| l.to_owned())
|
||||
.collect(),
|
||||
),
|
||||
expect
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue