Skip to content
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ dput PROJECT DSC_FILE
[--build-info-out BUILD_INFO_FILE=build-info.json]
[--message MESSAGE]
[--rebuild-if-unchanged]
[--exclude-arch EXCLUDED_ARCH]
[--exclude-repo EXCLUDED_REPO]
```

This will upload the given .dsc file, as well as any files referenced by it, to
Expand Down
8 changes: 8 additions & 0 deletions obo-core/src/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ pub struct DputAction {
pub rebuild_if_unchanged: bool,
#[clap(long, default_value = "")]
pub message: String,
#[clap(long)]
pub exclude_arch: Vec<String>,
#[clap(long)]
pub exclude_repo: Vec<String>,
}

#[derive(Parser, Debug)]
Expand Down Expand Up @@ -233,6 +237,8 @@ impl Actions {
// Getting disabled repos has to happen *after* the upload,
// since the new version can change the supported architectures.
disabled_repos: DisabledRepos::Keep,
exclude_arch: args.exclude_arch.clone(),
exclude_repo: args.exclude_repo.clone(),
},
)
.await?;
Expand Down Expand Up @@ -264,6 +270,8 @@ impl Actions {
disabled_repos: DisabledRepos::Skip {
wait_options: Default::default(),
},
exclude_arch: args.exclude_arch,
exclude_repo: args.exclude_repo,
Comment thread
refi64 marked this conversation as resolved.
},
)
.await?
Expand Down
111 changes: 110 additions & 1 deletion obo-core/src/build_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ pub enum DisabledRepos {
pub struct BuildMetaOptions {
pub history_retrieval: BuildHistoryRetrieval,
pub disabled_repos: DisabledRepos,
pub exclude_arch: Vec<String>,
pub exclude_repo: Vec<String>,
}

#[instrument(skip(client))]
Expand Down Expand Up @@ -156,7 +158,17 @@ impl BuildMeta {
let mut repos = HashMap::new();

for repo_meta in project_meta.repositories {
if options.exclude_repo.contains(&repo_meta.name) {
debug!(repo = %repo_meta.name, "Excluded by options");
continue;
}

for arch in repo_meta.arches {
if options.exclude_arch.contains(&arch) {
debug!(repo = %repo_meta.name, %arch, "Excluded by options");
continue;
}

if let DisabledRepos::Skip { wait_options } = &options.disabled_repos {
let status = get_status_when_ready(
&client,
Expand Down Expand Up @@ -343,6 +355,8 @@ mod tests {
disabled_repos: DisabledRepos::Skip {
wait_options: Default::default()
},
exclude_arch: vec![],
exclude_repo: vec![],
}
)
.await
Expand All @@ -359,6 +373,25 @@ mod tests {
let arch_2 = assert_some!(build_info.iter().find(|e| e.repo_arch == repo_arch_2));
assert_none!(arch_2.prev_endtime_for_commit);

let meta = assert_ok!(
BuildMeta::get(
client.clone(),
TEST_PROJECT.to_owned(),
TEST_PACKAGE_1.to_owned(),
&BuildMetaOptions {
history_retrieval: BuildHistoryRetrieval::Full,
disabled_repos: DisabledRepos::Skip {
wait_options: Default::default()
},
exclude_arch: vec![TEST_ARCH_1.to_string()],
exclude_repo: vec![],
}
)
.await
);
assert_eq!(meta.repos.len(), 1);
assert!(meta.repos.contains_key(&repo_arch_2));

let meta = assert_ok!(
BuildMeta::get(
client.clone(),
Expand All @@ -369,6 +402,8 @@ mod tests {
disabled_repos: DisabledRepos::Skip {
wait_options: Default::default()
},
exclude_arch: vec![],
exclude_repo: vec![],
}
)
.await
Expand Down Expand Up @@ -416,6 +451,8 @@ mod tests {
disabled_repos: DisabledRepos::Skip {
wait_options: Default::default()
},
exclude_arch: vec![],
exclude_repo: vec![],
}
)
.await
Expand Down Expand Up @@ -450,6 +487,8 @@ mod tests {
disabled_repos: DisabledRepos::Skip {
wait_options: Default::default()
},
exclude_arch: vec![],
exclude_repo: vec![],
}
)
.await
Expand Down Expand Up @@ -485,6 +524,8 @@ mod tests {
disabled_repos: DisabledRepos::Skip {
wait_options: Default::default()
},
exclude_arch: vec![],
exclude_repo: vec![],
}
)
.await
Expand All @@ -499,6 +540,8 @@ mod tests {
&BuildMetaOptions {
history_retrieval: BuildHistoryRetrieval::Full,
disabled_repos: DisabledRepos::Keep,
exclude_arch: vec![],
exclude_repo: vec![],
}
)
.await
Expand All @@ -507,6 +550,68 @@ mod tests {

assert_ok!(meta.remove_disabled_repos(&Default::default()).await);
assert_eq!(meta.repos.len(), 0);

mock.add_or_update_repository(
TEST_PROJECT,
TEST_REPO.to_owned(),
TEST_ARCH_1.to_owned(),
MockRepositoryCode::Finished,
);

mock.add_or_update_repository(
TEST_PROJECT,
TEST_REPO.to_owned(),
TEST_ARCH_2.to_owned(),
MockRepositoryCode::Finished,
);

mock.add_or_update_repository(
TEST_PROJECT,
TEST_REPO_EXTRA.to_owned(),
TEST_ARCH_1.to_owned(),
MockRepositoryCode::Finished,
);

mock.add_or_update_repository(
TEST_PROJECT,
TEST_REPO_EXTRA.to_owned(),
TEST_ARCH_2.to_owned(),
MockRepositoryCode::Finished,
);

let meta = assert_ok!(
BuildMeta::get(
client.clone(),
TEST_PROJECT.to_owned(),
TEST_PACKAGE_1.to_owned(),
&BuildMetaOptions {
history_retrieval: BuildHistoryRetrieval::Full,
disabled_repos: DisabledRepos::Keep,
exclude_arch: vec![],
exclude_repo: vec![],
}
)
.await
);
assert_eq!(meta.repos.len(), 4);

let meta = assert_ok!(
BuildMeta::get(
client.clone(),
TEST_PROJECT.to_owned(),
TEST_PACKAGE_1.to_owned(),
&BuildMetaOptions {
history_retrieval: BuildHistoryRetrieval::Full,
disabled_repos: DisabledRepos::Keep,
exclude_arch: vec![],
exclude_repo: vec![TEST_REPO_EXTRA.to_owned()],
}
)
.await
);
assert_eq!(meta.repos.len(), 2);
assert!(meta.repos.contains_key(&repo_arch_1));
assert!(meta.repos.contains_key(&repo_arch_2));
}

#[rstest]
Expand Down Expand Up @@ -556,7 +661,9 @@ mod tests {
history_retrieval: BuildHistoryRetrieval::Full,
disabled_repos: DisabledRepos::Skip {
wait_options: Default::default()
}
},
exclude_arch: vec![],
exclude_repo: vec![],
}
)
.await
Expand Down Expand Up @@ -611,6 +718,8 @@ mod tests {
} else {
DisabledRepos::Keep
},
exclude_arch: vec![],
exclude_repo: vec![],
}
)
.await
Expand Down
1 change: 1 addition & 0 deletions obo-test-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub const TEST_PROJECT: &str = "foo";
pub const TEST_PACKAGE_1: &str = "bar";
pub const TEST_PACKAGE_2: &str = "baz";
pub const TEST_REPO: &str = "repo";
pub const TEST_REPO_EXTRA: &str = "repo_extra";
pub const TEST_ARCH_1: &str = "aarch64";
pub const TEST_ARCH_2: &str = "x86_64";

Expand Down