From bf2b9fb39a470386cf9df65f5ef3cf24b37f50f5 Mon Sep 17 00:00:00 2001 From: Fries Date: Sun, 18 Sep 2022 09:17:44 -0700 Subject: [PATCH] operations/clean: make sure paccache keeps 3 pkgs looks like .pacnew files don't generate properly unless theres like 3 packages in the pacman cache. why is pacman so confusing i swear nobody knows how it works. well anyways this commit also removes the config keys `paccache_keep` and `paccache_keep_ins_pkgs` as they shouldnt be able to be changed. --- src/internal/config.rs | 8 +------- src/operations/clean.rs | 10 ++++------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/internal/config.rs b/src/internal/config.rs index e0d599e..277352b 100644 --- a/src/internal/config.rs +++ b/src/internal/config.rs @@ -17,8 +17,6 @@ pub struct Config { #[derive(Debug, Deserialize, Serialize)] pub struct ConfigBase { pub pacdiff_warn: bool, - pub paccache_keep: i32, - pub paccache_keep_ins_pkgs: bool, } #[derive(Debug, Deserialize, Serialize, Default)] @@ -34,11 +32,7 @@ pub struct ConfigBin { impl Default for ConfigBase { fn default() -> Self { - Self { - pacdiff_warn: true, - paccache_keep: 0, - paccache_keep_ins_pkgs: true, - } + Self { pacdiff_warn: true } } } diff --git a/src/operations/clean.rs b/src/operations/clean.rs index 2c5f92f..85858a8 100644 --- a/src/operations/clean.rs +++ b/src/operations/clean.rs @@ -83,14 +83,12 @@ pub async fn clean(options: Options) { let clear_pacman_cache = noconfirm || prompt!(default no, "Also clear pacman's package cache?"); if clear_pacman_cache { - let conf = Config::read(); - // Clear pacman's cache - // keeps 0 versions of the package in the cache by default - // keeps installed packages in the cache by default + // keeps 3 versions of the package in the cache + // keeps installed packages in the cache let result = PaccacheBuilder::default() - .set_keep(conf.base.paccache_keep) - .keep_ins_pkgs(conf.base.paccache_keep_ins_pkgs) + .set_keep(3) + .keep_ins_pkgs(true) .quiet_output(quiet) .remove() .await;