mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-07 19:01:04 +00:00
release: add Commands file reference type
used by command-not-found to lookup which package ships which command. Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
0a9685ed4a
commit
566981077c
@ -51,6 +51,8 @@ pub type Component = String;
|
|||||||
/// `Packages` and `Sources` will contain further reference to binary or source package files.
|
/// `Packages` and `Sources` will contain further reference to binary or source package files.
|
||||||
/// These are handled in `PackagesFile` and `SourcesFile` respectively.
|
/// These are handled in `PackagesFile` and `SourcesFile` respectively.
|
||||||
pub enum FileReferenceType {
|
pub enum FileReferenceType {
|
||||||
|
/// A `Commands` index listing command to package mappings
|
||||||
|
Commands(Architecture, Option<CompressionType>),
|
||||||
/// A `Contents` index listing contents of binary packages
|
/// A `Contents` index listing contents of binary packages
|
||||||
Contents(Architecture, Option<CompressionType>),
|
Contents(Architecture, Option<CompressionType>),
|
||||||
/// A `Contents` index listing contents of binary udeb packages
|
/// A `Contents` index listing contents of binary udeb packages
|
||||||
@ -123,6 +125,20 @@ impl FileReferenceType {
|
|||||||
Ok(FileReferenceType::Unknown)
|
Ok(FileReferenceType::Unknown)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"cnf" => {
|
||||||
|
if let Some(rest) = rest.strip_prefix("Commands-") {
|
||||||
|
if let Some((arch, ext)) = rest.rsplit_once('.') {
|
||||||
|
Ok(FileReferenceType::Commands(
|
||||||
|
arch.to_owned(),
|
||||||
|
FileReferenceType::match_compression(ext).ok().flatten(),
|
||||||
|
))
|
||||||
|
} else {
|
||||||
|
Ok(FileReferenceType::Commands(rest.to_owned(), None))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Ok(FileReferenceType::Unknown)
|
||||||
|
}
|
||||||
|
},
|
||||||
"dep11" => {
|
"dep11" => {
|
||||||
if let Some((_path, ext)) = rest.rsplit_once('.') {
|
if let Some((_path, ext)) = rest.rsplit_once('.') {
|
||||||
Ok(FileReferenceType::Dep11(
|
Ok(FileReferenceType::Dep11(
|
||||||
@ -198,7 +214,8 @@ impl FileReferenceType {
|
|||||||
|
|
||||||
pub fn compression(&self) -> Option<CompressionType> {
|
pub fn compression(&self) -> Option<CompressionType> {
|
||||||
match *self {
|
match *self {
|
||||||
FileReferenceType::Contents(_, comp)
|
FileReferenceType::Commands(_, comp)
|
||||||
|
| FileReferenceType::Contents(_, comp)
|
||||||
| FileReferenceType::ContentsUdeb(_, comp)
|
| FileReferenceType::ContentsUdeb(_, comp)
|
||||||
| FileReferenceType::Packages(_, comp)
|
| FileReferenceType::Packages(_, comp)
|
||||||
| FileReferenceType::Sources(comp)
|
| FileReferenceType::Sources(comp)
|
||||||
|
Loading…
Reference in New Issue
Block a user