Skip to content

Full multi-arch support #166

@aszady

Description

@aszady

PR #151 introduced initial support for resolving dependencies across multiple architectures for resolve or lockfile commands.
However, including the same package for multiple architectures within a single resolution context remains problematic. Since this is a common requirement in cross-compilation use cases, I suggest extending multi-arch resolution to fully support such scenarios.

Looking forward to your feedback!

Proposed changes

  • Packages need to be identified by some combination of name and arch, instead of just by name. The bazeldnf code will distinguish between foo.x86_64 and foo.i686 as separate packages.

  • The alias repository needs to provide access to multiple architectures of a package. This behaviour should be customizable with a client-provided macro, as it's hard to derive a one-size-fits-all solution. The default implementation could be, for example:

    • @bazeldnf_rpms//foo:foo - points to the primary/default architecture
    • @bazeldnf_rpms//foo:foo.x86_64 - points to the x86_64 version
    • @bazeldnf_rpms//foo:foo.i686 - points to the i686 version
  • SAT loaders / constraint updates:

    1. Group packages by (name, arch) instead of just name for the purposes of "best" version, so that the choice is fully independent between distinct architectures of the same package. This also gives possibility for foo.i686 to participate in dependency resolution even if foo.x86_64 is the best for foo.

    2. Relax provider uniqueness constraints – multiple packages may provide the same capability (e.g. if they have different architectures). In a multi-arch setting this is essential, as packages are often required just by their name or by library name, which is shared between multiple architectures. This also more closely matches the behaviour of dnf, where we could have e.g. multiple providers of webserver. (Related: SAT solver: Relax unique package provider clause for a package requires #142).

    3. Because of the above, we need to add all providers as dependencies in the lock file – if the requirement is satisfied by more than one package. Let's just list them all and let the client make a choice. This can be perceived as matching the system environment more closely, where any package has access to the full filesystem anyway, which includes all possible requirement alternatives to its requirement.

  • Lockfile format extensions:

    • id field containing a unique, opaque identifier for each package. Useful for constructing repository names and mapping dependencies within the lockfile. So far, only the package name was used for these purposes.
    • arch field containing the package architecture, which can be used later in the alias repository for custom logic.

Backwards Compatibility

Existing single-architecture workflows will continue to work unchanged. Old lockfiles will be supported. With default settings, target references in the alias repository will remain compatible for single-architecture cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions