Reimplement runtime dependency resolution toggle

This commit is contained in:
2026-02-07 15:03:38 +02:00
parent f18c837bc2
commit bc3df83936
3 changed files with 8 additions and 7 deletions
+4 -3
View File
@@ -100,7 +100,7 @@ type ResolvedPackage struct {
InstallationReason InstallationReason
}
func ResolveDependencies(pkgInfo *PackageInfo, resolvedVirtualPackages map[string]string, includeOptionalDepends bool, rootDir string) (resolved []ResolvedPackage, unresolved []string) {
func ResolveDependencies(pkgInfo *PackageInfo, resolvedVirtualPackages map[string]string, includeRuntimeDepends, includeOptionalDepends bool, rootDir string) (resolved []ResolvedPackage, unresolved []string) {
visited := make([]string, 0)
var dfs func(resolvedPkg *PackageInfo)
@@ -139,9 +139,10 @@ func ResolveDependencies(pkgInfo *PackageInfo, resolvedVirtualPackages map[strin
visited = append(visited, pkgInfo.Name)
checkDependencies(pkgInfo.Depends, InstallationReasonDependency)
if pkgInfo.Type == "binary" {
if includeRuntimeDepends {
checkDependencies(pkgInfo.RuntimeDepends, InstallationReasonDependency)
} else if pkgInfo.Type == "source" {
}
if pkgInfo.Type == "source" {
checkDependencies(pkgInfo.MakeDepends, InstallationReasonMakeDependency)
checkDependencies(pkgInfo.CheckDepends, InstallationReasonMakeDependency)
}
+2 -2
View File
@@ -132,7 +132,7 @@ func InstallPackages(rootDir string, forceInstallationReason InstallationReason,
}
// Resolve dependencies
operation.ResolveDependencies(reinstallMethod == ReinstallMethodAll, installOptionalDependencies)
operation.ResolveDependencies(reinstallMethod == ReinstallMethodAll, installRuntimeDependencies, installOptionalDependencies)
if len(operation.UnresolvedDepends) != 0 {
if !forceInstallation {
return nil, DependencyNotFoundErr{operation.UnresolvedDepends}
@@ -428,7 +428,7 @@ func UpdatePackages(rootDir string, syncDatabase bool, allowDowngrades bool, ins
}
// Check for new dependencies in updated packages
operation.ResolveDependencies(false, installOptionalDependencies)
operation.ResolveDependencies(false, true, installOptionalDependencies)
if len(operation.UnresolvedDepends) != 0 {
if !forceInstallation {
return nil, DependencyNotFoundErr{operation.UnresolvedDepends}
+2 -2
View File
@@ -131,7 +131,7 @@ func (operation *BPMOperation) GetFinalActionSize(rootDir string) int64 {
return ret
}
func (operation *BPMOperation) ResolveDependencies(reinstallDependencies, installOptionalDependencies bool) {
func (operation *BPMOperation) ResolveDependencies(reinstallDependencies, installRuntimeDepends, installOptionalDependencies bool) {
// Discover resolved virtual packages
resolvedVirtualPackages := make(map[string]string)
for _, value := range slices.Clone(operation.Actions) {
@@ -167,7 +167,7 @@ func (operation *BPMOperation) ResolveDependencies(reinstallDependencies, instal
continue
}
resolved, unresolved := ResolveDependencies(pkgInfo, resolvedVirtualPackages, installOptionalDependencies, operation.RootDir)
resolved, unresolved := ResolveDependencies(pkgInfo, resolvedVirtualPackages, installRuntimeDepends, installOptionalDependencies, operation.RootDir)
// Append unresolved dependencies
operation.UnresolvedDepends = append(operation.UnresolvedDepends, unresolved...)