|
|
|
@ -21,6 +21,7 @@ import (
|
|
|
|
|
"os"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
|
|
|
|
|
"github.com/Masterminds/semver"
|
|
|
|
|
"github.com/gosuri/uitable"
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
|
|
|
|
@ -140,8 +141,14 @@ func (l *dependencyListCmd) run() error {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (l *dependencyListCmd) dependencyStatus(dep *chartutil.Dependency) string {
|
|
|
|
|
filename := fmt.Sprintf("%s-%s.tgz", dep.Name, dep.Version)
|
|
|
|
|
archive := filepath.Join(l.chartpath, "charts", filename)
|
|
|
|
|
filename := fmt.Sprintf("%s-%s.tgz", dep.Name, "*")
|
|
|
|
|
archives, err := filepath.Glob(filepath.Join(l.chartpath, "charts", filename))
|
|
|
|
|
if err != nil {
|
|
|
|
|
return "bad pattern"
|
|
|
|
|
} else if len(archives) > 1 {
|
|
|
|
|
return "too many matches"
|
|
|
|
|
} else if len(archives) == 1 {
|
|
|
|
|
archive := archives[0]
|
|
|
|
|
if _, err := os.Stat(archive); err == nil {
|
|
|
|
|
c, err := chartutil.Load(archive)
|
|
|
|
|
if err != nil {
|
|
|
|
@ -152,10 +159,24 @@ func (l *dependencyListCmd) dependencyStatus(dep *chartutil.Dependency) string {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if c.Metadata.Version != dep.Version {
|
|
|
|
|
constraint, err := semver.NewConstraint(dep.Version)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return "invalid version"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
v, err := semver.NewVersion(c.Metadata.Version)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return "invalid version"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if constraint.Check(v) {
|
|
|
|
|
return "ok"
|
|
|
|
|
}
|
|
|
|
|
return "wrong version"
|
|
|
|
|
}
|
|
|
|
|
return "ok"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
folder := filepath.Join(l.chartpath, "charts", dep.Name)
|
|
|
|
|
if fi, err := os.Stat(folder); err != nil {
|
|
|
|
@ -174,6 +195,19 @@ func (l *dependencyListCmd) dependencyStatus(dep *chartutil.Dependency) string {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if c.Metadata.Version != dep.Version {
|
|
|
|
|
constraint, err := semver.NewConstraint(dep.Version)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return "invalid version"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
v, err := semver.NewVersion(c.Metadata.Version)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return "invalid version"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if constraint.Check(v) {
|
|
|
|
|
return "unpacked"
|
|
|
|
|
}
|
|
|
|
|
return "wrong version"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|