Skip to content

Commit 2417f8e

Browse files
committed
Merge branch 'main' into zap
2 parents 29d3bd2 + 053b25b commit 2417f8e

5 files changed

Lines changed: 33 additions & 12 deletions

File tree

errata/load.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import (
1616
//go:embed default.yaml
1717
var defaultErrata []byte
1818

19-
func LoadErrata(config *config.Config) (*Collection, error) {
20-
b := loadErrataFile(config.Root())
19+
func LoadErrata(config *config.Config, errataPath string) (*Collection, error) {
20+
b := loadErrataFile(config.Root(), errataPath)
2121
if b == nil {
2222
b = defaultErrata
2323
}
@@ -82,11 +82,16 @@ type overlayErrata struct {
8282
ZAP *SDK `yaml:"zap,omitempty"`
8383
}
8484

85-
func loadErrataFile(specRoot string) []byte {
86-
if specRoot == "" {
87-
return nil
85+
func loadErrataFile(specRoot string, overridePath string) []byte {
86+
var errataPath string
87+
if overridePath != "" {
88+
errataPath = overridePath
89+
} else {
90+
if specRoot == "" {
91+
return nil
92+
}
93+
errataPath = filepath.Join(specRoot, ".github/alchemy/errata.yaml")
8894
}
89-
errataPath := filepath.Join(specRoot, ".github/alchemy/errata.yaml")
9095
exists, err := files.Exists(errataPath)
9196
if err != nil {
9297
slog.Warn("error checking for errata path", slog.Any("error", err))

matter/constraint/hex.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func (c *HexLimit) ASCIIDocString(dataType *types.DataType) string {
2222
case 4:
2323
return fmt.Sprintf("0x%08X", uint32(val))
2424
case 8:
25-
return fmt.Sprintf("0x%16X", uint64(val))
25+
return fmt.Sprintf("0x%016X", uint64(val))
2626
}
2727
}
2828
return fmt.Sprintf("0x%X", uint64(val))

matter/spec/option.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ func (bo BuilderOptions) List() (options []BuilderOption) {
3131
}
3232

3333
type ParserOptions struct {
34-
Root string `name:"spec-root" default:"connectedhomeip-spec" aliases:"specRoot" help:"the src root of your clone of CHIP-Specifications/connectedhomeip-spec" group:"Spec:"`
34+
Root string `name:"spec-root" default:"connectedhomeip-spec" aliases:"specRoot" help:"the src root of your clone of CHIP-Specifications/connectedhomeip-spec" group:"Spec:"`
35+
ErrataPath string `name:"errata-path" help:"the path to the errata file" group:"Spec:"`
3536
}
3637

3738
func (po *ParserOptions) AfterApply() error {
@@ -49,6 +50,21 @@ func (po *ParserOptions) AfterApply() error {
4950
if !exists {
5051
return fmt.Errorf("spec root \"%s\" does not exist", po.Root)
5152
}
53+
if po.ErrataPath != "" {
54+
if !filepath.IsAbs(po.ErrataPath) {
55+
po.ErrataPath, err = filepath.Abs(po.ErrataPath)
56+
if err != nil {
57+
return err
58+
}
59+
}
60+
exists, err = files.Exists(po.ErrataPath)
61+
if err != nil {
62+
return err
63+
}
64+
if !exists {
65+
return fmt.Errorf("errata path \"%s\" does not exist", po.ErrataPath)
66+
}
67+
}
5268
return nil
5369
}
5470

matter/spec/pipeline.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func Build(cxt context.Context, parserOptions ParserOptions, processingOptions p
2929
}
3030

3131
var ec *errata.Collection
32-
ec, err = errata.LoadErrata(cfg)
32+
ec, err = errata.LoadErrata(cfg, parserOptions.ErrataPath)
3333
if err != nil {
3434
return
3535
}

matter/types/extreme.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (ce *DataTypeExtreme) ZapString(dataType *DataType) string {
124124
case 4:
125125
return fmt.Sprintf("0x%08X", uint32(val))
126126
case 8:
127-
return fmt.Sprintf("0x%16X", uint64(val))
127+
return fmt.Sprintf("0x%016X", uint64(val))
128128

129129
}
130130
}
@@ -163,7 +163,7 @@ func (ce *DataTypeExtreme) DataModelString(dataType *DataType) string {
163163
case 4:
164164
return fmt.Sprintf("0x%08X", uint32(val))
165165
case 8:
166-
return fmt.Sprintf("0x%16X", uint64(val))
166+
return fmt.Sprintf("0x%016X", uint64(val))
167167

168168
}
169169
}
@@ -212,7 +212,7 @@ func (ce *DataTypeExtreme) formatUint64(dataType *DataType, val uint64) string {
212212
case 4:
213213
return fmt.Sprintf("0x%08X", uint32(val))
214214
case 8:
215-
return fmt.Sprintf("0x%16X", uint64(val))
215+
return fmt.Sprintf("0x%016X", uint64(val))
216216

217217
}
218218
}

0 commit comments

Comments
 (0)