rpm-software-management / microdnf

Lightweight implementation of dnf in C
GNU General Public License v2.0
220 stars 34 forks source link

multiple archs: ignorearch option not picked up? #114

Open rb2k opened 3 years ago

rb2k commented 3 years ago

Update

It seems like ignorearch is not picked up from the dnf.conf

PREVIOUS CONTEXT

We are running rpm and microdnf on our mac fleet.

I am experimenting with Apple's new M1 CPUs, so I'd like to be able to install x86 and aarch64 RPMs on the M1 machines since they can run both (one natively, one via rosetta 2). To make things a bit simpler, I tried to start with the easy use-case: allow installation of aarch64 architecture RPMs ona an x86 machine.

For RPM, all I needed to do was add aarch64 as a compatible option for x86_64:

arch_compat: x86_64: amd64 em64t athlon noarch aarch64

And I was able to install the RPM with rpm directly:

[root@mactest ~]# rpm -i hello-2.10-ambfjrcjdl77xgb7qvbfp5k89i8rivl6-1-0.aarch64.rpm
warning: hello-2.10-ambfjrcjdl77xgb7qvbfp5k89i8rivl6-1-0.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 14e56dc8: NOKEY
[root@mactest ~]# rpm -qa | grep hello
hello-ambfjrcjdl77xgb7qvbfp5k89i8rivl6-1-0.aarch64

However, if try to install the same RPM from the repo using microDNF:

[root@mactest ~]# microdnf install hello-2.10-ambfjrcjdl77xgb7qvbfp5k89i8rivl6
error: Could not depsolve transaction; 1 problem detected:
 Problem: conflicting requests
  - package hello-2.10-ambfjrcjdl77xgb7qvbfp5k89i8rivl6-1-0.aarch64 does not have a compatible architecture
[root@mactest ~]# 

This is a very similar (but not exactly the same) error message as if I didn't have the rpmrc file set up correctly.

[root@mactest~]# rpm -i hello-ambfjrcjdl77xgb7qvbfp5k89i8rivl6-1-0.aarch64.rpm
warning: hello-2.10-ambfjrcjdl77xgb7qvbfp5k89i8rivl6-1-0.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 14e56dc8: NOKEY
    package hello-aarch64-ambfjrcjdl77xgb7qvbfp5k89i8rivl6-1-0.aarch64 is intended for a different architecture

I tried setting

ignorearch=1

In the dnf.conf, but no luck so far.

Any idea what else I would have to do to let microdnf recognize the additional arch as valid?

rb2k commented 3 years ago

Ah, it seems like I might have to add some code to treat it similarly to this flag:

https://github.com/rpm-software-management/microdnf/blob/7b84c0699311839ea79b0cfbcbf88ef91e3c0ce1/dnf/dnf-main.c#L190-L202

and then

https://github.com/rpm-software-management/microdnf/blob/7b84c0699311839ea79b0cfbcbf88ef91e3c0ce1/dnf/dnf-main.c#L563-L566

rb2k commented 3 years ago

Hmm, I think this might also not be easily surfaced in libdnf yet? I think I might need to do something similar to what @jrohel did in https://github.com/rpm-software-management/libdnf/pull/1116