mirror of
https://github.com/mudler/luet.git
synced 2025-09-11 20:19:30 +00:00
@@ -43,6 +43,7 @@ var installCmd = &cobra.Command{
|
|||||||
LuetCfg.Viper.BindPFlag("onlydeps", cmd.Flags().Lookup("onlydeps"))
|
LuetCfg.Viper.BindPFlag("onlydeps", cmd.Flags().Lookup("onlydeps"))
|
||||||
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"))
|
||||||
},
|
},
|
||||||
Long: `Install packages in parallel`,
|
Long: `Install packages in parallel`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
@@ -75,6 +76,7 @@ var installCmd = &cobra.Command{
|
|||||||
nodeps := LuetCfg.Viper.GetBool("nodeps")
|
nodeps := LuetCfg.Viper.GetBool("nodeps")
|
||||||
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")
|
||||||
|
|
||||||
LuetCfg.GetSolverOptions().Type = stype
|
LuetCfg.GetSolverOptions().Type = stype
|
||||||
LuetCfg.GetSolverOptions().LearnRate = float32(rate)
|
LuetCfg.GetSolverOptions().LearnRate = float32(rate)
|
||||||
@@ -99,6 +101,7 @@ var installCmd = &cobra.Command{
|
|||||||
Force: force,
|
Force: force,
|
||||||
OnlyDeps: onlydeps,
|
OnlyDeps: onlydeps,
|
||||||
PreserveSystemEssentialData: true,
|
PreserveSystemEssentialData: true,
|
||||||
|
Ask: !yes,
|
||||||
})
|
})
|
||||||
inst.Repositories(repos)
|
inst.Repositories(repos)
|
||||||
|
|
||||||
@@ -131,6 +134,7 @@ func init() {
|
|||||||
installCmd.Flags().Bool("onlydeps", false, "Consider **only** package dependencies")
|
installCmd.Flags().Bool("onlydeps", false, "Consider **only** package dependencies")
|
||||||
installCmd.Flags().Bool("force", false, "Skip errors and keep going (potentially harmful)")
|
installCmd.Flags().Bool("force", false, "Skip errors and keep going (potentially harmful)")
|
||||||
installCmd.Flags().Bool("solver-concurrent", false, "Use concurrent solver (experimental)")
|
installCmd.Flags().Bool("solver-concurrent", false, "Use concurrent solver (experimental)")
|
||||||
|
installCmd.Flags().BoolP("yes", "y", false, "Don't ask questions")
|
||||||
|
|
||||||
RootCmd.AddCommand(installCmd)
|
RootCmd.AddCommand(installCmd)
|
||||||
}
|
}
|
||||||
|
28
cmd/root.go
28
cmd/root.go
@@ -54,9 +54,31 @@ var (
|
|||||||
|
|
||||||
// RootCmd represents the base command when called without any subcommands
|
// RootCmd represents the base command when called without any subcommands
|
||||||
var RootCmd = &cobra.Command{
|
var RootCmd = &cobra.Command{
|
||||||
Use: "luet",
|
Use: "luet",
|
||||||
Short: "Package manager for the XXth century!",
|
Short: "Package manager for the XXth century!",
|
||||||
Long: `Package manager which uses containers to build packages`,
|
Long: `Luet is a single-binary package manager based on containers to build packages.
|
||||||
|
|
||||||
|
To install a package:
|
||||||
|
|
||||||
|
$ luet install package
|
||||||
|
|
||||||
|
To search for a package in the repositories:
|
||||||
|
|
||||||
|
$ luet search package
|
||||||
|
|
||||||
|
To list all packages installed in the system:
|
||||||
|
|
||||||
|
$ luet search --installed .
|
||||||
|
|
||||||
|
To show hidden packages:
|
||||||
|
|
||||||
|
$ luet search --hidden package
|
||||||
|
|
||||||
|
To build a package, from a tree definition:
|
||||||
|
|
||||||
|
$ luet build --tree tree/path package
|
||||||
|
|
||||||
|
`,
|
||||||
Version: fmt.Sprintf("%s-g%s %s", LuetCLIVersion, BuildCommit, BuildTime),
|
Version: fmt.Sprintf("%s-g%s %s", LuetCLIVersion, BuildCommit, BuildTime),
|
||||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||||
err := LoadConfig(config.LuetCfg)
|
err := LoadConfig(config.LuetCfg)
|
||||||
|
@@ -42,6 +42,7 @@ var uninstallCmd = &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("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"))
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
var systemDB pkg.PackageDatabase
|
var systemDB pkg.PackageDatabase
|
||||||
@@ -63,6 +64,7 @@ var uninstallCmd = &cobra.Command{
|
|||||||
checkconflicts, _ := cmd.Flags().GetBool("conflictscheck")
|
checkconflicts, _ := cmd.Flags().GetBool("conflictscheck")
|
||||||
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")
|
||||||
|
|
||||||
LuetCfg.GetSolverOptions().Type = stype
|
LuetCfg.GetSolverOptions().Type = stype
|
||||||
LuetCfg.GetSolverOptions().LearnRate = float32(rate)
|
LuetCfg.GetSolverOptions().LearnRate = float32(rate)
|
||||||
@@ -86,6 +88,7 @@ var uninstallCmd = &cobra.Command{
|
|||||||
FullUninstall: full,
|
FullUninstall: full,
|
||||||
FullCleanUninstall: fullClean,
|
FullCleanUninstall: fullClean,
|
||||||
CheckConflicts: checkconflicts,
|
CheckConflicts: checkconflicts,
|
||||||
|
Ask: !yes,
|
||||||
})
|
})
|
||||||
|
|
||||||
if LuetCfg.GetSystem().DatabaseEngine == "boltdb" {
|
if LuetCfg.GetSystem().DatabaseEngine == "boltdb" {
|
||||||
@@ -120,6 +123,7 @@ func init() {
|
|||||||
uninstallCmd.Flags().Bool("conflictscheck", true, "Check if the package marked for deletion is required by other packages")
|
uninstallCmd.Flags().Bool("conflictscheck", true, "Check if the package marked for deletion is required by other packages")
|
||||||
uninstallCmd.Flags().Bool("full-clean", false, "(experimental) Uninstall packages and all the other deps/revdeps of it.")
|
uninstallCmd.Flags().Bool("full-clean", false, "(experimental) Uninstall packages and all the other deps/revdeps of it.")
|
||||||
uninstallCmd.Flags().Bool("solver-concurrent", false, "Use concurrent solver (experimental)")
|
uninstallCmd.Flags().Bool("solver-concurrent", false, "Use concurrent solver (experimental)")
|
||||||
|
uninstallCmd.Flags().BoolP("yes", "y", false, "Don't ask questions")
|
||||||
|
|
||||||
RootCmd.AddCommand(uninstallCmd)
|
RootCmd.AddCommand(uninstallCmd)
|
||||||
}
|
}
|
||||||
|
@@ -39,6 +39,7 @@ var upgradeCmd = &cobra.Command{
|
|||||||
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"))
|
||||||
LuetCfg.Viper.BindPFlag("force", cmd.Flags().Lookup("force"))
|
LuetCfg.Viper.BindPFlag("force", cmd.Flags().Lookup("force"))
|
||||||
|
LuetCfg.Viper.BindPFlag("yes", cmd.Flags().Lookup("yes"))
|
||||||
},
|
},
|
||||||
Long: `Upgrades packages in parallel`,
|
Long: `Upgrades packages in parallel`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
@@ -65,6 +66,7 @@ var upgradeCmd = &cobra.Command{
|
|||||||
clean, _ := cmd.Flags().GetBool("clean")
|
clean, _ := cmd.Flags().GetBool("clean")
|
||||||
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")
|
||||||
|
|
||||||
LuetCfg.GetSolverOptions().Type = stype
|
LuetCfg.GetSolverOptions().Type = stype
|
||||||
LuetCfg.GetSolverOptions().LearnRate = float32(rate)
|
LuetCfg.GetSolverOptions().LearnRate = float32(rate)
|
||||||
@@ -90,6 +92,7 @@ var upgradeCmd = &cobra.Command{
|
|||||||
SolverUpgrade: universe,
|
SolverUpgrade: universe,
|
||||||
RemoveUnavailableOnUpgrade: clean,
|
RemoveUnavailableOnUpgrade: clean,
|
||||||
UpgradeNewRevisions: sync,
|
UpgradeNewRevisions: sync,
|
||||||
|
Ask: !yes,
|
||||||
})
|
})
|
||||||
inst.Repositories(repos)
|
inst.Repositories(repos)
|
||||||
_, err := inst.SyncRepositories(false)
|
_, err := inst.SyncRepositories(false)
|
||||||
@@ -129,6 +132,7 @@ func init() {
|
|||||||
upgradeCmd.Flags().Bool("clean", false, "Try to drop removed packages (experimental, only when --universe is enabled)")
|
upgradeCmd.Flags().Bool("clean", false, "Try to drop removed packages (experimental, only when --universe is enabled)")
|
||||||
upgradeCmd.Flags().Bool("sync", false, "Upgrade packages with new revisions (experimental)")
|
upgradeCmd.Flags().Bool("sync", false, "Upgrade packages with new revisions (experimental)")
|
||||||
upgradeCmd.Flags().Bool("solver-concurrent", false, "Use concurrent solver (experimental)")
|
upgradeCmd.Flags().Bool("solver-concurrent", false, "Use concurrent solver (experimental)")
|
||||||
|
upgradeCmd.Flags().BoolP("yes", "y", false, "Don't ask questions")
|
||||||
|
|
||||||
RootCmd.AddCommand(upgradeCmd)
|
RootCmd.AddCommand(upgradeCmd)
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
package installer
|
package installer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -24,6 +23,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
. "github.com/logrusorgru/aurora"
|
||||||
"github.com/mudler/luet/pkg/bus"
|
"github.com/mudler/luet/pkg/bus"
|
||||||
compiler "github.com/mudler/luet/pkg/compiler"
|
compiler "github.com/mudler/luet/pkg/compiler"
|
||||||
"github.com/mudler/luet/pkg/config"
|
"github.com/mudler/luet/pkg/config"
|
||||||
@@ -45,6 +45,7 @@ type LuetInstallerOptions struct {
|
|||||||
FullUninstall, FullCleanUninstall bool
|
FullUninstall, FullCleanUninstall bool
|
||||||
CheckConflicts bool
|
CheckConflicts bool
|
||||||
SolverUpgrade, RemoveUnavailableOnUpgrade, UpgradeNewRevisions bool
|
SolverUpgrade, RemoveUnavailableOnUpgrade, UpgradeNewRevisions bool
|
||||||
|
Ask bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type LuetInstaller struct {
|
type LuetInstaller struct {
|
||||||
@@ -63,93 +64,105 @@ func NewLuetInstaller(opts LuetInstallerOptions) Installer {
|
|||||||
return &LuetInstaller{Options: opts}
|
return &LuetInstaller{Options: opts}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LuetInstaller) Upgrade(s *System) error {
|
// ComputeUpgrade returns the packages to be uninstalled and installed in a system to perform an upgrade
|
||||||
|
// based on the system repositories
|
||||||
|
func (l *LuetInstaller) ComputeUpgrade(s *System) (Repositories, pkg.Packages, pkg.Packages, error) {
|
||||||
|
toInstall := pkg.Packages{}
|
||||||
|
var uninstall pkg.Packages
|
||||||
|
|
||||||
syncedRepos, err := l.SyncRepositories(true)
|
syncedRepos, err := l.SyncRepositories(true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil, uninstall, toInstall, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// First match packages against repositories by priority
|
||||||
|
allRepos := pkg.NewInMemoryDatabase(false)
|
||||||
|
syncedRepos.SyncDatabase(allRepos)
|
||||||
|
// compute a "big" world
|
||||||
|
solv := solver.NewResolver(solver.Options{Type: l.Options.SolverOptions.Implementation, Concurrency: l.Options.Concurrency}, s.Database, allRepos, pkg.NewInMemoryDatabase(false), l.Options.SolverOptions.Resolver())
|
||||||
|
var solution solver.PackagesAssertions
|
||||||
|
|
||||||
|
if l.Options.SolverUpgrade {
|
||||||
|
uninstall, solution, err = solv.UpgradeUniverse(l.Options.RemoveUnavailableOnUpgrade)
|
||||||
|
if err != nil {
|
||||||
|
return syncedRepos, uninstall, toInstall, errors.Wrap(err, "Failed solving solution for upgrade")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uninstall, solution, err = solv.Upgrade(!l.Options.FullUninstall, l.Options.NoDeps)
|
||||||
|
if err != nil {
|
||||||
|
return syncedRepos, uninstall, toInstall, errors.Wrap(err, "Failed solving solution for upgrade")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, assertion := range solution {
|
||||||
|
// Be sure to filter from solutions packages already installed in the system
|
||||||
|
if _, err := s.Database.FindPackage(assertion.Package); err != nil && assertion.Value {
|
||||||
|
toInstall = append(toInstall, assertion.Package)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if l.Options.UpgradeNewRevisions {
|
||||||
|
for _, p := range s.Database.World() {
|
||||||
|
matches := syncedRepos.PackageMatches(pkg.Packages{p})
|
||||||
|
if len(matches) == 0 {
|
||||||
|
// Package missing. the user should run luet upgrade --universe
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, artefact := range matches[0].Repo.GetIndex() {
|
||||||
|
if artefact.GetCompileSpec().GetPackage() == nil {
|
||||||
|
return syncedRepos, uninstall, toInstall, errors.New("Package in compilespec empty")
|
||||||
|
|
||||||
|
}
|
||||||
|
if artefact.GetCompileSpec().GetPackage().Matches(p) && artefact.GetCompileSpec().GetPackage().GetBuildTimestamp() != p.GetBuildTimestamp() {
|
||||||
|
toInstall = append(toInstall, matches[0].Package).Unique()
|
||||||
|
uninstall = append(uninstall, p).Unique()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return syncedRepos, uninstall, toInstall, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func packsToList(p pkg.Packages) string {
|
||||||
|
var packs []string
|
||||||
|
|
||||||
|
for _, pp := range p {
|
||||||
|
packs = append(packs, pp.HumanReadableString())
|
||||||
|
}
|
||||||
|
return strings.Join(packs, " ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Upgrade upgrades a System based on the Installer options. Returns error in case of failure
|
||||||
|
func (l *LuetInstaller) Upgrade(s *System) error {
|
||||||
Info(":thinking: Computing upgrade, please hang tight... :zzz:")
|
Info(":thinking: Computing upgrade, please hang tight... :zzz:")
|
||||||
if l.Options.UpgradeNewRevisions {
|
if l.Options.UpgradeNewRevisions {
|
||||||
Info(":memo: note: will consider new build revisions while upgrading")
|
Info(":memo: note: will consider new build revisions while upgrading")
|
||||||
}
|
}
|
||||||
Spinner(32)
|
Spinner(32)
|
||||||
defer SpinnerStop()
|
defer SpinnerStop()
|
||||||
// First match packages against repositories by priority
|
|
||||||
allRepos := pkg.NewInMemoryDatabase(false)
|
|
||||||
syncedRepos.SyncDatabase(allRepos)
|
|
||||||
// compute a "big" world
|
|
||||||
solv := solver.NewResolver(solver.Options{Type: l.Options.SolverOptions.Implementation, Concurrency: l.Options.Concurrency}, s.Database, allRepos, pkg.NewInMemoryDatabase(false), l.Options.SolverOptions.Resolver())
|
|
||||||
var uninstall pkg.Packages
|
|
||||||
var solution solver.PackagesAssertions
|
|
||||||
|
|
||||||
if l.Options.SolverUpgrade {
|
|
||||||
|
|
||||||
uninstall, solution, err = solv.UpgradeUniverse(l.Options.RemoveUnavailableOnUpgrade)
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "Failed solving solution for upgrade")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
uninstall, solution, err = solv.Upgrade(!l.Options.FullUninstall, l.Options.NoDeps)
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "Failed solving solution for upgrade")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
syncedRepos, uninstall, toInstall, err := l.ComputeUpgrade(s)
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "failed computing upgrade")
|
||||||
}
|
}
|
||||||
SpinnerStop()
|
|
||||||
|
|
||||||
if len(uninstall) > 0 {
|
if len(uninstall) > 0 {
|
||||||
Info(":recycle: Packages marked for uninstall:")
|
Info(":recycle: Packages that are going to be removed from the system:\n ", Yellow(packsToList(uninstall)).BgBlack().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, p := range uninstall {
|
if len(toInstall) > 0 {
|
||||||
Info(fmt.Sprintf("- %s", p.HumanReadableString()))
|
Info(":zap: Packages that are going to be installed in the system:\n ", Green(packsToList(toInstall)).BgBlack().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(solution) > 0 {
|
if l.Options.Ask {
|
||||||
Info(":zap: Packages marked for upgrade:")
|
Info("By going forward, you are also accepting the licenses of the packages that you are going to install in your system.")
|
||||||
}
|
if Ask() {
|
||||||
|
return l.swap(syncedRepos, uninstall, toInstall, s)
|
||||||
toInstall := pkg.Packages{}
|
} else {
|
||||||
for _, assertion := range solution {
|
return errors.New("Aborted by user")
|
||||||
// Be sure to filter from solutions packages already installed in the system
|
|
||||||
if _, err := s.Database.FindPackage(assertion.Package); err != nil && assertion.Value {
|
|
||||||
Info(fmt.Sprintf("- %s", assertion.Package.HumanReadableString()))
|
|
||||||
toInstall = append(toInstall, assertion.Package)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if l.Options.UpgradeNewRevisions {
|
|
||||||
Info(":mag: Checking packages with new revisions available")
|
|
||||||
for _, p := range s.Database.World() {
|
|
||||||
matches := syncedRepos.PackageMatches(pkg.Packages{p})
|
|
||||||
if len(matches) == 0 {
|
|
||||||
// Package missing. the user should run luet upgrade --universe
|
|
||||||
Info(":warning: Installed packages seems to be missing from remote repositories.")
|
|
||||||
Info(":warning: It is suggested to run 'luet upgrade --universe'")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
for _, artefact := range matches[0].Repo.GetIndex() {
|
|
||||||
if artefact.GetCompileSpec().GetPackage() == nil {
|
|
||||||
return errors.New("Package in compilespec empty")
|
|
||||||
|
|
||||||
}
|
|
||||||
if artefact.GetCompileSpec().GetPackage().Matches(p) && artefact.GetCompileSpec().GetPackage().GetBuildTimestamp() != p.GetBuildTimestamp() {
|
|
||||||
toInstall = append(toInstall, matches[0].Package).Unique()
|
|
||||||
uninstall = append(uninstall, p).Unique()
|
|
||||||
Info(
|
|
||||||
fmt.Sprintf("- %s ( %s vs %s ) repo: %s (date: %s)",
|
|
||||||
p.HumanReadableString(),
|
|
||||||
artefact.GetCompileSpec().GetPackage().GetBuildTimestamp(),
|
|
||||||
p.GetBuildTimestamp(),
|
|
||||||
matches[0].Repo.GetName(),
|
|
||||||
matches[0].Repo.GetLastUpdate(),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return l.swap(syncedRepos, uninstall, toInstall, s)
|
return l.swap(syncedRepos, uninstall, toInstall, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,7 +229,12 @@ func (l *LuetInstaller) swap(syncedRepos Repositories, toRemove pkg.Packages, to
|
|||||||
}
|
}
|
||||||
l.Options.Force = forced
|
l.Options.Force = forced
|
||||||
|
|
||||||
return l.install(syncedRepos, toInstall, s)
|
match, packages, assertions, allRepos, err := l.ComputeInstall(syncedRepos, toInstall, s)
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "computing installation")
|
||||||
|
}
|
||||||
|
|
||||||
|
return l.install(syncedRepos, match, packages, assertions, allRepos, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LuetInstaller) Install(cp pkg.Packages, s *System) error {
|
func (l *LuetInstaller) Install(cp pkg.Packages, s *System) error {
|
||||||
@@ -224,7 +242,28 @@ func (l *LuetInstaller) Install(cp pkg.Packages, s *System) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return l.install(syncedRepos, cp, s)
|
|
||||||
|
match, packages, assertions, allRepos, err := l.ComputeInstall(syncedRepos, cp, s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(packages) > 0 {
|
||||||
|
Info("Packages that are going to be installed in the system: \n ", Green(packsToList(packages)).BgBlack().String())
|
||||||
|
} else {
|
||||||
|
Info("No packages to install")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if l.Options.Ask {
|
||||||
|
Info("By going forward, you are also accepting the licenses of the packages that you are going to install in your system.")
|
||||||
|
if Ask() {
|
||||||
|
return l.install(syncedRepos, match, packages, assertions, allRepos, s)
|
||||||
|
} else {
|
||||||
|
return errors.New("Aborted by user")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return l.install(syncedRepos, match, packages, assertions, allRepos, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LuetInstaller) download(syncedRepos Repositories, cp pkg.Packages) error {
|
func (l *LuetInstaller) download(syncedRepos Repositories, cp pkg.Packages) error {
|
||||||
@@ -323,16 +362,18 @@ func (l *LuetInstaller) Reclaim(s *System) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LuetInstaller) install(syncedRepos Repositories, cp pkg.Packages, s *System) error {
|
func (l *LuetInstaller) ComputeInstall(syncedRepos Repositories, cp pkg.Packages, s *System) (map[string]ArtifactMatch, pkg.Packages, solver.PackagesAssertions, pkg.PackageDatabase, error) {
|
||||||
var p pkg.Packages
|
var p pkg.Packages
|
||||||
|
toInstall := map[string]ArtifactMatch{}
|
||||||
|
allRepos := pkg.NewInMemoryDatabase(false)
|
||||||
|
var solution solver.PackagesAssertions
|
||||||
|
|
||||||
// Check if the package is installed first
|
// Check if the package is installed first
|
||||||
for _, pi := range cp {
|
for _, pi := range cp {
|
||||||
|
|
||||||
vers, _ := s.Database.FindPackageVersions(pi)
|
vers, _ := s.Database.FindPackageVersions(pi)
|
||||||
|
|
||||||
if len(vers) >= 1 {
|
if len(vers) >= 1 {
|
||||||
Warning("Filtering out package " + pi.HumanReadableString() + ", it has other versions already installed. Uninstall one of them first ")
|
// Warning("Filtering out package " + pi.HumanReadableString() + ", it has other versions already installed. Uninstall one of them first ")
|
||||||
continue
|
continue
|
||||||
//return errors.New("Package " + pi.GetFingerPrint() + " has other versions already installed. Uninstall one of them first: " + strings.Join(vers, " "))
|
//return errors.New("Package " + pi.GetFingerPrint() + " has other versions already installed. Uninstall one of them first: " + strings.Join(vers, " "))
|
||||||
|
|
||||||
@@ -342,7 +383,7 @@ func (l *LuetInstaller) install(syncedRepos Repositories, cp pkg.Packages, s *Sy
|
|||||||
|
|
||||||
if len(p) == 0 {
|
if len(p) == 0 {
|
||||||
Warning("No package to install, bailing out with no errors")
|
Warning("No package to install, bailing out with no errors")
|
||||||
return nil
|
return toInstall, p, solution, allRepos, nil
|
||||||
}
|
}
|
||||||
// First get metas from all repos (and decodes trees)
|
// First get metas from all repos (and decodes trees)
|
||||||
|
|
||||||
@@ -350,25 +391,19 @@ func (l *LuetInstaller) install(syncedRepos Repositories, cp pkg.Packages, s *Sy
|
|||||||
// matches := syncedRepos.PackageMatches(p)
|
// matches := syncedRepos.PackageMatches(p)
|
||||||
|
|
||||||
// compute a "big" world
|
// compute a "big" world
|
||||||
allRepos := pkg.NewInMemoryDatabase(false)
|
|
||||||
syncedRepos.SyncDatabase(allRepos)
|
syncedRepos.SyncDatabase(allRepos)
|
||||||
p = syncedRepos.ResolveSelectors(p)
|
p = syncedRepos.ResolveSelectors(p)
|
||||||
toInstall := map[string]ArtifactMatch{}
|
|
||||||
var packagesToInstall pkg.Packages
|
var packagesToInstall pkg.Packages
|
||||||
var err error
|
var err error
|
||||||
var solution solver.PackagesAssertions
|
|
||||||
|
|
||||||
if !l.Options.NoDeps {
|
if !l.Options.NoDeps {
|
||||||
Info(":deciduous_tree: Computing installation, hang tight")
|
|
||||||
solv := solver.NewResolver(solver.Options{Type: l.Options.SolverOptions.Implementation, Concurrency: l.Options.Concurrency}, s.Database, allRepos, pkg.NewInMemoryDatabase(false), l.Options.SolverOptions.Resolver())
|
solv := solver.NewResolver(solver.Options{Type: l.Options.SolverOptions.Implementation, Concurrency: l.Options.Concurrency}, s.Database, allRepos, pkg.NewInMemoryDatabase(false), l.Options.SolverOptions.Resolver())
|
||||||
solution, err = solv.Install(p)
|
solution, err = solv.Install(p)
|
||||||
/// TODO: PackageAssertions needs to be a map[fingerprint]pack so lookup is in O(1)
|
/// TODO: PackageAssertions needs to be a map[fingerprint]pack so lookup is in O(1)
|
||||||
if err != nil && !l.Options.Force {
|
if err != nil && !l.Options.Force {
|
||||||
return errors.Wrap(err, "Failed solving solution for package")
|
return toInstall, p, solution, allRepos, errors.Wrap(err, "Failed solving solution for package")
|
||||||
}
|
}
|
||||||
Info(":deciduous_tree: Finished calculating dependencies")
|
|
||||||
// Gathers things to install
|
// Gathers things to install
|
||||||
Info(":deciduous_tree: Checking for packages already installed, and prepare for installation")
|
|
||||||
for _, assertion := range solution {
|
for _, assertion := range solution {
|
||||||
if assertion.Value {
|
if assertion.Value {
|
||||||
if _, err := s.Database.FindPackage(assertion.Package); err == nil {
|
if _, err := s.Database.FindPackage(assertion.Package); err == nil {
|
||||||
@@ -387,32 +422,33 @@ func (l *LuetInstaller) install(syncedRepos Repositories, cp pkg.Packages, s *Sy
|
|||||||
packagesToInstall = append(packagesToInstall, currentPack)
|
packagesToInstall = append(packagesToInstall, currentPack)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Info(":deciduous_tree: Finding packages to install from :cloud:")
|
|
||||||
// Gathers things to install
|
// Gathers things to install
|
||||||
for _, currentPack := range packagesToInstall {
|
for _, currentPack := range packagesToInstall {
|
||||||
// Check if package is already installed.
|
// Check if package is already installed.
|
||||||
|
|
||||||
matches := syncedRepos.PackageMatches(pkg.Packages{currentPack})
|
matches := syncedRepos.PackageMatches(pkg.Packages{currentPack})
|
||||||
if len(matches) == 0 {
|
if len(matches) == 0 {
|
||||||
return errors.New("Failed matching solutions against repository for " + currentPack.HumanReadableString() + " where are definitions coming from?!")
|
return toInstall, p, solution, allRepos, errors.New("Failed matching solutions against repository for " + currentPack.HumanReadableString() + " where are definitions coming from?!")
|
||||||
}
|
}
|
||||||
A:
|
A:
|
||||||
for _, artefact := range matches[0].Repo.GetIndex() {
|
for _, artefact := range matches[0].Repo.GetIndex() {
|
||||||
if artefact.GetCompileSpec().GetPackage() == nil {
|
if artefact.GetCompileSpec().GetPackage() == nil {
|
||||||
return errors.New("Package in compilespec empty")
|
return toInstall, p, solution, allRepos, errors.New("Package in compilespec empty")
|
||||||
|
|
||||||
}
|
}
|
||||||
if matches[0].Package.Matches(artefact.GetCompileSpec().GetPackage()) {
|
if matches[0].Package.Matches(artefact.GetCompileSpec().GetPackage()) {
|
||||||
currentPack.SetBuildTimestamp(artefact.GetCompileSpec().GetPackage().GetBuildTimestamp())
|
currentPack.SetBuildTimestamp(artefact.GetCompileSpec().GetPackage().GetBuildTimestamp())
|
||||||
// Filter out already installed
|
// Filter out already installed
|
||||||
if _, err := s.Database.FindPackage(currentPack); err != nil {
|
if _, err := s.Database.FindPackage(currentPack); err != nil {
|
||||||
toInstall[currentPack.GetFingerPrint()] = ArtifactMatch{Package: currentPack, Artifact: artefact, Repository: matches[0].Repo}
|
toInstall[currentPack.GetFingerPrint()] = ArtifactMatch{Package: currentPack, Artifact: artefact, Repository: matches[0].Repo}
|
||||||
Info("\t:package:", currentPack.HumanReadableString(), ":cloud:", matches[0].Repo.GetName())
|
|
||||||
}
|
}
|
||||||
break A
|
break A
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return toInstall, p, solution, allRepos, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *LuetInstaller) install(syncedRepos Repositories, toInstall map[string]ArtifactMatch, p pkg.Packages, solution solver.PackagesAssertions, allRepos pkg.PackageDatabase, s *System) error {
|
||||||
// Install packages into rootfs in parallel.
|
// Install packages into rootfs in parallel.
|
||||||
all := make(chan ArtifactMatch)
|
all := make(chan ArtifactMatch)
|
||||||
|
|
||||||
@@ -542,7 +578,7 @@ func (l *LuetInstaller) downloadWorker(i int, wg *sync.WaitGroup, c <-chan Artif
|
|||||||
return errors.Wrap(err, "Failed installing package "+p.Package.GetName())
|
return errors.Wrap(err, "Failed installing package "+p.Package.GetName())
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
Info("\n:package: ", p.Package.HumanReadableString(), "downloaded")
|
Info("\n:package: Package ", p.Package.HumanReadableString(), "downloaded")
|
||||||
} else if err != nil && l.Options.Force {
|
} else if err != nil && l.Options.Force {
|
||||||
Info("\n:package: ", p.Package.HumanReadableString(), "downloaded with failures (force download)")
|
Info("\n:package: ", p.Package.HumanReadableString(), "downloaded with failures (force download)")
|
||||||
}
|
}
|
||||||
@@ -563,9 +599,9 @@ func (l *LuetInstaller) installerWorker(i int, wg *sync.WaitGroup, c <-chan Arti
|
|||||||
return errors.Wrap(err, "Failed installing package "+p.Package.GetName())
|
return errors.Wrap(err, "Failed installing package "+p.Package.GetName())
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
Info(":package: ", p.Package.HumanReadableString(), "installed")
|
Info(":package: Package ", p.Package.HumanReadableString(), "installed")
|
||||||
} else if err != nil && l.Options.Force {
|
} else if err != nil && l.Options.Force {
|
||||||
Info(":package: ", p.Package.HumanReadableString(), "installed with failures (force install)")
|
Info(":package: Package ", p.Package.HumanReadableString(), "installed with failures (forced install)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -663,12 +699,9 @@ func (l *LuetInstaller) uninstall(p pkg.Package, s *System) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LuetInstaller) Uninstall(p pkg.Package, s *System) error {
|
func (l *LuetInstaller) ComputeUninstall(p pkg.Package, s *System) (pkg.Packages, error) {
|
||||||
Spinner(32)
|
|
||||||
defer SpinnerStop()
|
|
||||||
|
|
||||||
Info(":recycle: Uninstalling :package:", p.HumanReadableString(), "hang tight")
|
|
||||||
|
|
||||||
|
var toUninstall pkg.Packages
|
||||||
// compute uninstall from all world - remove packages in parallel - run uninstall finalizer (in order) TODO - mark the uninstallation in db
|
// compute uninstall from all world - remove packages in parallel - run uninstall finalizer (in order) TODO - mark the uninstallation in db
|
||||||
// Get installed definition
|
// Get installed definition
|
||||||
checkConflicts := l.Options.CheckConflicts
|
checkConflicts := l.Options.CheckConflicts
|
||||||
@@ -685,44 +718,66 @@ func (l *LuetInstaller) Uninstall(p pkg.Package, s *System) error {
|
|||||||
for _, i := range s.Database.World() {
|
for _, i := range s.Database.World() {
|
||||||
_, err := installedtmp.CreatePackage(i)
|
_, err := installedtmp.CreatePackage(i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "Failed create temporary in-memory db")
|
return toUninstall, errors.Wrap(err, "Failed create temporary in-memory db")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !l.Options.NoDeps {
|
if !l.Options.NoDeps {
|
||||||
Info(":mag: Finding :package:", p.HumanReadableString(), "dependency graph :deciduous_tree:")
|
|
||||||
solv := solver.NewResolver(solver.Options{Type: l.Options.SolverOptions.Implementation, Concurrency: l.Options.Concurrency}, installedtmp, installedtmp, pkg.NewInMemoryDatabase(false), l.Options.SolverOptions.Resolver())
|
solv := solver.NewResolver(solver.Options{Type: l.Options.SolverOptions.Implementation, Concurrency: l.Options.Concurrency}, installedtmp, installedtmp, pkg.NewInMemoryDatabase(false), l.Options.SolverOptions.Resolver())
|
||||||
var solution pkg.Packages
|
var solution pkg.Packages
|
||||||
var err error
|
var err error
|
||||||
if l.Options.FullCleanUninstall {
|
if l.Options.FullCleanUninstall {
|
||||||
solution, err = solv.UninstallUniverse(pkg.Packages{p})
|
solution, err = solv.UninstallUniverse(pkg.Packages{p})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "Could not solve the uninstall constraints. Tip: try with --solver-type qlearning or with --force, or by removing packages excluding their dependencies with --nodeps")
|
return toUninstall, errors.Wrap(err, "Could not solve the uninstall constraints. Tip: try with --solver-type qlearning or with --force, or by removing packages excluding their dependencies with --nodeps")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
solution, err = solv.Uninstall(checkConflicts, full, p)
|
solution, err = solv.Uninstall(checkConflicts, full, p)
|
||||||
if err != nil && !l.Options.Force {
|
if err != nil && !l.Options.Force {
|
||||||
return errors.Wrap(err, "Could not solve the uninstall constraints. Tip: try with --solver-type qlearning or with --force, or by removing packages excluding their dependencies with --nodeps")
|
return toUninstall, errors.Wrap(err, "Could not solve the uninstall constraints. Tip: try with --solver-type qlearning or with --force, or by removing packages excluding their dependencies with --nodeps")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, p := range solution {
|
for _, p := range solution {
|
||||||
Info(":recycle: Uninstalling", p.HumanReadableString())
|
toUninstall = append(toUninstall, p)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
toUninstall = append(toUninstall, p)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return toUninstall, nil
|
||||||
|
}
|
||||||
|
func (l *LuetInstaller) Uninstall(p pkg.Package, s *System) error {
|
||||||
|
Spinner(32)
|
||||||
|
defer SpinnerStop()
|
||||||
|
|
||||||
|
toUninstall, err := l.ComputeUninstall(p, s)
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "while computing uninstall")
|
||||||
|
}
|
||||||
|
|
||||||
|
uninstall := func() error {
|
||||||
|
for _, p := range toUninstall {
|
||||||
err := l.uninstall(p, s)
|
err := l.uninstall(p, s)
|
||||||
if err != nil && !l.Options.Force {
|
if err != nil && !l.Options.Force {
|
||||||
return errors.Wrap(err, "Uninstall failed")
|
return errors.Wrap(err, "Uninstall failed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
return nil
|
||||||
Info(":recycle: Uninstalling", p.HumanReadableString(), "without deps")
|
|
||||||
err := l.uninstall(p, s)
|
|
||||||
if err != nil && !l.Options.Force {
|
|
||||||
return errors.Wrap(err, "Uninstall failed")
|
|
||||||
}
|
|
||||||
Info(":recycle: :package:", p.HumanReadableString(), "uninstalled :heavy_check_mark:")
|
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
|
|
||||||
|
Info(":recycle: Packages that are going to be removed from the system:\n ", Yellow(packsToList(toUninstall)).BgBlack().String())
|
||||||
|
|
||||||
|
if l.Options.Ask {
|
||||||
|
Info("By going forward, you are also accepting the licenses of the packages that you are going to install in your system.")
|
||||||
|
if Ask() {
|
||||||
|
return uninstall()
|
||||||
|
} else {
|
||||||
|
return errors.New("Aborted by user")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return uninstall()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LuetInstaller) Repositories(r []Repository) { l.PackageRepositories = r }
|
func (l *LuetInstaller) Repositories(r []Repository) { l.PackageRepositories = r }
|
||||||
|
@@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
|
||||||
. "github.com/mudler/luet/pkg/config"
|
. "github.com/mudler/luet/pkg/config"
|
||||||
|
|
||||||
@@ -36,6 +37,22 @@ func GetAurora() Aurora {
|
|||||||
return aurora
|
return aurora
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Ask() bool {
|
||||||
|
var input string
|
||||||
|
|
||||||
|
Info("Do you want to continue with this operation? [y/N]: ")
|
||||||
|
_, err := fmt.Scanln(&input)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
input = strings.ToLower(input)
|
||||||
|
|
||||||
|
if input == "y" || input == "yes" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func ZapLogger() error {
|
func ZapLogger() error {
|
||||||
var err error
|
var err error
|
||||||
if z == nil {
|
if z == nil {
|
||||||
@@ -183,7 +200,7 @@ func msg(level string, withoutColor bool, msg ...interface{}) {
|
|||||||
case "debug":
|
case "debug":
|
||||||
levelMsg = White(message).BgBlack().String()
|
levelMsg = White(message).BgBlack().String()
|
||||||
case "info":
|
case "info":
|
||||||
levelMsg = Bold(White(message)).BgBlack().String()
|
levelMsg = message
|
||||||
case "error":
|
case "error":
|
||||||
levelMsg = Bold(Red(":bomb: " + message + ":fire:")).BgBlack().String()
|
levelMsg = Bold(Red(":bomb: " + message + ":fire:")).BgBlack().String()
|
||||||
}
|
}
|
||||||
|
@@ -57,22 +57,22 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
luet install --config $tmpdir/luet.yaml test/c
|
luet install -y --config $tmpdir/luet.yaml test/c
|
||||||
#luet install --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
#luet install -y --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
||||||
}
|
}
|
||||||
|
|
||||||
testReInstall() {
|
testReInstall() {
|
||||||
output=$(luet install --config $tmpdir/luet.yaml test/c-1.0)
|
output=$(luet install -y --config $tmpdir/luet.yaml test/c-1.0)
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertContains 'contains warning' "$output" 'Filtering out'
|
assertContains 'contains warning' "$output" 'No packages to install'
|
||||||
}
|
}
|
||||||
|
|
||||||
testUnInstall() {
|
testUnInstall() {
|
||||||
luet uninstall --config $tmpdir/luet.yaml test/c
|
luet uninstall -y --config $tmpdir/luet.yaml test/c
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'uninstall test successfully' "$installst" "0"
|
assertEquals 'uninstall test successfully' "$installst" "0"
|
||||||
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
||||||
@@ -80,10 +80,10 @@ testUnInstall() {
|
|||||||
|
|
||||||
testInstallAgain() {
|
testInstallAgain() {
|
||||||
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
||||||
output=$(luet install --config $tmpdir/luet.yaml test/c-1.0)
|
output=$(luet install -y --config $tmpdir/luet.yaml test/c-1.0)
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertNotContains 'contains warning' "$output" 'Filtering out'
|
assertNotContains 'contains warning' "$output" 'No packages to install'
|
||||||
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
||||||
assertTrue 'package in cache' "[ -e '$tmpdir/testrootfs/packages/c-test-1.0.package.tar.gz' ]"
|
assertTrue 'package in cache' "[ -e '$tmpdir/testrootfs/packages/c-test-1.0.package.tar.gz' ]"
|
||||||
}
|
}
|
||||||
|
@@ -62,22 +62,22 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
luet install --config $tmpdir/luet.yaml test/c-1.0
|
luet install -y --config $tmpdir/luet.yaml test/c-1.0
|
||||||
#luet install --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
#luet install -y --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
||||||
}
|
}
|
||||||
|
|
||||||
testReInstall() {
|
testReInstall() {
|
||||||
output=$(luet install --config $tmpdir/luet.yaml test/c-1.0)
|
output=$(luet install -y --config $tmpdir/luet.yaml test/c-1.0)
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertContains 'contains warning' "$output" 'Filtering out'
|
assertContains 'contains warning' "$output" 'No packages to install'
|
||||||
}
|
}
|
||||||
|
|
||||||
testUnInstall() {
|
testUnInstall() {
|
||||||
luet uninstall --config $tmpdir/luet.yaml test/c-1.0
|
luet uninstall -y --config $tmpdir/luet.yaml test/c-1.0
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'uninstall test successfully' "$installst" "0"
|
assertEquals 'uninstall test successfully' "$installst" "0"
|
||||||
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
||||||
@@ -85,10 +85,10 @@ testUnInstall() {
|
|||||||
|
|
||||||
testInstallAgain() {
|
testInstallAgain() {
|
||||||
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
||||||
output=$(luet install --config $tmpdir/luet.yaml test/c-1.0)
|
output=$(luet install -y --config $tmpdir/luet.yaml test/c-1.0)
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertNotContains 'contains warning' "$output" 'Filtering out'
|
assertNotContains 'contains warning' "$output" 'No packages to install'
|
||||||
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
||||||
assertTrue 'package in cache' "[ -e '$tmpdir/testrootfs/packages/c-test-1.0.package.tar.gz' ]"
|
assertTrue 'package in cache' "[ -e '$tmpdir/testrootfs/packages/c-test-1.0.package.tar.gz' ]"
|
||||||
}
|
}
|
||||||
|
@@ -65,22 +65,22 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
luet install --config $tmpdir/luet.yaml test/c-1.0
|
luet install -y --config $tmpdir/luet.yaml test/c-1.0
|
||||||
#luet install --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
#luet install -y --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
||||||
}
|
}
|
||||||
|
|
||||||
testReInstall() {
|
testReInstall() {
|
||||||
output=$(luet install --config $tmpdir/luet.yaml test/c-1.0)
|
output=$(luet install -y --config $tmpdir/luet.yaml test/c-1.0)
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertContains 'contains warning' "$output" 'Filtering out'
|
assertContains 'contains warning' "$output" 'No packages to install'
|
||||||
}
|
}
|
||||||
|
|
||||||
testUnInstall() {
|
testUnInstall() {
|
||||||
luet uninstall --config $tmpdir/luet.yaml test/c-1.0
|
luet uninstall -y --config $tmpdir/luet.yaml test/c-1.0
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'uninstall test successfully' "$installst" "0"
|
assertEquals 'uninstall test successfully' "$installst" "0"
|
||||||
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
||||||
@@ -88,10 +88,10 @@ testUnInstall() {
|
|||||||
|
|
||||||
testInstallAgain() {
|
testInstallAgain() {
|
||||||
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
||||||
output=$(luet install --config $tmpdir/luet.yaml test/c-1.0)
|
output=$(luet install -y --config $tmpdir/luet.yaml test/c-1.0)
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertNotContains 'contains warning' "$output" 'Filtering out'
|
assertNotContains 'contains warning' "$output" 'No packages to install'
|
||||||
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
||||||
assertTrue 'package in cache' "[ -e '$tmpdir/testrootfs/packages/c-test-1.0.package.tar.gz' ]"
|
assertTrue 'package in cache' "[ -e '$tmpdir/testrootfs/packages/c-test-1.0.package.tar.gz' ]"
|
||||||
}
|
}
|
||||||
|
@@ -55,22 +55,22 @@ testRepo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
luet install --config $tmpdir/luet.yaml test/c-1.0
|
luet install -y --config $tmpdir/luet.yaml test/c-1.0
|
||||||
#luet install --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
#luet install -y --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
||||||
}
|
}
|
||||||
|
|
||||||
testReInstall() {
|
testReInstall() {
|
||||||
output=$(luet install --config $tmpdir/luet.yaml test/c-1.0)
|
output=$(luet install -y --config $tmpdir/luet.yaml test/c-1.0)
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertContains 'contains warning' "$output" 'Filtering out'
|
assertContains 'contains warning' "$output" 'No packages to install'
|
||||||
}
|
}
|
||||||
|
|
||||||
testUnInstall() {
|
testUnInstall() {
|
||||||
luet uninstall --config $tmpdir/luet.yaml test/c-1.0
|
luet uninstall -y --config $tmpdir/luet.yaml test/c-1.0
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'uninstall test successfully' "$installst" "0"
|
assertEquals 'uninstall test successfully' "$installst" "0"
|
||||||
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
||||||
@@ -78,10 +78,10 @@ testUnInstall() {
|
|||||||
|
|
||||||
testInstallAgain() {
|
testInstallAgain() {
|
||||||
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
||||||
output=$(luet install --config $tmpdir/luet.yaml test/c-1.0)
|
output=$(luet install -y --config $tmpdir/luet.yaml test/c-1.0)
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertNotContains 'contains warning' "$output" 'Filtering out'
|
assertNotContains 'contains warning' "$output" 'No packages to install'
|
||||||
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
||||||
assertTrue 'package in cache' "[ -e '$tmpdir/testrootfs/packages/c-test-1.0.package.tar.gz' ]"
|
assertTrue 'package in cache' "[ -e '$tmpdir/testrootfs/packages/c-test-1.0.package.tar.gz' ]"
|
||||||
}
|
}
|
||||||
|
@@ -57,15 +57,15 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
luet install --config $tmpdir/luet.yaml test/c
|
luet install -y --config $tmpdir/luet.yaml test/c
|
||||||
#luet install --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
#luet install -y --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package C installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package C installed' "[ -e '$tmpdir/testrootfs/c' ]"
|
||||||
}
|
}
|
||||||
|
|
||||||
testFullInstall() {
|
testFullInstall() {
|
||||||
output=$(luet install --config $tmpdir/luet.yaml test/d test/f test/e test/a)
|
output=$(luet install -y --config $tmpdir/luet.yaml test/d test/f test/e test/a)
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'cannot install' "$installst" "1"
|
assertEquals 'cannot install' "$installst" "1"
|
||||||
assertTrue 'package D installed' "[ ! -e '$tmpdir/testrootfs/d' ]"
|
assertTrue 'package D installed' "[ ! -e '$tmpdir/testrootfs/d' ]"
|
||||||
@@ -73,11 +73,11 @@ testFullInstall() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testInstallAgain() {
|
testInstallAgain() {
|
||||||
output=$(luet install --solver-type qlearning --config $tmpdir/luet.yaml test/d test/f test/e test/a)
|
output=$(luet install -y --solver-type qlearning --config $tmpdir/luet.yaml test/d test/f test/e test/a)
|
||||||
installst=$?
|
installst=$?
|
||||||
echo "$output"
|
echo "$output"
|
||||||
assertEquals 'install test successfully' "0" "$installst"
|
assertEquals 'install test successfully' "0" "$installst"
|
||||||
assertNotContains 'contains warning' "$output" 'Filtering out'
|
assertNotContains 'contains warning' "$output" 'No packages to install'
|
||||||
assertTrue 'package D installed' "[ -e '$tmpdir/testrootfs/d' ]"
|
assertTrue 'package D installed' "[ -e '$tmpdir/testrootfs/d' ]"
|
||||||
assertTrue 'package F installed' "[ -e '$tmpdir/testrootfs/f' ]"
|
assertTrue 'package F installed' "[ -e '$tmpdir/testrootfs/f' ]"
|
||||||
assertTrue 'package E not installed' "[ ! -e '$tmpdir/testrootfs/e' ]"
|
assertTrue 'package E not installed' "[ ! -e '$tmpdir/testrootfs/e' ]"
|
||||||
|
@@ -59,8 +59,8 @@ EOF
|
|||||||
|
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
luet install --config $tmpdir/luet.yaml test/b
|
luet install -y --config $tmpdir/luet.yaml test/b
|
||||||
#luet install --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
#luet install -y --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package B installed' "[ -e '$tmpdir/testrootfs/b' ]"
|
assertTrue 'package B installed' "[ -e '$tmpdir/testrootfs/b' ]"
|
||||||
@@ -71,7 +71,7 @@ testInstall() {
|
|||||||
|
|
||||||
|
|
||||||
testUnInstall() {
|
testUnInstall() {
|
||||||
luet uninstall --full --config $tmpdir/luet.yaml test/b
|
luet uninstall -y --full --config $tmpdir/luet.yaml test/b
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'uninstall test successfully' "$installst" "0"
|
assertEquals 'uninstall test successfully' "$installst" "0"
|
||||||
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/b' ]"
|
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/b' ]"
|
||||||
|
@@ -85,31 +85,31 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
luet install --config $tmpdir/luet.yaml test/b-1.0
|
luet install -y --config $tmpdir/luet.yaml test/b-1.0
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package installed B' "[ -e '$tmpdir/testrootfs/test5' ]"
|
assertTrue 'package installed B' "[ -e '$tmpdir/testrootfs/test5' ]"
|
||||||
|
|
||||||
luet install --config $tmpdir/luet.yaml test/a-1.0
|
luet install -y --config $tmpdir/luet.yaml test/a-1.0
|
||||||
assertTrue 'package installed A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
assertTrue 'package installed A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
|
|
||||||
luet install --config $tmpdir/luet.yaml test/a-1.1
|
luet install -y --config $tmpdir/luet.yaml test/a-1.1
|
||||||
assertTrue 'package installed A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
assertTrue 'package installed A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package keeps old A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
assertTrue 'package keeps old A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
||||||
assertTrue 'package new A was not installed' "[ ! -e '$tmpdir/testrootfs/testlatest' ]"
|
assertTrue 'package new A was not installed' "[ ! -e '$tmpdir/testrootfs/testlatest' ]"
|
||||||
|
|
||||||
luet install --config $tmpdir/luet.yaml test/c-1.0
|
luet install -y --config $tmpdir/luet.yaml test/c-1.0
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package installed C' "[ -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package installed C' "[ -e '$tmpdir/testrootfs/c' ]"
|
||||||
}
|
}
|
||||||
|
|
||||||
testUpgrade() {
|
testUpgrade() {
|
||||||
upgrade=$(luet --config $tmpdir/luet.yaml upgrade)
|
upgrade=$(luet --config $tmpdir/luet.yaml upgrade -y)
|
||||||
installst=$?
|
installst=$?
|
||||||
echo "$upgrade"
|
echo "$upgrade"
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
|
@@ -84,24 +84,24 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
luet install --config $tmpdir/luet.yaml test/b-1.0
|
luet install -y --config $tmpdir/luet.yaml test/b-1.0
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package installed B' "[ -e '$tmpdir/testrootfs/test5' ]"
|
assertTrue 'package installed B' "[ -e '$tmpdir/testrootfs/test5' ]"
|
||||||
|
|
||||||
luet install --config $tmpdir/luet.yaml test/a-1.0
|
luet install -y --config $tmpdir/luet.yaml test/a-1.0
|
||||||
assertTrue 'package installed A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
assertTrue 'package installed A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
|
|
||||||
luet install --config $tmpdir/luet.yaml test/a-1.1
|
luet install -y --config $tmpdir/luet.yaml test/a-1.1
|
||||||
assertTrue 'package installed A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
assertTrue 'package installed A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package keeps old A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
assertTrue 'package keeps old A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
||||||
assertTrue 'package new A was not installed' "[ ! -e '$tmpdir/testrootfs/testlatest' ]"
|
assertTrue 'package new A was not installed' "[ ! -e '$tmpdir/testrootfs/testlatest' ]"
|
||||||
|
|
||||||
luet install --config $tmpdir/luet.yaml test/c-1.0
|
luet install -y --config $tmpdir/luet.yaml test/c-1.0
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package installed C' "[ -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package installed C' "[ -e '$tmpdir/testrootfs/c' ]"
|
||||||
|
@@ -56,8 +56,8 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
luet install --config $tmpdir/luet.yaml seed/alpine
|
luet install -y --config $tmpdir/luet.yaml seed/alpine
|
||||||
#luet install --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
#luet install -y --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/bin/busybox' ]"
|
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/bin/busybox' ]"
|
||||||
|
@@ -56,8 +56,8 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
luet install --config $tmpdir/luet.yaml seed/alpine
|
luet install -y --config $tmpdir/luet.yaml seed/alpine
|
||||||
#luet install --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
#luet install -y --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/bin/busybox' ]"
|
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/bin/busybox' ]"
|
||||||
|
@@ -64,13 +64,13 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
luet install --config $tmpdir/luet.yaml media-libs/libsndfile
|
luet install -y --config $tmpdir/luet.yaml media-libs/libsndfile
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "0" "$installst"
|
assertEquals 'install test successfully' "0" "$installst"
|
||||||
}
|
}
|
||||||
|
|
||||||
testInstall2() {
|
testInstall2() {
|
||||||
luet install --config $tmpdir/luet.yaml '>=dev-libs/libsigc++-2-0'
|
luet install -y --config $tmpdir/luet.yaml '>=dev-libs/libsigc++-2-0'
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "0" "$installst"
|
assertEquals 'install test successfully' "0" "$installst"
|
||||||
}
|
}
|
||||||
|
@@ -63,7 +63,7 @@ testInstall() {
|
|||||||
docker run --name luet-runtime-test \
|
docker run --name luet-runtime-test \
|
||||||
-v /tmp:/tmp \
|
-v /tmp:/tmp \
|
||||||
-v $tmpdir/luet.yaml:/etc/luet/luet.yaml:ro \
|
-v $tmpdir/luet.yaml:/etc/luet/luet.yaml:ro \
|
||||||
luet:test install seed/alpine
|
luet:test install -y seed/alpine
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "0" "$installst"
|
assertEquals 'install test successfully' "0" "$installst"
|
||||||
|
|
||||||
|
@@ -85,31 +85,31 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
luet install --config $tmpdir/luet.yaml test/b-1.0
|
luet install -y --config $tmpdir/luet.yaml test/b-1.0
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package installed B' "[ -e '$tmpdir/testrootfs/test5' ]"
|
assertTrue 'package installed B' "[ -e '$tmpdir/testrootfs/test5' ]"
|
||||||
|
|
||||||
luet install --config $tmpdir/luet.yaml test/a-1.0
|
luet install -y --config $tmpdir/luet.yaml test/a-1.0
|
||||||
assertTrue 'package installed A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
assertTrue 'package installed A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
|
|
||||||
luet install --config $tmpdir/luet.yaml test/a-1.1
|
luet install -y --config $tmpdir/luet.yaml test/a-1.1
|
||||||
assertTrue 'package installed A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
assertTrue 'package installed A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package keeps old A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
assertTrue 'package keeps old A' "[ -e '$tmpdir/testrootfs/testaa' ]"
|
||||||
assertTrue 'package new A was not installed' "[ ! -e '$tmpdir/testrootfs/testlatest' ]"
|
assertTrue 'package new A was not installed' "[ ! -e '$tmpdir/testrootfs/testlatest' ]"
|
||||||
|
|
||||||
luet install --config $tmpdir/luet.yaml test/c-1.0
|
luet install -y --config $tmpdir/luet.yaml test/c-1.0
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package installed C' "[ -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package installed C' "[ -e '$tmpdir/testrootfs/c' ]"
|
||||||
}
|
}
|
||||||
|
|
||||||
testUpgrade() {
|
testUpgrade() {
|
||||||
upgrade=$(luet --config $tmpdir/luet.yaml upgrade --universe --clean)
|
upgrade=$(luet --config $tmpdir/luet.yaml upgrade -y --universe --clean)
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
echo "$upgrade"
|
echo "$upgrade"
|
||||||
|
@@ -74,7 +74,7 @@ testInstall() {
|
|||||||
mkdir $tmpdir/testrootfs/etc/a -p
|
mkdir $tmpdir/testrootfs/etc/a -p
|
||||||
echo "fakeconf" > $tmpdir/testrootfs/etc/a/conf
|
echo "fakeconf" > $tmpdir/testrootfs/etc/a/conf
|
||||||
|
|
||||||
luet install --config $tmpdir/luet.yaml test/a
|
luet install -y --config $tmpdir/luet.yaml test/a
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ testInstall() {
|
|||||||
|
|
||||||
|
|
||||||
testUnInstall() {
|
testUnInstall() {
|
||||||
luet uninstall --full --config $tmpdir/luet.yaml test/a
|
luet uninstall -y --full --config $tmpdir/luet.yaml test/a
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'uninstall test successfully' "$installst" "0"
|
assertEquals 'uninstall test successfully' "$installst" "0"
|
||||||
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
||||||
|
@@ -74,7 +74,7 @@ testInstall() {
|
|||||||
mkdir $tmpdir/testrootfs/opt/etc -p
|
mkdir $tmpdir/testrootfs/opt/etc -p
|
||||||
echo "fakeconf" > $tmpdir/testrootfs/opt/etc/conf
|
echo "fakeconf" > $tmpdir/testrootfs/opt/etc/conf
|
||||||
|
|
||||||
luet install --config $tmpdir/luet.yaml test/a
|
luet install -y --config $tmpdir/luet.yaml test/a
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ testInstall() {
|
|||||||
|
|
||||||
|
|
||||||
testUnInstall() {
|
testUnInstall() {
|
||||||
luet uninstall --full --config $tmpdir/luet.yaml test/a
|
luet uninstall -y --full --config $tmpdir/luet.yaml test/a
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'uninstall test successfully' "$installst" "0"
|
assertEquals 'uninstall test successfully' "$installst" "0"
|
||||||
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
||||||
|
@@ -75,7 +75,7 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
testUpgrade() {
|
testUpgrade() {
|
||||||
luet install --config $tmpdir/luet.yaml test/b-1.0
|
luet install -y --config $tmpdir/luet.yaml test/b-1.0
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package installed B' "[ -e '$tmpdir/testrootfs/test5' ]"
|
assertTrue 'package installed B' "[ -e '$tmpdir/testrootfs/test5' ]"
|
||||||
@@ -100,13 +100,13 @@ EOF
|
|||||||
res=$?
|
res=$?
|
||||||
assertEquals 'config test successfully' "$res" "0"
|
assertEquals 'config test successfully' "$res" "0"
|
||||||
|
|
||||||
luet upgrade --sync --config $tmpdir/luet.yaml
|
luet upgrade -y --sync --config $tmpdir/luet.yaml
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'upgrade test successfully' "$installst" "0"
|
assertEquals 'upgrade test successfully' "$installst" "0"
|
||||||
assertTrue 'package uninstalled B' "[ ! -e '$tmpdir/testrootfs/test5' ]"
|
assertTrue 'package uninstalled B' "[ ! -e '$tmpdir/testrootfs/test5' ]"
|
||||||
assertTrue 'package installed B' "[ -e '$tmpdir/testrootfs/newc' ]"
|
assertTrue 'package installed B' "[ -e '$tmpdir/testrootfs/newc' ]"
|
||||||
|
|
||||||
content=$(luet upgrade --sync --config $tmpdir/luet.yaml)
|
content=$(luet upgrade -y --sync --config $tmpdir/luet.yaml)
|
||||||
installst=$?
|
installst=$?
|
||||||
assertNotContains 'didn not upgrade' "$content" "Uninstalling"
|
assertNotContains 'didn not upgrade' "$content" "Uninstalling"
|
||||||
}
|
}
|
||||||
|
@@ -56,7 +56,7 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
luet install --config $tmpdir/luet.yaml test/pkgAsym test/pkgBsym
|
luet install -y --config $tmpdir/luet.yaml test/pkgAsym test/pkgBsym
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
ls -liah $tmpdir/testrootfs/
|
ls -liah $tmpdir/testrootfs/
|
||||||
|
@@ -56,7 +56,7 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
$ROOT_DIR/tests/integration/bin/luet install --config $tmpdir/luet.yaml test/caps-0.1 test/caps2-0.1
|
$ROOT_DIR/tests/integration/bin/luet install -y --config $tmpdir/luet.yaml test/caps-0.1 test/caps2-0.1
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
|
|
||||||
|
@@ -75,7 +75,7 @@ testInstall() {
|
|||||||
mkdir $tmpdir/testrootfs/etc/a -p
|
mkdir $tmpdir/testrootfs/etc/a -p
|
||||||
echo "fakeconf" > $tmpdir/testrootfs/etc/a/conf
|
echo "fakeconf" > $tmpdir/testrootfs/etc/a/conf
|
||||||
|
|
||||||
luet install --config $tmpdir/luet.yaml test/a
|
luet install -y --config $tmpdir/luet.yaml test/a
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ testInstall() {
|
|||||||
|
|
||||||
|
|
||||||
testUnInstall() {
|
testUnInstall() {
|
||||||
luet uninstall --full --config $tmpdir/luet.yaml test/a
|
luet uninstall -y --full --config $tmpdir/luet.yaml test/a
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'uninstall test successfully' "$installst" "0"
|
assertEquals 'uninstall test successfully' "$installst" "0"
|
||||||
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
||||||
|
@@ -58,7 +58,7 @@ EOF
|
|||||||
|
|
||||||
testDatabase() {
|
testDatabase() {
|
||||||
luet database create --config $tmpdir/luet.yaml $tmpdir/testbuild/c-test-1.0.metadata.yaml
|
luet database create --config $tmpdir/luet.yaml $tmpdir/testbuild/c-test-1.0.metadata.yaml
|
||||||
#luet install --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
#luet install -y --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
||||||
createst=$?
|
createst=$?
|
||||||
assertEquals 'created package successfully' "$createst" "0"
|
assertEquals 'created package successfully' "$createst" "0"
|
||||||
assertTrue 'package not installed' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package not installed' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
||||||
@@ -75,12 +75,12 @@ testDatabase() {
|
|||||||
assertTrue 'file not touched' "[ -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'file not touched' "[ -e '$tmpdir/testrootfs/c' ]"
|
||||||
|
|
||||||
luet database create --config $tmpdir/luet.yaml $tmpdir/testbuild/c-test-1.0.metadata.yaml
|
luet database create --config $tmpdir/luet.yaml $tmpdir/testbuild/c-test-1.0.metadata.yaml
|
||||||
#luet install --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
#luet install -y --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
||||||
createst=$?
|
createst=$?
|
||||||
assertEquals 'created package successfully' "$createst" "0"
|
assertEquals 'created package successfully' "$createst" "0"
|
||||||
assertTrue 'file still present' "[ -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'file still present' "[ -e '$tmpdir/testrootfs/c' ]"
|
||||||
|
|
||||||
luet uninstall --config $tmpdir/luet.yaml test/c
|
luet uninstall -y --config $tmpdir/luet.yaml test/c
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'uninstall test successfully' "$installst" "0"
|
assertEquals 'uninstall test successfully' "$installst" "0"
|
||||||
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
||||||
|
@@ -56,8 +56,8 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
luet install --config $tmpdir/luet.yaml seed/alpine
|
luet install -y --config $tmpdir/luet.yaml seed/alpine
|
||||||
#luet install --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
#luet install -y --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/bin/busybox' ]"
|
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/bin/busybox' ]"
|
||||||
|
@@ -61,8 +61,8 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
luet --plugin test-foo install --config $tmpdir/luet.yaml seed/alpine
|
luet --plugin test-foo install -y --config $tmpdir/luet.yaml seed/alpine
|
||||||
#luet install --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
#luet install -y --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/bin/busybox' ]"
|
assertTrue 'package installed' "[ -e '$tmpdir/testrootfs/bin/busybox' ]"
|
||||||
|
@@ -59,7 +59,7 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
luet install --config $tmpdir/luet.yaml distro/a
|
luet install -y --config $tmpdir/luet.yaml distro/a
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
|
|
||||||
@@ -75,12 +75,12 @@ testInstall() {
|
|||||||
|
|
||||||
assertContains 'contains distro/a-0.1' "$installed" 'distro/a-0.1'
|
assertContains 'contains distro/a-0.1' "$installed" 'distro/a-0.1'
|
||||||
|
|
||||||
luet uninstall --config $tmpdir/luet.yaml distro/a
|
luet uninstall -y --config $tmpdir/luet.yaml distro/a
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
|
|
||||||
# We do the same check for the others
|
# We do the same check for the others
|
||||||
luet install --config $tmpdir/luet.yaml distro/b
|
luet install -y --config $tmpdir/luet.yaml distro/b
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
|
|
||||||
@@ -94,11 +94,11 @@ testInstall() {
|
|||||||
|
|
||||||
assertContains 'contains distro/b-0.3' "$installed" 'distro/b-0.3'
|
assertContains 'contains distro/b-0.3' "$installed" 'distro/b-0.3'
|
||||||
|
|
||||||
luet uninstall --config $tmpdir/luet.yaml distro/b
|
luet uninstall -y --config $tmpdir/luet.yaml distro/b
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
|
|
||||||
luet install --config $tmpdir/luet.yaml distro/c
|
luet install -y --config $tmpdir/luet.yaml distro/c
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ testInstall() {
|
|||||||
|
|
||||||
assertContains 'contains distro/c-0.3' "$installed" 'distro/c-0.3'
|
assertContains 'contains distro/c-0.3' "$installed" 'distro/c-0.3'
|
||||||
|
|
||||||
luet uninstall --config $tmpdir/luet.yaml distro/c
|
luet uninstall -y --config $tmpdir/luet.yaml distro/c
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user