You are not logged in.

#1 2012-01-17 13:38:26

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

PkgClip - Cached Packages Trimmer Utility

PkgClip is a little helper utility that will scan pacman's cache, and classify every package into different groups, also called "reasons." Reasons, because they'll be used to determine whether a package should be kept, or removed. (Well, to determine the recommended action, up to you to go with it or not, of course.)

If your cache keeps growing and only ever growing, and over time it'll get pretty fat. And while keeping old versions is good, there's no point to keep every single version of everything you ever installed.

For each package, PkgClip will check whether or not it is installed on the system. The test will determine whether this version of the package is installed, or another one. Based on this, each package will fall under one of the following :

- Package of a version more recent than the one currently installed; Marked to Keep
- Package of the currently installed version; Marked to Keep
- Package of the same version but a previous package release (pkgrel); Marked to Remove
- Package of an older version. You can define how many of those you'd like to keep. As many will be marked to Keep, any other (i.e. the oldest ones, of course) will be marked to Remove
- Package for which no version is currently installed; Marked to Remove

As a result, you might have quite a few packages marked to be removed, but still keep a few more than what `pacman -Sc` would do. Of course you can tweak this selection:
- You can define how many older versions to keeping
- You can set not to remove old package releases, that is a package of the same version but a previous package release will simply be treated as an old version
- Finally, all of this only defines the recommended/default values for each packages. You can obviously then review the list and manually add/remove packages to be removed as you wish.

As you probably know, you cannot actually just run `pacman -Sc` from your terminal, if you're logged in as a regular user. Because those files belong to root and therefore root privileges are required to do anything. PkgClip is not intended to be run as root of course, and will rely on PolicyKit to ensure correct authorization has been granted. Obviously it requires you to have PolicyKit installed, but also (assuming default configuration) a PolicyKit agent, which is the one in charge of asking for your/root password and making sure you don't just press random keys and whatnot.

Everything should be pretty straight-forward; hopefully this might be useful to some. As hinted above, DBus and PolicyKit are required for PkgClip to work. It also requires libalpm 7 (pacman 4) and GTK3.
PkgClip is released under GNU GPL v3+ The source code is available on this BitBucket repository; You can also find a PKGBUILD in the AUR.

And of course bug reports, suggestions or any other form of constructive criticism is very much welcome.

Offline

#2 2012-01-17 19:57:59

sas
Member
Registered: 2009-11-24
Posts: 155

Re: PkgClip - Cached Packages Trimmer Utility

I like the idea, even if I'm not sure having it as a gui app is really necessary.

In any case, in the PKGBUILD replace:
  arch=('i686')
with:
  arch=('i686', 'x86_64')

Compiling and running it on 64bit Arch works just fine, so no reason to disable it in the PKGBUILD.

Offline

#3 2012-01-18 09:52:38

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: PkgClip - Cached Packages Trimmer Utility

Thanks. Yeah it could have worked as a cli thing, but I wanted to have a list I could review/change before any removal takes place, so gui seemed right.
( Also, as I'm still learning, this was an occasion to play with GTK wink )

And yeah, my bad: PKGBUILD updated w/ (new version and) "support" for x86_64 as well.

Offline

#4 2012-05-10 19:18:46

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: PkgClip - Cached Packages Trimmer Utility

Just a quick note, as a new version (1.0.0) is up :

- Added buttons to "Select previous/next marked package" to allow quick & easy review of marked packages
- Added menus for "Select previous/next marked package" and "Remove marked packages", all with accelerators
- Added "As Installed" list, to treat packages as if they were installed. For packages installed, this will have no effect. For others, the most recent version will be treated as if it was installed, then same thing (i.e. regarding older pkgrel, etc) This can be useful for non-installed packages that one wants to keep, when they're needed on occasion (e.g. to compile something...)
- Added option to specify number of old versions to keep specific to packages on "As Installed" list.
- A few fixes
- Bumped to 1.0.0 to follow semantic versioning

Offline

#5 2014-12-21 07:11:53

adam777
Member
Registered: 2012-05-28
Posts: 161

Re: PkgClip - Cached Packages Trimmer Utility

Hello,
Just a quick heads-up, PkgClip does not work for me, probably due to incompatibility with pacman 4.2.0:

pkgclip: error while loading shared libraries: libalpm.so.8: cannot open shared object file: No such file or directory

Thanks.

Offline

#6 2014-12-21 11:38:51

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: PkgClip - Cached Packages Trimmer Utility

Yes, you can just rebuild it against pacman-4.2 and it'll work, as pkgclip isn't affected by the API changes.

Offline

#7 2014-12-21 12:44:21

adam777
Member
Registered: 2012-05-28
Posts: 161

Re: PkgClip - Cached Packages Trimmer Utility

jjacky wrote:

Yes, you can just rebuild it against pacman-4.2 and it'll work, as pkgclip isn't affected by the API changes.

It worked, Thanks.

Offline

#8 2015-03-04 23:37:48

stef_204
Member
Registered: 2014-08-15
Posts: 37

Re: PkgClip - Cached Packages Trimmer Utility

@ jjacky

Are you still developing this?

Just installed it.

It runs fine the first time; but if I then edit the "preferences" and change the "numbers of old versions to keep" variable to "3" and tick off the box "load on startup" --probably ANY change that will create a ".config/pkgclip.conf"--it segfaults on next start.  I also tried to edit the config file itself, no joy.

As soon as I delete ".config/pkgclip.conf", the program starts up fine again.

So, I cannot change prefs without crashing it.

I tried to backtrace:

Reading symbols from pkgclip...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/pkgclip -d 8
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffe8fcf700 (LWP 7728)]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff62aae94 in free () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff62aae94 in free () from /usr/lib/libc.so.6
#1  0x000000000040c52e in ?? ()
#2  0x000000000040cf4d in ?? ()
#3  0x000000000040d654 in ?? ()
#4  0x000000000040602d in ?? ()
#5  0x00007ffff6250800 in __libc_start_main () from /usr/lib/libc.so.6
#6  0x0000000000407f09 in ?? ()
(gdb) quit
nm -a -C /usr/bin/pkgclip 
nm: /usr/bin/pkgclip: no symbols

Let me know if interested in debugging/troubleshooting and how I can provide useful info.
Thanks.

PS Running Pacman v4.2.1 - libalpm v9.0.1

Last edited by stef_204 (2015-03-05 14:17:19)

Offline

#9 2015-03-07 18:00:30

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: PkgClip - Cached Packages Trimmer Utility

Yes, I'm still maintaining this, though I have been meaning to release a new version for some time now but keep pushing it...

Anyhow, first if you could try using the latest, i.e. branch next from github, as a few bugs have actually been fixed there. (You can see this PKGBUILD for inspiration if needed). If it still occurs then, please try compiling with (PKGBUILD) options debug & !strip to hopefully get a useful backtrace.

Thanks!

Offline

#10 2016-02-01 19:32:53

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: PkgClip - Cached Packages Trimmer Utility

At last, a new version! smile PkgClip 1.3.0 is out :

  • Reset ALPM on reload (in case of config/DB update)
    E.g. after a sysupgrade it's no longer needed to restart PkgClip to have it use the latest DB.

  • Fix possible memory leak

  • Add option to remove matching .sig files (enabled by default)

  • Fix scrolling on going prev/next package w/ GTK+3.14

  • Fix possible segfault

Offline

Board footer

Powered by FluxBB