release: add 'architecture' helper

which returns if a file reference is architecture specific, and for
which architecture it is relevant.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2022-09-15 15:09:15 +02:00 committed by Thomas Lamprecht
parent 566981077c
commit f54534cc37

View File

@ -228,6 +228,22 @@ impl FileReferenceType {
} }
} }
pub fn architecture(&self) -> Option<&Architecture> {
match self {
FileReferenceType::Commands(arch, _)
| FileReferenceType::Contents(arch, _)
| FileReferenceType::ContentsUdeb(arch, _)
| FileReferenceType::Packages(arch, _) => Some(arch),
FileReferenceType::PseudoRelease(arch) => arch.as_ref(),
FileReferenceType::Unknown
| FileReferenceType::PDiff
| FileReferenceType::Sources(_)
| FileReferenceType::Dep11(_)
| FileReferenceType::Translation(_)
| FileReferenceType::Ignored => None,
}
}
pub fn is_package_index(&self) -> bool { pub fn is_package_index(&self) -> bool {
matches!(self, FileReferenceType::Packages(_, _)) matches!(self, FileReferenceType::Packages(_, _))
} }