fix 'show_unmanaged_packages'
This commit is contained in:
+1
-1
@@ -12,7 +12,7 @@ clap = "3.*"
|
|||||||
[profile.release]
|
[profile.release]
|
||||||
lto = "fat"
|
lto = "fat"
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
strip = true
|
debug = true
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
criterion = "*"
|
criterion = "*"
|
||||||
|
|||||||
+11
-14
@@ -1,11 +1,10 @@
|
|||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::HashSet;
|
||||||
use std::process::exit;
|
|
||||||
|
|
||||||
use anyhow::{bail, Context, Result};
|
use anyhow::{bail, Context, Result};
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
|
|
||||||
use crate::action;
|
use crate::action;
|
||||||
use crate::backend::{Backend, Backends, Pacman};
|
use crate::backend::{Backend, Backends};
|
||||||
use crate::cmd::run_edit_command;
|
use crate::cmd::run_edit_command;
|
||||||
use crate::ui::get_user_confirmation;
|
use crate::ui::get_user_confirmation;
|
||||||
use crate::Group;
|
use crate::Group;
|
||||||
@@ -22,17 +21,13 @@ impl Pacdef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn install_packages(&self) {
|
pub(crate) fn install_packages(&self) {
|
||||||
let mut to_install = ToInstallPerBackend::new();
|
let mut to_install = ToDoPerBackend::new();
|
||||||
|
|
||||||
for mut b in Backends::iter() {
|
for mut b in Backends::iter() {
|
||||||
print!("{}: ", b.get_binary());
|
print!("{}: ", b.get_binary());
|
||||||
|
|
||||||
// dbg!(&self.groups);
|
|
||||||
|
|
||||||
b.load(&self.groups);
|
b.load(&self.groups);
|
||||||
|
|
||||||
// dbg!(b.get_managed_packages());
|
|
||||||
|
|
||||||
let diff = b.get_missing_packages_sorted();
|
let diff = b.get_missing_packages_sorted();
|
||||||
if diff.is_empty() {
|
if diff.is_empty() {
|
||||||
println!("nothing to do");
|
println!("nothing to do");
|
||||||
@@ -96,7 +91,9 @@ impl Pacdef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn show_unmanaged_packages(self) {
|
pub(crate) fn show_unmanaged_packages(self) {
|
||||||
for b in Backends::iter() {
|
for mut b in Backends::iter() {
|
||||||
|
b.load(&self.groups);
|
||||||
|
|
||||||
let unmanaged = b.get_unmanaged_packages_sorted();
|
let unmanaged = b.get_unmanaged_packages_sorted();
|
||||||
if unmanaged.is_empty() {
|
if unmanaged.is_empty() {
|
||||||
continue;
|
continue;
|
||||||
@@ -146,9 +143,9 @@ impl Pacdef {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ToInstallPerBackend(Vec<(Box<dyn Backend>, Vec<Package>)>);
|
struct ToDoPerBackend(Vec<(Box<dyn Backend>, Vec<Package>)>);
|
||||||
|
|
||||||
impl ToInstallPerBackend {
|
impl ToDoPerBackend {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Self(vec![])
|
Self(vec![])
|
||||||
}
|
}
|
||||||
@@ -157,9 +154,9 @@ impl ToInstallPerBackend {
|
|||||||
self.0.push(item);
|
self.0.push(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn iter(&self) -> impl Iterator<Item = &(Box<dyn Backend>, Vec<Package>)> {
|
// fn iter(&self) -> impl Iterator<Item = &(Box<dyn Backend>, Vec<Package>)> {
|
||||||
self.0.iter()
|
// self.0.iter()
|
||||||
}
|
// }
|
||||||
|
|
||||||
fn nothing_to_do_for_all_backends(&self) -> bool {
|
fn nothing_to_do_for_all_backends(&self) -> bool {
|
||||||
self.0.iter().all(|(_, diff)| diff.is_empty())
|
self.0.iter().all(|(_, diff)| diff.is_empty())
|
||||||
|
|||||||
Reference in New Issue
Block a user