From f78016ab93019bd05f0c10b7726371fcd7f15e2c Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 3 Aug 2021 15:53:42 -0700 Subject: [PATCH] Add support for "all" host type in package index tool definition There is a catch-all "all" host type: https://github.com/arduino/arduino-cli/blob/495a5f1a3d9d2f47b399329d6e6d91562fb683f8/arduino/cores/tools.go#L159 The package index JSON schema was missing support for this host type, resulting in spurious violations of rule IT0016. --- etc/schemas/arduino-package-index-definitions-schema.json | 3 +++ internal/project/packageindex/packageindexschemas_test.go | 4 ++++ internal/rule/schema/schemadata/bindata.go | 3 +++ 3 files changed, 10 insertions(+) diff --git a/etc/schemas/arduino-package-index-definitions-schema.json b/etc/schemas/arduino-package-index-definitions-schema.json index 98561789..262e6897 100644 --- a/etc/schemas/arduino-package-index-definitions-schema.json +++ b/etc/schemas/arduino-package-index-definitions-schema.json @@ -1369,6 +1369,9 @@ "validHost": { "$comment": "https://github.com/arduino/arduino-cli/blob/cdbebe98f895c18146ea2607cfb706d002b01191/arduino/cores/tools.go#L144-L155", "anyOf": [ + { + "pattern": "^all$" + }, { "pattern": "^arm.*-linux-gnueabihf$" }, diff --git a/internal/project/packageindex/packageindexschemas_test.go b/internal/project/packageindex/packageindexschemas_test.go index 8a1fd91c..eea78538 100644 --- a/internal/project/packageindex/packageindexschemas_test.go +++ b/internal/project/packageindex/packageindexschemas_test.go @@ -487,6 +487,10 @@ func TestPattern(t *testing.T) { {"/packages/0/tools/0/systems/0/size", "foo", compliancelevel.Specification, assert.True}, {"/packages/0/tools/0/systems/0/size", "foo", compliancelevel.Strict, assert.True}, + {"/packages/0/tools/0/systems/0/host", "all", compliancelevel.Permissive, assert.False}, + {"/packages/0/tools/0/systems/0/host", "all", compliancelevel.Specification, assert.False}, + {"/packages/0/tools/0/systems/0/host", "all", compliancelevel.Strict, assert.False}, + {"/packages/0/tools/0/systems/0/host", "arm-linux-gnueabihf", compliancelevel.Permissive, assert.False}, {"/packages/0/tools/0/systems/0/host", "arm-linux-gnueabihf", compliancelevel.Specification, assert.False}, {"/packages/0/tools/0/systems/0/host", "arm-linux-gnueabihf", compliancelevel.Strict, assert.False}, diff --git a/internal/rule/schema/schemadata/bindata.go b/internal/rule/schema/schemadata/bindata.go index 09865827..96acd7b8 100644 --- a/internal/rule/schema/schemadata/bindata.go +++ b/internal/rule/schema/schemadata/bindata.go @@ -3904,6 +3904,9 @@ var _arduinoPackageIndexDefinitionsSchemaJson = []byte(`{ "validHost": { "$comment": "https://github.com/arduino/arduino-cli/blob/cdbebe98f895c18146ea2607cfb706d002b01191/arduino/cores/tools.go#L144-L155", "anyOf": [ + { + "pattern": "^all$" + }, { "pattern": "^arm.*-linux-gnueabihf$" },