@@ -7,6 +7,8 @@ use std::collections::HashMap;
7
7
use std:: io:: BufReader ;
8
8
use std:: io:: prelude:: * ;
9
9
10
+ pub const BIN_NMU_PREFIX : & str = "+b" ;
11
+
10
12
// TODO: support more archs
11
13
pub fn any_architectures ( ) -> Vec < String > {
12
14
vec ! [
@@ -32,9 +34,17 @@ impl SourcePkgBucket {
32
34
}
33
35
}
34
36
35
- pub fn get ( & self , pkg : & DebianBinPkg ) -> Result < & DebianSourcePkg > {
37
+ pub fn get ( & self , pkg : & DebianBinPkg ) -> Result < DebianSourcePkg > {
36
38
let ( name, version) = & pkg. source ;
37
- let list = self . pkgs . get ( name)
39
+ let bin_nmu = pkg
40
+ . version
41
+ . rfind ( BIN_NMU_PREFIX )
42
+ . map ( |idx| pkg. version . split_at ( idx) . 1 )
43
+ . filter ( |num| num[ BIN_NMU_PREFIX . len ( ) ..] . parse :: < u64 > ( ) . is_ok ( ) )
44
+ . unwrap_or ( "" ) ;
45
+ let list = self
46
+ . pkgs
47
+ . get ( name)
38
48
. with_context ( || anyhow ! ( "No source package found with name: {:?}" , name) ) ?;
39
49
40
50
// we currently track if the version was set explicitly or implicitly, keeping track just in case
@@ -45,7 +55,9 @@ impl SourcePkgBucket {
45
55
46
56
for src in list {
47
57
if src. version == * version {
48
- return Ok ( src) ;
58
+ let mut src_cpy = src. clone ( ) ;
59
+ src_cpy. version . push_str ( bin_nmu) ;
60
+ return Ok ( src_cpy) ;
49
61
}
50
62
}
51
63
@@ -59,7 +71,7 @@ pub enum VersionConstraint {
59
71
Implicit ( String ) ,
60
72
}
61
73
62
- #[ derive( Debug , PartialEq , Eq ) ]
74
+ #[ derive( Debug , PartialEq , Eq , Clone ) ]
63
75
pub struct DebianSourcePkg {
64
76
pub base : String ,
65
77
pub binary : Vec < String > ,
@@ -366,7 +378,7 @@ pub async fn sync(sync: &PkgsSync) -> Result<Vec<PkgGroup>> {
366
378
let src = sources. get ( & pkg) ?;
367
379
debug ! ( "Matched binary package to source package: {:?} {:?}" , src. base, src. version) ;
368
380
369
- out. push ( src, pkg, & sync. source , sync. distro . clone ( ) , sync. suite . clone ( ) ) ;
381
+ out. push ( & src, pkg, & sync. source , sync. distro . clone ( ) , sync. suite . clone ( ) ) ;
370
382
}
371
383
}
372
384
}
@@ -1015,21 +1027,26 @@ Section: mail
1015
1027
let cursor = Cursor :: new ( bytes) ;
1016
1028
let src_pkgs = extract_pkgs_uncompressed :: < DebianSourcePkg , _ > ( cursor) . unwrap ( ) ;
1017
1029
1030
+ let mut sources = SourcePkgBucket :: new ( ) ;
1031
+ for pkg in src_pkgs {
1032
+ sources. push ( pkg) ;
1033
+ }
1034
+
1018
1035
let mut state = SyncState :: new ( ) ;
1019
1036
for bin in bin_pkgs {
1020
- state. push ( & src_pkgs[ 0 ] , bin, "https://deb.debian.org/debian" , "debian" . to_string ( ) , "main" . to_string ( ) ) ;
1037
+ let src = sources. get ( & bin) . unwrap ( ) ;
1038
+ state. push ( & src, bin, "https://deb.debian.org/debian" , "debian" . to_string ( ) , "main" . to_string ( ) ) ;
1021
1039
}
1022
1040
1023
1041
let mut groups = HashMap :: new ( ) ;
1024
1042
groups. insert ( "courier" . to_string ( ) , vec ! [
1025
1043
PkgGroup {
1026
1044
name: "courier" . to_string( ) ,
1027
- version: "1.0.16-3" . to_string( ) ,
1045
+ version: "1.0.16-3+b1 " . to_string( ) ,
1028
1046
distro: "debian" . to_string( ) ,
1029
1047
suite: "main" . to_string( ) ,
1030
1048
architecture: "amd64" . to_string( ) ,
1031
- // TODO: correct buildinfo file is https://buildinfos.debian.net/buildinfo-pool/c/courier/courier_1.0.16-3+b1_amd64.buildinfo
1032
- input_url: Some ( "https://buildinfos.debian.net/buildinfo-pool/c/courier/courier_1.0.16-3_amd64.buildinfo" . to_string( ) ) ,
1049
+ input_url: Some ( "https://buildinfos.debian.net/buildinfo-pool/c/courier/courier_1.0.16-3+b1_amd64.buildinfo" . to_string( ) ) ,
1033
1050
artifacts: vec![
1034
1051
PkgArtifact {
1035
1052
name: "courier-base" . to_string( ) ,
0 commit comments