pull: refactor to remove series argument
All checks were successful
CI / build (push) Successful in 9m31s

This commit is contained in:
2026-01-11 12:36:19 +01:00
parent 2f43ed1597
commit 70e6d8c051
4 changed files with 14 additions and 11 deletions

View File

@@ -339,11 +339,11 @@ async fn fetch_archive_sources(
/// The source will be extracted under 'package/package'.
pub async fn pull(
package_info: &PackageInfo,
series: Option<&str>,
cwd: Option<&Path>,
progress: ProgressCallback<'_>,
) -> Result<(), Box<dyn Error>> {
let package = &package_info.stanza.package;
let series = &package_info.series;
let package_dir = if let Some(path) = cwd {
path.join(package)
} else {
@@ -355,11 +355,14 @@ pub async fn pull(
// We have found a preferred VCS (git repository) for the package, so
// we fetch the package from that repo.
// Depending on target series, we pick target branch; if no series is specified,
// Depending on target series, we pick target branch; if latest series is specified,
// we target the development branch, i.e. the default branch
let branch_name = if let Some(s) = series {
let branch_name = if crate::package_info::get_ordered_series(package_info.dist.as_str())
.await?[0]
!= *series
{
if package_info.dist == "ubuntu" {
Some(format!("{}/{}", package_info.dist, s))
Some(format!("{}/{}", package_info.dist, series))
} else {
// Debian does not have reliable branch naming...
// For now, we skip that part and clone default
@@ -438,7 +441,7 @@ mod tests {
let info = crate::package_info::lookup(package, None, series, "", dist, None)
.await
.unwrap();
pull(&info, series, Some(cwd), None).await.unwrap();
pull(&info, Some(cwd), None).await.unwrap();
let package_dir = cwd.join(package);
assert!(package_dir.exists());