To give a bit more context, the key insight here is that mkosi is a script that invokes pacman with a list of packages supplied by the user (in this case -> systemd). mkosi first provisions a base Arch image and then installs the packages listed by systemd in it's mkosi config file (https://github.com/systemd/systemd/blob/master/.mkosi/mkosi.arch). To be on the safe side, the config file lists all build dependencies of systemd as build packages so that the mkosi config keeps working regardless of which packages are installed in a base Arch install. Because of this approach, users get quite a few warnings from Pacman when running mkosi (one for each package in BuildPackages that's already installed in the base image). I was hoping --needed would silence these warnings as well. Of course, I could add logic to systemd to filter out the duplicate packages by calling into pacman and filtering existing packages out of the list we install but if pacman didn't warn when using --needed, we'd be able to save us a little bit of complexity.
Thinking about this further, If a user always knew exactly which of the packages he was installing were already installed, there wouldn't be a need for --needed (no pun intended) as the user could simply remove those packages from the list of packages passed to pacman. To me, --needed seems useful exactly in the case where a user doesn't know which packages are already installed and which aren't, which makes the warning a bit moot as the reason we're using --needed is exactly because we don't know which ones are already installed and want to delegate the complexity of finding that out and only installing the packages that aren't already installed to pacman. I hope that makes sense. Daan On Sun, 6 Dec 2020 at 23:22, Allan McRae <al...@archlinux.org> wrote: > > On 7/12/20 5:05 am, Daan De Meyer wrote: > > Hi, > > > > I recently added --needed to pacman's invocation in mkosi but noticed > > that even when --needed is specified, pacman still prints warning > > messages for packages that it's skipping because they are already > > installed. My intuition was that by enabling --needed, I was > > explicitly telling pacman that there might be packages that are > > already installed in the packages that I'm installing and that I want > > to skip those and not be warned about them. The skipping works fine > > but I still get warnings. Would it make sense to remove the skipped > > warning message for packages that are already installed when --needed > > is specified since the user is explicitly requesting this behavior? > > > > I'm on the fence here. You have explicitly asked for packages to be > installed by providing them on the command line, but then --needed says > they don't need installed. That does seem warning-ish to me. > > Allan