diff --git a/Cargo.lock b/Cargo.lock index 09b31ad..66dd57a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -302,6 +302,12 @@ dependencies = [ "once_cell", ] +[[package]] +name = "brace-expand" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3adb80ee272c844254166ea32c8ae11c211b3639a293fdde41b1645b6be2c62" + [[package]] name = "bumpalo" version = "3.11.1" @@ -1291,6 +1297,7 @@ name = "ofborg" version = "0.1.9" dependencies = [ "async-std", + "brace-expand", "chrono", "either", "fs2", diff --git a/README.md b/README.md index b3c35ba..e71452c 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Example commit titles and the builds they will start: | `vim: 1.0.0 -> 2.0.0` | `vim` | | `vagrant: Fix dependencies for version 2.0.2 ` | `vagrant` | | `python36Packages.requests,python27Packages.requests: 1.0.0 -> 2.0.0` | `python36Packages.requests`, `python27Packages.requests` | -| `python{2,3}Packages.requests: 1.0.0 -> 2.0.0` | _nothing_ | +| `python{2,3}Packages.requests: 1.0.0 -> 2.0.0` | `python2Packages.requests`, `python3Packages.requests` | When opening a PR with multiple commits, ofborg creates a single build job for all detected packages. If multiple commits get pushed to a PR one-by-one, each diff --git a/ofborg/Cargo.toml b/ofborg/Cargo.toml index 9029188..b919528 100644 --- a/ofborg/Cargo.toml +++ b/ofborg/Cargo.toml @@ -7,6 +7,7 @@ edition = "2018" [dependencies] async-std = { version = "=1.12.0", features = ["unstable", "tokio1"] } +brace-expand = "0.1.0" chrono = "0.4.22" either = "1.8.0" fs2 = "0.4.3" diff --git a/ofborg/src/tasks/eval/nixpkgs.rs b/ofborg/src/tasks/eval/nixpkgs.rs index 7f49b5c..5ffaa9c 100644 --- a/ofborg/src/tasks/eval/nixpkgs.rs +++ b/ofborg/src/tasks/eval/nixpkgs.rs @@ -16,6 +16,7 @@ use crate::tasks::evaluate::{get_prefix, make_gist, update_labels}; use std::path::Path; +use brace_expand::brace_expand; use chrono::Utc; use hubcaps::checks::{CheckRunOptions, CheckRunState, Conclusion, Output}; use hubcaps::gists::Gists; @@ -623,17 +624,9 @@ fn parse_commit_messages(messages: &[String]) -> Vec { .iter() .filter_map(|line| { // Convert "foo: some notes" in to "foo" - let parts: Vec<&str> = line.splitn(2, ':').collect(); - if parts.len() == 2 { - Some(parts[0]) - } else { - None - } - }) - .flat_map(|line| { - let pkgs: Vec<&str> = line.split(',').collect(); - pkgs + line.split_once(':').map(|(pre, _)| pre.trim()) }) + .flat_map(|line| brace_expand(&format!("{{{}}}", line))) .map(|line| line.trim().to_owned()) .collect() } @@ -646,8 +639,8 @@ mod tests { #[test] fn test_parse_commit_messages() { let expect: Vec<&str> = vec![ - "firefox{-esr", // don't support such fancy syntax - "}", // Don't support such fancy syntax + "firefox-esr", + "firefox", "firefox", "buildkite-agent", "python.pkgs.ptyprocess", @@ -655,6 +648,11 @@ mod tests { "android-studio-preview", "foo", "bar", + "firefox", + "firefox-bin", + "firefox-beta", + "firefox-beta-bin", + "librewolf", ]; assert_eq!( parse_commit_messages( @@ -671,6 +669,7 @@ mod tests { Merge pull request #34188 from dotlambda/home-assistant Merge pull request #34414 from dotlambda/postfix foo,bar: something here: yeah + firefox{,-beta}{,-bin}, librewolf: blah blah blah " .lines() .map(|l| l.to_owned())