Skip to content

Commit c2cc20a

Browse files
author
Christian Weichel
committed
[bugfix] Include full BUILD file in version, not arg resolved config
1 parent ecab062 commit c2cc20a

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

cmd/describe.go

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,26 @@ func describePackage(pkg *leeway.Package) {
155155
fmt.Fprintf(w, "\t%s\n", argdep)
156156
}
157157
}
158-
fmt.Fprintf(w, "Dependencies:\n")
159-
for _, dep := range deps {
160-
fmt.Fprint(w, dep)
158+
if len(pkg.Environment) > 0 {
159+
fmt.Fprintf(w, "Build Environment Variables:\n")
160+
for _, env := range pkg.Environment {
161+
fmt.Fprintf(w, "\t%s\n", env)
162+
}
163+
}
164+
if len(pkg.Dependencies) > 0 {
165+
fmt.Fprintf(w, "Dependencies:\n")
166+
for _, dep := range deps {
167+
fmt.Fprint(w, dep)
168+
}
161169
}
162-
fmt.Fprintf(w, "Sources:\n")
163-
for _, src := range manifest {
164-
segs := strings.Split(src, ":")
165-
name := strings.TrimPrefix(segs[0], pkg.C.Origin+"/")
166-
version := segs[1]
167-
fmt.Fprintf(w, "\t%s\t%s\n", name, version)
170+
if len(pkg.Sources) > 0 {
171+
fmt.Fprintf(w, "Sources:\n")
172+
for _, src := range manifest {
173+
segs := strings.Split(src, ":")
174+
name := strings.TrimPrefix(segs[0], pkg.C.Origin+"/")
175+
version := segs[1]
176+
fmt.Fprintf(w, "\t%s\t%s\n", name, version)
177+
}
168178
}
169179
}
170180

pkg/leeway/package.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ func loadComponent(workspace *Workspace, path string, args Arguments) (Component
213213

214214
// add component BUILD file and additional sources to package sources
215215
completeSources := make(map[string]struct{})
216+
completeSources[path] = struct{}{}
216217
for _, src := range pkg.Sources {
217218
completeSources[src] = struct{}{}
218219
}
@@ -314,8 +315,7 @@ type Package struct {
314315
versionCache string
315316

316317
packageInternal
317-
Config PackageConfig `yaml:"config"`
318-
rawYAML []byte
318+
Config PackageConfig `yaml:"config"`
319319

320320
dependencies []*Package
321321
}
@@ -381,10 +381,6 @@ func (p *Package) UnmarshalYAML(unmarshal func(interface{}) error) error {
381381
if err != nil {
382382
return err
383383
}
384-
p.rawYAML, err = yaml.Marshal(buf)
385-
if err != nil {
386-
return err
387-
}
388384

389385
cfg, err := unmarshalTypeDependentConfig(tpe.Type, unmarshal)
390386
if err != nil {
@@ -715,10 +711,6 @@ func (p *Package) Version() (string, error) {
715711
}
716712

717713
h := sha1.New()
718-
_, err = h.Write(p.rawYAML)
719-
if err != nil {
720-
return "", err
721-
}
722714
_, err = io.WriteString(h, strings.Join(manifest, "\n"))
723715
if err != nil {
724716
return "", err

0 commit comments

Comments
 (0)