Concurrency option is now global

* concurrency could be configured now from cmdline,
  configuration file or LUET_GENERAL__CONCURRENCY env variable

* verbose option is now related to debug option
This commit is contained in:
Daniele Rondina
2019-12-29 16:33:10 +01:00
committed by Ettore Di Giacinto
parent 358b39b5dd
commit 16453bd09f
7 changed files with 26 additions and 28 deletions

View File

@@ -18,11 +18,11 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"
installer "github.com/mudler/luet/pkg/installer"
_gentoo "github.com/Sabayon/pkgs-checker/pkg/gentoo"
. "github.com/mudler/luet/pkg/config"
. "github.com/mudler/luet/pkg/logger"
pkg "github.com/mudler/luet/pkg/package"
@@ -37,7 +37,6 @@ var uninstallCmd = &cobra.Command{
PreRun: func(cmd *cobra.Command, args []string) {
viper.BindPFlag("system-dbpath", cmd.Flags().Lookup("system-dbpath"))
viper.BindPFlag("system-target", cmd.Flags().Lookup("system-target"))
viper.BindPFlag("concurrency", cmd.Flags().Lookup("concurrency"))
},
Run: func(cmd *cobra.Command, args []string) {
for _, a := range args {
@@ -57,7 +56,7 @@ var uninstallCmd = &cobra.Command{
Uri: make([]string, 0),
}
inst := installer.NewLuetInstaller(viper.GetInt("concurrency"))
inst := installer.NewLuetInstaller(LuetCfg.GetGeneral().Concurrency)
os.MkdirAll(viper.GetString("system-dbpath"), os.ModePerm)
systemDB := pkg.NewBoltDatabase(filepath.Join(viper.GetString("system-dbpath"), "luet.db"))
system := &installer.System{Database: systemDB, Target: viper.GetString("system-target")}
@@ -77,6 +76,5 @@ func init() {
}
uninstallCmd.Flags().String("system-dbpath", path, "System db path")
uninstallCmd.Flags().String("system-target", path, "System rootpath")
uninstallCmd.Flags().Int("concurrency", runtime.NumCPU(), "Concurrency")
RootCmd.AddCommand(uninstallCmd)
}