Package Details: paccache-hook 1.2.0-1

Git Clone URL: https://aur.archlinux.org/paccache-hook.git (read-only, click to copy)
Package Base: paccache-hook
Description: A configurable hook to cleanup the pacman package cache using paccache
Upstream URL: None
Keywords: cleanup hook paccache pacman
Licenses: BSD
Conflicts: pacman-cleanup-hook
Submitter: Skycoder42
Maintainer: Skycoder42
Last Packager: Skycoder42
Votes: 60
Popularity: 1.84
First Submitted: 2019-03-23 10:57 (UTC)
Last Updated: 2024-09-09 18:45 (UTC)

Pinned Comments

Skycoder42 commented on 2019-03-23 11:00 (UTC)

This packages was inspired by pacman-cleanup-hook and builds on top of it by making the hook configurable. For a basic, non-configurable cleanup, check out that one!

Latest Comments

1 2 3 Next › Last »

deemon commented on 2025-06-24 15:12 (UTC) (edited on 2025-06-24 15:14 (UTC) by deemon)

yay doesn't generate this pacnew for this package. either it's yay problem or package problem? maybe it should be backup=("/etc/$pkgname.conf") instead of current backup=("etc/$pkgname.conf") ?

Skycoder42 commented on 2025-06-24 04:42 (UTC)

Hi @deemon,

I cannot reproduce the error, but I think I know where it stems from: In https://aur.archlinux.org/cgit/aur.git/commit/?h=paccache-hook&id=fdb12832b9bdec8bfbcf2e9519eae2df25260c8a, I updated how the configuration is loaded. The primary change is that installed_extra_args are now an array instead of a string.

My guess is that you did not update your configuration file accordingly (as it is not updated by pacman). You should see a "/etc/paccache.conf.pacnew" file with that difference.

I personally use https://archlinux.org/packages/extra/any/etc-update/ to periodically check for such files and resolve conflicts.

deemon commented on 2025-06-23 15:20 (UTC) (edited on 2025-06-23 15:41 (UTC) by deemon)

with set -x I see this:

sudo /usr/bin/bash /usr/share/libalpm/scripts/paccache-hook.sh
[sudo] password for deemon:
+ . /etc/paccache-hook.conf
++ extra_args=-v
++ cache_dirs=()
++ installed=true
++ installed_keep=2
++ installed_extra_args=
++ installed_move_to=
++ uninstalled=true
++ uninstalled_keep=0
++ uninstalled_extra_args=--min-mtime=-30days
++ uninstalled_move_to=
+ common_args=()
+ common_args+=("${extra_args[@]}")
+ '[' true = true ']'
+ installed_args=("--keep" "${installed_keep:-2}")
+ '[' -n '' ']'
+ installed_args+=("--remove")
+ echo 'Removing old installed packages...'
Removing old installed packages...
+ echo paccache --keep 2 --remove '' -v
paccache --keep 2 --remove  -v
+ paccache --keep 2 --remove '' -v
==> no candidate packages found for pruning

apparently those empty quotes ('') are causing the problem. echo somehow removed those empty quotes and when I ran the echo output manually it didn't have those quotes anymore there and thus ran correctly. So apparently having nothing set in installed_extra_args= is not good. Checked the new updated config file and putting there empty () fixed it: installed_extra_args=()

japhir commented on 2025-05-26 08:49 (UTC)

I'm curious about the set -e at the start of the bash script, because I've read somewhere that it's bad practice. Thoughts?

Skycoder42 commented on 2024-09-09 18:47 (UTC)

Hi everyone,

I updated the script to be more resiliant. It now expects arrays for all additional parameters and sets the --min-mtime "14 days ago" by default.

kageyama commented on 2024-08-28 03:16 (UTC) (edited on 2024-08-28 03:17 (UTC) by kageyama)

@bhe69 Thanks for the workaround. I won't be able to test it as it turns out i am runnning out of space so i ended up using installed_keep=0.

For your question on How did you get the "debug output" of ./paccache-hook.sh ?,

  1. I looked into this pkgfile for how/what was it installing.https://aur.archlinux.org/cgit/aur.git/tree/paccache-hook.sh?h=paccache-hook
  2. So it was installing a hook and .sh. https://aur.archlinux.org/cgit/aur.git/tree/paccache-hook.sh?h=paccache-hook
  3. looked into .sh file and it was sourcing the .conf file.
  4. So i copied .sh and .conf file into my home directory, changed .sh file to read .conf from my home directory and added set -x at start in .sh file. https://stackoverflow.com/questions/36273665/what-does-set-x-do

bhe69 commented on 2024-08-27 21:40 (UTC)

@kageyama thanks for the analysis. Out of interest: How did you get the "debug output" of ./paccache-hook.sh ?

Looking into the info document of date and time I found a workaround: Instead of using "14 days ago" we can use "-14 days". The fuzzy analysis of time also accepts "-14days". No spaces, no problems.

uninstalled_extra_args=--min-mtime=-14days

works like a charm :-)

kageyama commented on 2024-08-09 02:55 (UTC) (edited on 2024-08-13 20:07 (UTC) by kageyama)

@bhe69, you are right. I have the same config and its not working.

uninstalled_extra_args="'--min-mtime=14 days ago'"

This is silently failing. This is what gets ran. ->

[phoenix@ArchLinux ~]$ paccache -duk0 \'--min-mtime=14 days ago\'
==> no candidate packages found for pruning

This is how it should behave actually ->

[phoenix@ArchLinux ~]$ paccache -duk0 '--min-mtime=14 days ago'

==> finished dry run: 994 candidates (disk space saved: 5.21 GiB)

The problem is that, uninstalled_extra_args="--min-mtime=14 days ago" needs to passed as a single string, but if we quote it ourselves like this uninstalled_extra_args="'--min-mtime=14 days ago'" , that quotation (') gets preserved and gets passed as string to pacache command. It can be seen here ->

[phoenix@ArchLinux ~]$ ./paccache-hook.sh 
+ . /home/phoenix/paccache-hook.conf
++ extra_args=-v
++ cache_dirs=()
++ installed=true
++ installed_keep=3
++ installed_move_to=
++ uninstalled=true
++ uninstalled_keep=0
++ uninstalled_extra_args=''\''--min-mtime=14 days ago'\'''
++ uninstalled_move_to=
+ paccache -duk0 -v ''\''--min-mtime=14' days 'ago'\'''
==> no candidate packages found for pruning

But if we don't quote it and keep it like this uninstalled_extra_args="--min-mtime=14 days ago", then it gets passed as split arguments, this is what gets ran ->

[phoenix@ArchLinux ~]$ ./paccache-hook.sh 
+ . /home/phoenix/paccache-hook.conf
++ extra_args=-v
++ cache_dirs=()
++ installed=true
++ installed_keep=3
++ installed_move_to=
++ uninstalled=true
++ uninstalled_keep=0
++ uninstalled_extra_args='--min-mtime=14 days ago'
++ uninstalled_move_to=
+ paccache -duk0 -v --min-mtime=14 days ago
==> no candidate packages found for pruning

In BOTH cases, paccache is failing silently.


https://aur.archlinux.org/cgit/aur.git/tree/paccache-hook.sh?h=paccache-hook#n25 needs to contain either "$uninstalled_extra_args" or array expansion or maybe the developer knows someway.

bhe69 commented on 2024-08-08 21:06 (UTC)

@escorares yes, but I also have uninstalled_keep=0 and my issue are the uninstalled packages.