You are not logged in.

#1 2021-10-16 15:53:25

karb94
Member
Registered: 2019-12-15
Posts: 10

[Solved] How does pacman cache work?

I'm in the process of creating a local repo for my AUR packages as I'll be using aurutils to manage them. This is my understanding of how the AUR package installation process works when using aurutils with a local repo:

  1. Aurutils downloads the necessary files, builds the package, copies the package file (pkg.tar.zst) to the designated local repo directory and registers the packages in the database of that repo with repo-add

  2. The local database at /var/lib/pacman/sync/myrepo (which is a copy of your local AUR repo database) needs to be syncronised so that pacman knows that the new package exists: pacman -Sy

  3. The package can then be installed by pacman -S. This downloads (or in the case of a local repo, copies) the pkg.tar.zst file to the cache directory (by default /var/cache/pacman/pkg) and then pacman uses that file to "install" the package.

Please correct or expand on any of these points if necessary.

The aurutils manual recommends adding a new Cachedir directory equal to your AUR's local repo directory. The idea behind this (I think) is that then pacman doesn't need to download (or rather, copy) the pkg.tar.zst to the cache directory as the package already exists locally and would be wasteful to create another copy. So I did as indicated in the aurutils manual and added this to my pacman.conf:

[options]
CacheDir = /var/cache/pacman/pkg
CacheDir = /path/to/myrepo
CleanMethod = KeepCurrent

To my surprise, any package from my local AUR repo gets copied to /var/cache/pacman/pkg after pacman -S mypackage eventhough /path/to/myrepo already contains the corresponding pkg.tar.zst file and has been included as a CacheDir.

Am I misunderstanding the purpose of adding /path/to/myrepo as a Cachedir or is there something wrong with my pacman.conf? If it's the latter I'm happy to provide more details about my pacman.conf and local repo setup.

Last edited by karb94 (2021-10-17 10:14:05)

Offline

#2 2021-10-16 22:39:59

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,390
Website

Re: [Solved] How does pacman cache work?

Set your AUR repo to have SigLevel = Never if you are not signing packages.

Offline

#3 2021-10-17 00:38:11

karb94
Member
Registered: 2019-12-15
Posts: 10

Re: [Solved] How does pacman cache work?

OK so that worked, thanks. But I'm confused as to why it worked. What does signing have to do with whether the package is copied or not to the first CacheDir? My original SigLevel for the repo was set to Optional TrustAll.

Offline

#4 2021-10-17 02:03:46

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,390
Website

Re: [Solved] How does pacman cache work?

If there is no signature, but pacman is looking for one, it tries to redownload the package and signature file.  The downloaded package goes to the main cache.  This is a "bug" in pacman, that I really can not be bothered fixing.

Offline

#5 2021-10-17 10:13:42

karb94
Member
Registered: 2019-12-15
Posts: 10

Re: [Solved] How does pacman cache work?

I see, thanks again. Your work and help is really appreciated. Closing.

Offline

Board footer

Powered by FluxBB