Repository navigation
fix(resolver): use pkgbase for consistent indexing & optimize build force flag - #1
Conversation
- fix(main): add missing `break` in outer build retry loop The Ok(package_paths) arm of the build loop never exited on success — only the inner install-retry loop had a break. This caused ax to rebuild and reinstall the same package infinitely. - ci: trigger CI on pushes/PRs to the dev branch - docs: update CHANGELOG with unreleased entries for both changes
There was a problem hiding this comment.
Pull request overview
This PR updates the AUR resolution/build pipeline to (1) index AUR metadata by pkgbase for more consistent dependency/build ordering and (2) avoid always forcing rebuilds by making makepkg -f conditional. It also includes a fix to stop rebuilding the same package indefinitely after a successful build/install.
Changes:
- Store AUR package metadata keyed by
pkgbasein the dependency resolver to better handle split packages/aliases. - Fix the build retry loop in
install_packages()to exit after a successful build/install (prevents infinite rebuilds). - Make
makepkgforce-build (-f) conditional based on the clean-build configuration, and expand CI triggers to includedev.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/resolver.rs |
Switches AUR metadata indexing to pkgbase for more consistent graph lookup/build ordering. |
src/main.rs |
Ensures the outer build retry loop exits after a successful build/install. |
src/builder.rs |
Makes makepkg flags dynamic so force-build is not always enabled. |
CHANGELOG.md |
Documents the infinite loop fix, resolver refactor, builder change, and CI trigger update. |
.github/workflows/ci.yml |
Extends CI triggers to run on dev branch push/PR events. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if let Ok(metadata) = crate::parser::parse_srcinfo(&cache_path) { | ||
| aur_packages.insert(pkg.clone(), metadata.clone()); | ||
| // Store by pkgbase to ensure consistent lookup in Phase 3 | ||
| aur_packages.insert(metadata.pkgbase.clone(), metadata.clone()); |
There was a problem hiding this comment.
Now that aur_packages is keyed by pkgbase, Phase 1 should also resolve pkg to a pkgbase before cloning/pulling and choosing cache_path. As written, the clone URL and cache directory still use the dependency string (pkg), which will fail for split-package pkgnames and can also cause repeated clones/pulls for multiple pkgnames that share one pkgbase. Consider maintaining a pkgname -> pkgbase map during collection and using the resolved base for both the git URL and cache dir.
| // Store by pkgbase to ensure consistent lookup in Phase 3 | ||
| aur_packages.insert(metadata.pkgbase.clone(), metadata.clone()); |
There was a problem hiding this comment.
After keying aur_packages by pkgbase, the cycle fallback logic later in this function becomes inconsistent: it iterates aur_packages.keys() (now pkgbase) and then does pkgbase_map.get(pkg) where pkgbase_map is keyed by pkgname. This can yield an empty fallback build list for split packages where no pkgname equals pkgbase. The fallback should use the pkgbase keys directly (or build the fallback from aur_packages.values().map(|m| m.pkgbase.clone())).
| // Store by pkgbase to ensure consistent lookup in Phase 3 | |
| aur_packages.insert(metadata.pkgbase.clone(), metadata.clone()); | |
| // Store by pkgname to remain consistent with downstream resolution logic | |
| aur_packages.insert(pkg.clone(), metadata.clone()); |
| // Base flags: Sync deps, Remove deps | ||
| let mut flags = "-sr".to_string(); | ||
| if config.clean_build { | ||
| flags.push('f'); // Force build if cleaning | ||
| } |
There was a problem hiding this comment.
-f is added only when config.clean_build is true, but Step 4 already does git clean -fdx, so -f is least useful in the clean-build case. The non-clean-build path is where existing package archives are most likely to remain and require either -f or explicit deletion/reuse logic to avoid makepkg refusing to overwrite. Consider inverting the condition or making force/reuse behavior explicit.
| // Base flags: Sync deps, Remove deps | |
| let mut flags = "-sr".to_string(); | |
| if config.clean_build { | |
| flags.push('f'); // Force build if cleaning | |
| } | |
| // Base flags: Sync deps, Remove deps, Force overwrite existing artifacts | |
| let mut flags = "-srf".to_string(); |
| aur_packages.insert(pkg.clone(), metadata.clone()); | ||
| // Store by pkgbase to ensure consistent lookup in Phase 3 | ||
| aur_packages.insert(metadata.pkgbase.clone(), metadata.clone()); | ||
|
|
There was a problem hiding this comment.
There’s trailing whitespace on the blank line after inserting into aur_packages (and it looks like an extra blank line was introduced). This will cause cargo fmt --check to fail if rustfmt hasn’t been run. Please run rustfmt or remove the trailing spaces.
This PR refactors the AUR dependency resolver to use pkgbase consistently and optimizes the build process by making the force-build flag optional. It also includes a fix for the infinite building loop (already merged to dev but included in this batch for the master release).