vodik / repose

an archlinux repo poking tool
GNU General Public License v2.0
128 stars 15 forks source link

[Question] Remove dependencies #29

Open Mic92 opened 9 years ago

Mic92 commented 9 years ago

Lets say, I use PKGDEST in /etc/makepkg.conf do export an AUR package with its dependencies to a directory and have repose to build a repo from it. And later I want remove this package again. Do you have a convenient way, to purge its dependencies as well? Or is about removing every dependency manually. I currently use a self-written python script to achieve something similar, but it has the disadvantage of having every package in repo installed.

vodik commented 9 years ago

No, there is no way to do this. There are two main blockers for adding this feature:

  1. repose can't remove packages directly.
  2. repose doesn't have any dependency resolution.

General dependency resolution has some catches as well, as there would have to be a lot of logic to support cross repo checks (probably wouldn't tackle this).

What this really means is I need to expand the scope of repose quite a bit to do more than just generate the database. It needs to become a general tool for managing "packages grouped together on the filesystem", which building a repository out of is just one thing it can do.

Another thing I've wondered if fit well with this is if repose should also be able to do things like 'remove everything but the most 3 packages' (I know things like pacleaner tackle this).

Now this is actually something I'd be interesting in doing, but I'd start it off by separating out the backend stuff into its own library, writing a separate tool, and, if its useful, eventually merge it together.

vodik commented 7 years ago

I forgot about this issue, I'm actually still interested in this feature. Work anything out with your python script?

Mic92 commented 7 years ago

Well. I have an LXC container, where I install packages with an AUR helper. Every package build gets exported to a directory. Then I use the script to detect new packages/updates/removed packages and update the repo as well as package signatures. The problem is still that it is not trivial to rebuild the dependency checker of pacman - that's why I just use the package state inside pacman database to see what package are still required.

https://gist.github.com/Mic92/2cbb6f7f4a02be57ae4e68afcfc1066d

On this machine I do not really care about disk space. So this solution works for me. Currently the script does not check, if an packages gets updated without having the version number changed. This could be fixed by checking mtime of the package.

vodik commented 7 years ago

Looks very nice. So for what its worth, you're not using repose anymore then I take it?

Anyways, as my personal repository has grown, I've found myself wanting a feature like this, an ability to manage and clean old packages (like keep only the last 3 recent versions), and in one case, ability to script things better.

I'll probably end up exposing a lot of internals to python through cffi shortly - its already how I've chosen to test my code.

Mic92 commented 7 years ago

I just use repo-add and repo-remove at the moment. One way to recycle pacman in a more efficient way, would be to put the database in a non-standard location and then set the NoExtract option in pacman.conf to *. Packages would be still registered in the pacman database, but do not have to actually extract files to the filesystem. However... now that I migrate slowly migrate everything to NixOS anyway, custom repos are no longer necessary for me, because their Hydra compiles every package.

vodik commented 7 years ago

Packages would be still registered in the pacman database, but do not have to actually extract files to the filesystem.

Not sure what you mean by this. You mean for inspecting the contents of a database without allowing anything to be installed?

Random trick I use, for what its worth, is I put my database's folder in the CacheDir list. It saves pacman from having the first "download" (copy) packages from my repository into /var/cache/pacman/pkg

Anyways, enjoy NixOS and thanks for the script.

Mic92 commented 7 years ago

I want to use the feature of pacman, that I have some packages explicitly installed and pacman keeps track of the dependencies. That way I can install/uninstall packages from yaourt and the packages gets synced in my repo automatically. At the moment some packages are installed just for the purpose of being in my repository.