Merge ~fourdollars/pc-enablement/+git/oem-scripts:master into ~oem-solutions-engineers/pc-enablement/+git/oem-scripts:master

Proposed by Shih-Yuan Lee
Status: Merged
Approved by: Shih-Yuan Lee
Approved revision: 5f2b26c9833fef47f9124fc73869a0499b654bcf
Merged at revision: 1f693f0f12cf4a0ddf0d75d43353c62b89bb19ae
Proposed branch: ~fourdollars/pc-enablement/+git/oem-scripts:master
Merge into: ~oem-solutions-engineers/pc-enablement/+git/oem-scripts:master
Diff against target: 697 lines (+559/-37)
9 files modified
bootstrap-meta (+420/-0)
debian/changelog (+14/-0)
debian/tests/bootstrap-meta (+58/-0)
debian/tests/control (+1/-0)
mir-bug (+8/-37)
oem-meta-package.sru.jinja2 (+24/-0)
oem_scripts/LaunchpadLogin.py (+3/-0)
oem_scripts/__init__.py (+30/-0)
setup.py (+1/-0)
Reviewer Review Type Date Requested Status
Yuan-Chen Cheng (community) Approve
Review via email: mp+408091@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Shih-Yuan Lee (fourdollars) wrote :

[BOT]
$ cat oem-scripts-1.12-5f2b26c-in-docker-focal-summary.log
autopkgtest-collect-credentials PASS
autopkgtest-oem-scripts-auto PASS
pkg-somerville-meta PASS
pkg-stella-meta PASS
pkg-sutton-meta PASS
bootstrap-meta PASS
bug-bind PASS
get-private-ppa PASS
jq-lp PASS
launchpad-api PASS
lp-bug PASS
oem-meta-packages PASS
pkg-list PASS
review-merge-proposal PASS
run-autopkgtest PASS
setup-apt-dir PASS
mir-bug SKIP exit status 77 and marked as skippable
git-url-insteadof-setting PASS
lp-dl-attm PASS
recovery-from-iso.sh PASS
mir-bug-verification PASS
https://paste.ubuntu.com/p/b7GVnfyvkN/ oem-scripts-1.12-5f2b26c-in-docker-focal-complete.log

Revision history for this message
Yuan-Chen Cheng (ycheng-twn) wrote :

Well, the code looks fine, however, there are some nice to have change:

1. For get meta pkg name from group and platform name, can we refactor so that it's a function call that can be re-use?

2. for project oem-priority, team name oem-solutions-engineers, ubuntu-desktop, etc, can we start to put those string into const variable, so that the source code editor will tell us we have typo.

I mean something like:

OEM_TEAM = "oem-solutions-engineers"

person=lp.people[OEM_TEAM]

