Skip to content

Commit 8445042

Browse files
committed
default manifest filename for FindPaths
1 parent b39cfe7 commit 8445042

3 files changed

Lines changed: 7 additions & 11 deletions

File tree

‎internal/manifest/manifest.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
)
1616

1717
const Schema = "1.0"
18+
const DefaultFilename = "manifest.wall"
1819

1920
type Package struct {
2021
Kind string `json:"kind"`
@@ -165,13 +166,13 @@ func Validate(manifest *Manifest) (err error) {
165166

166167
// FindPaths finds the paths marked with "generate:manifest" and
167168
// returns a map from the manifest path to all the slices that declare it.
168-
func FindPaths(slices []*setup.Slice, manifestFileName string) map[string][]*setup.Slice {
169+
func FindPaths(slices []*setup.Slice) map[string][]*setup.Slice {
169170
manifestSlices := make(map[string][]*setup.Slice)
170171
for _, slice := range slices {
171172
for path, info := range slice.Contents {
172173
if info.Generate == setup.GenerateManifest {
173174
dir := strings.TrimSuffix(path, "**")
174-
path = filepath.Join(dir, manifestFileName)
175+
path = filepath.Join(dir, DefaultFilename)
175176
manifestSlices[path] = append(manifestSlices[path], slice)
176177
}
177178
}

‎internal/manifest/manifest_test.go‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ func (s *S) TestManifestReadValidate(c *C) {
176176
var findPathsTests = []struct {
177177
summary string
178178
slices []*setup.Slice
179-
filename string
180179
expected map[string][]string
181180
}{{
182181
summary: "Single slice",
@@ -189,7 +188,6 @@ var findPathsTests = []struct {
189188
},
190189
},
191190
}},
192-
filename: "manifest.wall",
193191
expected: map[string][]string{
194192
"/folder/manifest.wall": []string{"slice1"},
195193
},
@@ -199,7 +197,6 @@ var findPathsTests = []struct {
199197
Name: "slice1",
200198
Contents: map[string]setup.PathInfo{},
201199
}},
202-
filename: "manifest.wall",
203200
expected: map[string][]string{},
204201
}, {
205202
summary: "Several matches with several groups",
@@ -239,18 +236,17 @@ var findPathsTests = []struct {
239236
},
240237
},
241238
}},
242-
filename: "mfest.wall",
243239
expected: map[string][]string{
244-
"/folder/mfest.wall": {"slice1", "slice2"},
245-
"/other-folder/mfest.wall": {"slice4", "slice5"},
240+
"/folder/manifest.wall": {"slice1", "slice2"},
241+
"/other-folder/manifest.wall": {"slice4", "slice5"},
246242
},
247243
}}
248244

249245
func (s *S) TestFindPaths(c *C) {
250246
for _, test := range findPathsTests {
251247
c.Logf("Summary: %s", test.summary)
252248

253-
manifestSlices := manifest.FindPaths(test.slices, test.filename)
249+
manifestSlices := manifest.FindPaths(test.slices)
254250

255251
slicesByName := map[string]*setup.Slice{}
256252
for _, slice := range test.slices {

‎internal/slicer/slicer.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"github.com/canonical/chisel/internal/setup"
2424
)
2525

26-
const manifestFilename = "manifest.wall"
2726
const manifestMode fs.FileMode = 0644
2827

2928
type RunOptions struct {
@@ -335,7 +334,7 @@ func Run(options *RunOptions) error {
335334

336335
func generateManifests(targetDir string, selection *setup.Selection,
337336
report *manifest.Report, pkgInfos []*archive.PackageInfo) error {
338-
manifestSlices := manifest.FindPaths(selection.Slices, manifestFilename)
337+
manifestSlices := manifest.FindPaths(selection.Slices)
339338
if len(manifestSlices) == 0 {
340339
// Nothing to do.
341340
return nil

0 commit comments

Comments
 (0)