1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#![allow(renamed_and_removed_lints)]
use std::io;
use std::num;
use std::path::PathBuf;
use std::time;
quick_error! {
#[derive(Debug)]
#[non_exhaustive]
pub enum CargoDebError {
Io(err: io::Error) {
from()
display("I/O error: {}", err)
source(err)
}
TomlParsing(err: cargo_toml::Error) {
from()
display("Unable to parse Cargo.toml")
source(err)
}
IoFile(msg: &'static str, err: io::Error, file: PathBuf) {
display("{}: {}", msg, file.display())
source(err)
}
CommandFailed(err: io::Error, cmd: &'static str) {
display("Command {} failed to launch", cmd)
source(err)
}
CommandError(msg: &'static str, arg: String, reason: Vec<u8>) {
display("{} ({}): {}", msg, arg, String::from_utf8_lossy(reason))
}
Str(msg: &'static str) {
display("{}", msg)
from()
}
NumParse(msg: &'static str, err: num::ParseIntError) {
display("{}", msg)
source(err)
}
InstallFailed {
display("installation failed, because dpkg -i returned error")
}
BuildFailed {
display("build failed")
}
DebHelperReplaceFailed(name: PathBuf) {
display("unable to replace #DEBHELPER# token in maintainer script '{}'", name.display())
}
StripFailed(name: PathBuf, reason: String) {
display("unable to strip binary '{}': {}", name.display(), reason)
}
SystemTime(err: time::SystemTimeError) {
from()
display("unable to get system time")
source(err)
}
ParseTOML(err: toml::de::Error) {
from()
display("unable to parse Cargo.toml")
source(err)
}
ParseJSON(err: serde_json::Error) {
from()
display("unable to parse `cargo metadata` output")
source(err)
}
ParseUTF8(err: std::str::Utf8Error) {
from()
from(err: std::string::FromUtf8Error) -> (err.utf8_error())
}
PackageNotFound(path: String, reason: Vec<u8>) {
display("path '{}' does not belong to a package: {}", path, String::from_utf8_lossy(reason))
}
PackageNotFoundInWorkspace(name: String, available: String) {
display("The workspace doesn't have a package named {}. Available packages are: {}", name, available)
}
NoRootFoundInWorkspace(available: String) {
display("This is a workspace with multiple packages, and there is no single package at the root. Please specify package name with -p. Available packages are: {}", available)
}
VariantNotFound(variant: String) {
display("[package.metadata.deb.variants.{}] not found in Cargo.toml", variant)
}
GlobPatternError(err: glob::PatternError) {
from()
display("unable to parse glob pattern")
source(err)
}
AssetFileNotFound(path: PathBuf) {
display("Asset file path does not match any files: {}", path.display())
}
AssetGlobError(err: glob::GlobError) {
from()
display("unable to iterate asset glob result")
source(err)
}
#[cfg(feature = "lzma")]
LzmaCompressionError(err: xz2::stream::Error) {
display("lzma compression error: {:?}", err)
}
}
}
pub type CDResult<T> = Result<T, CargoDebError>;