Fix error when installing, updating or remove packages

This commit is contained in:
2025-05-13 20:44:16 +03:00
parent f20d7b66d1
commit d26d878308
2 changed files with 23 additions and 1 deletions
+4 -1
View File
@@ -99,7 +99,10 @@ func (hook *BPMHook) Execute(packageChanges map[string]string, verbose bool, roo
// Get modified files slice
modifiedFiles := make([]*PackageFileEntry, 0)
for pkg := range packageChanges {
modifiedFiles = append(modifiedFiles, GetPackage(pkg, rootDir).PkgFiles...)
if GetPackage(pkg, rootDir) != nil {
modifiedFiles = append(modifiedFiles, GetPackage(pkg, rootDir).PkgFiles...)
}
}
// Check if any targets are met
+19
View File
@@ -870,6 +870,16 @@ func installPackage(filename, rootDir string, verbose, force bool) error {
return err
}
}
// Ensure local package information has been initialized for rootDir
err = initializeLocalPackageInformation(rootDir)
if err != nil {
return err
}
// Add or update package information for rootDir
localPackageInformation[rootDir][bpmpkg.PkgInfo.Name] = bpmpkg
return nil
}
@@ -999,5 +1009,14 @@ func removePackage(pkg string, verbose bool, rootDir string) error {
return err
}
// Ensure local package information has been initialized for rootDir
err = initializeLocalPackageInformation(rootDir)
if err != nil {
return err
}
// Add or update package information for rootDir
delete(localPackageInformation[rootDir], pkgInfo.Name)
return nil
}