Skip to content

Always prefer native/device arch when building

postmarketOS Bot requested to merge fix/smarter-build-arch-autodetect into master

Created by: ollieparanoid

In case the user does not specify for which arch packages should be built with pmbootstrap build, we detect it automatically.

Previous logic was, that if the APKBUILD's arch is "all" or "noarch", then prefer the native arch, and otherwise use the first one in the list of available arches.

New behavior is, that we also check if the list of possible arches contains the native arch (and if that fails, the device arch). If that is the case, we return the native/device arch instead of the first one in the list.

Use case

The arch from gcc-armhf and similar packages (as generated by pmbootstrap aportgen) used to be "all", but is nowadays a specific list of arches. This means, that after updating the gcc-armhf and gcc-aarch64 packages, and calling pmbootstrap build gcc-armhf, it will try to build gcc-armhf for aarch64 instead of the native architecture, because that is the first one listed. And since compiling to aarch64 requires gcc-aarch64, it will build that for the native architecture first.

So you're asking for gcc-armhf and it compiles gcc-aarch64, which is very confusing (see #1272 (closed)).

Merge request reports