Re: xim

Monday, Sep 27, 2021
#unix #void #tips

After sharing my xim post earlier this week, nytpu suggested a big improvement in my mailing list. For some context, the original xim script is for situations when you need to install a bunch of libraries, compilers, and other junk to work on a short project and then want to cleanly remove everything when you’re finished. The script is just a wrapper for the void linux package manager which allows adding a “reason message” when you install some packages. Later, you can grep the file xim created to see all the packages you installed for various projects and remove them if you please.

This is what nytpu suggested:

I don’t know about XBPS but Pacman on Artix lets you mark packages as dependencies with --asdeps which will be marked for uninstalling once the parent package is removed. What I currently do in a similar way to xim is make a dummy PKGBUILD where I list all the dependencies and install that (which doesn’t actually install anything, just the dependencies), so I can then just do pacman -Rns <project>-meta when I’m done to remove all the dependencies and crap I installed for it. I wonder if it’d be possible to do something like that for XBPS? Or if one could write a wrapper script like xim for Pacman using the dummy PKGBUILD idea?

I hadn’t even considered creating a meta package that just depends on all the packages you temporarily need to install. What a great idea! I figured it’d be perfect if you could just run xim project-meta lib1 lib2 lib3 and have it automatically generate a project-meta package that depends on those libraries and installs it. Later, you could remove the project-meta package and remove all non-required dependency packages to clean up.

I told Henry about this and later that day he wrote a new script called xmeta that does just this! It’s for void linux at the moment, but should be adaptable to any distro, so long as you can locally create and install packages. Worst case scenario you should be able to make a meta package template and add the name + dependencies with sed.