Don't pull repos if they've already been pulled in the same command
This commit is contained in:
parent
be48f26e75
commit
8e74e58cad
2
build.go
2
build.go
|
@ -192,7 +192,7 @@ func buildPackage(ctx context.Context, script string, mgr manager.Manager) ([]st
|
|||
|
||||
if len(vars.BuildDepends) > 0 {
|
||||
log.Info("Installing build dependencies").Send()
|
||||
installPkgs(ctx, vars.BuildDepends, mgr)
|
||||
installPkgs(ctx, vars.BuildDepends, mgr, false)
|
||||
}
|
||||
|
||||
var builtDeps, builtNames, repoDeps []string
|
||||
|
|
14
install.go
14
install.go
|
@ -36,21 +36,23 @@ func installCmd(c *cli.Context) error {
|
|||
log.Fatal("Unable to detect supported package manager on system").Send()
|
||||
}
|
||||
|
||||
installPkgs(c.Context, args.Slice(), mgr)
|
||||
installPkgs(c.Context, args.Slice(), mgr, true)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func installPkgs(ctx context.Context, pkgs []string, mgr manager.Manager) {
|
||||
err := pullRepos(ctx)
|
||||
if err != nil {
|
||||
log.Fatal("Error pulling repositories").Err(err).Send()
|
||||
func installPkgs(ctx context.Context, pkgs []string, mgr manager.Manager, pull bool) {
|
||||
if pull {
|
||||
err := pullRepos(ctx)
|
||||
if err != nil {
|
||||
log.Fatal("Error pulling repositories").Err(err).Send()
|
||||
}
|
||||
}
|
||||
|
||||
scripts, notFound := findPkgs(pkgs)
|
||||
|
||||
if len(notFound) > 0 {
|
||||
err = mgr.Install(nil, notFound...)
|
||||
err := mgr.Install(nil, notFound...)
|
||||
if err != nil {
|
||||
log.Fatal("Error installing native packages").Err(err).Send()
|
||||
}
|
||||
|
|
|
@ -38,13 +38,18 @@ func upgradeCmd(c *cli.Context) error {
|
|||
log.Fatal("Unable to detect supported package manager on system").Send()
|
||||
}
|
||||
|
||||
err = pullRepos(c.Context)
|
||||
if err != nil {
|
||||
log.Fatal("Error pulling repos").Err(err).Send()
|
||||
}
|
||||
|
||||
updates, err := checkForUpdates(c.Context, mgr, info)
|
||||
if err != nil {
|
||||
log.Fatal("Error checking for updates").Err(err).Send()
|
||||
}
|
||||
|
||||
if len(updates) > 0 {
|
||||
installPkgs(c.Context, updates, mgr)
|
||||
installPkgs(c.Context, updates, mgr, false)
|
||||
} else {
|
||||
log.Info("There is nothing to do.").Send()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue