Skip to content

Commit

Permalink
filter packages by arch during resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
tofay committed Feb 17, 2025
1 parent b2d8ea4 commit 29efe3f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
### Added
### Fixed
- A more thorough fix for repositories that have packages for multiple architectures in the same repository.
- The archictecture of a package is now stored in the lockfile.
- Packages are filtered by base architecture, and the architecture of a package is now stored in the lockfile
- This change is backwards compatible - older versions of rpmoci will ignore this field and may select the wrong package on download.

## 0.4.1 - 2024-11-21
Expand Down
4 changes: 3 additions & 1 deletion src/lockfile/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ def get_packages(base, pkg_spec):
subj = dnf.subject.Subject(pkg_spec)
query = subj.get_best_query(base.sack)
query = query.available()
query = query.filterm(latest_per_arch_by_priority=True)
query = query.filterm(
latest_per_arch_by_priority=True, arch=[base.conf.basearch, "noarch"]
)

pkgs = query.run()
if not pkgs:
Expand Down
4 changes: 3 additions & 1 deletion tests/fixtures/basearch/rpmoci.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[contents]
packages = ["basesystem"]
packages = [
"libgcc", # has i686 and x86_64 variants
"basesystem"] # is noarch

[[contents.repositories]]
url = "https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi9/9/$basearch/baseos/os"
Expand Down

0 comments on commit 29efe3f

Please sign in to comment.