Skip to content

Commit

Permalink
Support binNMUs in Debian (Closes #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
jspricke committed Nov 5, 2024
1 parent 455997a commit 07aa773
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tools/src/schedule/debian.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ impl SourcePkgBucket {
}
}

pub fn get(&self, pkg: &DebianBinPkg) -> Result<&DebianSourcePkg> {
pub fn get(&self, pkg: &DebianBinPkg) -> Result<DebianSourcePkg> {
let (name, version) = &pkg.source;
let bin_nmu = pkg.version.rfind("+b")
.map(|idx| pkg.version.split_at(idx).1)
.filter(|num| num[2..].parse::<u64>().is_ok())
.unwrap_or("");
let list = self.pkgs.get(name)
.with_context(|| anyhow!("No source package found with name: {:?}", name))?;

Expand All @@ -45,7 +49,9 @@ impl SourcePkgBucket {

for src in list {
if src.version == *version {
return Ok(src);
let mut src_cpy = src.clone();
src_cpy.version.push_str(&bin_nmu);
return Ok(src_cpy);
}
}

Expand All @@ -59,7 +65,7 @@ pub enum VersionConstraint {
Implicit(String),
}

#[derive(Debug, PartialEq, Eq)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct DebianSourcePkg {
pub base: String,
pub binary: Vec<String>,
Expand Down Expand Up @@ -366,7 +372,7 @@ pub async fn sync(sync: &PkgsSync) -> Result<Vec<PkgGroup>> {
let src = sources.get(&pkg)?;
debug!("Matched binary package to source package: {:?} {:?}", src.base, src.version);

out.push(src, pkg, &sync.source, sync.distro.clone(), sync.suite.clone());
out.push(&src, pkg, &sync.source, sync.distro.clone(), sync.suite.clone());
}
}
}
Expand Down

0 comments on commit 07aa773

Please sign in to comment.