Merge ~fourdollars/pc-enablement/+git/oem-scripts:master into ~oem-solutions-engineers/pc-enablement/+git/oem-scripts:master
- Git
- lp:~fourdollars/pc-enablement/+git/oem-scripts
- master
- Merge into master
Status: | Merged |
---|---|
Approved by: | Shih-Yuan Lee |
Approved revision: | 745429770c0a14a979dfebc9c41a4f46d0c170ab |
Merged at revision: | ae352169ae3adfa9839d20ca24375f8b2cf27c80 |
Proposed branch: | ~fourdollars/pc-enablement/+git/oem-scripts:master |
Merge into: | ~oem-solutions-engineers/pc-enablement/+git/oem-scripts:master |
Diff against target: |
572 lines (+193/-86) 3 files modified
debian/tests/mir-bug (+27/-2) mir-bug (+165/-83) oem-meta-package.mir.jinja2 (+1/-1) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Bin Li | Approve | ||
Review via email: mp+433421@code.launchpad.net |
Commit message
Description of the change
OEM Taipei Bot (oem-taipei-bot) wrote : | # |
OEM Taipei Bot (oem-taipei-bot) wrote : | # |
[autopkgtest]
autopkgtest-
autopkgtest-
pkg-somerville-meta PASS
pkg-stella-meta PASS
pkg-sutton-meta PASS
bug-bind PASS
get-private-ppa PASS
jq-lp PASS
launchpad-api PASS
lp-bug PASS
pkg-list PASS
review-
run-autopkgtest PASS
setup-apt-dir PASS
bootstrap-meta PASS
mir-bug FAIL non-zero exit status 1
oem-meta-packages PASS
git-url-
lp-dl-attm PASS
recovery-
OEM Taipei Bot (oem-taipei-bot) wrote : | # |
[autopkgtest]
autopkgtest-
autopkgtest-
pkg-somerville-meta PASS
pkg-stella-meta PASS
pkg-sutton-meta PASS
bug-bind PASS
get-private-ppa PASS
jq-lp PASS
launchpad-api PASS
lp-bug PASS
pkg-list PASS
review-
run-autopkgtest PASS
setup-apt-dir PASS
bootstrap-meta PASS
mir-bug FAIL non-zero exit status 1
oem-meta-packages PASS
git-url-
lp-dl-attm PASS
recovery-
Shih-Yuan Lee (fourdollars) wrote : | # |
mir-bug FAIL non-zero exit status 1
Traceback (most recent call last):
File "/usr/bin/mir-bug", line 1259, in <module>
update_bug(
File "/usr/bin/mir-bug", line 432, in update_bug
check_
TypeError: check_and_
OEM Taipei Bot (oem-taipei-bot) wrote : | # |
[autopkgtest]
autopkgtest-
autopkgtest-
pkg-somerville-meta PASS
pkg-stella-meta PASS
pkg-sutton-meta PASS
bug-bind PASS
get-private-ppa PASS
jq-lp PASS
launchpad-api PASS
lp-bug PASS
pkg-list PASS
review-
run-autopkgtest PASS
setup-apt-dir PASS
bootstrap-meta PASS
mir-bug FAIL non-zero exit status 1
oem-meta-packages PASS
git-url-
lp-dl-attm PASS
recovery-
OEM Taipei Bot (oem-taipei-bot) wrote : | # |
[autopkgtest]
autopkgtest-
autopkgtest-
pkg-somerville-meta PASS
pkg-stella-meta PASS
pkg-sutton-meta PASS
bug-bind PASS
get-private-ppa PASS
jq-lp PASS
launchpad-api PASS
lp-bug PASS
pkg-list PASS
review-
run-autopkgtest PASS
setup-apt-dir PASS
bootstrap-meta PASS
mir-bug FAIL non-zero exit status 1
oem-meta-packages PASS
git-url-
lp-dl-attm PASS
recovery-
OEM Taipei Bot (oem-taipei-bot) wrote : | # |
[autopkgtest]
autopkgtest-
autopkgtest-
pkg-somerville-meta PASS
pkg-stella-meta PASS
pkg-sutton-meta PASS
bug-bind PASS
get-private-ppa PASS
jq-lp PASS
launchpad-api PASS
lp-bug PASS
pkg-list PASS
review-
run-autopkgtest PASS
setup-apt-dir PASS
bootstrap-meta PASS
mir-bug PASS
oem-meta-packages PASS
git-url-
lp-dl-attm PASS
recovery-
Bin Li (binli) wrote : | # |
LGTM.
BTW, I wish we could parse the json file name/content to get the series when use 'mir update', :)
Preview Diff
1 | diff --git a/debian/tests/mir-bug b/debian/tests/mir-bug | |||
2 | index 216eb7b..04c8b9d 100644 | |||
3 | --- a/debian/tests/mir-bug | |||
4 | +++ b/debian/tests/mir-bug | |||
5 | @@ -23,12 +23,24 @@ cat > "$AUTOPKGTEST_ARTIFACTS"/fossa-tentacool.json <<ENDLINE | |||
6 | 23 | "mirbug": 1943413, | 23 | "mirbug": 1943413, |
7 | 24 | "productnames": [ | 24 | "productnames": [ |
8 | 25 | "XPS 9320" | 25 | "XPS 9320" |
10 | 26 | ] | 26 | ], |
11 | 27 | "series": "focal" | ||
12 | 27 | } | 28 | } |
13 | 28 | ENDLINE | 29 | ENDLINE |
14 | 29 | 30 | ||
15 | 30 | export COPYRIGHT_YEAR=2022 | 31 | export COPYRIGHT_YEAR=2022 |
16 | 31 | 32 | ||
17 | 33 | cleanup() { | ||
18 | 34 | echo "= cleanup =" | ||
19 | 35 | if [ -f "bugid" ]; then | ||
20 | 36 | BUG_ID=$(cat bugid) | ||
21 | 37 | rm bugid | ||
22 | 38 | lp-bug cleanup --yes "$BUG_ID" | ||
23 | 39 | fi | ||
24 | 40 | } | ||
25 | 41 | |||
26 | 42 | trap cleanup EXIT INT TERM | ||
27 | 43 | |||
28 | 32 | # check/update | 44 | # check/update |
29 | 33 | mir-bug update --yes --skip --ready --release "$AUTOPKGTEST_ARTIFACTS"/fossa-tentacool.json | 45 | mir-bug update --yes --skip --ready --release "$AUTOPKGTEST_ARTIFACTS"/fossa-tentacool.json |
30 | 34 | mir-bug check --skip --ready --release "$AUTOPKGTEST_ARTIFACTS"/fossa-tentacool.json | 46 | mir-bug check --skip --ready --release "$AUTOPKGTEST_ARTIFACTS"/fossa-tentacool.json |
31 | @@ -36,8 +48,21 @@ mir-bug update --yes --skip --tz=UTC --release "$AUTOPKGTEST_ARTIFACTS"/fossa-te | |||
32 | 36 | mir-bug check --skip --tz=UTC --release "$AUTOPKGTEST_ARTIFACTS"/fossa-tentacool.json | 48 | mir-bug check --skip --tz=UTC --release "$AUTOPKGTEST_ARTIFACTS"/fossa-tentacool.json |
33 | 37 | 49 | ||
34 | 38 | # create | 50 | # create |
36 | 39 | mir-bug create -o bug_id somerville bronn "some Dell platforms" | 51 | mir-bug create -o bug_id somerville bronn "some Dell platforms" --series focal |
37 | 52 | BUG_ID=$(cat bug_id) | ||
38 | 53 | launchpad-api get bugs/"$BUG_ID" > "$AUTOPKGTEST_ARTIFACTS/$BUG_ID.json" | ||
39 | 54 | jq -r .title < "$AUTOPKGTEST_ARTIFACTS/$BUG_ID.json" | grep "\[MIR\] oem-somerville-bronn-meta" | ||
40 | 55 | jq -r .description < "$AUTOPKGTEST_ARTIFACTS/$BUG_ID.json" | grep focal | ||
41 | 56 | jq -r .description < "$AUTOPKGTEST_ARTIFACTS/$BUG_ID.json" | grep 20.04 | ||
42 | 57 | lp-bug cleanup --yes "$BUG_ID" | ||
43 | 58 | rm bug_id | ||
44 | 59 | |||
45 | 60 | mir-bug create -o bug_id somerville bronn "some Dell platforms" --series jammy | ||
46 | 40 | BUG_ID=$(cat bug_id) | 61 | BUG_ID=$(cat bug_id) |
47 | 62 | launchpad-api get bugs/"$BUG_ID" > "$AUTOPKGTEST_ARTIFACTS/$BUG_ID.json" | ||
48 | 63 | jq -r .title < "$AUTOPKGTEST_ARTIFACTS/$BUG_ID.json" | grep "\[MIR\]\[jammy\] oem-somerville-bronn-meta" | ||
49 | 64 | jq -r .description < "$AUTOPKGTEST_ARTIFACTS/$BUG_ID.json" | grep jammy | ||
50 | 65 | jq -r .description < "$AUTOPKGTEST_ARTIFACTS/$BUG_ID.json" | grep 22.04 | ||
51 | 41 | lp-bug cleanup --yes "$BUG_ID" | 66 | lp-bug cleanup --yes "$BUG_ID" |
52 | 42 | rm bug_id | 67 | rm bug_id |
53 | 43 | 68 | ||
54 | diff --git a/mir-bug b/mir-bug | |||
55 | index cb8e828..e752ce3 100755 | |||
56 | --- a/mir-bug | |||
57 | +++ b/mir-bug | |||
58 | @@ -24,6 +24,7 @@ import difflib | |||
59 | 24 | import jinja2 | 24 | import jinja2 |
60 | 25 | import json | 25 | import json |
61 | 26 | import lazr | 26 | import lazr |
62 | 27 | import lsb_release | ||
63 | 27 | import oem_scripts | 28 | import oem_scripts |
64 | 28 | import os | 29 | import os |
65 | 29 | import re | 30 | import re |
66 | @@ -32,6 +33,7 @@ import shutil | |||
67 | 32 | import sys | 33 | import sys |
68 | 33 | 34 | ||
69 | 34 | from copy import copy | 35 | from copy import copy |
70 | 36 | from distro_info import UbuntuDistroInfo | ||
71 | 35 | from glob import glob | 37 | from glob import glob |
72 | 36 | from logging import debug, info, warning, error, critical | 38 | from logging import debug, info, warning, error, critical |
73 | 37 | from oem_scripts import ( | 39 | from oem_scripts import ( |
74 | @@ -71,6 +73,11 @@ create.add_argument("oemCodename", help="Such as somerville, stella, or sutton.s | |||
75 | 71 | create.add_argument("platformCodename", help="Name deined by PM, like ace.") | 73 | create.add_argument("platformCodename", help="Name deined by PM, like ace.") |
76 | 72 | create.add_argument("deviceName", help="ThinkPad X1 Carbon Gen 8") | 74 | create.add_argument("deviceName", help="ThinkPad X1 Carbon Gen 8") |
77 | 73 | create.add_argument( | 75 | create.add_argument( |
78 | 76 | "-s", | ||
79 | 77 | "--series", | ||
80 | 78 | help="Specify the Ubuntu series to create the bug.", | ||
81 | 79 | ) | ||
82 | 80 | create.add_argument( | ||
83 | 74 | "-o", | 81 | "-o", |
84 | 75 | "--output", | 82 | "--output", |
85 | 76 | help="Specify a file name to write the bug number.", | 83 | help="Specify a file name to write the bug number.", |
86 | @@ -148,6 +155,7 @@ args = parser.parse_args() | |||
87 | 148 | setup_logging(debug=args.debug, quiet=args.quiet) | 155 | setup_logging(debug=args.debug, quiet=args.quiet) |
88 | 149 | 156 | ||
89 | 150 | pattern = re.compile(r".*\[MIR\]\W*oem-([^-]*)-(.*)-meta\W*") | 157 | pattern = re.compile(r".*\[MIR\]\W*oem-([^-]*)-(.*)-meta\W*") |
90 | 158 | pattern2 = re.compile(r".*\[MIR\]\[(.*)\]\W*oem-([^-]*)-(.*)-meta\W*") | ||
91 | 151 | 159 | ||
92 | 152 | 160 | ||
93 | 153 | def _grouping_market_names(market_names: list, maxsplit=1) -> str: | 161 | def _grouping_market_names(market_names: list, maxsplit=1) -> str: |
94 | @@ -177,7 +185,7 @@ def _grouping_market_names(market_names: list, maxsplit=1) -> str: | |||
95 | 177 | return ", ".join(f"{name} {'/'.join(models)}" for name, models in tmp.items()) | 185 | return ", ".join(f"{name} {'/'.join(models)}" for name, models in tmp.items()) |
96 | 178 | 186 | ||
97 | 179 | 187 | ||
99 | 180 | def create_bug(lp, oemCodename, platformCodename, deviceName): | 188 | def create_bug(lp, oemCodename, platformCodename, deviceName, series): |
100 | 181 | info("Creating bug...") | 189 | info("Creating bug...") |
101 | 182 | tempList = oemCodename.split(".") | 190 | tempList = oemCodename.split(".") |
102 | 183 | oemCodenameNogroup = tempList[0] | 191 | oemCodenameNogroup = tempList[0] |
103 | @@ -192,18 +200,22 @@ def create_bug(lp, oemCodename, platformCodename, deviceName): | |||
104 | 192 | metaPkgName = "oem-" + oemCodename + "-" + platformCodename + "-meta" | 200 | metaPkgName = "oem-" + oemCodename + "-" + platformCodename + "-meta" |
105 | 193 | 201 | ||
106 | 194 | if oemGroupName.strip() != "": | 202 | if oemGroupName.strip() != "": |
108 | 195 | branchName = oemGroupName + "." + platformCodename + "-focal-ubuntu" | 203 | branchName = oemGroupName + "." + platformCodename + f"-{series}-ubuntu" |
109 | 196 | else: | 204 | else: |
111 | 197 | branchName = platformCodename + "-focal-ubuntu" | 205 | branchName = platformCodename + f"-{series}-ubuntu" |
112 | 198 | 206 | ||
113 | 199 | project = lp.projects["oem-priority"] | 207 | project = lp.projects["oem-priority"] |
114 | 200 | 208 | ||
116 | 201 | bt = "[DRAFT][MIR] " + metaPkgName | 209 | if series == "focal": |
117 | 210 | bt = f"[DRAFT][MIR] {metaPkgName}" | ||
118 | 211 | else: | ||
119 | 212 | bt = f"[DRAFT][MIR][{series}] {metaPkgName}" | ||
120 | 202 | bd = "[DRAFT]" + read_from_template( | 213 | bd = "[DRAFT]" + read_from_template( |
121 | 203 | metaPkgName=metaPkgName, | 214 | metaPkgName=metaPkgName, |
122 | 204 | branchName=branchName, | 215 | branchName=branchName, |
123 | 205 | oemCodenameNogroup=oemCodenameNogroup, | 216 | oemCodenameNogroup=oemCodenameNogroup, |
124 | 206 | deviceName=deviceName, | 217 | deviceName=deviceName, |
125 | 218 | series=series, | ||
126 | 207 | ) | 219 | ) |
127 | 208 | bug = lp.bugs.createBug( | 220 | bug = lp.bugs.createBug( |
128 | 209 | description=bd, | 221 | description=bd, |
129 | @@ -281,19 +293,26 @@ def collect_bugs(lp, output): | |||
130 | 281 | ) | 293 | ) |
131 | 282 | continue | 294 | continue |
132 | 283 | 295 | ||
134 | 284 | result = pattern.match(bug.title) | 296 | result = pattern2.match(bug.title) |
135 | 285 | git = None | 297 | git = None |
136 | 286 | if result: | 298 | if result: |
147 | 287 | if "." in result.group(1): | 299 | series = result.group(1) |
148 | 288 | project, group = result.group(1).split(".") | 300 | project = result.group(2) |
149 | 289 | else: | 301 | platform = result.group(3) |
150 | 290 | project = result.group(1) | 302 | git = f"git clone --depth 1 -b {platform}-{series}-ubuntu https://git.launchpad.net/~oem-solutions-engineers/pc-enablement/+git/oem-{project}-projects-meta oem-{project}-{platform}-meta" |
151 | 291 | group = None | 303 | else: |
152 | 292 | platform = result.group(2) | 304 | result = pattern.match(bug.title) |
153 | 293 | if group: | 305 | if result: |
154 | 294 | git = f"git clone --depth 1 -b {group}.{platform}-focal-ubuntu https://git.launchpad.net/~oem-solutions-engineers/pc-enablement/+git/oem-{project}-projects-meta oem-{project}.{group}-{platform}-meta" | 306 | if "." in result.group(1): |
155 | 295 | else: | 307 | project, group = result.group(1).split(".") |
156 | 296 | git = f"git clone --depth 1 -b {platform}-focal-ubuntu https://git.launchpad.net/~oem-solutions-engineers/pc-enablement/+git/oem-{project}-projects-meta oem-{project}-{platform}-meta" | 308 | else: |
157 | 309 | project = result.group(1) | ||
158 | 310 | group = None | ||
159 | 311 | platform = result.group(2) | ||
160 | 312 | if group: | ||
161 | 313 | git = f"git clone --depth 1 -b {group}.{platform}-focal-ubuntu https://git.launchpad.net/~oem-solutions-engineers/pc-enablement/+git/oem-{project}-projects-meta oem-{project}.{group}-{platform}-meta" | ||
162 | 314 | else: | ||
163 | 315 | git = f"git clone --depth 1 -b {platform}-focal-ubuntu https://git.launchpad.net/~oem-solutions-engineers/pc-enablement/+git/oem-{project}-projects-meta oem-{project}-{platform}-meta" | ||
164 | 297 | 316 | ||
165 | 298 | subscriptions = [] | 317 | subscriptions = [] |
166 | 299 | for subscription in bug.subscriptions: | 318 | for subscription in bug.subscriptions: |
167 | @@ -338,6 +357,7 @@ def collect_bugs(lp, output): | |||
168 | 338 | 357 | ||
169 | 339 | def update_bug( | 358 | def update_bug( |
170 | 340 | lp, | 359 | lp, |
171 | 360 | series: str, | ||
172 | 341 | bug_number: int, | 361 | bug_number: int, |
173 | 342 | yes: bool, | 362 | yes: bool, |
174 | 343 | certified: bool = False, | 363 | certified: bool = False, |
175 | @@ -353,7 +373,7 @@ def update_bug( | |||
176 | 353 | bug_modified = True | 373 | bug_modified = True |
177 | 354 | bug.description = desc | 374 | bug.description = desc |
178 | 355 | 375 | ||
180 | 356 | if check_bug_title(bug, pkg_name) is False and yes_or_ask( | 376 | if check_bug_title(bug, pkg_name, series) is False and yes_or_ask( |
181 | 357 | yes, "Do you want to update the bug title?" | 377 | yes, "Do you want to update the bug title?" |
182 | 358 | ): | 378 | ): |
183 | 359 | bug_modified = True | 379 | bug_modified = True |
184 | @@ -406,9 +426,11 @@ def update_bug( | |||
185 | 406 | if tags != bug.tags: | 426 | if tags != bug.tags: |
186 | 407 | bug.tags = tags | 427 | bug.tags = tags |
187 | 408 | 428 | ||
189 | 409 | check_and_update_git_repo(bug, pkg_name, yes=yes, update=True, username=lp.me.name) | 429 | check_and_update_git_repo( |
190 | 430 | bug, pkg_name, series=series, yes=yes, update=True, username=lp.me.name | ||
191 | 431 | ) | ||
192 | 410 | 432 | ||
194 | 411 | check_and_update_bug_attachments(bug, pkg_name, update=True, yes=yes) | 433 | check_and_update_bug_attachments(bug, pkg_name, series=series, update=True, yes=yes) |
195 | 412 | 434 | ||
196 | 413 | if bug_modified: | 435 | if bug_modified: |
197 | 414 | bug.lp_save() | 436 | bug.lp_save() |
198 | @@ -420,7 +442,11 @@ def update_bug( | |||
199 | 420 | 442 | ||
200 | 421 | 443 | ||
201 | 422 | def check_bug( | 444 | def check_bug( |
203 | 423 | lp, bug_number: int, certified: bool = False, certified_hardwares: list = [] | 445 | lp, |
204 | 446 | bug_number: int, | ||
205 | 447 | series: str, | ||
206 | 448 | certified: bool = False, | ||
207 | 449 | certified_hardwares: list = [], | ||
208 | 424 | ) -> None: | 450 | ) -> None: |
209 | 425 | bug = lp.bugs[bug_number] | 451 | bug = lp.bugs[bug_number] |
210 | 426 | info(f'Checking LP: #{bug_number} - "{bug.title}" ...') | 452 | info(f'Checking LP: #{bug_number} - "{bug.title}" ...') |
211 | @@ -428,7 +454,7 @@ def check_bug( | |||
212 | 428 | desc, pkg_name = check_bug_description(bug, certified_hardwares) | 454 | desc, pkg_name = check_bug_description(bug, certified_hardwares) |
213 | 429 | if desc: | 455 | if desc: |
214 | 430 | need_fixing = True | 456 | need_fixing = True |
216 | 431 | if check_bug_title(bug, pkg_name) is False: | 457 | if check_bug_title(bug, pkg_name, series) is False: |
217 | 432 | need_fixing = True | 458 | need_fixing = True |
218 | 433 | if check_bug_importance(bug) is False: | 459 | if check_bug_importance(bug) is False: |
219 | 434 | need_fixing = True | 460 | need_fixing = True |
220 | @@ -438,13 +464,14 @@ def check_bug( | |||
221 | 438 | need_fixing = True | 464 | need_fixing = True |
222 | 439 | if check_bug_tags(bug, certified) is False: | 465 | if check_bug_tags(bug, certified) is False: |
223 | 440 | need_fixing = True | 466 | need_fixing = True |
225 | 441 | if check_and_update_git_repo(bug, pkg_name) is False: | 467 | if check_and_update_git_repo(bug, pkg_name, series=series) is False: |
226 | 442 | need_fixing = True | 468 | need_fixing = True |
228 | 443 | if check_and_update_bug_attachments(bug, pkg_name) is False: | 469 | if check_and_update_bug_attachments(bug, pkg_name, series=series) is False: |
229 | 444 | need_fixing = True | 470 | need_fixing = True |
230 | 445 | if ( | 471 | if ( |
231 | 446 | not args.skip | 472 | not args.skip |
233 | 447 | and check_and_update_git_repo(bug, pkg_name, bootstrap=False) is False | 473 | and check_and_update_git_repo(bug, pkg_name, series=series, bootstrap=False) |
234 | 474 | is False | ||
235 | 448 | ): | 475 | ): |
236 | 449 | need_fixing = True | 476 | need_fixing = True |
237 | 450 | 477 | ||
238 | @@ -456,22 +483,31 @@ def check_bug( | |||
239 | 456 | 483 | ||
240 | 457 | def check_bug_description(bug, certified_hardwares: list) -> (str, str): | 484 | def check_bug_description(bug, certified_hardwares: list) -> (str, str): |
241 | 458 | info("Checking bug description...") | 485 | info("Checking bug description...") |
243 | 459 | result = pattern.match(bug.title) | 486 | result = pattern2.match(bug.title) |
244 | 460 | if not result: | 487 | if not result: |
252 | 461 | critical(f"LP: #{bug.id} '{bug.title}' is NOT MATCHED") | 488 | result = pattern.match(bug.title) |
253 | 462 | exit(1) | 489 | if not result: |
254 | 463 | 490 | critical(f"LP: #{bug.id} '{bug.title}' is NOT MATCHED") | |
255 | 464 | if "." in result.group(1): | 491 | exit(1) |
256 | 465 | project, group = result.group(1).split(".") | 492 | if "." in result.group(1): |
257 | 466 | platform = result.group(2) | 493 | project, group = result.group(1).split(".") |
258 | 467 | branchName = group + "." + platform + "-focal-ubuntu" | 494 | platform = result.group(2) |
259 | 495 | branchName = group + "." + platform + "-focal-ubuntu" | ||
260 | 496 | else: | ||
261 | 497 | project = result.group(1) | ||
262 | 498 | platform = result.group(2) | ||
263 | 499 | group = None | ||
264 | 500 | branchName = platform + "-focal-ubuntu" | ||
265 | 501 | metaPkgName = f"oem-{result.group(1)}-{result.group(2)}-meta" | ||
266 | 502 | series = "focal" | ||
267 | 468 | else: | 503 | else: |
270 | 469 | project = result.group(1) | 504 | series = result.group(1) |
271 | 470 | platform = result.group(2) | 505 | project = result.group(2) |
272 | 506 | platform = result.group(3) | ||
273 | 471 | group = None | 507 | group = None |
275 | 472 | branchName = platform + "-focal-ubuntu" | 508 | branchName = platform + f"-{series}-ubuntu" |
276 | 509 | metaPkgName = f"oem-{project}-{platform}-meta" | ||
277 | 473 | 510 | ||
278 | 474 | metaPkgName = f"oem-{result.group(1)}-{result.group(2)}-meta" | ||
279 | 475 | prog = re.compile(r"\W*We want to improve the hardware support for ([^.]*).\W*") | 511 | prog = re.compile(r"\W*We want to improve the hardware support for ([^.]*).\W*") |
280 | 476 | deviceName = None | 512 | deviceName = None |
281 | 477 | 513 | ||
282 | @@ -480,7 +516,7 @@ def check_bug_description(bug, certified_hardwares: list) -> (str, str): | |||
283 | 480 | if not result: | 516 | if not result: |
284 | 481 | continue | 517 | continue |
285 | 482 | deviceName = result.group(1) | 518 | deviceName = result.group(1) |
287 | 483 | if deviceName.endswith(" on focal"): | 519 | if deviceName.endswith(f" on {series}"): |
288 | 484 | deviceName = deviceName[:-9] | 520 | deviceName = deviceName[:-9] |
289 | 485 | break | 521 | break |
290 | 486 | else: | 522 | else: |
291 | @@ -492,6 +528,7 @@ def check_bug_description(bug, certified_hardwares: list) -> (str, str): | |||
292 | 492 | branchName=branchName, | 528 | branchName=branchName, |
293 | 493 | oemCodenameNogroup=project, | 529 | oemCodenameNogroup=project, |
294 | 494 | deviceName=deviceName, | 530 | deviceName=deviceName, |
295 | 531 | series=series, | ||
296 | 495 | ) | 532 | ) |
297 | 496 | 533 | ||
298 | 497 | if certified_hardwares: | 534 | if certified_hardwares: |
299 | @@ -517,9 +554,11 @@ def check_bug_description(bug, certified_hardwares: list) -> (str, str): | |||
300 | 517 | return (None, metaPkgName) | 554 | return (None, metaPkgName) |
301 | 518 | 555 | ||
302 | 519 | 556 | ||
304 | 520 | def check_bug_title(bug, pkg_name: str) -> bool: | 557 | def check_bug_title(bug, pkg_name: str, series: str) -> bool: |
305 | 521 | info("Checking bug title...") | 558 | info("Checking bug title...") |
307 | 522 | if bug.title == f"[MIR] {pkg_name}": | 559 | if series == "focal" and bug.title == f"[MIR] {pkg_name}": |
308 | 560 | return True | ||
309 | 561 | elif bug.title == f"[MIR][{series}] {pkg_name}": | ||
310 | 523 | return True | 562 | return True |
311 | 524 | error(f"The bug title shall be '[MIR] {pkg_name}' but it is '{bug.title}'.") | 563 | error(f"The bug title shall be '[MIR] {pkg_name}' but it is '{bug.title}'.") |
312 | 525 | return False | 564 | return False |
313 | @@ -733,29 +772,43 @@ def check_bug_tags(bug, certified: bool = False) -> bool: | |||
314 | 733 | 772 | ||
315 | 734 | 773 | ||
316 | 735 | def check_and_update_bug_attachments( | 774 | def check_and_update_bug_attachments( |
318 | 736 | bug, pkg_name: str, update=False, yes=False | 775 | bug, |
319 | 776 | pkg_name: str, | ||
320 | 777 | series: str, | ||
321 | 778 | update=False, | ||
322 | 779 | yes=False, | ||
323 | 737 | ) -> bool: | 780 | ) -> bool: |
324 | 738 | if update: | 781 | if update: |
325 | 739 | info("Checking and updating attachments...") | 782 | info("Checking and updating attachments...") |
326 | 740 | else: | 783 | else: |
327 | 741 | info("Checking attachments...") | 784 | info("Checking attachments...") |
328 | 742 | result = pattern.match(f"[MIR] {pkg_name}") | ||
329 | 743 | 785 | ||
336 | 744 | if result is None: | 786 | if series != "focal": |
337 | 745 | critical(f"{pkg_name} failed.") | 787 | result = pattern2.match(f"[MIR][{series}] {pkg_name}") |
338 | 746 | exit(1) | 788 | if result is None: |
339 | 747 | 789 | critical(f"{pkg_name} failed.") | |
340 | 748 | if "." in result.group(1): | 790 | exit(1) |
341 | 749 | project, group = result.group(1).split(".") | 791 | project = result.group(2) |
342 | 792 | platform = result.group(3) | ||
343 | 793 | branch = f"{platform}-{series}-ubuntu" | ||
344 | 750 | else: | 794 | else: |
348 | 751 | project = result.group(1) | 795 | result = pattern.match(f"[MIR] {pkg_name}") |
346 | 752 | group = None | ||
347 | 753 | platform = result.group(2) | ||
349 | 754 | 796 | ||
354 | 755 | if group: | 797 | if result is None: |
355 | 756 | branch = f"{group}.{platform}-focal-ubuntu" | 798 | critical(f"{pkg_name} failed.") |
356 | 757 | else: | 799 | exit(1) |
357 | 758 | branch = f"{platform}-focal-ubuntu" | 800 | |
358 | 801 | if "." in result.group(1): | ||
359 | 802 | project, group = result.group(1).split(".") | ||
360 | 803 | else: | ||
361 | 804 | project = result.group(1) | ||
362 | 805 | group = None | ||
363 | 806 | platform = result.group(2) | ||
364 | 807 | |||
365 | 808 | if group: | ||
366 | 809 | branch = f"{group}.{platform}-focal-ubuntu" | ||
367 | 810 | else: | ||
368 | 811 | branch = f"{platform}-focal-ubuntu" | ||
369 | 759 | 812 | ||
370 | 760 | git_command = ( | 813 | git_command = ( |
371 | 761 | "git", | 814 | "git", |
372 | @@ -855,7 +908,13 @@ def check_and_update_bug_attachments( | |||
373 | 855 | 908 | ||
374 | 856 | 909 | ||
375 | 857 | def check_and_update_git_repo( | 910 | def check_and_update_git_repo( |
377 | 858 | bug, pkg_name: str, yes=False, bootstrap=True, update=False, username=None | 911 | bug, |
378 | 912 | pkg_name: str, | ||
379 | 913 | series: str, | ||
380 | 914 | yes=False, | ||
381 | 915 | bootstrap=True, | ||
382 | 916 | update=False, | ||
383 | 917 | username=None, | ||
384 | 859 | ) -> bool: | 918 | ) -> bool: |
385 | 860 | if update: | 919 | if update: |
386 | 861 | if bootstrap: | 920 | if bootstrap: |
387 | @@ -868,28 +927,37 @@ def check_and_update_git_repo( | |||
388 | 868 | else: | 927 | else: |
389 | 869 | info("Checking git repo for oem branch...") | 928 | info("Checking git repo for oem branch...") |
390 | 870 | 929 | ||
392 | 871 | result = pattern.match(f"[MIR] {pkg_name}") | 930 | if series != "focal": |
393 | 931 | result = pattern2.match(f"[MIR][{series}] {pkg_name}") | ||
394 | 932 | platform = result.group(2) | ||
395 | 933 | if bootstrap: | ||
396 | 934 | suffix = "ubuntu" | ||
397 | 935 | else: | ||
398 | 936 | suffix = "oem" | ||
399 | 937 | branch = f"{platform}-{series}-{suffix}" | ||
400 | 938 | else: | ||
401 | 939 | result = pattern.match(f"[MIR] {pkg_name}") | ||
402 | 872 | 940 | ||
406 | 873 | if result is None: | 941 | if result is None: |
407 | 874 | critical(f"{pkg_name} failed.") | 942 | critical(f"{pkg_name} failed.") |
408 | 875 | exit(1) | 943 | exit(1) |
409 | 876 | 944 | ||
416 | 877 | if "." in result.group(1): | 945 | if "." in result.group(1): |
417 | 878 | project, group = result.group(1).split(".") | 946 | project, group = result.group(1).split(".") |
418 | 879 | else: | 947 | else: |
419 | 880 | project = result.group(1) | 948 | project = result.group(1) |
420 | 881 | group = None | 949 | group = None |
421 | 882 | platform = result.group(2) | 950 | platform = result.group(2) |
422 | 883 | 951 | ||
427 | 884 | if bootstrap: | 952 | if bootstrap: |
428 | 885 | suffix = "ubuntu" | 953 | suffix = "ubuntu" |
429 | 886 | else: | 954 | else: |
430 | 887 | suffix = "oem" | 955 | suffix = "oem" |
431 | 888 | 956 | ||
436 | 889 | if group: | 957 | if group: |
437 | 890 | branch = f"{group}.{platform}-focal-{suffix}" | 958 | branch = f"{group}.{platform}-focal-{suffix}" |
438 | 891 | else: | 959 | else: |
439 | 892 | branch = f"{platform}-focal-{suffix}" | 960 | branch = f"{platform}-focal-{suffix}" |
440 | 893 | 961 | ||
441 | 894 | kernel_flavour, kernel_meta, market_name, ids = _get_items_from_git( | 962 | kernel_flavour, kernel_meta, market_name, ids = _get_items_from_git( |
442 | 895 | project, branch, pkg_name | 963 | project, branch, pkg_name |
443 | @@ -940,10 +1008,11 @@ def check_and_update_git_repo( | |||
444 | 940 | ): | 1008 | ): |
445 | 941 | market_name = new_market_name | 1009 | market_name = new_market_name |
446 | 942 | 1010 | ||
447 | 1011 | version = UbuntuDistroInfo().version(series).split(" ")[0] | ||
448 | 943 | if kernel_flavour == "default": | 1012 | if kernel_flavour == "default": |
449 | 944 | if kernel_meta is None: | 1013 | if kernel_meta is None: |
452 | 945 | kernel_meta = "linux-generic-hwe-20.04" | 1014 | kernel_meta = f"linux-generic-hwe-{version}" |
453 | 946 | elif kernel_meta == "linux-generic-hwe-20.04": | 1015 | elif kernel_meta == f"linux-generic-hwe-{version}": |
454 | 947 | pass | 1016 | pass |
455 | 948 | else: | 1017 | else: |
456 | 949 | critical( | 1018 | critical( |
457 | @@ -952,8 +1021,8 @@ def check_and_update_git_repo( | |||
458 | 952 | exit(1) | 1021 | exit(1) |
459 | 953 | elif kernel_flavour == "oem": | 1022 | elif kernel_flavour == "oem": |
460 | 954 | if kernel_meta is None: | 1023 | if kernel_meta is None: |
463 | 955 | kernel_meta = "linux-oem-20.04" | 1024 | kernel_meta = f"linux-oem-{version}" |
464 | 956 | elif kernel_meta.startswith("linux-oem-20.04"): | 1025 | elif kernel_meta.startswith(f"linux-oem-{version}"): |
465 | 957 | pass | 1026 | pass |
466 | 958 | else: | 1027 | else: |
467 | 959 | critical( | 1028 | critical( |
468 | @@ -972,7 +1041,7 @@ def check_and_update_git_repo( | |||
469 | 972 | command = [ | 1041 | command = [ |
470 | 973 | "pkg-somerville-meta", | 1042 | "pkg-somerville-meta", |
471 | 974 | "-s", | 1043 | "-s", |
473 | 975 | "focal", | 1044 | series, |
474 | 976 | "-k", | 1045 | "-k", |
475 | 977 | kernel_meta, | 1046 | kernel_meta, |
476 | 978 | "-p", | 1047 | "-p", |
477 | @@ -991,7 +1060,7 @@ def check_and_update_git_repo( | |||
478 | 991 | command = [ | 1060 | command = [ |
479 | 992 | "pkg-stella-meta", | 1061 | "pkg-stella-meta", |
480 | 993 | "-s", | 1062 | "-s", |
482 | 994 | "focal", | 1063 | series, |
483 | 995 | "-k", | 1064 | "-k", |
484 | 996 | kernel_meta, | 1065 | kernel_meta, |
485 | 997 | "-g", | 1066 | "-g", |
486 | @@ -1012,7 +1081,7 @@ def check_and_update_git_repo( | |||
487 | 1012 | command = [ | 1081 | command = [ |
488 | 1013 | "pkg-sutton-meta", | 1082 | "pkg-sutton-meta", |
489 | 1014 | "-s", | 1083 | "-s", |
491 | 1015 | "focal", | 1084 | series, |
492 | 1016 | "-k", | 1085 | "-k", |
493 | 1017 | kernel_meta, | 1086 | kernel_meta, |
494 | 1018 | "-g", | 1087 | "-g", |
495 | @@ -1060,10 +1129,13 @@ def check_and_update_git_repo( | |||
496 | 1060 | with open(changelog, "r") as f: | 1129 | with open(changelog, "r") as f: |
497 | 1061 | lines = f.readlines() | 1130 | lines = f.readlines() |
498 | 1062 | 1131 | ||
499 | 1132 | version = UbuntuDistroInfo().version(series).split(" ")[0] | ||
500 | 1063 | if args.release: | 1133 | if args.release: |
502 | 1064 | lines[0] = f"{pkg_name} (20.04~ubuntu1) focal; urgency=medium\n" | 1134 | lines[0] = f"{pkg_name} ({version}~ubuntu1) {series}; urgency=medium\n" |
503 | 1065 | else: | 1135 | else: |
505 | 1066 | lines[0] = f"{pkg_name} (20.04~ubuntu1) UNRELEASED; urgency=medium\n" | 1136 | lines[ |
506 | 1137 | 0 | ||
507 | 1138 | ] = f"{pkg_name} ({version}~ubuntu1) UNRELEASED; urgency=medium\n" | ||
508 | 1067 | 1139 | ||
509 | 1068 | if f"(LP: #{bug.id})" not in lines[2] and lines[2].startswith( | 1140 | if f"(LP: #{bug.id})" not in lines[2] and lines[2].startswith( |
510 | 1069 | " * Meta package for" | 1141 | " * Meta package for" |
511 | @@ -1130,7 +1202,8 @@ def check_and_update_git_repo( | |||
512 | 1130 | return True | 1202 | return True |
513 | 1131 | 1203 | ||
514 | 1132 | 1204 | ||
516 | 1133 | def read_from_template(metaPkgName, branchName, oemCodenameNogroup, deviceName): | 1205 | def read_from_template(metaPkgName, branchName, oemCodenameNogroup, deviceName, series): |
517 | 1206 | version = UbuntuDistroInfo().version(series).split(" ")[0] | ||
518 | 1134 | env = jinja2.Environment( | 1207 | env = jinja2.Environment( |
519 | 1135 | loader=jinja2.FileSystemLoader(["./", "/usr/share/oem-scripts"]) | 1208 | loader=jinja2.FileSystemLoader(["./", "/usr/share/oem-scripts"]) |
520 | 1136 | ) | 1209 | ) |
521 | @@ -1140,6 +1213,7 @@ def read_from_template(metaPkgName, branchName, oemCodenameNogroup, deviceName): | |||
522 | 1140 | branchName=branchName, | 1213 | branchName=branchName, |
523 | 1141 | oemCodenameNogroup=oemCodenameNogroup, | 1214 | oemCodenameNogroup=oemCodenameNogroup, |
524 | 1142 | deviceName=deviceName, | 1215 | deviceName=deviceName, |
525 | 1216 | version=version, | ||
526 | 1143 | ) | 1217 | ) |
527 | 1144 | 1218 | ||
528 | 1145 | 1219 | ||
529 | @@ -1148,7 +1222,13 @@ if args.subcommand: | |||
530 | 1148 | lp = login.lp | 1222 | lp = login.lp |
531 | 1149 | 1223 | ||
532 | 1150 | if args.subcommand == "create": | 1224 | if args.subcommand == "create": |
534 | 1151 | create_bug(lp, args.oemCodename, args.platformCodename, args.deviceName) | 1225 | if not args.series: |
535 | 1226 | series = lsb_release.get_os_release()["CODENAME"] | ||
536 | 1227 | else: | ||
537 | 1228 | series = args.series | ||
538 | 1229 | if not UbuntuDistroInfo().is_lts(series): | ||
539 | 1230 | series = UbuntuDistroInfo().lts() | ||
540 | 1231 | create_bug(lp, args.oemCodename, args.platformCodename, args.deviceName, series) | ||
541 | 1152 | elif args.subcommand == "update": | 1232 | elif args.subcommand == "update": |
542 | 1153 | args.json = json.load(args.json) | 1233 | args.json = json.load(args.json) |
543 | 1154 | certified = False | 1234 | certified = False |
544 | @@ -1182,6 +1262,7 @@ elif args.subcommand == "update": | |||
545 | 1182 | 1262 | ||
546 | 1183 | update_bug( | 1263 | update_bug( |
547 | 1184 | lp, | 1264 | lp, |
548 | 1265 | series=args.json["series"], | ||
549 | 1185 | bug_number=bug_number, | 1266 | bug_number=bug_number, |
550 | 1186 | yes=args.yes, | 1267 | yes=args.yes, |
551 | 1187 | certified=certified, | 1268 | certified=certified, |
552 | @@ -1220,6 +1301,7 @@ elif args.subcommand == "check": | |||
553 | 1220 | 1301 | ||
554 | 1221 | check_bug( | 1302 | check_bug( |
555 | 1222 | lp, | 1303 | lp, |
556 | 1304 | series=args.json["series"], | ||
557 | 1223 | bug_number=bug_number, | 1305 | bug_number=bug_number, |
558 | 1224 | certified=certified, | 1306 | certified=certified, |
559 | 1225 | certified_hardwares=certified_hardwares, | 1307 | certified_hardwares=certified_hardwares, |
560 | diff --git a/oem-meta-package.mir.jinja2 b/oem-meta-package.mir.jinja2 | |||
561 | index 064ec6a..6c44b08 100644 | |||
562 | --- a/oem-meta-package.mir.jinja2 | |||
563 | +++ b/oem-meta-package.mir.jinja2 | |||
564 | @@ -32,7 +32,7 @@ No CVE/known security issue. | |||
565 | 32 | 32 | ||
566 | 33 | [Quality assurance] | 33 | [Quality assurance] |
567 | 34 | I have used ppa:oem-solutions-engineers/oem-projects-meta to check this package on {{ deviceName }}. | 34 | I have used ppa:oem-solutions-engineers/oem-projects-meta to check this package on {{ deviceName }}. |
569 | 35 | {{ metaPkgName }} will be upgraded to 20.04ubuntu1 or the later version from OEM archive. | 35 | {{ metaPkgName }} will be upgraded to {{ version }}ubuntu1 or the later version from OEM archive. |
570 | 36 | 36 | ||
571 | 37 | [Dependencies] | 37 | [Dependencies] |
572 | 38 | It only depends on ubuntu-oem-keyring. | 38 | It only depends on ubuntu-oem-keyring. |
[autopkgtest] collect- credentials PASS oem-scripts- auto PASS merge-proposal PASS insteadof- setting PASS from-iso. sh PASS
autopkgtest-
autopkgtest-
pkg-somerville-meta PASS
pkg-stella-meta PASS
pkg-sutton-meta PASS
bug-bind PASS
get-private-ppa FAIL non-zero exit status 1
jq-lp PASS
launchpad-api PASS
lp-bug PASS
pkg-list PASS
review-
run-autopkgtest PASS
setup-apt-dir PASS
bootstrap-meta PASS
mir-bug PASS
oem-meta-packages PASS
git-url-
lp-dl-attm PASS
recovery-
https:/ /oem-share. canonical. com/partners/ lyoncore/ share/artifacts /oem-scripts/ oem-scripts- 1.52-27279e5- in-linux- container- jammy