mirror of
https://github.com/EnumeratedDev/bpm.git
synced 2026-09-16 10:36:12 +00:00
Improve ignore_package functionality
This commit is contained in:
@@ -129,6 +129,11 @@ func ResolveDependencies(pkgInfo *PackageInfo, resolvedVirtualPackages map[strin
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip ignored packages in config
|
||||||
|
if slices.Contains(MainBPMConfig.IgnorePackages, dependEntry.Info.Name) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if !slices.Contains(visited, dependEntry.Info.Name) {
|
if !slices.Contains(visited, dependEntry.Info.Name) {
|
||||||
dfs(dependEntry.Info)
|
dfs(dependEntry.Info)
|
||||||
resolved = append(resolved, ResolvedPackage{DatabaseEntry: dependEntry, InstallationReason: installationReason})
|
resolved = append(resolved, ResolvedPackage{DatabaseEntry: dependEntry, InstallationReason: installationReason})
|
||||||
|
|||||||
+61
-21
@@ -213,7 +213,7 @@ func RemovePackages(rootDir string, force, cleanupDependencies bool, packages ..
|
|||||||
// Get packages and their dependants
|
// Get packages and their dependants
|
||||||
packageDepndants := make(map[string][]string, 0)
|
packageDepndants := make(map[string][]string, 0)
|
||||||
for _, action := range operation.Actions {
|
for _, action := range operation.Actions {
|
||||||
// Skip package if ignored
|
// Skip package if ignored in config
|
||||||
if slices.Contains(MainBPMConfig.IgnorePackages, action.(*RemovePackageAction).BpmPackage.PkgInfo.Name) {
|
if slices.Contains(MainBPMConfig.IgnorePackages, action.(*RemovePackageAction).BpmPackage.PkgInfo.Name) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -393,6 +393,7 @@ func UpdatePackages(rootDir string, syncDatabase, allowDowngrades, forceInstalla
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Search for packages
|
// Search for packages
|
||||||
|
pkgsNotFound := make([]string, 0)
|
||||||
for _, pkg := range pkgs {
|
for _, pkg := range pkgs {
|
||||||
if slices.Contains(MainBPMConfig.IgnorePackages, pkg) {
|
if slices.Contains(MainBPMConfig.IgnorePackages, pkg) {
|
||||||
continue
|
continue
|
||||||
@@ -417,39 +418,78 @@ func UpdatePackages(rootDir string, syncDatabase, allowDowngrades, forceInstalla
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for new uninstalled dependencies
|
// Check for missing dependencies
|
||||||
for _, dep := range entry.Info.Depends {
|
for _, dep := range entry.Info.Depends {
|
||||||
if !IsPackageInstalled(dep, rootDir) && len(GetVirtualPackageInfo(dep, rootDir)) == 0 {
|
if IsPackageInstalled(dep, rootDir) {
|
||||||
// Find database entry for missing dependency
|
continue
|
||||||
depEntry, _, err := GetDatabaseEntry(dep)
|
}
|
||||||
if err != nil {
|
if len(GetVirtualPackageInfo(dep, rootDir)) > 0 {
|
||||||
return nil, err
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find database entry for missing dependency
|
||||||
|
depEntry, _, err := GetDatabaseEntry(dep)
|
||||||
|
if err != nil {
|
||||||
|
providers := GetDatabaseVirtualPackageEntry(dep)
|
||||||
|
if len(providers) == 0 {
|
||||||
|
pkgsNotFound = append(pkgsNotFound, dep)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
operation.AppendAction(&FetchPackageAction{
|
depEntry = providers[0]
|
||||||
InstallationReason: InstallationReasonDependency,
|
|
||||||
DatabaseEntry: depEntry,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip dependency if ignored in config
|
||||||
|
if slices.Contains(MainBPMConfig.IgnorePackages, depEntry.Info.Name) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch dependency
|
||||||
|
operation.AppendAction(&FetchPackageAction{
|
||||||
|
InstallationReason: InstallationReasonDependency,
|
||||||
|
DatabaseEntry: depEntry,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
// Check for new uninstalled runtime dependencies
|
// Check for missing runtime dependencies
|
||||||
for _, dep := range entry.Info.RuntimeDepends {
|
for _, dep := range entry.Info.RuntimeDepends {
|
||||||
if !IsPackageInstalled(dep, rootDir) && len(GetVirtualPackageInfo(dep, rootDir)) == 0 {
|
if IsPackageInstalled(dep, rootDir) {
|
||||||
// Find database entry for missing dependency
|
continue
|
||||||
depEntry, _, err := GetDatabaseEntry(dep)
|
}
|
||||||
if err != nil {
|
if len(GetVirtualPackageInfo(dep, rootDir)) > 0 {
|
||||||
return nil, err
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find database entry for missing dependency
|
||||||
|
depEntry, _, err := GetDatabaseEntry(dep)
|
||||||
|
if err != nil {
|
||||||
|
providers := GetDatabaseVirtualPackageEntry(dep)
|
||||||
|
if len(providers) == 0 {
|
||||||
|
pkgsNotFound = append(pkgsNotFound, dep)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
operation.AppendAction(&FetchPackageAction{
|
depEntry = providers[0]
|
||||||
InstallationReason: InstallationReasonDependency,
|
|
||||||
DatabaseEntry: depEntry,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip dependency if ignored in config
|
||||||
|
if slices.Contains(MainBPMConfig.IgnorePackages, depEntry.Info.Name) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch dependency
|
||||||
|
operation.AppendAction(&FetchPackageAction{
|
||||||
|
InstallationReason: InstallationReasonDependency,
|
||||||
|
DatabaseEntry: depEntry,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return error if not all packages are found
|
||||||
|
if len(pkgsNotFound) != 0 {
|
||||||
|
return nil, PackageNotFoundErr{pkgsNotFound}
|
||||||
|
}
|
||||||
|
|
||||||
// Replace obsolete packages
|
// Replace obsolete packages
|
||||||
operation.ReplaceObsoletePackages()
|
operation.ReplaceObsoletePackages()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user