@@ -33,8 +33,9 @@ import (
3333//
3434//easyjson:json
3535type Index struct {
36- Packages []* indexPackage `json:"packages"`
37- IsTrusted bool
36+ Packages []* indexPackage `json:"packages"`
37+ IsTrusted bool
38+ isInstalledJSON bool
3839}
3940
4041// indexPackage represents a single entry from package_index.json file.
@@ -144,7 +145,7 @@ var tr = i18n.Tr
144145// with the existing contents of the cores.Packages passed as parameter.
145146func (index Index ) MergeIntoPackages (outPackages cores.Packages ) {
146147 for _ , inPackage := range index .Packages {
147- inPackage .extractPackageIn (outPackages , index .IsTrusted )
148+ inPackage .extractPackageIn (outPackages , index .IsTrusted , index . isInstalledJSON )
148149 }
149150}
150151
@@ -243,7 +244,7 @@ func IndexFromPlatformRelease(pr *cores.PlatformRelease) Index {
243244 }
244245}
245246
246- func (inPackage indexPackage ) extractPackageIn (outPackages cores.Packages , trusted bool ) {
247+ func (inPackage indexPackage ) extractPackageIn (outPackages cores.Packages , trusted bool , isInstallJSON bool ) {
247248 outPackage := outPackages .GetOrCreatePackage (inPackage .Name )
248249 outPackage .Maintainer = inPackage .Maintainer
249250 outPackage .WebsiteURL = inPackage .WebsiteURL
@@ -256,15 +257,19 @@ func (inPackage indexPackage) extractPackageIn(outPackages cores.Packages, trust
256257 }
257258
258259 for _ , inPlatform := range inPackage .Platforms {
259- inPlatform .extractPlatformIn (outPackage , trusted )
260+ inPlatform .extractPlatformIn (outPackage , trusted , isInstallJSON )
260261 }
261262}
262263
263- func (inPlatformRelease indexPlatformRelease ) extractPlatformIn (outPackage * cores.Package , trusted bool ) error {
264+ func (inPlatformRelease indexPlatformRelease ) extractPlatformIn (outPackage * cores.Package , trusted bool , isInstallJSON bool ) error {
264265 outPlatform := outPackage .GetOrCreatePlatform (inPlatformRelease .Architecture )
265266 // FIXME: shall we use the Name and Category of the latest release? or maybe move Name and Category in PlatformRelease?
266267 outPlatform .Name = inPlatformRelease .Name
267268 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+
268273 // If the Platform is installed before deprecation installed.json file does not include "deprecated" field.
269274 // The installed.json is read during loading phase of an installed Platform, if the deprecated field is not found
270275 // 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) {
398403 } else {
399404 logrus .WithField ("index" , jsonIndexFile ).Infof ("Missing signature file" )
400405 }
406+
407+ if jsonIndexFile .Base () == "installed.json" {
408+ index .isInstalledJSON = true
409+ }
410+
401411 return & index , nil
402412}
403413
0 commit comments