cassava/repoctl

Dependency resolution doesn't take into account the 'Provides'

inglor opened this issue · 2 comments

Some packages provide "virtual" packages which repoctl doesn't take into account when resolving dependencies:

$ repoctl down -r linux-ck
Warning: unknown package initramfs
         Required by: linux-ck
Downloading: linux-ck
$ pacman -Qi mkinitcpio
Name            : mkinitcpio
Version         : 30-1
Description     : Modular initramfs image creation utility
Architecture    : any
URL             : https://projects.archlinux.org/mkinitcpio.git/
Licenses        : GPL
Groups          : None
Provides        : initramfs
Depends On      : awk  mkinitcpio-busybox>=1.19.4-2  kmod  util-linux>=2.23  libarchive
                  coreutils  bash  diffutils  findutils  grep  filesystem>=2011.10-1
                  zstd  systemd
Optional Deps   : gzip: Use gzip compression for the initramfs image [installed]
                  xz: Use lzma or xz compression for the initramfs image [installed]
                  bzip2: Use bzip2 compression for the initramfs image [installed]
                  lzop: Use lzo compression for the initramfs image [installed]
                  lz4: Use lz4 compression for the initramfs image [installed]
                  mkinitcpio-nfs-utils: Support for root filesystem on NFS
Required By     : linux  linux-ck  linux-gc  linux-zen
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 102.77 KiB
Packager        : Giancarlo Razzolini <grazzolini@archlinux.org>
Build Date      : Wed 17 Feb 2021 02:49:42 GMT
Install Date    : Sun 07 Mar 2021 12:39:00 GMT
Install Reason  : Explicitly installed
Install Script  : Yes
Validated By    : Signature
AladW commented

It seems strange that down -r looks at Provides for "required by" in the first place.

Hi @inglor thanks for raising the issue. This is a known limitation (to me at least) that I can't seem to find the time to work around.

I don't think down -r is looking at Provides, instead it is looking for a package called initramfs, which is not a real package. Instead there are a bunch of providers for that package.
In the current implementation of repoctl it assumes that all requires are real packages.
But we know that is not the case.

So basically, when repoctl comes across a package that is required but doesn't exist, repoctl should check if there is a package that "provides" this. We can then eliminate the warning, but what should repoctl do at this point? There are going to be multiple providers, and I don't really want to make repoctl ask you interactively which one it should pick.

Here's a possible path forward:

  1. Detect if the required package is virtual, then:
  2. Do not print a warning if a package that is installed already "Provides" this.
  3. Do not print a warning if a package that is to be downloaded already "Provides" this.
  4. Otherwise, print a warning message that package does not exist or is virtual.