From 97dedb265e6ef22cdac85001cd1d771eece7008d Mon Sep 17 00:00:00 2001 From: artpav <19916123+artemijspavlovs@users.noreply.github.com> Date: Fri, 13 Sep 2024 21:48:35 +0300 Subject: [PATCH] fix: change library installation flow (#933) --- utils/bash/bash_commands.go | 1 - utils/dependencies/dependencies.go | 16 ++++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/utils/bash/bash_commands.go b/utils/bash/bash_commands.go index a9411844..9d11b904 100644 --- a/utils/bash/bash_commands.go +++ b/utils/bash/bash_commands.go @@ -104,7 +104,6 @@ func RunCmdAsync( } func ExecCommandWithStdout(cmd *exec.Cmd) (bytes.Buffer, error) { - fmt.Println(cmd.String()) var stderr bytes.Buffer var stdout bytes.Buffer cmd.Stderr = &stderr diff --git a/utils/dependencies/dependencies.go b/utils/dependencies/dependencies.go index 45726621..0092702d 100644 --- a/utils/dependencies/dependencies.go +++ b/utils/dependencies/dependencies.go @@ -21,7 +21,7 @@ func InstallBinaries(bech32 string, withMockDA bool) error { c := exec.Command("sudo", "mkdir", "-p", consts.InternalBinsDir) _, err := bash.ExecCommandWithStdout(c) if err != nil { - errMsg := fmt.Sprintf("failed to create %s", consts.InternalBinsDir) + errMsg := fmt.Sprintf("failed to create %s\n", consts.InternalBinsDir) return errors.New(errMsg) } @@ -124,14 +124,14 @@ func InstallBinaries(bech32 string, withMockDA bool) error { libVersion := "v1.2.3" if runtime.GOOS == "linux" { - outputPath = "/usr/lib/libwasmvm.so" + outputPath = "/usr/lib" if runtime.GOARCH == "arm64" { libName = "libwasmvm.aarch64.so" } else if runtime.GOARCH == "amd64" { libName = "libwasmvm.x86_64.so" } } else if runtime.GOOS == "darwin" { - outputPath = "/usr/local/lib/libwasmvm.dylib" + outputPath = "/usr/local/lib" libName = "libwasmvm.dylib" } else { return errors.New("unsupported OS") @@ -143,13 +143,13 @@ func InstallBinaries(bech32 string, withMockDA bool) error { libName, ) - fsc := exec.Command("sudo", "mkdir", "-p", filepath.Dir(outputPath)) + fsc := exec.Command("sudo", "mkdir", "-p", outputPath) _, err := bash.ExecCommandWithStdout(fsc) if err != nil { return err } - c := exec.Command("sudo", "wget", "-O", outputPath, downloadPath) + c := exec.Command("sudo", "wget", "-O", filepath.Join(outputPath, libName), downloadPath) _, err = bash.ExecCommandWithStdout(c) if err != nil { return err @@ -190,7 +190,7 @@ func InstallBinaries(bech32 string, withMockDA bool) error { } func InstallBinaryFromRepo(dep types.Dependency, td string) error { - pterm.Debug.Printf("Installing %s", dep.Name) + pterm.Debug.Printf("Installing %s\n", dep.Name) targetDir, err := os.MkdirTemp(os.TempDir(), td) if err != nil { return err @@ -224,7 +224,7 @@ func InstallBinaryFromRepo(dep types.Dependency, td string) error { } pterm.Info.Printf( - "starting %s build from %s (this can take several minutes)", + "starting %s build from %s (this can take several minutes)\n", dep.Name, dep.Release, ) @@ -241,7 +241,7 @@ func InstallBinaryFromRepo(dep types.Dependency, td string) error { return err } pterm.Success.Printf( - "Successfully installed %s", filepath.Base(binary.BinaryDestination), + "Successfully installed %s\n", filepath.Base(binary.BinaryDestination), ) } return nil