RpmInfo 增加 sa 字段
Signed-off-by: Jia Chao <jiac13@chinaunicom.cn>
This commit is contained in:
parent
39ee661dc7
commit
b8a1b7c5c3
|
@ -163,6 +163,7 @@ impl UpdateInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
rpminfo.set("file", xmlreader.next_characters());
|
rpminfo.set("file", xmlreader.next_characters());
|
||||||
|
rpminfo.set("sa", self.id.clone());
|
||||||
self.pkglist.push(rpminfo);
|
self.pkglist.push(rpminfo);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
@ -189,6 +190,8 @@ pub struct RpmInfo {
|
||||||
arch: String,
|
arch: String,
|
||||||
|
|
||||||
file: String,
|
file: String,
|
||||||
|
|
||||||
|
sa: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RpmInfo {
|
impl RpmInfo {
|
||||||
|
@ -200,6 +203,7 @@ impl RpmInfo {
|
||||||
release: String::new(),
|
release: String::new(),
|
||||||
arch: String::new(),
|
arch: String::new(),
|
||||||
file: String::new(),
|
file: String::new(),
|
||||||
|
sa: String::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,6 +216,7 @@ impl RpmInfo {
|
||||||
"release" => self.release = value,
|
"release" => self.release = value,
|
||||||
"arch" => self.arch = value,
|
"arch" => self.arch = value,
|
||||||
"file" => self.file = value,
|
"file" => self.file = value,
|
||||||
|
"sa" => self.sa = value,
|
||||||
_ => error!("Unknow field: {key}"),
|
_ => error!("Unknow field: {key}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,6 +249,10 @@ impl RpmInfo {
|
||||||
&self.file
|
&self.file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn sa(&self) -> &str {
|
||||||
|
&self.sa
|
||||||
|
}
|
||||||
|
|
||||||
pub fn evr(&self) -> String {
|
pub fn evr(&self) -> String {
|
||||||
if self.epoch().is_some() {
|
if self.epoch().is_some() {
|
||||||
format!("{}:{}-{}", self.epoch, self.version, self.release)
|
format!("{}:{}-{}", self.epoch, self.version, self.release)
|
||||||
|
|
|
@ -12,6 +12,7 @@ fn it_works() {
|
||||||
let severity = cvrf_xmlparser::Severity::Important;
|
let severity = cvrf_xmlparser::Severity::Important;
|
||||||
let release = "openEuler";
|
let release = "openEuler";
|
||||||
let cves = 10;
|
let cves = 10;
|
||||||
|
let sa = "openEuler-SA-2022-1587";
|
||||||
|
|
||||||
let updateinfo = &db.db[0];
|
let updateinfo = &db.db[0];
|
||||||
assert_eq!(updateinfo.id, id);
|
assert_eq!(updateinfo.id, id);
|
||||||
|
@ -19,6 +20,7 @@ fn it_works() {
|
||||||
assert_eq!(updateinfo.severity, severity);
|
assert_eq!(updateinfo.severity, severity);
|
||||||
assert_eq!(updateinfo.release, release);
|
assert_eq!(updateinfo.release, release);
|
||||||
assert_eq!(updateinfo.cves.len(), cves);
|
assert_eq!(updateinfo.cves.len(), cves);
|
||||||
|
assert_eq!(updateinfo.pkglist[0].sa(), sa);
|
||||||
|
|
||||||
assert!(true);
|
assert!(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user