Package Details: pacman-cleanup-hook 1.1-1

Git Clone URL: https://aur.archlinux.org/pacman-cleanup-hook.git (read-only, click to copy)
Package Base: pacman-cleanup-hook
Description: hook to cleanup pacman cache keeping only the installed plus next most recent packages
Upstream URL: None
Submitter: alerque
Maintainer: alerque
Last Packager: alerque
Votes: 54
Popularity: 0.64
First Submitted: 2021-01-07 19:18 (UTC)
Last Updated: 2021-11-27 03:50 (UTC)

Dependencies (1)

Required by (0)

Sources (1)

Latest Comments

MarsSeed commented on 2023-08-14 18:01 (UTC) (edited on 2023-08-14 18:03 (UTC) by MarsSeed)

There is an improved, custom-configurable package for this use case:

paccache-hook

Also, technically, pacman-cleanup-hook is not legal to distribute, since there is no license. (In some jurisdictions, this might be considered trivial, non-original creation, therefore belonging to the public domain.)

1F616EMO commented on 2023-02-11 08:30 (UTC) (edited on 2023-02-11 08:31 (UTC) by 1F616EMO)

I wonder why a verbose output is needed... it badly spammed my console.

For those who want to get rid of the verbose messages, place the following content in /etc/pacman.d/hooks/pacman-cache-cleanup.hook:

[Trigger]
Type = Package
Operation = Remove
Operation = Install
Operation = Upgrade
Target = *

[Action]
Description = Removing unnecessary cached files (keeping the latest two)...
When = PostTransaction
Exec = /usr/bin/paccache -rk2

Note that a v is removed from the parameters.

fram2 commented on 2022-12-15 00:55 (UTC)

Yes! Adjusting the number of versions to keep in a way that would not be overwritten by a package update would be awesome! I registered just to comment that!

gissf1 commented on 2022-10-23 21:47 (UTC)

It would be nice to be able to adjust the number of versions to keep in a way that would not be overwritten by a package update. I imagine this could be done using some config file under /etc/ to set the value, with the default being the current value of 2. I can implement this change if there is community interest. Feedback on this idea would be appreciated.

alerque commented on 2021-11-27 03:45 (UTC)

@itaranto It doesn't matter what order this runs in relative to other hooks, only that it responds to the right triggers.

itaranto commented on 2021-11-25 13:36 (UTC) (edited on 2021-11-25 13:37 (UTC) by itaranto)

Also may I suggest some cosmetic changes?

I see that most of Arch Linux's hooks put the Type at the beginning, and I also believe that you should use ... instead of in the Description.

Something like this:

[Trigger]
Type = Package
Operation = Remove
Operation = Install
Operation = Upgrade
Target = *

[Action]
Description = Removing unnecessary cached files (keeping the latest two)...
When = PostTransaction
Exec = /usr/bin/paccache -rvk2

itaranto commented on 2021-11-25 13:30 (UTC)

Shouldn't this hook have an ordering number or it actually doesn't matter when this hook is going to run?

omeringen commented on 2021-02-15 07:42 (UTC) (edited on 2021-03-11 19:34 (UTC) by omeringen)

//removed my comment because it doesn't work.

I couldn't find a way by editing hook config file to apply this hook also for removed packages.

alerque commented on 2021-01-08 08:30 (UTC)

@starquake I'm not quite sure either, the whole episode was funny. I got an email notification of a comment from the original poster saying they were going to disown it because they switched to Fedora, then another email notifying me it was disowned. I tried to click through on the link to adopt it, but it was 404ed. I searched and tried poking around and couldn't find it at all. This is a repost from my local copy of the repository. I'm pretty sure (but not 100%) that I had the latest commit cloned locally. I tried just posting it and strangely nothing happened. It said it was up to date, but it wasn't available here on the AUR site. I think it was it some sort of hidden mode—which I believe is what "deleted" packages are. The Git repositories are not deleted, just the references that says they are live. I was able to get it to show up here again only by adding a commit that bumped the version and pushing that.

That suggests the package was deleted, but I am also a subscriber to the AUR notifications list that would normally show deletion flags and deletion actions. I've searched that list and can't find any references to this package. It seems to have been "silently" deleted.

starquake commented on 2021-01-07 22:44 (UTC)

This package was gone for a day. What happened?