Alpm.rs 3.0.5 compatibility
This commit is contained in:
parent
4c76ab0aec
commit
b621c34cd0
9 changed files with 111 additions and 118 deletions
108
Cargo.lock
generated
108
Cargo.lock
generated
|
@ -13,19 +13,19 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "alpm"
|
||||
version = "2.2.3"
|
||||
version = "3.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "245a64be26df370a05683facc92fbfdc1192af9327b8435f24c73504f0bdbe85"
|
||||
checksum = "310ec5dc25b236ee96bebf975af2d2de85e61001a7c39a0a7436a414ff3f6490"
|
||||
dependencies = [
|
||||
"alpm-sys",
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.4.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alpm-sys"
|
||||
version = "2.1.3"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e99634488829490948972ba0a7db33b5e50d96026a91f78e9464eb4541e4d8d"
|
||||
checksum = "08a17e0cf15a06d4b86e30c606ee8808ad791300f3bd5e364c30360354b010bd"
|
||||
dependencies = [
|
||||
"pkg-config",
|
||||
]
|
||||
|
@ -68,10 +68,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.86"
|
||||
version = "1.0.90"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f9fa1897e4325be0d68d48df6aa1a71ac2ed4d27723887e7754192705350730"
|
||||
checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
"libc",
|
||||
]
|
||||
|
||||
|
@ -187,9 +188,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dyn-clone"
|
||||
version = "1.0.16"
|
||||
version = "1.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d"
|
||||
checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
|
@ -211,9 +212,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
|||
|
||||
[[package]]
|
||||
name = "erased-serde"
|
||||
version = "0.4.3"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "388979d208a049ffdfb22fa33b9c81942215b940910bccfe258caeb25d125cb3"
|
||||
checksum = "2b73807008a3c7f171cc40312f37d95ef0396e048b5848d775f54b1a4dd4a0d3"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
@ -264,9 +265,9 @@ checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
|
|||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.2.3"
|
||||
version = "2.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177"
|
||||
checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
|
@ -308,6 +309,15 @@ version = "1.0.10"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
|
||||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
version = "0.1.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
|
@ -422,9 +432,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pacmanconf"
|
||||
version = "2.0.0"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba64fdfa5d4589657dc8c8497b67322d8a64c162357ea0359656bfe23eec6185"
|
||||
checksum = "31d9811f947c6ffc56eeafb789dfad44a7ea7cc383ac3bc6c9b23cd27100bbb1"
|
||||
dependencies = [
|
||||
"cini",
|
||||
]
|
||||
|
@ -506,9 +516,9 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.78"
|
||||
version = "1.0.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
|
||||
checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
@ -524,9 +534,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.8.1"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051"
|
||||
checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd"
|
||||
dependencies = [
|
||||
"either",
|
||||
"rayon-core",
|
||||
|
@ -685,9 +695,9 @@ checksum = "53001a0dd2404006fcb1bac222710b94ce34a5cbc84cf2eed1c02d646a782910"
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.50"
|
||||
version = "2.0.52"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb"
|
||||
checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -707,9 +717,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.10.0"
|
||||
version = "3.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67"
|
||||
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fastrand",
|
||||
|
@ -719,18 +729,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.57"
|
||||
version = "1.0.58"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b"
|
||||
checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.57"
|
||||
version = "1.0.58"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81"
|
||||
checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -778,9 +788,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
|
|||
|
||||
[[package]]
|
||||
name = "typetag"
|
||||
version = "0.2.15"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c43148481c7b66502c48f35b8eef38b6ccdc7a9f04bd4cc294226d901ccc9bc7"
|
||||
checksum = "661d18414ec032a49ece2d56eee03636e43c4e8d577047ab334c0ba892e29aaf"
|
||||
dependencies = [
|
||||
"erased-serde",
|
||||
"inventory",
|
||||
|
@ -791,9 +801,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "typetag-impl"
|
||||
version = "0.2.15"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "291db8a81af4840c10d636e047cac67664e343be44e24dfdbd1492df9a5d3390"
|
||||
checksum = "ac73887f47b9312552aa90ef477927ff014d63d1920ca8037c6c1951eab64bb1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -826,9 +836,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
|||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.4.0"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee"
|
||||
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi-util",
|
||||
|
@ -876,9 +886,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.3"
|
||||
version = "0.52.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f"
|
||||
checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
|
@ -891,45 +901,45 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.3"
|
||||
version = "0.52.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6"
|
||||
checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.3"
|
||||
version = "0.52.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f"
|
||||
checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.3"
|
||||
version = "0.52.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb"
|
||||
checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.3"
|
||||
version = "0.52.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58"
|
||||
checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.3"
|
||||
version = "0.52.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614"
|
||||
checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.3"
|
||||
version = "0.52.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c"
|
||||
checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.3"
|
||||
version = "0.52.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6"
|
||||
checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8"
|
||||
|
||||
[[package]]
|
||||
name = "xattr"
|
||||
|
|
|
@ -18,4 +18,4 @@ serde = { version = "1.0", features = ["derive"] }
|
|||
bincode = "1.3.3"
|
||||
|
||||
# Packaging
|
||||
alpm = { version = "2.2.2", features = ["checkver"] }
|
||||
alpm = { version = "3.0.5", features = ["checkver"] }
|
||||
|
|
|
@ -33,7 +33,7 @@ libseccomp = "0.3.0"
|
|||
signal-hook = "0.3.15"
|
||||
|
||||
# Packaging
|
||||
alpm = { version = "2.2.2", features = ["checkver"] }
|
||||
alpm = { version = "3.0.5", features = ["checkver"] }
|
||||
pacmanconf = "2.0.0"
|
||||
tar = "0.4"
|
||||
zstd = "0.13.0"
|
||||
|
|
|
@ -26,8 +26,8 @@ use crate::utils::prompt::prompt;
|
|||
pub fn callback(question: AnyQuestion, _: &mut ()) {
|
||||
match question.question() {
|
||||
Conflict(mut x) => {
|
||||
let pkg_a = x.conflict().package1();
|
||||
let pkg_b = x.conflict().package2();
|
||||
let pkg_a = x.conflict().package1().name();
|
||||
let pkg_b = x.conflict().package2().name();
|
||||
let prompt_string = format!("Conflict between {pkg_a} and {pkg_b}; Remove {pkg_b}?");
|
||||
|
||||
if let Ok(_) = prompt("->", prompt_string, false) {
|
||||
|
@ -54,11 +54,9 @@ pub fn callback(question: AnyQuestion, _: &mut ()) {
|
|||
}
|
||||
}
|
||||
ImportKey(mut x) => {
|
||||
let key = x.key();
|
||||
let fingerprint = key.fingerprint();
|
||||
let email = key.email();
|
||||
let name = key.name();
|
||||
let prompt_string = format!("Import key {fingerprint},\"{name} <{email}>\" to keyring?");
|
||||
let fingerprint = x.fingerprint();
|
||||
let name = x.uid();
|
||||
let prompt_string = format!("Import key {fingerprint},\"{name}\" to keyring?");
|
||||
|
||||
if let Ok(_) = prompt("->", prompt_string, true) {
|
||||
x.set_import(true);
|
||||
|
|
|
@ -29,7 +29,7 @@ use crate::{
|
|||
|
||||
pub struct DependencyResolver<'a> {
|
||||
resolved: HashSet<&'a str>,
|
||||
packages: Vec<Package<'a>>,
|
||||
packages: Vec<&'a Package>,
|
||||
keys: Vec<&'a str>,
|
||||
ignored: &'a HashSet<String>,
|
||||
handle: &'a Alpm,
|
||||
|
@ -57,7 +57,7 @@ impl<'a> DependencyResolver<'a> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn enumerate(mut self, packages: &Vec<&'a str>) -> Result<(Option<Vec<String>>, Vec<Package<'a>>), Error> {
|
||||
pub fn enumerate(mut self, packages: &Vec<&'a str>) -> Result<(Option<Vec<String>>, Vec<&'a Package>), Error> {
|
||||
let mut synchronize: Vec<&'a str> = Vec::new();
|
||||
|
||||
for pkg in packages {
|
||||
|
|
|
@ -29,7 +29,7 @@ use crate::{
|
|||
|
||||
pub struct LocalDependencyResolver<'a> {
|
||||
resolved: HashSet<&'a str>,
|
||||
packages: Vec<Package<'a>>,
|
||||
packages: Vec<&'a Package>,
|
||||
ignored: &'a HashSet<String>,
|
||||
handle: &'a Alpm,
|
||||
depth: isize,
|
||||
|
@ -60,7 +60,7 @@ impl<'a> LocalDependencyResolver<'a> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn enumerate(mut self, packages: &Vec<&'a str>) -> Result<Vec<Package<'a>>, Error> {
|
||||
pub fn enumerate(mut self, packages: &Vec<&'a str>) -> Result<Vec<&'a Package>, Error> {
|
||||
let mut synchronize: Vec<&'a str> = Vec::new();
|
||||
|
||||
for pkg in packages {
|
||||
|
|
|
@ -398,7 +398,7 @@ impl<'a> TransactionHandle<'a> {
|
|||
.iter()
|
||||
.filter(|a| !self.meta.held_pkgs.contains(a.name()))
|
||||
.map(|a| *a)
|
||||
.collect::<Vec<Package<'_>>>()
|
||||
.collect::<Vec<&Package>>()
|
||||
{
|
||||
if !self.agent && !ignored.contains(pkg.name()) && config.alpm().held().contains(&pkg.name()) {
|
||||
if let Err(_) =
|
||||
|
@ -429,7 +429,7 @@ impl<'a> TransactionHandle<'a> {
|
|||
Some(*a)
|
||||
}
|
||||
})
|
||||
.collect::<Vec<Package<'_>>>()
|
||||
.collect::<Vec<&Package>>()
|
||||
{
|
||||
if !self.agent && config.alpm().ignored().contains(&pkg.name()) {
|
||||
if let Err(_) = prompt(
|
||||
|
@ -495,7 +495,7 @@ impl<'a> TransactionHandle<'a> {
|
|||
|
||||
pub fn mark_depends(&mut self) {
|
||||
if let Some(deps) = self.deps.as_ref() {
|
||||
for mut pkg in deps.iter().filter_map(|a| self.alpm().get_local_package(a)) {
|
||||
for pkg in deps.iter().filter_map(|a| self.alpm().get_local_package(a)) {
|
||||
pkg.set_reason(PackageReason::Depend).unwrap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use alpm::{Alpm, CommitResult, FileConflictType, Package, PrepareResult};
|
||||
use alpm::{Alpm, CommitData, CommitError, Package, PrepareData, PrepareError};
|
||||
|
||||
use crate::{
|
||||
constants::{BOLD, BOLD_WHITE, RESET},
|
||||
|
@ -29,37 +29,31 @@ use crate::{
|
|||
};
|
||||
|
||||
pub trait AlpmUtils {
|
||||
fn get_local_package(&self, pkg: &str) -> Option<Package<'_>>;
|
||||
fn get_package(&self, pkg: &str) -> Option<Package<'_>>;
|
||||
fn get_local_package(&self, pkg: &str) -> Option<&Package>;
|
||||
fn get_package(&self, pkg: &str) -> Option<&Package>;
|
||||
}
|
||||
|
||||
impl AlpmUtils for Alpm {
|
||||
fn get_local_package<'a>(&self, pkg: &'a str) -> Option<Package<'_>> {
|
||||
fn get_local_package<'a>(&self, pkg: &'a str) -> Option<&Package> {
|
||||
if let Ok(pkg) = self.localdb().pkg(pkg) {
|
||||
return Some(pkg);
|
||||
} else {
|
||||
self.localdb().pkgs().iter().find_map(|f| {
|
||||
if f.provides().iter().filter(|d| pkg == d.name()).count() > 0 {
|
||||
Some(f)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
self.localdb()
|
||||
.pkgs()
|
||||
.iter()
|
||||
.find_map(|f| f.provides().iter().find(|d| pkg == d.name()).and_then(|_| Some(f)))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_package(&self, pkg: &str) -> Option<Package<'_>> {
|
||||
fn get_package(&self, pkg: &str) -> Option<&Package> {
|
||||
for sync in self.syncdbs() {
|
||||
if let Ok(pkg) = sync.pkg(pkg) {
|
||||
return Some(pkg);
|
||||
} else {
|
||||
let package = sync.pkgs().iter().find_map(|f| {
|
||||
if f.provides().iter().filter(|d| pkg == d.name()).count() > 0 {
|
||||
Some(f)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
let package = sync
|
||||
.pkgs()
|
||||
.iter()
|
||||
.find_map(|f| f.provides().iter().find(|d| pkg == d.name()).and_then(|_| Some(f)));
|
||||
|
||||
if let None = package {
|
||||
continue;
|
||||
|
@ -73,57 +67,47 @@ impl AlpmUtils for Alpm {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn erroneous_transaction<'a>(error: (CommitResult<'a>, alpm::Error)) -> Result<()> {
|
||||
match error.0 {
|
||||
CommitResult::FileConflict(file) => {
|
||||
pub fn erroneous_transaction<'a>(error: CommitError) -> Result<()> {
|
||||
match error.data() {
|
||||
CommitData::FileConflict(file) => {
|
||||
for conflict in file {
|
||||
match conflict.conflict_type() {
|
||||
FileConflictType::Filesystem => {
|
||||
let file = conflict.file();
|
||||
let target = conflict.target();
|
||||
print_warning(&format!("{}: '{}' already exists.", target, file));
|
||||
}
|
||||
FileConflictType::Target => {
|
||||
let file = conflict.file();
|
||||
let target = format!("{}{}{}", *BOLD_WHITE, conflict.target(), *RESET);
|
||||
if let Some(conflicting) = conflict.conflicting_target() {
|
||||
let conflicting = format!("{}{conflicting}{}", *BOLD_WHITE, *RESET);
|
||||
print_warning(&format!("{conflicting}: '{target}' is owned by {file}"));
|
||||
} else {
|
||||
print_warning(&format!("{target}: '{file}' is owned by foreign target"));
|
||||
}
|
||||
}
|
||||
}
|
||||
let reason = conflict.reason();
|
||||
let package1 = conflict.package1().name();
|
||||
let package2 = conflict.package2().name();
|
||||
|
||||
print_warning(&format!(
|
||||
"Conflict between {}{}{} and {}{}{}: {}",
|
||||
*BOLD, package1, *RESET, *BOLD, package2, *RESET, reason
|
||||
));
|
||||
}
|
||||
|
||||
err!(SyncError::TransactionFailure("Conflict within container filesystem".into()))?
|
||||
}
|
||||
CommitResult::PkgInvalid(p) =>
|
||||
CommitData::PkgInvalid(p) =>
|
||||
for pkg in p.iter() {
|
||||
let pkg = format!("{}{pkg}{}", *BOLD_WHITE, *RESET);
|
||||
print_error(&format!("Invalid package: {}", pkg));
|
||||
},
|
||||
_ => (),
|
||||
}
|
||||
|
||||
err!(SyncError::TransactionFailure(error.1.to_string()))
|
||||
err!(SyncError::TransactionFailure(error.to_string()))
|
||||
}
|
||||
|
||||
pub fn erroneous_preparation<'a>(error: (PrepareResult<'a>, alpm::Error)) -> Result<()> {
|
||||
match error.0 {
|
||||
PrepareResult::PkgInvalidArch(list) =>
|
||||
pub fn erroneous_preparation<'a>(error: PrepareError) -> Result<()> {
|
||||
match error.data() {
|
||||
PrepareData::PkgInvalidArch(list) =>
|
||||
for package in list.iter() {
|
||||
print_error(&format!(
|
||||
"Invalid architecture {}{}{} for {}{}{}",
|
||||
*BOLD,
|
||||
package.arch().unwrap(),
|
||||
package.arch().unwrap_or("UNKNOWN"),
|
||||
*RESET,
|
||||
*BOLD,
|
||||
package.name(),
|
||||
*RESET
|
||||
));
|
||||
},
|
||||
PrepareResult::UnsatisfiedDeps(list) =>
|
||||
PrepareData::UnsatisfiedDeps(list) =>
|
||||
for missing in list.iter() {
|
||||
print_error(&format!(
|
||||
"Unsatisifed dependency {}{}{} for target {}{}{}",
|
||||
|
@ -135,21 +119,20 @@ pub fn erroneous_preparation<'a>(error: (PrepareResult<'a>, alpm::Error)) -> Res
|
|||
*RESET
|
||||
));
|
||||
},
|
||||
PrepareResult::ConflictingDeps(list) =>
|
||||
PrepareData::ConflictingDeps(list) =>
|
||||
for conflict in list.iter() {
|
||||
print_error(&format!(
|
||||
"Conflict between {}{}{} and {}{}{}: {}",
|
||||
*BOLD,
|
||||
conflict.package1(),
|
||||
conflict.package1().name(),
|
||||
*RESET,
|
||||
*BOLD,
|
||||
conflict.package2(),
|
||||
conflict.package2().name(),
|
||||
*RESET,
|
||||
conflict.reason()
|
||||
));
|
||||
},
|
||||
_ => (),
|
||||
}
|
||||
|
||||
err!(SyncError::PreparationFailure(error.1.to_string()))
|
||||
err!(SyncError::PreparationFailure(error.to_string()))
|
||||
}
|
||||
|
|
|
@ -24,7 +24,9 @@ signal-hook = "0.3.15"
|
|||
os_pipe = "1.1.4"
|
||||
|
||||
# Packaging
|
||||
alpm = { version = "2.2.2", features = ["checkver"] }
|
||||
alpm = { version = "3.0.5", features = ["checkver"] }
|
||||
|
||||
# Miscellaneous
|
||||
sha2 = "0.10.8"
|
||||
regex = "1.10.3"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue