Trim the package cache by default, and split it from orphan removal
CleanCache was off, so nothing ever pruned /var/cache/pacman/pkg - 23 GB on the machine this was found on, with three 3.2 GB copies of one package. Trimming only drops older versions of installed packages and cached versions of uninstalled ones, so the cost is downgrade depth, not working software. flatpak uninstall --unused moves from CleanCache to RemoveOrphans, where it belongs: unused runtimes are the Flatpak equivalent of orphaned packages, and removing installed software should not hide behind a flag named for cache trimming. RemoveOrphans stays off - 'orphaned' only means nothing depends on it, which is also true of something installed deliberately. The log now reports what a trim reclaimed, since a real paccache run says almost nothing and there was otherwise no way to tell it was working.
This commit is contained in:
1 parent
243115ea19
commit
6514c4d859
6 files changed
+41
-11
No files matched your search
@@ -8,7 +8,7 @@
|
|||||||
# Overridable so a packager can pass the version it is actually building
|
# Overridable so a packager can pass the version it is actually building
|
||||||
# (`make VERSION=$pkgver`). The literal below is the fallback for builds
|
# (`make VERSION=$pkgver`). The literal below is the fallback for builds
|
||||||
# straight from a checkout, and is what a release tag has to carry.
|
# straight from a checkout, and is what a release tag has to carry.
|
||||||
VERSION ?= 1.0.6
|
VERSION ?= 1.0.7
|
||||||
|
|
||||||
PREFIX ?= /usr
|
PREFIX ?= /usr
|
||||||
DESTDIR ?=
|
DESTDIR ?=
|
||||||
|
|||||||
@@ -55,8 +55,15 @@ business rebuilding somebody's system before being asked.
|
|||||||
| Flatpak | system and per-user installations |
|
| Flatpak | system and per-user installations |
|
||||||
| AppImages | via [Gear Lever](https://github.com/mijorus/gearlever), if installed |
|
| AppImages | via [Gear Lever](https://github.com/mijorus/gearlever), if installed |
|
||||||
|
|
||||||
`-git`/`-devel` AUR packages, cache trimming and orphan removal exist as
|
It also trims the pacman package cache after each run (`paccache`, keeping the
|
||||||
options but are off by default.
|
3 most recent versions), because otherwise `/var/cache/pacman/pkg` grows
|
||||||
|
forever — tens of gigabytes on a machine with a few large packages. Set
|
||||||
|
`KeepOldPackages=1` if disk space matters more than the ability to downgrade.
|
||||||
|
|
||||||
|
`-git`/`-devel` AUR packages and orphan removal exist as options but are off by
|
||||||
|
default. Orphan removal deletes installed software, and "orphaned" only means
|
||||||
|
nothing else depends on it — which is also true of something installed
|
||||||
|
deliberately.
|
||||||
|
|
||||||
## When it holds back
|
## When it holds back
|
||||||
|
|
||||||
|
|||||||
@@ -66,16 +66,29 @@ AutoResolveConflicts=yes
|
|||||||
IgnorePkg=
|
IgnorePkg=
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Housekeeping - all off by default
|
# Housekeeping
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
# Trim the pacman package cache after an update.
|
# Trim the pacman package cache after an update: drop the older versions of
|
||||||
CleanCache=no
|
# installed packages, and every cached version of packages that are no longer
|
||||||
|
# installed. Nothing that is currently installed is ever touched, so this only
|
||||||
|
# costs the ability to downgrade further back than KeepOldPackages.
|
||||||
|
# Without it /var/cache/pacman/pkg grows forever - tens of gigabytes on a
|
||||||
|
# machine with a few large packages.
|
||||||
|
CleanCache=yes
|
||||||
|
|
||||||
# How many old versions per package to keep when CleanCache is on.
|
# How many old versions per package to keep when CleanCache is on. 3 is the
|
||||||
|
# Arch default and leaves room to downgrade. Set it to 1 if disk space matters
|
||||||
|
# more than that; on a machine with a handful of multi-gigabyte packages the
|
||||||
|
# difference is easily ten gigabytes.
|
||||||
KeepOldPackages=3
|
KeepOldPackages=3
|
||||||
|
|
||||||
# Remove packages that were installed as dependencies and are no longer needed.
|
# Remove packages nothing depends on any more: pacman packages that were pulled
|
||||||
|
# in as dependencies and are now unreferenced, plus Flatpak runtimes no
|
||||||
|
# installed application uses.
|
||||||
|
# Off by default, and unlike CleanCache this one deletes installed software:
|
||||||
|
# "orphaned" only means no other package requires it, which is also true of
|
||||||
|
# something installed deliberately as a dependency of nothing.
|
||||||
RemoveOrphans=no
|
RemoveOrphans=no
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
+1
-1
@@ -96,7 +96,7 @@ cau_config_load() {
|
|||||||
CFG_APPIMAGE=no; cau_config_bool UpdateAppImages yes && CFG_APPIMAGE=yes
|
CFG_APPIMAGE=no; cau_config_bool UpdateAppImages yes && CFG_APPIMAGE=yes
|
||||||
CFG_DEVEL=no; cau_config_bool UpdateDevel no && CFG_DEVEL=yes
|
CFG_DEVEL=no; cau_config_bool UpdateDevel no && CFG_DEVEL=yes
|
||||||
CFG_RESOLVE_CONFLICTS=no; cau_config_bool AutoResolveConflicts yes && CFG_RESOLVE_CONFLICTS=yes
|
CFG_RESOLVE_CONFLICTS=no; cau_config_bool AutoResolveConflicts yes && CFG_RESOLVE_CONFLICTS=yes
|
||||||
CFG_CLEAN_CACHE=no; cau_config_bool CleanCache no && CFG_CLEAN_CACHE=yes
|
CFG_CLEAN_CACHE=no; cau_config_bool CleanCache yes && CFG_CLEAN_CACHE=yes
|
||||||
CFG_REMOVE_ORPHANS=no; cau_config_bool RemoveOrphans no && CFG_REMOVE_ORPHANS=yes
|
CFG_REMOVE_ORPHANS=no; cau_config_bool RemoveOrphans no && CFG_REMOVE_ORPHANS=yes
|
||||||
CFG_NOTIFY_SUCCESS=no; cau_config_bool NotifyOnSuccess yes && CFG_NOTIFY_SUCCESS=yes
|
CFG_NOTIFY_SUCCESS=no; cau_config_bool NotifyOnSuccess yes && CFG_NOTIFY_SUCCESS=yes
|
||||||
CFG_NOTIFY_ERROR=no; cau_config_bool NotifyOnError yes && CFG_NOTIFY_ERROR=yes
|
CFG_NOTIFY_ERROR=no; cau_config_bool NotifyOnError yes && CFG_NOTIFY_ERROR=yes
|
||||||
|
|||||||
@@ -63,7 +63,10 @@ cau_flatpak_update() {
|
|||||||
fi
|
fi
|
||||||
done < <(cau_human_users)
|
done < <(cau_human_users)
|
||||||
|
|
||||||
if [[ $CFG_CLEAN_CACHE == yes ]]; then
|
# Unused runtimes are the Flatpak equivalent of orphaned packages - this is
|
||||||
|
# removal of installed software, not cache trimming, so it belongs behind
|
||||||
|
# RemoveOrphans rather than CleanCache.
|
||||||
|
if [[ $CFG_REMOVE_ORPHANS == yes ]]; then
|
||||||
cau_run_logged flatpak uninstall --system --unused --noninteractive --assumeyes || true
|
cau_run_logged flatpak uninstall --system --unused --noninteractive --assumeyes || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -254,7 +254,14 @@ cau_pacman_cleanup() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $CFG_CLEAN_CACHE == yes ]] && cau_have paccache; then
|
if [[ $CFG_CLEAN_CACHE == yes ]] && cau_have paccache; then
|
||||||
cau_info "Trimming the package cache"
|
# paccache's dry run reports what a real run would reclaim; logging it
|
||||||
|
# first is the only way to tell afterwards whether trimming is doing
|
||||||
|
# anything, since the real run says little.
|
||||||
|
local reclaim
|
||||||
|
reclaim="$( { paccache -d --nocolor -k"$CFG_KEEP_OLD"; paccache -du --nocolor -k0; } 2>&1 \
|
||||||
|
| grep -oE 'disk space saved: [^)]*' | paste -sd', ' -)"
|
||||||
|
|
||||||
|
cau_info "Trimming the package cache (keeping $CFG_KEEP_OLD old version(s))${reclaim:+ - $reclaim}"
|
||||||
cau_run_logged paccache -r --nocolor -k"$CFG_KEEP_OLD" || cau_warn "paccache -r failed"
|
cau_run_logged paccache -r --nocolor -k"$CFG_KEEP_OLD" || cau_warn "paccache -r failed"
|
||||||
cau_run_logged paccache -ru --nocolor -k0 || cau_warn "paccache -ru failed"
|
cau_run_logged paccache -ru --nocolor -k0 || cau_warn "paccache -ru failed"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in new issue
Block a user