11use crate :: errors:: * ;
22use colored:: * ;
33use chrono:: NaiveDateTime ;
4- use strum_macros:: { EnumString , AsRefStr , Display } ;
54use serde:: { Serialize , Deserialize } ;
65use std:: iter:: FromIterator ;
76use std:: ops:: Deref ;
@@ -13,23 +12,6 @@ pub mod config;
1312pub mod errors;
1413pub mod utils;
1514
16- #[ derive( Debug , Clone , Copy , PartialEq , Display , EnumString , AsRefStr , Serialize , Deserialize ) ]
17- #[ strum( serialize_all = "kebab-case" ) ]
18- #[ serde( rename_all = "kebab-case" ) ]
19- pub enum VersionCmp {
20- Basic ,
21- Debian ,
22- }
23-
24- impl VersionCmp {
25- pub fn detect_from_distro ( distro : & str ) -> VersionCmp {
26- match distro {
27- "debian" => VersionCmp :: Debian ,
28- _ => VersionCmp :: Basic ,
29- }
30- }
31- }
32-
3315#[ derive( Debug , PartialEq , Serialize , Deserialize ) ]
3416pub struct PkgRelease {
3517 pub name : String ,
@@ -39,16 +21,14 @@ pub struct PkgRelease {
3921 pub suite : String ,
4022 pub architecture : String ,
4123 pub artifact_url : String ,
42- pub input_url : Option < String > ,
4324 pub build_id : Option < i32 > ,
4425 pub built_at : Option < NaiveDateTime > ,
4526 pub has_diffoscope : bool ,
4627 pub has_attestation : bool ,
47- pub next_retry : Option < NaiveDateTime > ,
4828}
4929
5030impl PkgRelease {
51- pub fn new ( name : String , version : String , distro : String , suite : String , architecture : String , artifact_url : String , input_url : Option < String > ) -> PkgRelease {
31+ pub fn new ( name : String , version : String , distro : String , suite : String , architecture : String , artifact_url : String ) -> PkgRelease {
5232 PkgRelease {
5333 name,
5434 version,
@@ -57,45 +37,43 @@ impl PkgRelease {
5737 suite,
5838 architecture,
5939 artifact_url,
60- input_url,
6140 build_id : None ,
6241 built_at : None ,
6342 has_diffoscope : false ,
6443 has_attestation : false ,
65- next_retry : None ,
6644 }
6745 }
6846}
6947
70- #[ derive( Debug , PartialEq , Serialize , Deserialize ) ]
48+ #[ derive( Debug , PartialEq , Clone , Serialize , Deserialize ) ]
7149pub struct PkgGroup {
72- pub base : String ,
50+ pub name : String ,
7351 pub version : String ,
7452
7553 pub distro : String ,
7654 pub suite : String ,
7755 pub architecture : String ,
7856
79- pub input : Option < String > ,
57+ pub input_url : Option < String > ,
8058 pub artifacts : Vec < PkgArtifact > ,
8159}
8260
83- #[ derive( Debug , PartialEq , Serialize , Deserialize ) ]
61+ #[ derive( Debug , PartialEq , Clone , Serialize , Deserialize ) ]
8462pub struct PkgArtifact {
8563 pub name : String ,
8664 pub version : String ,
8765 pub url : String ,
8866}
8967
9068impl PkgGroup {
91- pub fn new ( base : String , version : String , distro : String , suite : String , architecture : String , input : Option < String > ) -> PkgGroup {
69+ pub fn new ( name : String , version : String , distro : String , suite : String , architecture : String , input_url : Option < String > ) -> PkgGroup {
9270 PkgGroup {
93- base ,
71+ name ,
9472 version,
9573 distro,
9674 suite,
9775 architecture,
98- input ,
76+ input_url ,
9977 artifacts : Vec :: new ( ) ,
10078 }
10179 }
@@ -104,9 +82,9 @@ impl PkgGroup {
10482 self . artifacts . push ( artifact) ;
10583 }
10684
107- pub fn input ( & self ) -> Result < & str > {
108- if let Some ( input ) = & self . input {
109- Ok ( input . as_str ( ) )
85+ pub fn input_url ( & self ) -> Result < & str > {
86+ if let Some ( input_url ) = & self . input_url {
87+ Ok ( input_url . as_str ( ) )
11088 } else if !self . artifacts . is_empty ( ) {
11189 let mut artifacts = Vec :: from_iter ( self . artifacts . iter ( ) . collect :: < Vec < _ > > ( ) ) ;
11290 artifacts. sort_by_key ( |a| & a. name ) ;
0 commit comments