@@ -16,6 +16,7 @@ type ImageSource struct {
16
16
Ref string
17
17
Platform * ocispecs.Platform
18
18
Digest digest.Digest
19
+ Local bool
19
20
}
20
21
21
22
type GitSource struct {
@@ -43,11 +44,10 @@ type SSH struct {
43
44
}
44
45
45
46
type Sources struct {
46
- Images []ImageSource
47
- LocalImages []ImageSource
48
- Git []GitSource
49
- HTTP []HTTPSource
50
- Local []LocalSource
47
+ Images []ImageSource
48
+ Git []GitSource
49
+ HTTP []HTTPSource
50
+ Local []LocalSource
51
51
}
52
52
53
53
type Capture struct {
@@ -67,9 +67,6 @@ func (c *Capture) Merge(c2 *Capture) error {
67
67
for _ , i := range c2 .Sources .Images {
68
68
c .AddImage (i )
69
69
}
70
- for _ , i := range c2 .Sources .LocalImages {
71
- c .AddLocalImage (i )
72
- }
73
70
for _ , l := range c2 .Sources .Local {
74
71
c .AddLocal (l )
75
72
}
@@ -98,9 +95,6 @@ func (c *Capture) Sort() {
98
95
sort .Slice (c .Sources .Images , func (i , j int ) bool {
99
96
return c .Sources .Images [i ].Ref < c .Sources .Images [j ].Ref
100
97
})
101
- sort .Slice (c .Sources .LocalImages , func (i , j int ) bool {
102
- return c .Sources .LocalImages [i ].Ref < c .Sources .LocalImages [j ].Ref
103
- })
104
98
sort .Slice (c .Sources .Local , func (i , j int ) bool {
105
99
return c .Sources .Local [i ].Name < c .Sources .Local [j ].Name
106
100
})
@@ -151,7 +145,7 @@ func (c *Capture) OptimizeImageSources() error {
151
145
152
146
func (c * Capture ) AddImage (i ImageSource ) {
153
147
for _ , v := range c .Sources .Images {
154
- if v .Ref == i .Ref {
148
+ if v .Ref == i .Ref && v . Local == i . Local {
155
149
if v .Platform == i .Platform {
156
150
return
157
151
}
@@ -165,22 +159,6 @@ func (c *Capture) AddImage(i ImageSource) {
165
159
c .Sources .Images = append (c .Sources .Images , i )
166
160
}
167
161
168
- func (c * Capture ) AddLocalImage (i ImageSource ) {
169
- for _ , v := range c .Sources .LocalImages {
170
- if v .Ref == i .Ref {
171
- if v .Platform == i .Platform {
172
- return
173
- }
174
- if v .Platform != nil && i .Platform != nil {
175
- if v .Platform .Architecture == i .Platform .Architecture && v .Platform .OS == i .Platform .OS && v .Platform .Variant == i .Platform .Variant {
176
- return
177
- }
178
- }
179
- }
180
- }
181
- c .Sources .LocalImages = append (c .Sources .LocalImages , i )
182
- }
183
-
184
162
func (c * Capture ) AddLocal (l LocalSource ) {
185
163
for _ , v := range c .Sources .Local {
186
164
if v .Name == l .Name {
0 commit comments