konflux-ci / rpm-lockfile-prototype

GNU General Public License v3.0
3 stars 10 forks source link

Using contentOrigin: repos: fails for single arch package if arches: contains other arches. #51

Closed ckelleyRH closed 1 month ago

ckelleyRH commented 1 month ago

I have rpms.in.yaml (redacted/simplified - you can have the full stuff on request):

contentOrigin:
  repos:
    - repoid: <snip>
      baseurl: <snip>
      varsFromContainerfile: Dockerfile
packages:
  # list of rpm names to resolve
  - librtas
  - <snip>
arches:
  - x86_64
  - aarch64
  - ppc64le
  - s390x
context:
    containerfile: Dockerfile

Here librtas is a ppc64le-only package. I get the following traceback:

rpm-lockfile-prototype --debug --allowerasing rpms.in.yaml
<snip>
INFO:root:Running solver for aarch64
<snip>
Traceback (most recent call last):
  File "/home/ckelley/.local/lib/python3.12/site-packages/rpm_lockfile/__init__.py", line 134, in resolver
    base.install(solvable)
  File "/usr/lib/python3.12/site-packages/dnf/base.py", line 2092, in install
    self._raise_package_not_found_error(pkg_spec, forms, reponame)
  File "/usr/lib/python3.12/site-packages/dnf/base.py", line 2758, in _raise_package_not_found_error
    raise dnf.exceptions.PackageNotFoundError(_('No match for argument'), pkg_spec)
dnf.exceptions.PackageNotFoundError: No match for argument: librtas

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ckelley/.local/bin/rpm-lockfile-prototype", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/ckelley/.local/lib/python3.12/site-packages/rpm_lockfile/__init__.py", line 370, in main
    process_arch(
  File "/home/ckelley/.local/lib/python3.12/site-packages/rpm_lockfile/__init__.py", line 187, in process_arch
    packages, sources = resolver(
                        ^^^^^^^^^
  File "/home/ckelley/.local/lib/python3.12/site-packages/rpm_lockfile/__init__.py", line 136, in resolver
    raise RuntimeError(f"No match found for {solvable}")
RuntimeError: No match found for librtas

Running the same with only ppc64le specified runs to completion. The equivalent using repofiles has been working fine. So either the processor for repos is trying to process all archs for single arch package and repofiles is not, or both are processing all archs and repos is not failing on it and repofiles is.

lubomir commented 1 month ago

The difference between repos and repofiles is a red herring. The real problem is the package that only exists on one particular architecture. The tool doesn't know that, so it tries to install it on all arches, which fails.

The fix is to extend the input file so that users can say they want to install something only on a subset of architectures.