lpkg/ai/metadata/schema.json

378 lines
8.8 KiB
JSON
Raw Normal View History

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://lpkg.dev/schemas/package-metadata.json",
"title": "LPKG Package Metadata",
"type": "object",
"required": ["schema_version", "package", "source", "build", "provenance", "status"],
"additionalProperties": false,
"properties": {
"schema_version": {
"type": "string",
"pattern": "^v\\d+\\.\\d+\\.\\d+$"
},
"package": {
"type": "object",
"required": ["id", "name", "version", "book"],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"pattern": "^[a-z0-9][a-z0-9-/]*$"
},
"name": {
"type": "string",
"minLength": 1
},
"upstream": {
2025-10-01 07:08:31 +02:00
"type": ["string", "null"]
},
"version": {
"type": "string",
"minLength": 1
},
"book": {
"type": "string",
"enum": ["lfs", "mlfs", "blfs", "glfs"]
},
"chapter": {
"type": ["integer", "null"],
"minimum": 0
},
"section": {
"type": ["string", "null"],
"pattern": "^\\d+\\.\\d+$"
},
"stage": {
"type": ["string", "null"],
"enum": [
"cross-toolchain",
"temporary-tools",
"system",
"system-configuration",
"system-finalization",
"desktop",
"server",
"multilib",
"kernel",
"boot",
null
]
},
"variant": {
"type": ["string", "null"],
"minLength": 1
},
"anchors": {
"type": "object",
"additionalProperties": {
"type": "string",
"format": "uri"
}
}
}
},
"source": {
"type": "object",
"required": ["urls"],
"additionalProperties": false,
"properties": {
"urls": {
"type": "array",
"items": {
"type": "object",
"required": ["url"],
"additionalProperties": false,
"properties": {
"url": {
"type": "string",
"format": "uri"
},
"kind": {
"type": "string",
"enum": ["primary", "mirror", "patch", "signature"]
}
}
}
},
"archive": {
"type": ["string", "null"]
},
"checksums": {
"type": "array",
"items": {
"type": "object",
"required": ["alg", "value"],
"additionalProperties": false,
"properties": {
"alg": {
"type": "string",
"enum": ["md5", "sha1", "sha256", "sha512"]
},
"value": {
"type": "string",
"pattern": "^[A-Fa-f0-9]{16,128}$"
}
}
}
}
}
},
"artifacts": {
"type": "object",
"additionalProperties": false,
"properties": {
"sbu": {
"type": ["number", "null"],
"minimum": 0
},
"disk": {
"type": ["integer", "null"],
"minimum": 0,
"description": "Approximate disk usage in MB"
},
"install_prefix": {
"type": ["string", "null"],
"minLength": 1
}
}
},
"dependencies": {
"type": "object",
"additionalProperties": false,
"properties": {
"build": {
"type": "array",
"items": {
"type": "object",
"required": ["name"],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"minLength": 1
},
"optional": {
"type": "boolean",
"default": false
}
}
}
},
"runtime": {
"type": "array",
"items": {
"type": "string",
"minLength": 1
}
}
}
},
"environment": {
"type": "object",
"additionalProperties": false,
"properties": {
"variables": {
"type": "array",
"items": {
"type": "object",
"required": ["name"],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"pattern": "^[A-Z0-9_]+$"
},
"required": {
"type": "boolean",
"default": true
},
"description": {
"type": "string"
}
}
}
},
"users": {
"type": "array",
"items": {
"type": "object",
"required": ["name"],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"minLength": 1
},
"purpose": {
"type": "string"
}
}
}
}
}
},
"build": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"required": ["phase", "commands"],
"additionalProperties": false,
"properties": {
"phase": {
"type": "string",
"enum": ["setup", "configure", "build", "test", "install", "post"]
},
"commands": {
"type": "array",
"items": {
"type": "string",
"minLength": 1
}
},
"cwd": {
"type": ["string", "null"],
"minLength": 1
},
"requires_root": {
"type": "boolean",
"default": false
},
"notes": {
"type": ["string", "null"],
"minLength": 1
}
}
}
},
"optimizations": {
"type": "object",
"additionalProperties": false,
"properties": {
"enable_lto": {
"type": "boolean"
},
"enable_pgo": {
"type": "boolean"
},
"cflags": {
"type": "array",
"items": {
"type": "string"
}
},
"ldflags": {
"type": "array",
"items": {
"type": "string"
}
},
"profdata": {
"type": ["string", "null"],
"minLength": 1
}
}
},
"tests": {
"type": "array",
"items": {
"type": "object",
"required": ["commands"],
"additionalProperties": false,
"properties": {
"commands": {
"type": "array",
"items": {
"type": "string"
}
},
"optional": {
"type": "boolean"
},
"expected_failures": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"post_install": {
"type": "array",
"items": {
"type": "object",
"required": ["commands"],
"additionalProperties": false,
"properties": {
"commands": {
"type": "array",
"items": {
"type": "string"
}
},
"description": {
"type": ["string", "null"]
}
}
}
},
"notes": {
"type": "array",
"items": {
"type": "object",
"required": ["text"],
"additionalProperties": false,
"properties": {
"severity": {
"type": "string",
"enum": ["info", "warning", "error"]
},
"text": {
"type": "string"
}
}
}
},
"provenance": {
"type": "object",
"required": ["book_release", "page_url", "retrieved_at"],
"additionalProperties": false,
"properties": {
"book_release": {
"type": "string"
},
"page_url": {
"type": "string",
"format": "uri"
},
"retrieved_at": {
"type": "string",
"format": "date-time"
},
"content_hash": {
"type": "string",
"pattern": "^[A-Fa-f0-9]{64}$"
}
}
},
"status": {
"type": "object",
"required": ["state"],
"additionalProperties": false,
"properties": {
"state": {
"type": "string",
"enum": ["draft", "review", "imported", "stale"]
},
"issues": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}