dnf icon indicating copy to clipboard operation
dnf copied to clipboard

Incorrect «--resolve» for set of packages, like «libtool rpm-build»

Open belonesox opened this issue 2 years ago • 2 comments

Consider the case:

  • we need to download set of packages with dependencies
  • then install it from local repo
  • let it be just couple of packages → «libtool» «rpm-build»

I try:

  • «dnf download --downloaddir ./dir4rpms --resolve libtool rpm-build» (according #1998 --resolve without --alldeps should work)
  • creating offline repo with «baseurl=file://$PWD/dir4rpms»
  • installing from local offline repo «dnf install --disablerepo="*" --enablerepo="offline" libtool rpm-build» — failed.
Error:
 Problem: package redhat-rpm-config-262-1.fc39.noarch from offline requires (annobin-plugin-gcc if gcc), but none of the providers can be installed
  - package redhat-rpm-config-262-1.fc39.noarch from offline requires (gcc-plugin-annobin if gcc), but none of the providers can be installed
  - package rpm-build-4.19.0-1.fc39.x86_64 from offline requires system-rpm-config, but none of the providers can be installed
  - package libtool-2.4.7-7.fc39.x86_64 from offline requires gcc(major) = 13, but none of the providers can be installed

I checked it on FC37, FC38, FC39

Script to reproduce: https://gist.github.com/belonesox/0ff847cb441b13f26c697ad0f07c7d03

#!/bin/sh
set +ex
rm -rf ./dir4rpms
toolbox rm -f test-fc39 -y || true
SETPACKAGES="libtool rpm-build"
#dnf-utils rpm-build
toolbox create test-fc39 --distro fedora --release 39 
toolbox run -c test-fc39 sudo dnf install createrepo -y
toolbox run -c test-fc39 sudo dnf download  --downloaddir ./dir4rpms --arch=x86_64  --arch=x86_64 --arch=noarch --resolve $SETPACKAGES -y

#Does not work either
#toolbox run -c test-fc39 sudo dnf download  --downloaddir ./dir4rpms --arch=x86_64  --arch=x86_64 --arch=noarch --resolve libtool --resolve rpm-build -y

toolbox run -c test-fc39 sudo createrepo ./dir4rpms
toolbox run -c test-fc39 sudo bash -c 'sudo echo -e "[offline]\nname=offline\nbaseurl=file://$PWD/dir4rpms/\nenabled=0\ngpgcheck=0\nrepo_gpgcheck=0\n" > /etc/yum.repos.d/offline.repo'
toolbox run -c test-fc39 sudo dnf install --refresh --nogpgcheck --disablerepo="*" --enablerepo="offline"  -y --allowerasing $SETPACKAGES

Is it bug or feature? What I am doing wrong?

belonesox avatar Oct 11 '23 10:10 belonesox

After some experiments, I think you do not do anything wrong, there are just some bugs (actually two of them) in the download command :)

Bug 1 (demonstrates in case the downgrade is part of the installation): dnf download downloads only packages that are in transaction table marked as install and upgrade. In case the result of dnf install libtool is downgrade of some package, this package is not downloaded. I hit this bug when trying reproduce your issue on old F38 image.

Bug 2 (the one you hit): Packages from the downloaded set are processed independently, one by one. This means that the conditional requirement of (gcc-plugin-annobin if gcc) is not downloaded (because gcc is not present on the system and is not part of the transaction).

Thanks for the report, the issue is valid.

m-blaha avatar Oct 11 '23 11:10 m-blaha

On the other hand, resolving downloaded packages independently enables us to download even conflicting packages. That means to resolve this issue we need to make selection of the algorithm configurable.

m-blaha avatar Oct 26 '23 12:10 m-blaha