mirror of
https://github.com/mudler/luet.git
synced 2025-09-04 00:34:41 +00:00
Pass by the cli args to the underlying system struct
We didn't set previously what we catched from CLI. Note, this is a temporary solution until we refactor the cli code Fixes #186
This commit is contained in:
@@ -46,10 +46,19 @@ For reference, inspect a "metadata.yaml" file generated while running "luet buil
|
|||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(cmd *cobra.Command, args []string) {
|
||||||
LuetCfg.Viper.BindPFlag("system.database_path", cmd.Flags().Lookup("system-dbpath"))
|
LuetCfg.Viper.BindPFlag("system.database_path", cmd.Flags().Lookup("system-dbpath"))
|
||||||
LuetCfg.Viper.BindPFlag("system.rootfs", cmd.Flags().Lookup("system-target"))
|
LuetCfg.Viper.BindPFlag("system.rootfs", cmd.Flags().Lookup("system-target"))
|
||||||
|
LuetCfg.Viper.BindPFlag("system.database_engine", cmd.Flags().Lookup("system-engine"))
|
||||||
|
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
|
dbpath := LuetCfg.Viper.GetString("system.database_path")
|
||||||
|
rootfs := LuetCfg.Viper.GetString("system.rootfs")
|
||||||
|
engine := LuetCfg.Viper.GetString("system.database_engine")
|
||||||
|
|
||||||
|
LuetCfg.System.DatabaseEngine = engine
|
||||||
|
LuetCfg.System.DatabasePath = dbpath
|
||||||
|
LuetCfg.System.Rootfs = rootfs
|
||||||
|
|
||||||
systemDB := LuetCfg.GetSystemDB()
|
systemDB := LuetCfg.GetSystemDB()
|
||||||
|
|
||||||
for _, a := range args {
|
for _, a := range args {
|
||||||
@@ -77,5 +86,9 @@ For reference, inspect a "metadata.yaml" file generated while running "luet buil
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ans.Flags().String("system-dbpath", "", "System db path")
|
||||||
|
ans.Flags().String("system-target", "", "System rootpath")
|
||||||
|
ans.Flags().String("system-engine", "", "System DB engine")
|
||||||
|
|
||||||
return ans
|
return ans
|
||||||
}
|
}
|
||||||
|
@@ -40,9 +40,18 @@ To return also files:
|
|||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(cmd *cobra.Command, args []string) {
|
||||||
LuetCfg.Viper.BindPFlag("system.database_path", cmd.Flags().Lookup("system-dbpath"))
|
LuetCfg.Viper.BindPFlag("system.database_path", cmd.Flags().Lookup("system-dbpath"))
|
||||||
LuetCfg.Viper.BindPFlag("system.rootfs", cmd.Flags().Lookup("system-target"))
|
LuetCfg.Viper.BindPFlag("system.rootfs", cmd.Flags().Lookup("system-target"))
|
||||||
|
LuetCfg.Viper.BindPFlag("system.database_engine", cmd.Flags().Lookup("system-engine"))
|
||||||
|
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
showFiles, _ := cmd.Flags().GetBool("files")
|
showFiles, _ := cmd.Flags().GetBool("files")
|
||||||
|
dbpath := LuetCfg.Viper.GetString("system.database_path")
|
||||||
|
rootfs := LuetCfg.Viper.GetString("system.rootfs")
|
||||||
|
engine := LuetCfg.Viper.GetString("system.database_engine")
|
||||||
|
|
||||||
|
LuetCfg.System.DatabaseEngine = engine
|
||||||
|
LuetCfg.System.DatabasePath = dbpath
|
||||||
|
LuetCfg.System.Rootfs = rootfs
|
||||||
|
|
||||||
systemDB := LuetCfg.GetSystemDB()
|
systemDB := LuetCfg.GetSystemDB()
|
||||||
|
|
||||||
@@ -78,6 +87,9 @@ To return also files:
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
c.Flags().Bool("files", false, "Show package files.")
|
c.Flags().Bool("files", false, "Show package files.")
|
||||||
|
c.Flags().String("system-dbpath", "", "System db path")
|
||||||
|
c.Flags().String("system-target", "", "System rootpath")
|
||||||
|
c.Flags().String("system-engine", "", "System DB engine")
|
||||||
|
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
@@ -38,9 +38,18 @@ This commands takes multiple packages as arguments and prunes their entries from
|
|||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(cmd *cobra.Command, args []string) {
|
||||||
LuetCfg.Viper.BindPFlag("system.database_path", cmd.Flags().Lookup("system-dbpath"))
|
LuetCfg.Viper.BindPFlag("system.database_path", cmd.Flags().Lookup("system-dbpath"))
|
||||||
LuetCfg.Viper.BindPFlag("system.rootfs", cmd.Flags().Lookup("system-target"))
|
LuetCfg.Viper.BindPFlag("system.rootfs", cmd.Flags().Lookup("system-target"))
|
||||||
|
LuetCfg.Viper.BindPFlag("system.database_engine", cmd.Flags().Lookup("system-engine"))
|
||||||
|
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
dbpath := LuetCfg.Viper.GetString("system.database_path")
|
||||||
|
rootfs := LuetCfg.Viper.GetString("system.rootfs")
|
||||||
|
engine := LuetCfg.Viper.GetString("system.database_engine")
|
||||||
|
|
||||||
|
LuetCfg.System.DatabaseEngine = engine
|
||||||
|
LuetCfg.System.DatabasePath = dbpath
|
||||||
|
LuetCfg.System.Rootfs = rootfs
|
||||||
|
|
||||||
systemDB := LuetCfg.GetSystemDB()
|
systemDB := LuetCfg.GetSystemDB()
|
||||||
|
|
||||||
for _, a := range args {
|
for _, a := range args {
|
||||||
@@ -60,6 +69,9 @@ This commands takes multiple packages as arguments and prunes their entries from
|
|||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
ans.Flags().String("system-dbpath", "", "System db path")
|
||||||
|
ans.Flags().String("system-target", "", "System rootpath")
|
||||||
|
ans.Flags().String("system-engine", "", "System DB engine")
|
||||||
|
|
||||||
return ans
|
return ans
|
||||||
}
|
}
|
||||||
|
@@ -15,8 +15,6 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
|
|
||||||
installer "github.com/mudler/luet/pkg/installer"
|
installer "github.com/mudler/luet/pkg/installer"
|
||||||
"github.com/mudler/luet/pkg/solver"
|
"github.com/mudler/luet/pkg/solver"
|
||||||
|
|
||||||
@@ -51,6 +49,7 @@ To force install a package:
|
|||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(cmd *cobra.Command, args []string) {
|
||||||
LuetCfg.Viper.BindPFlag("system.database_path", cmd.Flags().Lookup("system-dbpath"))
|
LuetCfg.Viper.BindPFlag("system.database_path", cmd.Flags().Lookup("system-dbpath"))
|
||||||
LuetCfg.Viper.BindPFlag("system.rootfs", cmd.Flags().Lookup("system-target"))
|
LuetCfg.Viper.BindPFlag("system.rootfs", cmd.Flags().Lookup("system-target"))
|
||||||
|
LuetCfg.Viper.BindPFlag("system.database_engine", cmd.Flags().Lookup("system-engine"))
|
||||||
LuetCfg.Viper.BindPFlag("solver.type", cmd.Flags().Lookup("solver-type"))
|
LuetCfg.Viper.BindPFlag("solver.type", cmd.Flags().Lookup("solver-type"))
|
||||||
LuetCfg.Viper.BindPFlag("solver.discount", cmd.Flags().Lookup("solver-discount"))
|
LuetCfg.Viper.BindPFlag("solver.discount", cmd.Flags().Lookup("solver-discount"))
|
||||||
LuetCfg.Viper.BindPFlag("solver.rate", cmd.Flags().Lookup("solver-rate"))
|
LuetCfg.Viper.BindPFlag("solver.rate", cmd.Flags().Lookup("solver-rate"))
|
||||||
@@ -91,6 +90,14 @@ To force install a package:
|
|||||||
concurrent, _ := cmd.Flags().GetBool("solver-concurrent")
|
concurrent, _ := cmd.Flags().GetBool("solver-concurrent")
|
||||||
yes := LuetCfg.Viper.GetBool("yes")
|
yes := LuetCfg.Viper.GetBool("yes")
|
||||||
|
|
||||||
|
dbpath := LuetCfg.Viper.GetString("system.database_path")
|
||||||
|
rootfs := LuetCfg.Viper.GetString("system.rootfs")
|
||||||
|
engine := LuetCfg.Viper.GetString("system.database_engine")
|
||||||
|
|
||||||
|
LuetCfg.System.DatabaseEngine = engine
|
||||||
|
LuetCfg.System.DatabasePath = dbpath
|
||||||
|
LuetCfg.System.Rootfs = rootfs
|
||||||
|
|
||||||
LuetCfg.GetSolverOptions().Type = stype
|
LuetCfg.GetSolverOptions().Type = stype
|
||||||
LuetCfg.GetSolverOptions().LearnRate = float32(rate)
|
LuetCfg.GetSolverOptions().LearnRate = float32(rate)
|
||||||
LuetCfg.GetSolverOptions().Discount = float32(discount)
|
LuetCfg.GetSolverOptions().Discount = float32(discount)
|
||||||
@@ -127,12 +134,10 @@ To force install a package:
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
path, err := os.Getwd()
|
installCmd.Flags().String("system-dbpath", "", "System db path")
|
||||||
if err != nil {
|
installCmd.Flags().String("system-target", "", "System rootpath")
|
||||||
Fatal(err)
|
installCmd.Flags().String("system-engine", "", "System DB engine")
|
||||||
}
|
|
||||||
installCmd.Flags().String("system-dbpath", path, "System db path")
|
|
||||||
installCmd.Flags().String("system-target", path, "System rootpath")
|
|
||||||
installCmd.Flags().String("solver-type", "", "Solver strategy ( Defaults none, available: "+AvailableResolvers+" )")
|
installCmd.Flags().String("solver-type", "", "Solver strategy ( Defaults none, available: "+AvailableResolvers+" )")
|
||||||
installCmd.Flags().Float32("solver-rate", 0.7, "Solver learning rate")
|
installCmd.Flags().Float32("solver-rate", 0.7, "Solver learning rate")
|
||||||
installCmd.Flags().Float32("solver-discount", 1.0, "Solver discount rate")
|
installCmd.Flags().Float32("solver-discount", 1.0, "Solver discount rate")
|
||||||
|
@@ -15,8 +15,6 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
|
|
||||||
installer "github.com/mudler/luet/pkg/installer"
|
installer "github.com/mudler/luet/pkg/installer"
|
||||||
|
|
||||||
. "github.com/mudler/luet/pkg/config"
|
. "github.com/mudler/luet/pkg/config"
|
||||||
@@ -31,6 +29,7 @@ var reclaimCmd = &cobra.Command{
|
|||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(cmd *cobra.Command, args []string) {
|
||||||
LuetCfg.Viper.BindPFlag("system.database_path", cmd.Flags().Lookup("system-dbpath"))
|
LuetCfg.Viper.BindPFlag("system.database_path", cmd.Flags().Lookup("system-dbpath"))
|
||||||
LuetCfg.Viper.BindPFlag("system.rootfs", cmd.Flags().Lookup("system-target"))
|
LuetCfg.Viper.BindPFlag("system.rootfs", cmd.Flags().Lookup("system-target"))
|
||||||
|
LuetCfg.Viper.BindPFlag("system.database_engine", cmd.Flags().Lookup("system-engine"))
|
||||||
LuetCfg.Viper.BindPFlag("force", cmd.Flags().Lookup("force"))
|
LuetCfg.Viper.BindPFlag("force", cmd.Flags().Lookup("force"))
|
||||||
},
|
},
|
||||||
Long: `Reclaim tries to find association between packages in the online repositories and the system one.
|
Long: `Reclaim tries to find association between packages in the online repositories and the system one.
|
||||||
@@ -40,6 +39,13 @@ var reclaimCmd = &cobra.Command{
|
|||||||
It scans the target file system, and if finds a match with a package available in the repositories, it marks as installed in the system database.
|
It scans the target file system, and if finds a match with a package available in the repositories, it marks as installed in the system database.
|
||||||
`,
|
`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
dbpath := LuetCfg.Viper.GetString("system.database_path")
|
||||||
|
rootfs := LuetCfg.Viper.GetString("system.rootfs")
|
||||||
|
engine := LuetCfg.Viper.GetString("system.database_engine")
|
||||||
|
|
||||||
|
LuetCfg.System.DatabaseEngine = engine
|
||||||
|
LuetCfg.System.DatabasePath = dbpath
|
||||||
|
LuetCfg.System.Rootfs = rootfs
|
||||||
|
|
||||||
// This shouldn't be necessary, but we need to unmarshal the repositories to a concrete struct, thus we need to port them back to the Repositories type
|
// This shouldn't be necessary, but we need to unmarshal the repositories to a concrete struct, thus we need to port them back to the Repositories type
|
||||||
repos := installer.Repositories{}
|
repos := installer.Repositories{}
|
||||||
@@ -71,12 +77,11 @@ It scans the target file system, and if finds a match with a package available i
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
path, err := os.Getwd()
|
|
||||||
if err != nil {
|
reclaimCmd.Flags().String("system-dbpath", "", "System db path")
|
||||||
Fatal(err)
|
reclaimCmd.Flags().String("system-target", "", "System rootpath")
|
||||||
}
|
reclaimCmd.Flags().String("system-engine", "", "System DB engine")
|
||||||
reclaimCmd.Flags().String("system-dbpath", path, "System db path")
|
|
||||||
reclaimCmd.Flags().String("system-target", path, "System rootpath")
|
|
||||||
reclaimCmd.Flags().Bool("force", false, "Skip errors and keep going (potentially harmful)")
|
reclaimCmd.Flags().Bool("force", false, "Skip errors and keep going (potentially harmful)")
|
||||||
|
|
||||||
RootCmd.AddCommand(reclaimCmd)
|
RootCmd.AddCommand(reclaimCmd)
|
||||||
|
@@ -15,8 +15,6 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
|
|
||||||
installer "github.com/mudler/luet/pkg/installer"
|
installer "github.com/mudler/luet/pkg/installer"
|
||||||
"github.com/mudler/luet/pkg/solver"
|
"github.com/mudler/luet/pkg/solver"
|
||||||
|
|
||||||
@@ -38,6 +36,7 @@ var replaceCmd = &cobra.Command{
|
|||||||
`,
|
`,
|
||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(cmd *cobra.Command, args []string) {
|
||||||
LuetCfg.Viper.BindPFlag("system.database_path", cmd.Flags().Lookup("system-dbpath"))
|
LuetCfg.Viper.BindPFlag("system.database_path", cmd.Flags().Lookup("system-dbpath"))
|
||||||
|
LuetCfg.Viper.BindPFlag("system.database_engine", cmd.Flags().Lookup("system-engine"))
|
||||||
LuetCfg.Viper.BindPFlag("system.rootfs", cmd.Flags().Lookup("system-target"))
|
LuetCfg.Viper.BindPFlag("system.rootfs", cmd.Flags().Lookup("system-target"))
|
||||||
LuetCfg.Viper.BindPFlag("solver.type", cmd.Flags().Lookup("solver-type"))
|
LuetCfg.Viper.BindPFlag("solver.type", cmd.Flags().Lookup("solver-type"))
|
||||||
LuetCfg.Viper.BindPFlag("solver.discount", cmd.Flags().Lookup("solver-discount"))
|
LuetCfg.Viper.BindPFlag("solver.discount", cmd.Flags().Lookup("solver-discount"))
|
||||||
@@ -64,6 +63,13 @@ var replaceCmd = &cobra.Command{
|
|||||||
onlydeps := LuetCfg.Viper.GetBool("onlydeps")
|
onlydeps := LuetCfg.Viper.GetBool("onlydeps")
|
||||||
concurrent, _ := cmd.Flags().GetBool("solver-concurrent")
|
concurrent, _ := cmd.Flags().GetBool("solver-concurrent")
|
||||||
yes := LuetCfg.Viper.GetBool("yes")
|
yes := LuetCfg.Viper.GetBool("yes")
|
||||||
|
dbpath := LuetCfg.Viper.GetString("system.database_path")
|
||||||
|
rootfs := LuetCfg.Viper.GetString("system.rootfs")
|
||||||
|
engine := LuetCfg.Viper.GetString("system.database_engine")
|
||||||
|
|
||||||
|
LuetCfg.System.DatabaseEngine = engine
|
||||||
|
LuetCfg.System.DatabasePath = dbpath
|
||||||
|
LuetCfg.System.Rootfs = rootfs
|
||||||
|
|
||||||
for _, a := range args {
|
for _, a := range args {
|
||||||
pack, err := helpers.ParsePackageStr(a)
|
pack, err := helpers.ParsePackageStr(a)
|
||||||
@@ -127,12 +133,11 @@ var replaceCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
path, err := os.Getwd()
|
|
||||||
if err != nil {
|
replaceCmd.Flags().String("system-dbpath", "", "System db path")
|
||||||
Fatal(err)
|
replaceCmd.Flags().String("system-target", "", "System rootpath")
|
||||||
}
|
replaceCmd.Flags().String("system-engine", "", "System DB engine")
|
||||||
replaceCmd.Flags().String("system-dbpath", path, "System db path")
|
|
||||||
replaceCmd.Flags().String("system-target", path, "System rootpath")
|
|
||||||
replaceCmd.Flags().String("solver-type", "", "Solver strategy ( Defaults none, available: "+AvailableResolvers+" )")
|
replaceCmd.Flags().String("solver-type", "", "Solver strategy ( Defaults none, available: "+AvailableResolvers+" )")
|
||||||
replaceCmd.Flags().Float32("solver-rate", 0.7, "Solver learning rate")
|
replaceCmd.Flags().Float32("solver-rate", 0.7, "Solver learning rate")
|
||||||
replaceCmd.Flags().Float32("solver-discount", 1.0, "Solver discount rate")
|
replaceCmd.Flags().Float32("solver-discount", 1.0, "Solver discount rate")
|
||||||
|
@@ -16,7 +16,6 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/ghodss/yaml"
|
"github.com/ghodss/yaml"
|
||||||
@@ -307,6 +306,7 @@ Search can also return results in the terminal in different ways: as terminal ou
|
|||||||
LuetCfg.Viper.BindPFlag("installed", cmd.Flags().Lookup("installed"))
|
LuetCfg.Viper.BindPFlag("installed", cmd.Flags().Lookup("installed"))
|
||||||
LuetCfg.Viper.BindPFlag("solver.type", cmd.Flags().Lookup("solver-type"))
|
LuetCfg.Viper.BindPFlag("solver.type", cmd.Flags().Lookup("solver-type"))
|
||||||
LuetCfg.Viper.BindPFlag("solver.discount", cmd.Flags().Lookup("solver-discount"))
|
LuetCfg.Viper.BindPFlag("solver.discount", cmd.Flags().Lookup("solver-discount"))
|
||||||
|
LuetCfg.Viper.BindPFlag("system.database_engine", cmd.Flags().Lookup("system-engine"))
|
||||||
LuetCfg.Viper.BindPFlag("solver.rate", cmd.Flags().Lookup("solver-rate"))
|
LuetCfg.Viper.BindPFlag("solver.rate", cmd.Flags().Lookup("solver-rate"))
|
||||||
LuetCfg.Viper.BindPFlag("solver.max_attempts", cmd.Flags().Lookup("solver-attempts"))
|
LuetCfg.Viper.BindPFlag("solver.max_attempts", cmd.Flags().Lookup("solver-attempts"))
|
||||||
},
|
},
|
||||||
@@ -329,7 +329,13 @@ Search can also return results in the terminal in different ways: as terminal ou
|
|||||||
revdeps, _ := cmd.Flags().GetBool("revdeps")
|
revdeps, _ := cmd.Flags().GetBool("revdeps")
|
||||||
tableMode, _ := cmd.Flags().GetBool("table")
|
tableMode, _ := cmd.Flags().GetBool("table")
|
||||||
files, _ := cmd.Flags().GetBool("files")
|
files, _ := cmd.Flags().GetBool("files")
|
||||||
|
dbpath := LuetCfg.Viper.GetString("system.database_path")
|
||||||
|
rootfs := LuetCfg.Viper.GetString("system.rootfs")
|
||||||
|
engine := LuetCfg.Viper.GetString("system.database_engine")
|
||||||
|
|
||||||
|
LuetCfg.System.DatabaseEngine = engine
|
||||||
|
LuetCfg.System.DatabasePath = dbpath
|
||||||
|
LuetCfg.System.Rootfs = rootfs
|
||||||
out, _ := cmd.Flags().GetString("output")
|
out, _ := cmd.Flags().GetString("output")
|
||||||
if out != "terminal" {
|
if out != "terminal" {
|
||||||
LuetCfg.GetLogging().SetLogLevel("error")
|
LuetCfg.GetLogging().SetLogLevel("error")
|
||||||
@@ -387,12 +393,10 @@ Search can also return results in the terminal in different ways: as terminal ou
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
path, err := os.Getwd()
|
searchCmd.Flags().String("system-dbpath", "", "System db path")
|
||||||
if err != nil {
|
searchCmd.Flags().String("system-target", "", "System rootpath")
|
||||||
Fatal(err)
|
searchCmd.Flags().String("system-engine", "", "System DB engine")
|
||||||
}
|
|
||||||
searchCmd.Flags().String("system-dbpath", path, "System db path")
|
|
||||||
searchCmd.Flags().String("system-target", path, "System rootpath")
|
|
||||||
searchCmd.Flags().Bool("installed", false, "Search between system packages")
|
searchCmd.Flags().Bool("installed", false, "Search between system packages")
|
||||||
searchCmd.Flags().String("solver-type", "", "Solver strategy ( Defaults none, available: "+AvailableResolvers+" )")
|
searchCmd.Flags().String("solver-type", "", "Solver strategy ( Defaults none, available: "+AvailableResolvers+" )")
|
||||||
searchCmd.Flags().StringP("output", "o", "terminal", "Output format ( Defaults: terminal, available: json,yaml )")
|
searchCmd.Flags().StringP("output", "o", "terminal", "Output format ( Defaults: terminal, available: json,yaml )")
|
||||||
|
@@ -15,8 +15,6 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
|
|
||||||
helpers "github.com/mudler/luet/cmd/helpers"
|
helpers "github.com/mudler/luet/cmd/helpers"
|
||||||
. "github.com/mudler/luet/pkg/config"
|
. "github.com/mudler/luet/pkg/config"
|
||||||
installer "github.com/mudler/luet/pkg/installer"
|
installer "github.com/mudler/luet/pkg/installer"
|
||||||
@@ -42,6 +40,7 @@ var uninstallCmd = &cobra.Command{
|
|||||||
LuetCfg.Viper.BindPFlag("nodeps", cmd.Flags().Lookup("nodeps"))
|
LuetCfg.Viper.BindPFlag("nodeps", cmd.Flags().Lookup("nodeps"))
|
||||||
LuetCfg.Viper.BindPFlag("force", cmd.Flags().Lookup("force"))
|
LuetCfg.Viper.BindPFlag("force", cmd.Flags().Lookup("force"))
|
||||||
LuetCfg.Viper.BindPFlag("yes", cmd.Flags().Lookup("yes"))
|
LuetCfg.Viper.BindPFlag("yes", cmd.Flags().Lookup("yes"))
|
||||||
|
LuetCfg.Viper.BindPFlag("system.database_engine", cmd.Flags().Lookup("system-engine"))
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
toRemove := []pkg.Package{}
|
toRemove := []pkg.Package{}
|
||||||
@@ -65,6 +64,13 @@ var uninstallCmd = &cobra.Command{
|
|||||||
fullClean, _ := cmd.Flags().GetBool("full-clean")
|
fullClean, _ := cmd.Flags().GetBool("full-clean")
|
||||||
concurrent, _ := cmd.Flags().GetBool("solver-concurrent")
|
concurrent, _ := cmd.Flags().GetBool("solver-concurrent")
|
||||||
yes := LuetCfg.Viper.GetBool("yes")
|
yes := LuetCfg.Viper.GetBool("yes")
|
||||||
|
dbpath := LuetCfg.Viper.GetString("system.database_path")
|
||||||
|
rootfs := LuetCfg.Viper.GetString("system.rootfs")
|
||||||
|
engine := LuetCfg.Viper.GetString("system.database_engine")
|
||||||
|
|
||||||
|
LuetCfg.System.DatabaseEngine = engine
|
||||||
|
LuetCfg.System.DatabasePath = dbpath
|
||||||
|
LuetCfg.System.Rootfs = rootfs
|
||||||
|
|
||||||
LuetCfg.GetSolverOptions().Type = stype
|
LuetCfg.GetSolverOptions().Type = stype
|
||||||
LuetCfg.GetSolverOptions().LearnRate = float32(rate)
|
LuetCfg.GetSolverOptions().LearnRate = float32(rate)
|
||||||
@@ -101,12 +107,11 @@ var uninstallCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
path, err := os.Getwd()
|
|
||||||
if err != nil {
|
uninstallCmd.Flags().String("system-dbpath", "", "System db path")
|
||||||
Fatal(err)
|
uninstallCmd.Flags().String("system-target", "", "System rootpath")
|
||||||
}
|
uninstallCmd.Flags().String("system-engine", "", "System DB engine")
|
||||||
uninstallCmd.Flags().String("system-dbpath", path, "System db path")
|
|
||||||
uninstallCmd.Flags().String("system-target", path, "System rootpath")
|
|
||||||
uninstallCmd.Flags().String("solver-type", "", "Solver strategy ( Defaults none, available: "+AvailableResolvers+" )")
|
uninstallCmd.Flags().String("solver-type", "", "Solver strategy ( Defaults none, available: "+AvailableResolvers+" )")
|
||||||
uninstallCmd.Flags().Float32("solver-rate", 0.7, "Solver learning rate")
|
uninstallCmd.Flags().Float32("solver-rate", 0.7, "Solver learning rate")
|
||||||
uninstallCmd.Flags().Float32("solver-discount", 1.0, "Solver discount rate")
|
uninstallCmd.Flags().Float32("solver-discount", 1.0, "Solver discount rate")
|
||||||
|
@@ -15,8 +15,6 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
|
|
||||||
. "github.com/mudler/luet/pkg/config"
|
. "github.com/mudler/luet/pkg/config"
|
||||||
installer "github.com/mudler/luet/pkg/installer"
|
installer "github.com/mudler/luet/pkg/installer"
|
||||||
. "github.com/mudler/luet/pkg/logger"
|
. "github.com/mudler/luet/pkg/logger"
|
||||||
@@ -38,6 +36,7 @@ var upgradeCmd = &cobra.Command{
|
|||||||
LuetCfg.Viper.BindPFlag("solver.max_attempts", cmd.Flags().Lookup("solver-attempts"))
|
LuetCfg.Viper.BindPFlag("solver.max_attempts", cmd.Flags().Lookup("solver-attempts"))
|
||||||
LuetCfg.Viper.BindPFlag("force", cmd.Flags().Lookup("force"))
|
LuetCfg.Viper.BindPFlag("force", cmd.Flags().Lookup("force"))
|
||||||
LuetCfg.Viper.BindPFlag("yes", cmd.Flags().Lookup("yes"))
|
LuetCfg.Viper.BindPFlag("yes", cmd.Flags().Lookup("yes"))
|
||||||
|
LuetCfg.Viper.BindPFlag("system.database_engine", cmd.Flags().Lookup("system-engine"))
|
||||||
},
|
},
|
||||||
Long: `Upgrades packages in parallel`,
|
Long: `Upgrades packages in parallel`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
@@ -64,7 +63,13 @@ var upgradeCmd = &cobra.Command{
|
|||||||
sync, _ := cmd.Flags().GetBool("sync")
|
sync, _ := cmd.Flags().GetBool("sync")
|
||||||
concurrent, _ := cmd.Flags().GetBool("solver-concurrent")
|
concurrent, _ := cmd.Flags().GetBool("solver-concurrent")
|
||||||
yes := LuetCfg.Viper.GetBool("yes")
|
yes := LuetCfg.Viper.GetBool("yes")
|
||||||
|
dbpath := LuetCfg.Viper.GetString("system.database_path")
|
||||||
|
rootfs := LuetCfg.Viper.GetString("system.rootfs")
|
||||||
|
engine := LuetCfg.Viper.GetString("system.database_engine")
|
||||||
|
|
||||||
|
LuetCfg.System.DatabaseEngine = engine
|
||||||
|
LuetCfg.System.DatabasePath = dbpath
|
||||||
|
LuetCfg.System.Rootfs = rootfs
|
||||||
LuetCfg.GetSolverOptions().Type = stype
|
LuetCfg.GetSolverOptions().Type = stype
|
||||||
LuetCfg.GetSolverOptions().LearnRate = float32(rate)
|
LuetCfg.GetSolverOptions().LearnRate = float32(rate)
|
||||||
LuetCfg.GetSolverOptions().Discount = float32(discount)
|
LuetCfg.GetSolverOptions().Discount = float32(discount)
|
||||||
@@ -102,12 +107,10 @@ var upgradeCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
path, err := os.Getwd()
|
upgradeCmd.Flags().String("system-dbpath", "", "System db path")
|
||||||
if err != nil {
|
upgradeCmd.Flags().String("system-target", "", "System rootpath")
|
||||||
Fatal(err)
|
upgradeCmd.Flags().String("system-engine", "", "System DB engine")
|
||||||
}
|
|
||||||
upgradeCmd.Flags().String("system-dbpath", path, "System db path")
|
|
||||||
upgradeCmd.Flags().String("system-target", path, "System rootpath")
|
|
||||||
upgradeCmd.Flags().String("solver-type", "", "Solver strategy ( Defaults none, available: "+AvailableResolvers+" )")
|
upgradeCmd.Flags().String("solver-type", "", "Solver strategy ( Defaults none, available: "+AvailableResolvers+" )")
|
||||||
upgradeCmd.Flags().Float32("solver-rate", 0.7, "Solver learning rate")
|
upgradeCmd.Flags().Float32("solver-rate", 0.7, "Solver learning rate")
|
||||||
upgradeCmd.Flags().Float32("solver-discount", 1.0, "Solver discount rate")
|
upgradeCmd.Flags().Float32("solver-discount", 1.0, "Solver discount rate")
|
||||||
|
Reference in New Issue
Block a user