Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add printing of which package failed to clean in aur cache #1074

Merged
merged 5 commits into from
Nov 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ fn clean_aur(
.with_context(|| tr!("can't open clone dir: {}", config.fetch.clone_dir.display()))?;

for file in cached_pkgs {
if let Err(err) = clean_aur_pkg(config, file, remove_all, keep_installed, keep_current, rm)
if let Err(err) =
clean_aur_pkg(config, &file?, remove_all, keep_installed, keep_current, rm)
{
print_error(config.color.error, err);
continue;
Expand All @@ -115,14 +116,12 @@ fn fix_perms(file: &Path) -> Result<()> {

fn clean_aur_pkg(
config: &Config,
file: std::io::Result<DirEntry>,
file: &DirEntry,
remove_all: bool,
keep_installed: bool,
keep_current: bool,
rm: bool,
) -> Result<()> {
let file = file?;

if !file.file_type()?.is_dir()
|| !file.path().join(".git").exists()
|| !file.path().join(".SRCINFO").exists()
Expand All @@ -136,7 +135,13 @@ fn clean_aur_pkg(
return do_remove(config, &file.path(), rm);
}

let srcinfo = Srcinfo::parse_file(file.path().join(".SRCINFO"))?;
let srcinfo = Srcinfo::parse_file(file.path().join(".SRCINFO")).with_context(|| {
let file_name = file.file_name();
tr!(
"could not parse .SRCINFO for '{}'",
file_name.to_string_lossy()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use .display() here instead. Otherwise all good.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this is the filename and not a Path so nevermind.

)
})?;

if config.clean == 1 {
if keep_installed {
Expand Down
Loading