rpm-software-management / mock

Mock is a tool for a reproducible build of RPM packages.
GNU General Public License v2.0
381 stars 227 forks source link

New {{ repo_arch }} variable usable instead of $basearch #1317

Closed praiskup closed 7 months ago

praiskup commented 7 months ago

This fixes the native bootstrap preparation for cross-arch (emulated) builds.

Conan-Kudo commented 7 months ago

$basearch is not valid for 32-bit x86 (i386 vs i586) and 32-bit ARM (armhfp vs arm7hl)

praiskup commented 7 months ago

Ok, the basearch seems to be useless indeed. I think the current version of the patch could help, so we keep using native architecture for the bootstrap chroot, and emulated for target chroot. Even though... I don't get why mageia-8-x86_64 prepares the bootstrap correctly, but not mageia-8-armv7hl:

determining the fastest mirror (1 hosts).. done.
Mageia 8 - x86_64 - Updates                                                                                                                                                                                 2.6 kB/s | 1.5 kB     00:00    
Error: 
 Problem 1: conflicting requests
  - nothing provides python3-libcomps >= 0.1.8 needed by python3-dnf-4.6.0-1.mga8.noarch from mageia
  - nothing provides python3-libdnf >= 0.57.0 needed by python3-dnf-4.6.0-1.mga8.noarch from mageia
  - nothing provides python3-libmodulemd >= 2.9.3 needed by python3-dnf-4.6.0-1.mga8.noarch from mageia
  - nothing provides python3-rpm >= 4.14.0 needed by python3-dnf-4.6.0-1.mga8.noarch from mageia
  - nothing provides deltarpm needed by python3-dnf-4.6.0-1.mga8.noarch from mageia
  - nothing provides python3-gpg needed by python3-dnf-4.6.0-1.mga8.noarch from mageia
  - nothing provides python(abi) = 3.8 needed by python3-dnf-4.6.0-1.mga8.noarch from mageia
  - nothing provides python3-hawkey >= 0.57.0 needed by python3-dnf-4.6.0-1.mga8.noarch from mageia
 Problem 2: conflicting requests
  - nothing provides python3-dbus needed by python3-dnf-plugins-core-4.0.19-1.mga8.noarch from mageia
  - nothing provides python(abi) = 3.8 needed by python3-dnf-plugins-core-4.0.19-1.mga8.noarch from mageia
  - nothing provides python3-hawkey >= 0.46.1 needed by python3-dnf-plugins-core-4.0.19-1.mga8.noarch from mageia
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

The very same on-host command is used:

- /usr/bin/dnf-3 --installroot /var/lib/mock/mageia-8-armv7hl-bootstrap/root/ --releasever 8 --setopt=deltarpm=False --setopt=allow_vendor_change=yes --allowerasing --disableplugin=local --disableplugin=spacewalk --disableplugin=versionlock install python3-dnf python3-dnf-plugins-core --setopt=tsflags=nocontexts
+ /usr/bin/dnf-3 --installroot /var/lib/mock/mageia-8-x86_64-bootstrap/root/  --releasever 8 --setopt=deltarpm=False --setopt=allow_vendor_change=yes --allowerasing --disableplugin=local --disableplugin=spacewalk --disableplugin=versionlock install python3-dnf python3-dnf-plugins-core --setopt=tsflags=nocontexts

The very same configuration is used, except for user_agent:

--- /var/lib/mock/mageia-8-armv7hl-bootstrap/root/etc/dnf/dnf.conf      2024-02-09 10:22:09.426386586 +0100
+++ /var/lib/mock/mageia-8-x86_64-bootstrap/root/etc/dnf/dnf.conf       2024-02-09 10:24:02.588258507 +0100
@@ -14,7 +14,7 @@
 metadata_expire=0
 best=1
 protected_packages=
-user_agent=Mock (mageia-8-armv7hl-bootstrap; armv7hl)
+user_agent=Mock (mageia-8-x86_64-bootstrap; x86_64)

 # repos
Conan-Kudo commented 7 months ago

ping @pterjan

Conan-Kudo commented 7 months ago

Mageia 8 is EOL anyway, so I'm a bit less concerned about it, but does this problem come up in Mageia 9?

praiskup commented 7 months ago

Mageia 9 behaves the same:

