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

vars: Use uname() for architecture autodetection #1063

Merged
merged 2 commits into from
Dec 7, 2023

Conversation

m-blaha
Copy link
Member

@m-blaha m-blaha commented Dec 5, 2023

The %_host_cpu macro is not runtime detected, it's only usable to detect
which architecture rpm was built for.
To detect that dnf5 is running on 32bit personality on x86_64 we need to
use uname().
The code is taken from libdnf (see libdnf/hy-util.cpp).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2252671

The %_host_cpu macro is not runtime detected, it's only usable to detect
which architecture rpm was built for.
To detect that dnf5 is running on 32bit personality on x86_64 we need to
use uname().
The code is taken from libdnf (see libdnf/hy-util.cpp).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2252671
@j-mracek
Copy link
Contributor

j-mracek commented Dec 6, 2023

I believe that we can modify init_lib_rpm(arch); call. It was required to call it prior arch detection, but the new implementation does not require it. I would suggest to call it after the last step of detection is performed.

@j-mracek j-mracek self-assigned this Dec 6, 2023
Now that detect_arch() no longer relies on initialized librpm, we can
defer the librpm initialization until after the arch is detected and use
the detected architecture as its argument.
@m-blaha
Copy link
Member Author

m-blaha commented Dec 6, 2023

I believe that we can modify init_lib_rpm(arch); call. It was required to call it prior arch detection, but the new implementation does not require it. I would suggest to call it after the last step of detection is performed.

I've moved librpm initialization after arch detection.

@j-mracek
Copy link
Contributor

j-mracek commented Dec 6, 2023

LGTM, There are some failing tests, but it looks like that two PRs were somehow mixed -> ready to merge

@praiskup
Copy link
Member

praiskup commented Dec 7, 2023

Awesome. Any ETA for when this will be added to F40 (Rawhide) repos? In particular this is blocking https://fedoraproject.org/wiki/Changes/BuildWithDNF5

@praiskup
Copy link
Member

praiskup commented Dec 7, 2023

FTR, I tested with:

$ cat /tmp/test.cfg
include('/etc/mock/fedora-rawhide-i386.cfg')

config_opts['root'] = 'packit-rpm-software-management-dnf5-1063_fedora-rawhide-i386'
config_opts['isolation'] = 'unchanged'

config_opts["package_manager"] = 'dnf5'

config_opts['dnf.conf'] += """
[copr_base]
name="Copr repository"
baseurl=https://download.copr.fedorainfracloud.org/results/packit/rpm-software-management-dnf5-1063/fedora-rawhide-x86_64/
gpgcheck=0
enabled=1
skip_if_unavailable=1
metadata_expire=0
cost=1
best=1
"""

$ mock -r /tmp/test.cfg /home/praiskup/rh/packages/tar/fedora/tar-1.35-2.src.rpm
...

And it behaves as expected.

@j-mracek j-mracek added this pull request to the merge queue Dec 7, 2023
Merged via the queue into main with commit 8091c79 Dec 7, 2023
11 of 14 checks passed
@j-mracek j-mracek deleted the mblaha/arch-detect-uname branch December 7, 2023 13:41
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 this pull request may close these issues.

3 participants