Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid repoquery --location output for EPEL 10 buildroots #2130

Closed
praiskup opened this issue Sep 16, 2024 · 2 comments · Fixed by #2131
Closed

Invalid repoquery --location output for EPEL 10 buildroots #2130

praiskup opened this issue Sep 16, 2024 · 2 comments · Fixed by #2131
Assignees

Comments

@praiskup
Copy link
Member

Reproducer:

$ options=( --disablerepo '*' --enablerepo hell --repofrompath=hell,https://kojipkgs.fedoraproject.org/repos/epel10.0-build/latest/x86_64 repoquery --location )
$ dnf-3 "${options[@]}" | grep util-linux
Added hell repo from https://kojipkgs.fedoraproject.org/repos/epel10.0-build/latest/x86_64
Last metadata expiration check: 0:03:39 ago on po 16. září 2024, 13:51:44.
https://kojipkgs.fedoraproject.org/repos/epel10.0-build/latest/x86_64/Packages/util-linux-2.40.2-4.el10.x86_64.rpm
https://kojipkgs.fedoraproject.org/repos/epel10.0-build/latest/x86_64/Packages/util-linux-core-2.40.2-4.el10.x86_64.rpm

These are non-existing files ^^^, and dnf5 repoquery behaves correctly:

$ dnf5 "${options[@]}" | grep util-linux
https://infrastructure.fedoraproject.org/repo/centos/centos-10/BaseOS/x86_64/os/Packages/util-linux-2.40.2-4.el10.x86_64.rpm
https://infrastructure.fedoraproject.org/repo/centos/centos-10/BaseOS/x86_64/os/Packages/util-linux-core-2.40.2-4.el10.x86_64.rpm

Installed packages:

$ rpm -qa | grep -e libsolv -e dnf 
dnfdaemon-0.3.22-3.fc41.noarch
python3-dnfdaemon-0.3.22-3.fc41.noarch
dnf-plugin-diff-1.1-21.fc41.noarch
libsolv-0.7.30-1.fc41.x86_64
libdnf5-5.2.5.0-2.fc41.x86_64
libdnf-0.73.3-1.fc41.x86_64
python3-libdnf-0.73.3-1.fc41.x86_64
libdnf5-cli-5.2.5.0-2.fc41.x86_64
dnf5-5.2.5.0-2.fc41.x86_64
dnf-data-4.21.1-1.fc41.noarch
python3-dnf-4.21.1-1.fc41.noarch
python3-dnf-plugins-core-4.9.0-1.fc41.noarch
dnf-plugins-core-4.9.0-1.fc41.noarch
libsolv-devel-0.7.30-1.fc41.x86_64
libsolv-tools-base-0.7.30-1.fc41.x86_64
libsolv-tools-0.7.30-1.fc41.x86_64
libdnf-devel-0.73.3-1.fc41.x86_64
dnf-utils-4.9.0-1.fc41.noarch
python3-dnf-plugins-extras-common-4.1.2-3.fc41.noarch
dnf5-plugins-5.2.5.0-2.fc41.x86_64
python3-libdnf5-5.2.5.0-2.fc41.x86_64
libdnf-plugin-subscription-manager-1.29.41-1.fc41.x86_64
dnfdragora-2.1.5-7.fc41.noarch
dnfdaemon-selinux-0.3.22-3.fc41.noarch
@m-blaha m-blaha self-assigned this Sep 17, 2024
@m-blaha
Copy link
Member

m-blaha commented Sep 17, 2024

The issue is valid.
When printing remote locations of the package, dnf4 (unlike dnf5) does not take into account the base url from the repository metadata.
This is how the location of the util-linux package looks like in metadata:

<location xml:base="https://infrastructure.fedoraproject.org/repo/centos/centos-10/BaseOS/x86_64/os" href="Packages/util-linux-2.40.2-4.el10.x86_64.rpm"/>

dnf5 correctly uses xml:base from the metadata, dnf4 ignores it and concatenates the href of the package with the url of the repository.

@m-blaha
Copy link
Member

m-blaha commented Sep 17, 2024

Here is part of the dnf5 code to get package's remote location:
https://github.com/rpm-software-management/dnf5/blob/a1a66ce16363d46dbd7a02604b816e2ceeb74d0e/libdnf5/rpm/package.cpp#L350-L356

And this is the equivalent in dnf4 which does not take base url into account:

dnf/dnf/package.py

Lines 292 to 303 in f519e60

def remote_location(self, schemes=('http', 'ftp', 'file', 'https')):
# :api
"""
The location from where the package can be downloaded from. Returns None for installed and
commandline packages.
:param schemes: list of allowed protocols. Default is ('http', 'ftp', 'file', 'https')
:return: location (string) or None
"""
if self._from_system or self._from_cmdline:
return None
return self.repo.remote_location(self.location, schemes)

m-blaha added a commit that referenced this issue Sep 18, 2024
If the package location in the repodata contains basedir, it needs to be
taken into account when calculating the package's remote_location.

Resolves: #2130

= changelog =
msg:           Fix package location if baseurl is present in the metadata
type:          bugfix
resolves:      #2130
m-blaha added a commit to rpm-software-management/ci-dnf-stack that referenced this issue Sep 18, 2024
m-blaha added a commit to rpm-software-management/ci-dnf-stack that referenced this issue Sep 18, 2024
m-blaha added a commit to rpm-software-management/ci-dnf-stack that referenced this issue Sep 18, 2024
kontura pushed a commit to rpm-software-management/ci-dnf-stack that referenced this issue Sep 18, 2024
kontura pushed a commit that referenced this issue Sep 20, 2024
If the package location in the repodata contains basedir, it needs to be
taken into account when calculating the package's remote_location.

Resolves: #2130

= changelog =
msg:           Fix package location if baseurl is present in the metadata
type:          bugfix
resolves:      #2130
m-blaha added a commit to rpm-software-management/ci-dnf-stack that referenced this issue Sep 25, 2024
kontura pushed a commit to rpm-software-management/ci-dnf-stack that referenced this issue Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants