@@ -33,8 +33,9 @@ import (
33
33
//
34
34
//easyjson:json
35
35
type Index struct {
36
- Packages []* indexPackage `json:"packages"`
37
- IsTrusted bool
36
+ Packages []* indexPackage `json:"packages"`
37
+ IsTrusted bool
38
+ isInstalledJSON bool
38
39
}
39
40
40
41
// indexPackage represents a single entry from package_index.json file.
@@ -144,7 +145,7 @@ var tr = i18n.Tr
144
145
// with the existing contents of the cores.Packages passed as parameter.
145
146
func (index Index ) MergeIntoPackages (outPackages cores.Packages ) {
146
147
for _ , inPackage := range index .Packages {
147
- inPackage .extractPackageIn (outPackages , index .IsTrusted )
148
+ inPackage .extractPackageIn (outPackages , index .IsTrusted , index . isInstalledJSON )
148
149
}
149
150
}
150
151
@@ -243,7 +244,7 @@ func IndexFromPlatformRelease(pr *cores.PlatformRelease) Index {
243
244
}
244
245
}
245
246
246
- func (inPackage indexPackage ) extractPackageIn (outPackages cores.Packages , trusted bool ) {
247
+ func (inPackage indexPackage ) extractPackageIn (outPackages cores.Packages , trusted bool , isInstallJSON bool ) {
247
248
outPackage := outPackages .GetOrCreatePackage (inPackage .Name )
248
249
outPackage .Maintainer = inPackage .Maintainer
249
250
outPackage .WebsiteURL = inPackage .WebsiteURL
@@ -256,15 +257,19 @@ func (inPackage indexPackage) extractPackageIn(outPackages cores.Packages, trust
256
257
}
257
258
258
259
for _ , inPlatform := range inPackage .Platforms {
259
- inPlatform .extractPlatformIn (outPackage , trusted )
260
+ inPlatform .extractPlatformIn (outPackage , trusted , isInstallJSON )
260
261
}
261
262
}
262
263
263
- func (inPlatformRelease indexPlatformRelease ) extractPlatformIn (outPackage * cores.Package , trusted bool ) error {
264
+ func (inPlatformRelease indexPlatformRelease ) extractPlatformIn (outPackage * cores.Package , trusted bool , isInstallJSON bool ) error {
264
265
outPlatform := outPackage .GetOrCreatePlatform (inPlatformRelease .Architecture )
265
266
// FIXME: shall we use the Name and Category of the latest release? or maybe move Name and Category in PlatformRelease?
266
267
outPlatform .Name = inPlatformRelease .Name
267
268
outPlatform .Category = inPlatformRelease .Category
269
+ // If the variable `isInstallJSON` is false it means that the index we're reading is coming from the additional-urls.
270
+ // Therefore, the `outPlatform.Indexed` will be set at `true`.
271
+ outPlatform .Indexed = outPlatform .Indexed || ! isInstallJSON
272
+
268
273
// If the Platform is installed before deprecation installed.json file does not include "deprecated" field.
269
274
// The installed.json is read during loading phase of an installed Platform, if the deprecated field is not found
270
275
// the package_index.json field would be overwritten and the deprecation info would be lost.
@@ -398,6 +403,11 @@ func LoadIndex(jsonIndexFile *paths.Path) (*Index, error) {
398
403
} else {
399
404
logrus .WithField ("index" , jsonIndexFile ).Infof ("Missing signature file" )
400
405
}
406
+
407
+ if jsonIndexFile .Base () == "installed.json" {
408
+ index .isInstalledJSON = true
409
+ }
410
+
401
411
return & index , nil
402
412
}
403
413
0 commit comments