mirror of
https://github.com/EnumeratedDev/bpm.git
synced 2026-09-16 02:26:12 +00:00
Fix virtual package resolution
This commit is contained in:
@@ -160,7 +160,7 @@ func ResolveDependencies(pkgInfo *PackageInfo, resolvedVirtualPackages map[strin
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve virtual resolved packages
|
// Resolve virtual packages
|
||||||
for _, vpkg := range dependEntry.Info.Provides {
|
for _, vpkg := range dependEntry.Info.Provides {
|
||||||
if _, ok := resolvedVirtualPackages[vpkg]; !ok {
|
if _, ok := resolvedVirtualPackages[vpkg]; !ok {
|
||||||
resolvedVirtualPackages[vpkg] = dependEntry.Info.Name
|
resolvedVirtualPackages[vpkg] = dependEntry.Info.Name
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ func InstallPackages(rootDir string, forceInstallationReason InstallationReason,
|
|||||||
|
|
||||||
// Resolve packages
|
// Resolve packages
|
||||||
pkgsNotFound := make([]string, 0)
|
pkgsNotFound := make([]string, 0)
|
||||||
|
resolvedVirtualPackages := make(map[string]string)
|
||||||
for _, pkg := range packages {
|
for _, pkg := range packages {
|
||||||
if stat, err := os.Stat(pkg); err == nil && !stat.IsDir() {
|
if stat, err := os.Stat(pkg); err == nil && !stat.IsDir() {
|
||||||
bpmpkg, err := ReadPackage(pkg)
|
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{
|
operation.Actions = append(operation.Actions, &InstallPackageAction{
|
||||||
File: pkg,
|
File: pkg,
|
||||||
InstallationReason: installationReason,
|
InstallationReason: installationReason,
|
||||||
@@ -84,6 +92,11 @@ func InstallPackages(rootDir string, forceInstallationReason InstallationReason,
|
|||||||
// Split package name and required version
|
// Split package name and required version
|
||||||
pkgName, _, _ := SplitPkgNameAndVersion(pkg)
|
pkgName, _, _ := SplitPkgNameAndVersion(pkg)
|
||||||
|
|
||||||
|
// Check resolved virtual packages
|
||||||
|
if resolvedPkg, ok := resolvedVirtualPackages[pkgName]; ok {
|
||||||
|
pkgName = resolvedPkg
|
||||||
|
}
|
||||||
|
|
||||||
entry := ResolveDatabaseEntry(pkgName, rootDir)
|
entry := ResolveDatabaseEntry(pkgName, rootDir)
|
||||||
if entry == nil {
|
if entry == nil {
|
||||||
pkgsNotFound = append(pkgsNotFound, pkg)
|
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{
|
operation.Actions = append(operation.Actions, &FetchPackageAction{
|
||||||
InstallationReason: installationReason,
|
InstallationReason: installationReason,
|
||||||
DatabaseEntry: entry,
|
DatabaseEntry: entry,
|
||||||
@@ -392,6 +412,7 @@ func UpdatePackages(rootDir string, syncDatabase, allowDowngrades, forceInstalla
|
|||||||
|
|
||||||
// Search for packages
|
// Search for packages
|
||||||
pkgsNotFound := make([]string, 0)
|
pkgsNotFound := make([]string, 0)
|
||||||
|
resolvedVirtualPackages := make(map[string]string)
|
||||||
for _, pkg := range pkgs {
|
for _, pkg := range pkgs {
|
||||||
if rootDir == "/" && slices.Contains(MainBPMConfig.IgnorePackages, pkg) {
|
if rootDir == "/" && slices.Contains(MainBPMConfig.IgnorePackages, pkg) {
|
||||||
continue
|
continue
|
||||||
@@ -410,6 +431,13 @@ func UpdatePackages(rootDir string, syncDatabase, allowDowngrades, forceInstalla
|
|||||||
} else {
|
} else {
|
||||||
comparison := CompareVersions(entry.Info.GetFullVersion(), installedInfo.GetFullVersion())
|
comparison := CompareVersions(entry.Info.GetFullVersion(), installedInfo.GetFullVersion())
|
||||||
if (!allowDowngrades && comparison > 0) || (allowDowngrades && comparison != 0) {
|
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{
|
operation.Actions = append(operation.Actions, &FetchPackageAction{
|
||||||
InstallationReason: GetPackage(pkg, rootDir).LocalInfo.GetInstallationReason(),
|
InstallationReason: GetPackage(pkg, rootDir).LocalInfo.GetInstallationReason(),
|
||||||
DatabaseEntry: entry,
|
DatabaseEntry: entry,
|
||||||
@@ -428,6 +456,11 @@ func UpdatePackages(rootDir string, syncDatabase, allowDowngrades, forceInstalla
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check resolved virtual packages
|
||||||
|
if resolvedPkg, ok := resolvedVirtualPackages[dependName]; ok {
|
||||||
|
dependName = resolvedPkg
|
||||||
|
}
|
||||||
|
|
||||||
// Find database entry for missing dependency
|
// Find database entry for missing dependency
|
||||||
dependEntry := ResolveDatabaseEntry(dependName, rootDir)
|
dependEntry := ResolveDatabaseEntry(dependName, rootDir)
|
||||||
if dependEntry == nil {
|
if dependEntry == nil {
|
||||||
@@ -451,6 +484,13 @@ func UpdatePackages(rootDir string, syncDatabase, allowDowngrades, forceInstalla
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resolve virtual packages
|
||||||
|
for _, vpkg := range dependEntry.Info.Provides {
|
||||||
|
if _, ok := resolvedVirtualPackages[vpkg]; !ok {
|
||||||
|
resolvedVirtualPackages[vpkg] = dependEntry.Info.Name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch dependency
|
// Fetch dependency
|
||||||
operation.Actions = append(operation.Actions, &FetchPackageAction{
|
operation.Actions = append(operation.Actions, &FetchPackageAction{
|
||||||
InstallationReason: InstallationReasonDependency,
|
InstallationReason: InstallationReasonDependency,
|
||||||
@@ -470,6 +510,11 @@ func UpdatePackages(rootDir string, syncDatabase, allowDowngrades, forceInstalla
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check resolved virtual packages
|
||||||
|
if resolvedPkg, ok := resolvedVirtualPackages[dependName]; ok {
|
||||||
|
dependName = resolvedPkg
|
||||||
|
}
|
||||||
|
|
||||||
// Find database entry for missing dependency
|
// Find database entry for missing dependency
|
||||||
dependEntry := ResolveDatabaseEntry(dependName, rootDir)
|
dependEntry := ResolveDatabaseEntry(dependName, rootDir)
|
||||||
if dependEntry == nil {
|
if dependEntry == nil {
|
||||||
@@ -488,6 +533,13 @@ func UpdatePackages(rootDir string, syncDatabase, allowDowngrades, forceInstalla
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resolve virtual packages
|
||||||
|
for _, vpkg := range dependEntry.Info.Provides {
|
||||||
|
if _, ok := resolvedVirtualPackages[vpkg]; !ok {
|
||||||
|
resolvedVirtualPackages[vpkg] = dependEntry.Info.Name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch dependency
|
// Fetch dependency
|
||||||
operation.Actions = append(operation.Actions, &FetchPackageAction{
|
operation.Actions = append(operation.Actions, &FetchPackageAction{
|
||||||
InstallationReason: InstallationReasonDependency,
|
InstallationReason: InstallationReasonDependency,
|
||||||
|
|||||||
Reference in New Issue
Block a user