fedora-copr / copr

RPM build system - upstream for https://copr.fedorainfracloud.org/
114 stars 62 forks source link

`dnf5 copr enable` not expanding `$distname` variable in runtime dependencies #3387

Open jchecahi opened 2 months ago

jchecahi commented 2 months ago

We found this out in the llvm daily builds in copr. We have a runtime dependency repo that uses $distname as we have fedora and rhel chroots. See https://copr.fedorainfracloud.org/coprs/g/fedora-llvm-team/llvm-snapshots-big-merge-20240825/ for example.

We've seen that from Fedora 41 that variable is not being expanded when dnf is used:

# dnf copr -y enable -y @fedora-llvm-team/llvm-snapshots-big-merge-20240825 fedora-rawhide-x86_64
[...]
  1. [coprdep:https_download_copr_fedorainfracloud_org_results_40fedora_llvm_team_llvm_compat_packages_distname_releasever_basearch]
     baseurl=https://download.copr.fedorainfracloud.org/results/%40fedora-llvm-team/llvm-compat-packages/$distname-$releasever-$basearch

These repositories are being enabled together with the main
repository.

# grep llvm-compat /etc/yum.repos.d/*llvm-snapshots*
baseurl=https://download.copr.fedorainfracloud.org/results/%40fedora-llvm-team/llvm-compat-packages/$distname-$releasever-$basearch

However, when using dnf4 the $distname variable is expanded with no problem:

# dnf copr  -y disable -y @fedora-llvm-team/llvm-snapshots-big-merge-20240825
Copr repository 'copr.fedorainfracloud.org/@fedora-llvm-team/llvm-snapshots-big-merge-20240825' in '/etc/yum.repos.d/_copr:copr.fedorainfracloud.org:group_fedora-llvm-team:llvm-snapshots-big-merge-20240825.repo' disabled.
# dnf-3 copr -y enable -y @fedora-llvm-team/llvm-snapshots-big-merge-20240825 fedora-rawhide-x86_64
[...]
 1. [coprdep:https_download_copr_fedorainfracloud_org_results_40fedora_llvm_team_llvm_compat_packages_distname_releasever_basearch]
    baseurl=https://download.copr.fedorainfracloud.org/results/%40fedora-llvm-team/llvm-compat-packages/fedora-$releasever-$basearch

These repositories have been enabled automatically.
# grep llvm-compat /etc/yum.repos.d/*llvm-snapshots*
baseurl=https://download.copr.fedorainfracloud.org/results/%40fedora-llvm-team/llvm-compat-packages/fedora-$releasever-$basearch
praiskup commented 2 months ago

Thank you for the report!

This needs to be done for the DNF5 API call, too: https://github.com/fedora-copr/copr/blob/69957fc106e6bfa69fe426feda34c9822227df45/frontend/coprs_frontend/coprs/helpers.py#L629-L630