@@ -30,6 +30,8 @@ type Manifest2822Entry struct {
30
30
Tags []string `delim:"," strip:"\n\r\t "`
31
31
SharedTags []string `delim:"," strip:"\n\r\t "`
32
32
33
+ Architectures []string `delim:"," strip:"\n\r\t "`
34
+
33
35
GitRepo string
34
36
GitFetch string
35
37
GitCommit string
@@ -70,9 +72,28 @@ func (entry Manifest2822Entry) ConstraintsString() string {
70
72
return strings .Join (entry .Constraints , StringSeparator2822 )
71
73
}
72
74
75
+ func (entry Manifest2822Entry ) ArchitecturesString () string {
76
+ return strings .Join (entry .Architectures , StringSeparator2822 )
77
+ }
78
+
73
79
// if this method returns "true", then a.Tags and b.Tags can safely be combined (for the purposes of building)
74
80
func (a Manifest2822Entry ) SameBuildArtifacts (b Manifest2822Entry ) bool {
75
- return a .GitRepo == b .GitRepo && a .GitFetch == b .GitFetch && a .GitCommit == b .GitCommit && a .Directory == b .Directory && a .ConstraintsString () == b .ConstraintsString ()
81
+ for key ,val := range a .Paragraph .Values {
82
+ if isArchField (key ) && val != b .Paragraph .Values [key ] {
83
+ return false
84
+ }
85
+ }
86
+ for key ,val := range b .Paragraph .Values {
87
+ if isArchField (key ) && val != a .Paragraph .Values [key ] {
88
+ return false
89
+ }
90
+ }
91
+
92
+ return a .GitRepo == b .GitRepo && a .GitFetch == b .GitFetch && a .GitCommit == b .GitCommit && a .Directory == b .Directory && a .ConstraintsString () == b .ConstraintsString () && a .ArchitecturesString () == b .ArchitecturesString ()
93
+ }
94
+
95
+ func isArchField (field string ) bool {
96
+ return strings .HasSuffix (field , "-GitRepo" ) || strings .HasSuffix (field , "-GitFetch" ) || strings .HasSuffix (field , "-GitCommit" ) || strings .HasSuffix (field , "-Directory" )
76
97
}
77
98
78
99
// returns a new Entry with any of the values that are equal to the values in "defaults" cleared
@@ -101,6 +122,14 @@ func (entry Manifest2822Entry) ClearDefaults(defaults Manifest2822Entry) Manifes
101
122
if entry .ConstraintsString () == defaults .ConstraintsString () {
102
123
entry .Constraints = nil
103
124
}
125
+ if entry .ArchitecturesString () == defaults .ArchitecturesString () {
126
+ entry .Architectures = nil
127
+ }
128
+ for key ,val := range defaults .Paragraph .Values {
129
+ if isArchField (key ) && val == entry .Paragraph .Values [key ] {
130
+ delete (entry .Paragraph .Values , key )
131
+ }
132
+ }
104
133
return entry
105
134
}
106
135
@@ -130,6 +159,14 @@ func (entry Manifest2822Entry) String() string {
130
159
if str := entry .ConstraintsString (); str != "" {
131
160
ret = append (ret , "Constraints: " + str )
132
161
}
162
+ if str := entry .ArchitecturesString (); str != "" {
163
+ ret = append (ret , "Architectures: " + str )
164
+ }
165
+ for key ,val := range entry .Paragraph .Values {
166
+ if isArchField (key ) {
167
+ ret = append (ret , key + ": " + val )
168
+ }
169
+ }
133
170
return strings .Join (ret , "\n " )
134
171
}
135
172
@@ -148,6 +185,34 @@ func (manifest Manifest2822) String() string {
148
185
return strings .Join (ret , "\n \n " )
149
186
}
150
187
188
+ func (entry Manifest2822Entry ) ArchGitRepo (arch string ) string {
189
+ if val ,ok := entry .Paragraph .Values [arch + "-GitRepo" ]; ok {
190
+ return val
191
+ }
192
+ return entry .GitRepo
193
+ }
194
+
195
+ func (entry Manifest2822Entry ) ArchGitFetch (arch string ) string {
196
+ if val ,ok := entry .Paragraph .Values [arch + "-GitFetch" ]; ok {
197
+ return val
198
+ }
199
+ return entry .GitFetch
200
+ }
201
+
202
+ func (entry Manifest2822Entry ) ArchGitCommit (arch string ) string {
203
+ if val ,ok := entry .Paragraph .Values [arch + "-GitCommit" ]; ok {
204
+ return val
205
+ }
206
+ return entry .GitCommit
207
+ }
208
+
209
+ func (entry Manifest2822Entry ) ArchDirectory (arch string ) string {
210
+ if val ,ok := entry .Paragraph .Values [arch + "-Directory" ]; ok {
211
+ return val
212
+ }
213
+ return entry .Directory
214
+ }
215
+
151
216
func (entry Manifest2822Entry ) HasTag (tag string ) bool {
152
217
for _ , existingTag := range entry .Tags {
153
218
if tag == existingTag {
0 commit comments