On Fri, Nov 12, 2021 at 10:50 PM Maxwell G via devel <devel@lists.fedoraproject.org> wrote:
Hi everyone,

On Thu, 2021-09-16 at 15:17 -0400, Ben Cotton wrote:
> https://fedoraproject.org/wiki/Changes/ExcludeFromWeakAutodetect
>
>
> == Summary ==
> exclude_from_weak_autodetect enables autodetection of unmet weak
> dependencies (Recommends or Supplements) of installed packages and
> blocks installation of packages satisfying already unmet dependencies.
> In other words: When you don't have the recommended package installed,
> it won't be automatically installed with future upgrades of the
> recommending package.

I am not sure if this was intended, but this change has broken rich
weak dependencies when both packages are not installed as part of the
same transaction.

In my yt-dlp package's specfile[1], I have three subpackages for shell
completions: `yt-dlp-bash-completion`, `yt-dlp-zsh-completion`, and
`yt-dlp-fish-completion. Here is the `bash-completion` block:

``` spec
%package bash-completion
Summary:        Bash completion for %{name}
Requires:       %{name} = %{version}
Requires:       bash-completion
Supplements:    (%{name} and bash-completion)
BuildArch:      noarch
```

The intended effect is for the shell completions to be installed at the
time `yt-dlp` itself is installed if the respective shell package
(`bash-completion`, `zsh` or `fish`) is already present while still
allowing users to opt out. However, now this does not work; dnf will
only install the completions if both `yt-dlp` and the shell package are
installed as part of the same transaction. I can confirm that this is
caused by this change, because adding `--
setopt=exclude_from_weak_autodetect=false` fixes the problem. Replacing
`Supplements` with forward facing boolean `Requires` did not work
either.

``` spec
Recommends:     (%{name}-bash-completion if bash-completion)
Recommends:     (%{name}-zsh-completion if zsh)
Recommends:     (%{name}-fish-completion if fish)
```

While I agree that {rich,} weak dependencies should not be reinstalled
as part of updates, I do believe that they should be installed if one
of the packages is being installed for the first time.

I also think we should consider implementing better guidelines for
shell completions in Fedora. I believe that shell completions should be
split into subpackages and that these subpackages should depend on the
shells themselves or a `-filesystem` package that actually own the
directories. Right now, directory ownership is kind of a mess. At least
on my system, there are several packages that own /usr/share/bash-
completion, /usr/share/zsh/vendor-completions, /usr/share/zsh/site-
functions, and /usr/share/fish/vendor_completions.d/. We can also use
this oppurtunity to create macros for each of these directories.

Management of shell completion packages was discussed further in my
package review ticket [2].

I am relatively new to Fedora, so please correct me if I got anything
wrong.

Thanks,
Maxwell

[1]: https://src.fedoraproject.org/rpms/yt-dlp/blob/rawhide/f/yt-dlp.spec
[2]: https://bugzilla.redhat.com/show_bug.cgi?id=2012522


Hey Maxwell,
can you please file a new bug in bugzilla against dnf and copy the problem description into it? Then make your new bug block bug 2013327 [1], which is the tracker for this Change. This way you'll make sure that this problem doesn't get lost and the maintainer has to deal with it before the appropriate Change deadline. Thanks!

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2013327