Remove duplicate strings in packages slice from install and remove operations

This commit is contained in:
2025-12-17 12:16:45 +02:00
parent 04a71b573b
commit 2ba78f16db
2 changed files with 18 additions and 1 deletions
+6 -1
View File
@@ -21,7 +21,6 @@ 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, forceInstallationReason InstallationReason, reinstallMethod ReinstallMethod, installOptionalDependencies, forceInstallation, verbose bool, packages ...string) (operation *BPMOperation, err error) {
// Setup operation struct
operation = &BPMOperation{
Actions: make([]OperationAction, 0),
@@ -31,6 +30,9 @@ func InstallPackages(rootDir string, forceInstallationReason InstallationReason,
compiledPackages: make(map[string]string),
}
// Remove duplicates from packages
packages = removeDuplicates(packages)
// Resolve packages
pkgsNotFound := make([]string, 0)
for _, pkg := range packages {
@@ -193,6 +195,9 @@ func RemovePackages(rootDir string, force, cleanupDependencies bool, packages ..
compiledPackages: make(map[string]string),
}
// Remove duplicates from packages
packages = removeDuplicates(packages)
// Search for packages
for _, pkg := range packages {
bpmpkg := GetPackage(pkg, rootDir)