Fix package installation reason not being displayed or set correctly

This commit is contained in:
2025-08-11 12:23:45 +03:00
parent 713eafb708
commit 57231fdec5
3 changed files with 47 additions and 15 deletions
+32 -1
View File
@@ -19,7 +19,8 @@ const (
)
// InstallPackages installs the specified packages into the given root directory by fetching them from databases or directly from local bpm archives
func InstallPackages(rootDir string, installationReason InstallationReason, reinstallMethod ReinstallMethod, installOptionalDependencies, forceInstallation, verbose bool, packages ...string) (operation *BPMOperation, err error) {
func InstallPackages(rootDir string, forceInstallationReason InstallationReason, reinstallMethod ReinstallMethod, installOptionalDependencies, forceInstallation, verbose bool, packages ...string) (operation *BPMOperation, err error) {
// Setup operation struct
operation = &BPMOperation{
Actions: make([]OperationAction, 0),
@@ -44,6 +45,16 @@ func InstallPackages(rootDir string, installationReason InstallationReason, rein
continue
}
// Set package installation reason
installationReason := forceInstallationReason
if installationReason == InstallationReasonUnknown {
if IsPackageInstalled(splitPkg.Name, rootDir) {
installationReason = GetInstallationReason(splitPkg.Name, rootDir)
} else {
installationReason = InstallationReasonManual
}
}
operation.AppendAction(&InstallPackageAction{
File: pkg,
InstallationReason: installationReason,
@@ -58,6 +69,16 @@ func InstallPackages(rootDir string, installationReason InstallationReason, rein
continue
}
// Set package installation reason
installationReason := forceInstallationReason
if installationReason == InstallationReasonUnknown {
if IsPackageInstalled(bpmpkg.PkgInfo.Name, rootDir) {
installationReason = GetInstallationReason(bpmpkg.PkgInfo.Name, rootDir)
} else {
installationReason = InstallationReasonManual
}
}
operation.AppendAction(&InstallPackageAction{
File: pkg,
InstallationReason: installationReason,
@@ -84,6 +105,16 @@ func InstallPackages(rootDir string, installationReason InstallationReason, rein
continue
}
// Set package installation reason
installationReason := forceInstallationReason
if installationReason == InstallationReasonUnknown {
if IsPackageInstalled(entry.Info.Name, rootDir) {
installationReason = GetInstallationReason(entry.Info.Name, rootDir)
} else {
installationReason = InstallationReasonManual
}
}
operation.AppendAction(&FetchPackageAction{
InstallationReason: installationReason,
DatabaseEntry: entry,