Skip to content

Commit 39588e7

Browse files
cfriedtkartben
authored andcommitted
scripts: schemas: add schema for patches.yml files
Add a pykwalify schema for patches.yml files, which are used by the west patch command. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
1 parent b35404f commit 39588e7

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed

scripts/schemas/patch-schema.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# Copyright (c) 2024 Tenstorrent AI ULC
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# A pykwalify schema for basic validation of the patches.yml format.
6+
7+
# The schema for individual patch objects
8+
schema;patch-schema:
9+
type: seq
10+
sequence:
11+
- type: map
12+
mapping:
13+
14+
# The path to the patch file, relative to the root of the module
15+
# E.g. zephyr/kernel-pipe-fix-not-k-no-wait-and-ge-min-xfer-bytes.patch
16+
path:
17+
required: true
18+
type: str
19+
20+
# The SHA-256 checksum of the patch file
21+
# e.g. e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
22+
sha256sum:
23+
required: true
24+
type: str
25+
pattern: "^[0-9a-f]{64}$"
26+
27+
# The path of the module the patch is for, relative to the west workspace
28+
# e.g. zephyr, or bootloader/mcuboot
29+
module:
30+
required: true
31+
type: str
32+
33+
# The name of the primary author of the patch, e.g. Kermit D. Frog
34+
author:
35+
required: true
36+
type: str
37+
38+
# The email address of the primary author of the patch, e.g. itsnoteasy@being.gr
39+
email:
40+
required: true
41+
type: str
42+
pattern: ".+@.+"
43+
44+
# The date the patch was created, in ISO 8601 date format YYYY-MM-DD
45+
date:
46+
required: true
47+
type: date
48+
format: "%Y-%m-%d"
49+
50+
# Whether the patch should be submitted upstream
51+
upstreamable:
52+
type: bool
53+
default: true
54+
55+
# The URL of the upstream pull request to merge the patch
56+
# e.g. https://github.com/zephyrproject-rtos/zephyr/pull/24486
57+
merge-pr:
58+
type: str
59+
pattern: "^https?://"
60+
61+
# The URL of the upstream issue associated with the patch, such as an enhancement issue
62+
# or bug report, e.g. https://github.com/zephyrproject-rtos/zephyr/issues/24485
63+
issue:
64+
type: str
65+
pattern: "^https?://"
66+
67+
# Whether the associated merge-pr has been merged
68+
merge-status:
69+
type: bool
70+
71+
# The SHA-1 hash of the upstream git commit incorporating the associated merge-pr
72+
# e.g. af926ae728c78affa89cbc1de811ab4211ed0f69
73+
merge-commit:
74+
type: str
75+
pattern: "^[0-9a-f]{40}"
76+
77+
# The date the associated merge-pr was merged, in ISO 8601 date format YYYY-MM-DD
78+
merge-date:
79+
type: date
80+
format: "%Y-%m-%d"
81+
82+
# The command used to apply the change represented by the patch
83+
apply-command:
84+
type: str
85+
default: "git apply"
86+
87+
# Comments useful to other developers about the patch,
88+
# e.g. "This is a workaround for xyz and probably should not go upstream"
89+
comments:
90+
type: str
91+
92+
# Custom field that may be used for any purpose. For example, if the chosen apply-patch
93+
# command is able to filter based on semantic versioning and a particular patch file
94+
# only applies to version 1.2.3, one could specify e.g. custom: [1, 2, 3].
95+
# This field may be of any type and is not validated.
96+
custom:
97+
type: any
98+
99+
# The top-level schema for patches.yml files
100+
type: map
101+
mapping:
102+
103+
# The list of patch objects
104+
patches:
105+
include: patch-schema
106+
107+
# The command used to undo local changes to each module when "west patch clean" is run
108+
checkout-command:
109+
type: str
110+
default: "git checkout ."
111+
112+
# The command used to clean each module when "west patch clean" is run
113+
clean-command:
114+
type: str
115+
default: "git clean -d -f -x"

0 commit comments

Comments
 (0)