mirror of
https://github.com/EnumeratedDev/bpm.git
synced 2026-09-16 02:26:12 +00:00
Reimplement runtime dependency resolution toggle
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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...)
|
||||
|
||||
Reference in New Issue
Block a user