From e285fd792e68028a9d0ba01fab68af6beeae2db1 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Tue, 5 Nov 2024 22:11:37 +0200 Subject: [PATCH] Fixed bug where dependencies would be installed with 'manual' as installation reason --- utils/operations.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/operations.go b/utils/operations.go index 462dee5..754a17a 100644 --- a/utils/operations.go +++ b/utils/operations.go @@ -387,6 +387,7 @@ func (operation *BPMOperation) Execute(verbose, force bool) error { } else if action.GetActionType() == "install" { value := action.(*InstallPackageAction) bpmpkg := value.BpmPackage + isReinstall := IsPackageInstalled(bpmpkg.PkgInfo.Name, operation.RootDir) var err error if value.IsDependency { err = InstallPackage(value.File, operation.RootDir, verbose, true, false, false, false) @@ -396,18 +397,18 @@ func (operation *BPMOperation) Execute(verbose, force bool) error { if err != nil { return errors.New(fmt.Sprintf("could not install package (%s): %s\n", bpmpkg.PkgInfo.Name, err)) } - fmt.Printf("Package (%s) was successfully installed\n", bpmpkg.PkgInfo.Name) - if operation.ForceInstallationReason != Unknown { + if operation.ForceInstallationReason != Unknown && !value.IsDependency { err := SetInstallationReason(bpmpkg.PkgInfo.Name, operation.ForceInstallationReason, operation.RootDir) if err != nil { return errors.New(fmt.Sprintf("could not set installation reason for package (%s): %s\n", value.BpmPackage.PkgInfo.Name, err)) } - } else if value.IsDependency && !IsPackageInstalled(bpmpkg.PkgInfo.Name, operation.RootDir) { + } else if value.IsDependency && !isReinstall { err := SetInstallationReason(bpmpkg.PkgInfo.Name, Dependency, operation.RootDir) if err != nil { return errors.New(fmt.Sprintf("could not set installation reason for package (%s): %s\n", value.BpmPackage.PkgInfo.Name, err)) } } + fmt.Printf("Package (%s) was successfully installed\n", bpmpkg.PkgInfo.Name) } } fmt.Println("Operation complete!")