DEBUG: Executing command: ['/usr/bin/dnf-3', '--installroot', '/var/lib/mock/mageia-9-armv7hl-bootstrap/root/', '--releasever', '9', '--setopt=deltarpm=False', '--setopt=allow_vendor_change=yes', '--allowerasing', '--disableplugin=local', '--disableplugin=spacewalk', '--disableplugin=versionlock', 'install', 'python3-dnf', 'python3-dnf-plugins-core', '--setopt=tsflags=nocontexts'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/var/lib/mock/mageia-9-armv7hl-bootstrap/root/installation-homedir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'PS1': '<mock-chroot> \\s-\\v\\$ ', 'LANG': 'C.UTF-8', 'LC_MESSAGES': 'C.UTF-8'} and shell False
 => Personality: None
No matches found for the following disable plugin patterns: local, spacewalk, versionlock
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

determining the fastest mirror (8 hosts).. done.                                                       [===                                                                                               ] ---  B/s |   0  B     --:-- ETA
Mageia 9 - x86_64                                                                                                                                                                                           2.2 kB/s | 2.5 kB     00:01    
determining the fastest mirror (2 hosts).. done.                                                       [      ===                                                                                         ] ---  B/s |   0  B     --:-- ETA
Mageia 9 - x86_64 - Updates                                                                                                                                                                                  50 kB/s | 1.0 MB     00:20    
Error: 
 Problem 1: conflicting requests
  - nothing provides python3-libcomps >= 0.1.8 needed by python3-dnf-4.14.0-1.mga9.noarch from mageia
  - nothing provides python3-libdnf >= 0.66.0 needed by python3-dnf-4.14.0-1.mga9.noarch from mageia
  - nothing provides python3-libmodulemd >= 2.9.3 needed by python3-dnf-4.14.0-1.mga9.noarch from mageia
  - nothing provides python3-rpm >= 4.14.0 needed by python3-dnf-4.14.0-1.mga9.noarch from mageia
  - nothing provides deltarpm needed by python3-dnf-4.14.0-1.mga9.noarch from mageia
  - nothing provides python3-gpg needed by python3-dnf-4.14.0-1.mga9.noarch from mageia
  - nothing provides python(abi) = 3.10 needed by python3-dnf-4.14.0-1.mga9.noarch from mageia
  - nothing provides python3-hawkey >= 0.66.0 needed by python3-dnf-4.14.0-1.mga9.noarch from mageia
 Problem 2: conflicting requests
  - nothing provides python3-dbus needed by python3-dnf-plugins-core-4.3.1-1.mga9.noarch from mageia
  - nothing provides python(abi) = 3.10 needed by python3-dnf-plugins-core-4.3.1-1.mga9.noarch from mageia
  - nothing provides python3-hawkey >= 0.64.0 needed by python3-dnf-plugins-core-4.3.1-1.mga9.noarch from mageia
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
Conan-Kudo commented 7 months ago

Is the bootstrap chroot supposed to use the native arch? That seems broken.

praiskup commented 7 months ago

That is what we do for Fedora, so yes. Is there a reason why this shouldn't work for Mageia?

praiskup commented 7 months ago

Hm, I think this happens because we set PER_LINUX32 personality for the x86_64 transaction.

pep8speaks commented 7 months ago

Hello @praiskup! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers:

Comment last updated at 2024-02-12 10:34:58 UTC
praiskup commented 7 months ago

Can anyone test/check if this change is acceptable? Unfortunately, this is not just "config-only" patch.

wally-mageia commented 7 months ago

Can anyone test/check if this change is acceptable? Unfortunately, this is not just "config-only" patch.

I have tested the changes and everything seems to be working at least with Mageia Cauldron x86_64 host. I tried to build pkgs for armvh7l, aarch64, i586, and x86_64.

praiskup commented 7 months ago

Ok, thank you for checking. The last versions got fixes for Fedora builds (bootstrap image + multilib builds).

praiskup commented 7 months ago

From the tests:

PASSED: mageia-10-i586.cfg (tmpfs)
PASSED: mageia-10-i586.cfg
PASSED: mageia-10-x86_64.cfg (tmpfs)
PASSED: mageia-10-x86_64.cfg
PASSED: mageia-8-i586.cfg (tmpfs)
PASSED: mageia-8-i586.cfg
PASSED: mageia-8-x86_64.cfg (tmpfs)
PASSED: mageia-8-x86_64.cfg
PASSED: mageia-9-i586.cfg (tmpfs)
PASSED: mageia-9-i586.cfg
PASSED: mageia-9-x86_64.cfg (tmpfs)
PASSED: mageia-9-x86_64.cfg
PASSED: mageia-cauldron-i586.cfg (tmpfs)
PASSED: mageia-cauldron-i586.cfg
PASSED: mageia-cauldron-x86_64.cfg (tmpfs)
PASSED: mageia-cauldron-x86_64.cfg

But we do not test --forcearch builds. These were tested manually by @wally-mageia