3. "focal" is hardcoded, it will be easier to be changed if it's a variable.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/bootstrap-meta b/bootstrap-meta
0new file mode 1007550new file mode 100755
index 0000000..03549a3
--- /dev/null
+++ b/bootstrap-meta
@@ -0,0 +1,420 @@
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3# Copyright (C) 2021 Canonical Ltd.
4# Author: Shih-Yuan Lee (FourDollars) <sylee@canonical.com>
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 3 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20import argparse
21import collections
22import jinja2
23import json
24import oem_scripts
25import re
26
27from copy import copy
28from logging import info, warning, error
29from oem_scripts import SUBSCRIBER_LIST, TAG_LIST, remove_prefix, yes_or_ask
30from oem_scripts.LaunchpadLogin import LaunchpadLogin
31from oem_scripts.logging import setup_logging
32
33
34class BootstrapMeta(object):
35 def __init__(self, platformJson, lp, kernel_meta):
36 self.kernel_meta = kernel_meta
37 self.lp = lp
38 self.json = json.load(platformJson)
39 self.project = self.json["project"]
40 self.group = self.json["group"]
41 self.platform = self.json["platform"]
42
43 if self.json["project"] == "somerville":
44 self.meta = "oem-somerville-" + self.json["platform"] + "-meta"
45 elif self.json["project"] == "stella":
46 self.meta = (
47 "oem-stella."
48 + self.json["group"]
49 + "."
50 + self.json["platform"]
51 + "-meta"
52 )
53 elif self.json["project"] == "sutton":
54 self.meta = (
55 "oem-sutton."
56 + self.json["group"]
57 + "."
58 + self.json["platform"]
59 + "-meta"
60 )
61 else:
62 raise Exception("Not supported")
63
64 def create_bug(self, title, description, importance, status):
65 project = lp.projects["oem-priority"]
66 bug = self.lp.bugs.createBug(
67 description=description,
68 target=project,
69 title=title,
70 information_type="Public",
71 tags=TAG_LIST,
72 )
73 info("meta package public bug: " + bug.web_link)
74
75 for task in bug.bug_tasks:
76 task.status = status
77 task.importance = importance
78 # Assign to reporter by default
79 task.assignee = lp.me
80 task.lp_save()
81
82 # Subscribe the oem-solutions-engineers
83 bug.subscribe(person=lp.people["oem-solutions-engineers"])
84 bug.lp_save()
85
86 return bug
87
88 def _grouping_market_names(self, market_names: list, maxsplit=1) -> str:
89 # Remove empty item
90 while "" in market_names:
91 market_names.remove("")
92 tmp = collections.defaultdict(list)
93 space_in_model = False
94 try:
95 for market_name in sorted(market_names):
96 if maxsplit == 1:
97 name, model = market_name.split(maxsplit=maxsplit)
98 tmp[name].append(model)
99 if " " in model:
100 space_in_model = True
101 elif maxsplit == 2:
102 brand, name, model = market_name.split(maxsplit=maxsplit)
103 tmp[brand + " " + name].append(model)
104 if " " in model:
105 space_in_model = True
106 except ValueError:
107 return ", ".join(sorted(market_names))
108
109 if space_in_model:
110 return ", ".join(
111 f"{name} {', '.join(models)}" for name, models in tmp.items()
112 )
113 else:
114 return ", ".join(
115 f"{name} {'/'.join(models)}" for name, models in tmp.items()
116 )
117
118 def parse_market_name(self):
119 if self.project == "somerville":
120 self.market_name = self._grouping_market_names(self.json["productnames"])
121 if not self.market_name.startswith("Dell "):
122 self.market_name = "Dell " + self.market_name
123 elif self.project == "stella":
124 self.market_name = self._grouping_market_names(
125 self.json["productnames"], maxsplit=2
126 )
127 self.market_name = remove_prefix(self.market_name, "HP ")
128 if not self.market_name.startswith("HP "):
129 self.market_name = "HP " + self.market_name
130 elif self.project == "sutton":
131 self.market_name = self._grouping_market_names(self.json["productnames"])
132 if not self.market_name.startswith("Lenovo "):
133 self.market_name = "Lenovo " + self.market_name
134 else:
135 raise Exception("Not supported")
136
137
138class BootstrapMetaMIR(BootstrapMeta):
139 def __init__(self, platformJson, lp, kernel_meta):
140 super().__init__(platformJson, lp, kernel_meta)
141
142 def _read_from_template(self, marketName, oemMetaPackage, kernelMeta):
143 env = jinja2.Environment(
144 loader=jinja2.FileSystemLoader(["./", "/usr/share/oem-scripts"])
145 )
146 template = env.get_template("oem-meta-package.mir.jinja2")
147 return template.render(
148 metaPkgName=self.market_name,
149 branchName=self.branch,
150 oemCodenameNogroup=self.project,
151 deviceName=self.device_name,
152 )
153
154 def create(self):
155 title = f"[DRAFT][MIR] {self.meta}"
156 description = "[DRAFT]" + self._read_from_template()
157 super().create_bug(
158 title, description, importance="Critical", status="Confirmed"
159 )
160
161 def update(self):
162 pass
163
164
165class BootstrapMetaSRU(BootstrapMeta):
166 def __init__(self, platformJson, lp, kernel_meta, output):
167 super().__init__(platformJson, lp, kernel_meta)
168 self.parse_market_name()
169 self.pattern = re.compile(
170 rf".*Update the hardware support for .* in {self.meta}.*"
171 )
172 self.output = output
173
174 def _read_from_template(self):
175 env = jinja2.Environment(
176 loader=jinja2.FileSystemLoader(["./", "/usr/share/oem-scripts"])
177 )
178 template = env.get_template("oem-meta-package.sru.jinja2")
179 return template.render(
180 marketName=self.market_name,
181 oemMetaPackage=self.meta,
182 kernelMeta=self.kernel_meta,
183 )
184
185 def create(self, importance="High", status="Confirmed"):
186 project = lp.projects[f"ubuntu/focal/+source/{self.meta}"]
187 tasks = project.searchTasks()
188 for task in tasks:
189 bug = task.bug
190 if self.pattern.match(bug.title):
191 if self.output:
192 self.output.write(f"{bug.id}\n")
193 if lp.service_root != "https://api.launchpad.net/":
194 error(f'{bug.web_link} - "{bug.title}" has been created.')
195 else:
196 error(f'LP: #{bug.id} - "{bug.title}" has been created.')
197 exit(1)
198 title = (
199 f"[DRAFT] Update the hardware support for {self.market_name} in {self.meta}"
200 )
201 description = "[DRAFT]" + self._read_from_template()
202 bug = super().create_bug(
203 title, description, importance=importance, status=status
204 )
205 if self.output:
206 self.output.write(f"{bug.id}\n")
207 task = bug.addTask(target=lp.projects[f"ubuntu/+source/{self.meta}"])
208 task.status = "Won't Fix"
209 task.lp_save()
210 task = bug.addTask(target=lp.projects[f"ubuntu/focal/+source/{self.meta}"])
211 task.status = status
212 task.importance = importance
213 task.assignee = lp.me
214 task.lp_save()
215
216 def update(self, release=False, ready=False, yes=False):
217 project = lp.projects[f"ubuntu/focal/+source/{self.meta}"]
218 tasks = project.searchTasks()
219 candidate = None
220 for task in tasks:
221 bug = task.bug
222 if self.pattern.match(bug.title):
223 if yes_or_ask(
224 yes,
225 f'Do you want to update LP: #{bug.id} - "{bug.title}" for {self.kernel_meta}?',
226 ):
227 candidate = bug
228
229 if candidate is None:
230 warning("Please use create-sru-bug to create the SRU bug first.")
231 exit(1)
232 else:
233 bug = candidate
234 if self.output:
235 self.output.write(f"{bug.id}\n")
236
237 bug.title = f"Update the hardware support for {self.market_name} in {self.meta}"
238 bug.description = self._read_from_template()
239 bug.lp_save()
240
241 subscriptions = list(map(lambda x: x.person.name, bug.subscriptions))
242 tags = copy(bug.tags)
243 if ready or release:
244 for subscriber in SUBSCRIBER_LIST:
245 if subscriber not in subscriptions:
246 bug.subscribe(person=lp.people[subscriber])
247 if "oem-solutions-engineers" not in subscriptions:
248 bug.subscribe(person=lp.people["oem-solutions-engineers"])
249 if release:
250 if "oem-done-upload" not in tags:
251 tags.append("oem-done-upload")
252 if "oem-needs-upload" in tags:
253 tags.remove("oem-needs-upload")
254 if "ubuntu-desktop" not in subscriptions:
255 bug.subscribe(person=lp.people["ubuntu-desktop"])
256 if "ubuntu-sponsors" in subscriptions:
257 bug.unsubscribe(person=lp.people["ubuntu-sponsors"])
258 if "ubuntu-sru" not in subscriptions:
259 bug.subscribe(person=lp.people["ubuntu-sru"])
260 elif ready:
261 if "oem-done-upload" in tags:
262 tags.remove("oem-done-upload")
263 if "oem-needs-upload" not in tags:
264 tags.append("oem-needs-upload")
265 if "ubuntu-desktop" not in subscriptions:
266 bug.subscribe(person=lp.people["ubuntu-desktop"])
267 if "ubuntu-sponsors" not in subscriptions:
268 bug.subscribe(person=lp.people["ubuntu-sponsors"])
269 if "ubuntu-sru" in subscriptions:
270 bug.unsubscribe(person=lp.people["ubuntu-sru"])
271 else:
272 if "oem-done-upload" in tags:
273 tags.remove("oem-done-upload")
274 if "oem-needs-upload" in tags:
275 tags.remove("oem-needs-upload")
276 if "ubuntu-desktop" in subscriptions:
277 bug.unsubscribe(person=lp.people["ubuntu-desktop"])
278 if "ubuntu-sponsors" in subscriptions:
279 bug.unsubscribe(person=lp.people["ubuntu-sponsors"])
280 if "ubuntu-sru" in subscriptions:
281 bug.unsubscribe(person=lp.people["ubuntu-sru"])
282 for tag in bug.tags:
283 if tag.startswith("oem-scripts-"):
284 if tag[len("oem-scripts-") :] != oem_scripts.__version__:
285 tags.remove(tag)
286 for tag in TAG_LIST:
287 if tag not in tags:
288 tags.append(tag)
289 bug.tags = tags
290 bug.lp_save()
291
292 for task in bug.bug_tasks:
293 if (
294 task.bug_target_name == "oem-priority"
295 or task.bug_target_name == "oem-somerville-varys-meta (Ubuntu Focal)"
296 ):
297 if release:
298 task.status = "In Progress"
299 elif ready:
300 task.status = "Triaged"
301 else:
302 task.status = "Confirmed"
303 elif task.bug_target_name == "oem-somerville-varys-meta (Ubuntu)":
304 task.status = "Won't Fix"
305 task.lp_save()
306
307 if lp.service_root != "https://api.launchpad.net/":
308 info(f'{bug.web_link} - "{bug.title}" has been updated.')
309 else:
310 info(f'LP: #{bug.id} - "{bug.title}" has been updated.')
311
312
313parser = argparse.ArgumentParser(
314 formatter_class=argparse.RawDescriptionHelpFormatter,
315 epilog="""
316examples:
317 bootstrap-meta create-mir-bug platformJSON [WIP]
318 bootstrap-meta update-mir-bug platformJSON [WIP]
319 bootstrap-meta update-mir-git platformJSON [WIP]
320 bootstrap-meta create-sru-bug platformJSON [--kernel linux-generic-hwe-20.04]
321 bootstrap-meta update-sru-bug platformJSON [--kernel linux-generic-hwe-20.04] [--yes] [--ready|--release]
322 bootstrap-meta update-sru-git platformJSON [WIP]""",
323)
324
325parser.add_argument("-d", "--debug", help="print debug messages", action="store_true")
326parser.add_argument(
327 "-q", "--quiet", help="Don't print info messages", action="store_true"
328)
329
330subparsers = parser.add_subparsers(dest="subcommand")
331
332create_mir_bug = subparsers.add_parser("create-mir-bug", help="[-h] platformJSON")
333create_mir_bug.add_argument(
334 "json",
335 help="Specify the platform json of the OEM metapackage.",
336 type=argparse.FileType("r", encoding="UTF-8"),
337)
338
339update_mir_bug = subparsers.add_parser("update-mir-bug", help="[-h] platformJSON")
340update_mir_bug.add_argument(
341 "json",
342 help="Specify the platform json of the OEM metapackage.",
343 type=argparse.FileType("r", encoding="UTF-8"),
344)
345
346create_sru_bug = subparsers.add_parser("create-sru-bug", help="[-h] platformJSON")
347create_sru_bug.add_argument(
348 "json",
349 help="Specify the platform json of the OEM metapackage in Ubuntu archive.",
350 type=argparse.FileType("r", encoding="UTF-8"),
351)
352create_sru_bug.add_argument(
353 "--kernel",
354 default="linux-generic-hwe-20.04",
355 help="Specify the kernel meta of the OEM metapackage that is targeting on.",
356)
357create_sru_bug.add_argument(
358 "-o",
359 "--output",
360 help="Specify a file name to write the bug number.",
361 type=argparse.FileType("w", encoding="UTF-8"),
362)
363
364update_sru_bug = subparsers.add_parser(
365 "update-sru-bug",
366 help="[-h] platformJSON [--kernel linux-generic-hwe-20.04] [--yes] [--ready|--release]",
367)
368update_sru_bug.add_argument(
369 "json",
370 help="Specify the platform json of the OEM metapackage in Ubuntu archive.",
371 type=argparse.FileType("r", encoding="UTF-8"),
372)
373update_sru_bug.add_argument(
374 "--kernel",
375 default="linux-generic-hwe-20.04",
376 help="Specify the kernel meta of the OEM metapackage that is targeting on.",
377)
378update_sru_bug.add_argument(
379 "--release",
380 action="store_true",
381 help="Update the bug when the OEM metapackage has been uploaded into the queue for releasing.",
382)
383update_sru_bug.add_argument(
384 "--ready",
385 action="store_true",
386 help="Update the bug when the OEM metapackage is ready to upload.",
387)
388update_sru_bug.add_argument(
389 "--yes", help="Say yes for all prompts.", action="store_true"
390)
391update_sru_bug.add_argument(
392 "-o",
393 "--output",
394 help="Specify a file name to write the bug number.",
395 type=argparse.FileType("w", encoding="UTF-8"),
396)
397
398args = parser.parse_args()
399setup_logging(debug=args.debug, quiet=args.quiet)
400
401if args.subcommand:
402 login = LaunchpadLogin()
403 lp = login.lp
404 lp.service_root = login.service_root
405 lp.service_version = login.service_version
406
407# if args.subcommand == "create-mir-bug":
408# mirbug = BootstrapMetaMIR(args.json, lp, args.kernel)
409# mirbug.create()
410# elif args.subcommand == "update-mir-bug":
411# mirbug = BootstrapMetaMIR(args.json, lp, args.kernel)
412# mirbug.update()
413if args.subcommand == "create-sru-bug":
414 srubug = BootstrapMetaSRU(args.json, lp, args.kernel, args.output)
415 srubug.create()
416elif args.subcommand == "update-sru-bug":
417 srubug = BootstrapMetaSRU(args.json, lp, args.kernel, args.output)
418 srubug.update(release=args.release, ready=args.ready, yes=args.yes)
419else:
420 parser.print_help()
diff --git a/debian/changelog b/debian/changelog
index 4896fc6..6ef7544 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,17 @@
1oem-scripts (1.12) UNRELEASED; urgency=medium
2
3 * bootstrap-meta,
4 debian/tests/bootstrap-meta,
5 debian/tests/control,
6 mir-bug,
7 oem-meta-package.sru.jinja2,
8 oem_scripts/LaunchpadLogin.py,
9 oem_scripts/__init__.py,
10 setup.py: Add the bootstrap-meta tool to deal with OEM metapackages SRU
11 bugs.
12
13 -- Shih-Yuan Lee (FourDollars) <sylee@canonical.com> Thu, 02 Sep 2021 14:55:10 +0800
14
1oem-scripts (1.11) focal; urgency=medium15oem-scripts (1.11) focal; urgency=medium
216
3 * debian/control,17 * debian/control,
diff --git a/debian/tests/bootstrap-meta b/debian/tests/bootstrap-meta
4new file mode 10064418new file mode 100644
index 0000000..f0ec33f
--- /dev/null
+++ b/debian/tests/bootstrap-meta
@@ -0,0 +1,58 @@
1#!/bin/bash
2
3set -euo pipefail
4IFS=$'\n\t'
5
6export LAUNCHPAD_API="https://api.staging.launchpad.net/"
7
8cat > fossa-varys.json <<ENDLINE
9{
10 "group": "",
11 "platform": "varys",
12 "productnames": [
13 "Precision 5550"
14 ],
15 "project": "somerville"
16}
17ENDLINE
18
19cleanup() {
20 echo "= cleanup ="
21 if [ -f "bugid" ]; then
22 BUG_ID=$(cat bugid)
23 rm bugid
24 fi
25 if [ -f "$BUG_ID.json" ]; then
26 jq -C -S < "$BUG_ID.json"
27 rm "$BUG_ID.json"
28 lp-bug cleanup --yes "$BUG_ID"
29 fi
30}
31
32trap cleanup EXIT INT TERM
33
34bootstrap-meta create-sru-bug fossa-varys.json --kernel linux-oem-20.04 --output bugid
35BUG_ID=$(cat bugid)
36launchpad-api get "bugs/$BUG_ID" > "$BUG_ID.json"
37jq -r .description < "$BUG_ID.json" | grep "Precision 5550"
38jq -r .description < "$BUG_ID.json" | grep linux-oem-20.04
39jq -r '.tags|join(" ")' < "$BUG_ID.json" | grep oem-meta-packages
40
41if bootstrap-meta create-sru-bug fossa-varys.json --kernel linux-oem-20.04 --output bugid; then
42 echo "It is expected to return failed."
43 exit 1
44fi
45
46bootstrap-meta update-sru-bug fossa-varys.json --kernel linux-oem-20.04b --yes
47launchpad-api get "bugs/$BUG_ID" > "$BUG_ID.json"
48jq -r .description < "$BUG_ID.json" | grep linux-oem-20.04b
49
50bootstrap-meta update-sru-bug fossa-varys.json --kernel linux-oem-20.04c --yes --ready
51launchpad-api get "bugs/$BUG_ID" > "$BUG_ID.json"
52jq -r .description < "$BUG_ID.json" | grep linux-oem-20.04c
53jq -r '.tags|join(" ")' < "$BUG_ID.json" | grep oem-needs-upload
54
55bootstrap-meta update-sru-bug fossa-varys.json --kernel linux-oem-20.04d --yes --release
56launchpad-api get "bugs/$BUG_ID" > "$BUG_ID.json"
57jq -r .description < "$BUG_ID.json" | grep linux-oem-20.04d
58jq -r '.tags|join(" ")' < "$BUG_ID.json" | grep oem-done-upload
diff --git a/debian/tests/control b/debian/tests/control
index 1f9da74..a9a549d 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -10,6 +10,7 @@ Tests:
10Depends: @, ubuntu-dev-tools, git-buildpackage10Depends: @, ubuntu-dev-tools, git-buildpackage
1111
12Tests:12Tests:
13 bootstrap-meta,
13 bug-bind,14 bug-bind,
14 get-private-ppa,15 get-private-ppa,
15 jq-lp,16 jq-lp,
diff --git a/mir-bug b/mir-bug
index d90e130..be49cb3 100755
--- a/mir-bug
+++ b/mir-bug
@@ -33,23 +33,17 @@ import subprocess
33from copy import copy33from copy import copy
34from glob import glob34from glob import glob
35from logging import debug, info, warning, error, critical35from logging import debug, info, warning, error, critical
36from oem_scripts import (
37 SUBSCRIBER_LIST,
38 TAG_LIST,
39 ALLOWED_KERNEL_META_LIST,
40 remove_prefix,
41 yes_or_ask,
42)
36from oem_scripts.LaunchpadLogin import LaunchpadLogin43from oem_scripts.LaunchpadLogin import LaunchpadLogin
37from oem_scripts.logging import setup_logging44from oem_scripts.logging import setup_logging
38from tempfile import TemporaryDirectory45from tempfile import TemporaryDirectory
3946
40ALLOWED_KERNEL_META_LIST = (
41 "linux-oem-20.04c",
42 "linux-oem-20.04b",
43 "linux-oem-20.04",
44 "linux-generic-hwe-20.04",
45)
46SUBSCRIBER_LIST = ("oem-solutions-engineers", "ubuntu-sponsors", "ubuntu-desktop")
47TAG_LIST = [
48 "oem-meta-packages",
49 "oem-priority",
50 f"oem-scripts-{oem_scripts.__version__}",
51]
52
53parser = argparse.ArgumentParser(47parser = argparse.ArgumentParser(
54 formatter_class=argparse.RawDescriptionHelpFormatter,48 formatter_class=argparse.RawDescriptionHelpFormatter,
55 epilog="""49 epilog="""
@@ -154,11 +148,6 @@ setup_logging(debug=args.debug, quiet=args.quiet)
154pattern = re.compile(r".*\[MIR\]\W*oem-([^-]*)-(.*)-meta\W*")148pattern = re.compile(r".*\[MIR\]\W*oem-([^-]*)-(.*)-meta\W*")
155149
156150
157# Python 3.9 supports this.
158def remove_prefix(s, prefix):
159 return s[len(prefix) :] if s.startswith(prefix) else s
160
161
162def _grouping_market_names(market_names: list, maxsplit=1) -> str:151def _grouping_market_names(market_names: list, maxsplit=1) -> str:
163 # Remove empty item152 # Remove empty item
164 while "" in market_names:153 while "" in market_names:
@@ -345,20 +334,6 @@ def collect_bugs(lp, output):
345 output.write("\n")334 output.write("\n")
346335
347336
348def yes_or_ask(yes: bool, message: str) -> bool:
349 if yes:
350 print(f"> \033[1;34m{message}\033[1;0m (y/n) y")
351 return True
352 while True:
353 res = input(f"> \033[1;34m{message}\033[1;0m (y/n) ").lower()
354 if res not in {"y", "n"}:
355 continue
356 if res == "y":
357 return True
358 else:
359 return False
360
361
362def update_bug(337def update_bug(
363 lp,338 lp,
364 bug_number: int,339 bug_number: int,
@@ -713,11 +688,7 @@ def check_and_update_bug_subscriptions(lp, bug, update=False, yes=False) -> bool
713 else:688 else:
714 result = False689 result = False
715 if args.ready:690 if args.ready:
716 for subscriber in (691 for subscriber in SUBSCRIBER_LIST:
717 "oem-solutions-engineers",
718 "ubuntu-sponsors",
719 "ubuntu-desktop",
720 ):
721 if subscriber not in subscriptions:692 if subscriber not in subscriptions:
722 error(f"'{subscriber}' is not in the subscriptions.")693 error(f"'{subscriber}' is not in the subscriptions.")
723 if update and yes_or_ask(694 if update and yes_or_ask(
diff --git a/oem-meta-package.sru.jinja2 b/oem-meta-package.sru.jinja2
724new file mode 100644695new file mode 100644
index 0000000..88f8661
--- /dev/null
+++ b/oem-meta-package.sru.jinja2
@@ -0,0 +1,24 @@
1[Impact]
2
3 * It should have no impact at all because these changes shall have been applied and verified in the corresponding OEM archive before this SRU process.
4
5[Test Plan]
6
7* Install Ubuntu 20.04.x LTS on {{ marketName }} and remove {{ oemMetaPackage }} manually if any.
8
9 * Enable focal-proposed and execute the update-manager.
10
11 * The update-manager should show "Hardware support for {{ marketName }}". If not, please change "When there are security updates" and "When there are other updates" in the Updates of software-properties-gtk to "Display immediately", install the older firefox by `sudo apt install firefox=75.0+build3-0ubuntu1` and reboot the system to wait for the update-manager pop up automatically.
12
13 * After it installed {{ oemMetaPackage }} by update-manager and reboot the system, you should see the system booting from the {{ kernelMeta }} kernel.
14
15[Where problems could occur]
16
17 * {{ oemMetaPackage }} is installed but it is not updated to the version in the corresponding OEM archive.
18
19 * The update-manager didn't show "Hardware support for {{ marketName }}" at all.
20
21[Other Info]
22
23 * You can see all {{ oemMetaPackage }} versions on https://people.ubuntu.com/~fourdollars/oem-meta-packages/.
24 * I have used ppa:oem-solutions-engineers/oem-projects-meta to verify it before this SRU process.
diff --git a/oem_scripts/LaunchpadLogin.py b/oem_scripts/LaunchpadLogin.py
index 01bae8b..d2fa68e 100644
--- a/oem_scripts/LaunchpadLogin.py
+++ b/oem_scripts/LaunchpadLogin.py
@@ -67,6 +67,9 @@ class LaunchpadLogin:
67 else:67 else:
68 service_root = "production"68 service_root = "production"
6969
70 self.service_root = lookup_service_root(service_root)
71 self.service_version = version
72
70 oem_scripts_config_ini = os.path.join(73 oem_scripts_config_ini = os.path.join(
71 os.environ["HOME"], ".config/oem-scripts/config.ini"74 os.environ["HOME"], ".config/oem-scripts/config.ini"
72 )75 )
diff --git a/oem_scripts/__init__.py b/oem_scripts/__init__.py
index 2bfacd2..4052759 100644
--- a/oem_scripts/__init__.py
+++ b/oem_scripts/__init__.py
@@ -1 +1,31 @@
1__version__ = "1.11"1__version__ = "1.11"
2
3ALLOWED_KERNEL_META_LIST = (
4 "linux-oem-20.04c",
5 "linux-oem-20.04b",
6 "linux-oem-20.04",
7 "linux-generic-hwe-20.04",
8)
9
10SUBSCRIBER_LIST = ("oem-solutions-engineers", "ubuntu-sponsors", "ubuntu-desktop")
11
12TAG_LIST = ["oem-meta-packages", "oem-priority", f"oem-scripts-{__version__}"]
13
14
15# Python 3.9 supports this.
16def remove_prefix(s, prefix):
17 return s[len(prefix) :] if s.startswith(prefix) else s
18
19
20def yes_or_ask(yes: bool, message: str) -> bool:
21 if yes:
22 print(f"> \033[1;34m{message}\033[1;0m (y/n) y")
23 return True
24 while True:
25 res = input(f"> \033[1;34m{message}\033[1;0m (y/n) ").lower()
26 if res not in {"y", "n"}:
27 continue
28 if res == "y":
29 return True
30 else:
31 return False
diff --git a/setup.py b/setup.py
index 81004d7..ace90b3 100644
--- a/setup.py
+++ b/setup.py
@@ -34,6 +34,7 @@ Also there is a meta package oem-dev-tools that installs all scripts""",
34 author="Commercial Engineering",34 author="Commercial Engineering",
35 author_email="commercial-engineering@canonical.com",35 author_email="commercial-engineering@canonical.com",
36 scripts=[36 scripts=[
37 "bootstrap-meta",
37 "copyPackage.py",38 "copyPackage.py",
38 "get-oem-auth-token",39 "get-oem-auth-token",
39 "get-oemshare-auth-token",40 "get-oemshare-auth-token",

Subscribers

People subscribed via source and target branches