Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eval/nixpkgs: parse more commit messages #642

Merged
merged 3 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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{27,310}Packages.requests: 1.0.0 -> 2.0.0` | `python27Packages.requests`, `python310Packages.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
Expand Down
1 change: 1 addition & 0 deletions ofborg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
25 changes: 13 additions & 12 deletions ofborg/src/tasks/eval/nixpkgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,17 +623,12 @@ fn parse_commit_messages(messages: &[String]) -> Vec<String> {
.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())
})
// NOTE: This transforms `{foo,bar}` into `{{foo,bar}}` and `foo,bar` into `{foo,bar}`,
// which allows both the old style (`foo,bar`) and the new style (`{foo,bar}`) to expand to
// `foo` and `bar`.
.flat_map(|line| brace_expand::brace_expand(&format!("{{{}}}", line)))
.map(|line| line.trim().to_owned())
.collect()
}
Expand All @@ -646,15 +641,20 @@ 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",
"python.pkgs.ptyprocess",
"android-studio-preview",
"foo",
"bar",
"firefox",
"firefox-bin",
"firefox-beta",
"firefox-beta-bin",
"librewolf",
];
assert_eq!(
parse_commit_messages(
Expand All @@ -671,6 +671,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())
Expand Down