Fix virtual package resolution

This commit is contained in:
2026-06-14 18:57:41 +03:00
parent cb191dc16a
commit a496777b9e
2 changed files with 53 additions and 1 deletions
+1 -1
View File
@@ -160,7 +160,7 @@ func ResolveDependencies(pkgInfo *PackageInfo, resolvedVirtualPackages map[strin
continue
}
// Resolve virtual resolved packages
// Resolve virtual packages
for _, vpkg := range dependEntry.Info.Provides {
if _, ok := resolvedVirtualPackages[vpkg]; !ok {
resolvedVirtualPackages[vpkg] = dependEntry.Info.Name
+52
View File
@@ -28,6 +28,7 @@ func InstallPackages(rootDir string, forceInstallationReason InstallationReason,
// Resolve packages
pkgsNotFound := make([]string, 0)
resolvedVirtualPackages := make(map[string]string)
for _, pkg := range packages {
if stat, err := os.Stat(pkg); err == nil && !stat.IsDir() {
bpmpkg, err := ReadPackage(pkg)
@@ -75,6 +76,13 @@ func InstallPackages(rootDir string, forceInstallationReason InstallationReason,
}
}
// Resolve virtual packages
for _, vpkg := range bpmpkg.PkgInfo.Provides {
if _, ok := resolvedVirtualPackages[vpkg]; !ok {
resolvedVirtualPackages[vpkg] = bpmpkg.PkgInfo.Name
}
}
operation.Actions = append(operation.Actions, &InstallPackageAction{
File: pkg,
InstallationReason: installationReason,
@@ -84,6 +92,11 @@ func InstallPackages(rootDir string, forceInstallationReason InstallationReason,
// Split package name and required version
pkgName, _, _ := SplitPkgNameAndVersion(pkg)
// Check resolved virtual packages
if resolvedPkg, ok := resolvedVirtualPackages[pkgName]; ok {
pkgName = resolvedPkg
}
entry := ResolveDatabaseEntry(pkgName, rootDir)
if entry == nil {
pkgsNotFound = append(pkgsNotFound, pkg)
@@ -109,6 +122,13 @@ func InstallPackages(rootDir string, forceInstallationReason InstallationReason,
}
}
// Resolve virtual packages
for _, vpkg := range entry.Info.Provides {
if _, ok := resolvedVirtualPackages[vpkg]; !ok {
resolvedVirtualPackages[vpkg] = entry.Info.Name
}
}
operation.Actions = append(operation.Actions, &FetchPackageAction{
InstallationReason: installationReason,
DatabaseEntry: entry,
@@ -392,6 +412,7 @@ func UpdatePackages(rootDir string, syncDatabase, allowDowngrades, forceInstalla
// Search for packages
pkgsNotFound := make([]string, 0)
resolvedVirtualPackages := make(map[string]string)
for _, pkg := range pkgs {
if rootDir == "/" && slices.Contains(MainBPMConfig.IgnorePackages, pkg) {
continue
@@ -410,6 +431,13 @@ func UpdatePackages(rootDir string, syncDatabase, allowDowngrades, forceInstalla
} else {
comparison := CompareVersions(entry.Info.GetFullVersion(), installedInfo.GetFullVersion())
if (!allowDowngrades && comparison > 0) || (allowDowngrades && comparison != 0) {
// Resolve virtual packages
for _, vpkg := range entry.Info.Provides {
if _, ok := resolvedVirtualPackages[vpkg]; !ok {
resolvedVirtualPackages[vpkg] = entry.Info.Name
}
}
operation.Actions = append(operation.Actions, &FetchPackageAction{
InstallationReason: GetPackage(pkg, rootDir).LocalInfo.GetInstallationReason(),
DatabaseEntry: entry,
@@ -428,6 +456,11 @@ func UpdatePackages(rootDir string, syncDatabase, allowDowngrades, forceInstalla
continue
}
// Check resolved virtual packages
if resolvedPkg, ok := resolvedVirtualPackages[dependName]; ok {
dependName = resolvedPkg
}
// Find database entry for missing dependency
dependEntry := ResolveDatabaseEntry(dependName, rootDir)
if dependEntry == nil {
@@ -451,6 +484,13 @@ func UpdatePackages(rootDir string, syncDatabase, allowDowngrades, forceInstalla
continue
}
// Resolve virtual packages
for _, vpkg := range dependEntry.Info.Provides {
if _, ok := resolvedVirtualPackages[vpkg]; !ok {
resolvedVirtualPackages[vpkg] = dependEntry.Info.Name
}
}
// Fetch dependency
operation.Actions = append(operation.Actions, &FetchPackageAction{
InstallationReason: InstallationReasonDependency,
@@ -470,6 +510,11 @@ func UpdatePackages(rootDir string, syncDatabase, allowDowngrades, forceInstalla
continue
}
// Check resolved virtual packages
if resolvedPkg, ok := resolvedVirtualPackages[dependName]; ok {
dependName = resolvedPkg
}
// Find database entry for missing dependency
dependEntry := ResolveDatabaseEntry(dependName, rootDir)
if dependEntry == nil {
@@ -488,6 +533,13 @@ func UpdatePackages(rootDir string, syncDatabase, allowDowngrades, forceInstalla
continue
}
// Resolve virtual packages
for _, vpkg := range dependEntry.Info.Provides {
if _, ok := resolvedVirtualPackages[vpkg]; !ok {
resolvedVirtualPackages[vpkg] = dependEntry.Info.Name
}
}
// Fetch dependency
operation.Actions = append(operation.Actions, &FetchPackageAction{
InstallationReason: InstallationReasonDependency,