mirror of
https://github.com/EnumeratedDev/bpm.git
synced 2026-09-16 10:36:12 +00:00
Show error when compiling source packages in a different root directory
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"slices"
|
"slices"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ReinstallMethod uint8
|
type ReinstallMethod uint8
|
||||||
@@ -128,6 +129,28 @@ func InstallPackages(rootDir string, installationReason InstallationReason, rein
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check whether compiling source packages on different root directory
|
||||||
|
if rootDir != "/" {
|
||||||
|
sourcePackages := make([]string, 0)
|
||||||
|
for _, action := range operation.Actions {
|
||||||
|
switch action.(type) {
|
||||||
|
case *InstallPackageAction:
|
||||||
|
if action.(*InstallPackageAction).BpmPackage.PkgInfo.Type == "source" {
|
||||||
|
sourcePackages = append(sourcePackages, action.(*InstallPackageAction).BpmPackage.PkgInfo.Name)
|
||||||
|
}
|
||||||
|
case *FetchPackageAction:
|
||||||
|
if action.(*FetchPackageAction).DatabaseEntry.Info.Type == "source" {
|
||||||
|
sourcePackages = append(sourcePackages, action.(*FetchPackageAction).DatabaseEntry.Info.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return error if source packages are present in the operation
|
||||||
|
if len(sourcePackages) != 0 {
|
||||||
|
return nil, fmt.Errorf("cannot compile source packages in different root directory: %s", strings.Join(sourcePackages, ", "))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return operation, nil
|
return operation, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user