mirror of
https://github.com/EnumeratedDev/bpm.git
synced 2026-09-16 10:36:12 +00:00
Added --installation-reason flag
This commit is contained in:
+10
-4
@@ -10,9 +10,10 @@ import (
|
||||
)
|
||||
|
||||
type BPMOperation struct {
|
||||
Actions []OperationAction
|
||||
UnresolvedDepends []string
|
||||
RootDir string
|
||||
Actions []OperationAction
|
||||
UnresolvedDepends []string
|
||||
RootDir string
|
||||
ForceInstallationReason InstallationReason
|
||||
}
|
||||
|
||||
func (operation *BPMOperation) ActionsContainPackage(pkg string) bool {
|
||||
@@ -396,7 +397,12 @@ func (operation *BPMOperation) Execute(verbose, force bool) error {
|
||||
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 value.IsDependency {
|
||||
if operation.ForceInstallationReason != Unknown {
|
||||
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) {
|
||||
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))
|
||||
|
||||
@@ -1185,11 +1185,8 @@ func InstallPackage(filename, rootDir string, verbose, force, binaryPkgFromSrc,
|
||||
return err
|
||||
}
|
||||
pkgDir := path.Join(installedDir, bpmpkg.PkgInfo.Name)
|
||||
err = os.RemoveAll(pkgDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.Mkdir(pkgDir, 0755)
|
||||
|
||||
err = os.MkdirAll(pkgDir, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user