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: 3f33426c317f99278ac89eca0cef0f912ebead14
Merged at revision: 9a489264948e2c59ec5e4839a8316dad2993451f
Proposed branch: ~fourdollars/pc-enablement/+git/oem-scripts:master
Merge into: ~oem-solutions-engineers/pc-enablement/+git/oem-scripts:master
Diff against target: 314 lines (+146/-14)
3 files modified
debian/changelog (+9/-0)
mir-bug (+23/-2)
oem-meta-packages (+114/-12)
Reviewer Review Type Date Requested Status
Yuan-Chen Cheng (community) Approve
Review via email: mp+405748@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.3-3f33426-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
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
recovery-from-iso.sh PASS
mir-bug-verification PASS
https://paste.ubuntu.com/p/FQ5jycshjc/ oem-scripts-1.3-3f33426-in-docker-focal-complete.log

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

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 54a674e..386b56b 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,12 @@
6+oem-scripts (1.3) UNRELEASED; urgency=medium
7+
8+ * oem-meta-packages: Collect the market name in every stage.
9+ * oem-meta-packages: Get all needed information in BootstrapFromPPA.
10+ * mir-bug: Import the words from
11+ https://wiki.ubuntu.com/StableReleaseUpdates/OEMMeta.
12+
13+ -- Shih-Yuan Lee (FourDollars) <sylee@canonical.com> Thu, 15 Jul 2021 17:10:26 +0800
14+
15 oem-scripts (1.2) focal; urgency=medium
16
17 * pkg-oem-meta: Add the market name support.
18diff --git a/mir-bug b/mir-bug
19index 8897fec..37f38fc 100755
20--- a/mir-bug
21+++ b/mir-bug
22@@ -143,8 +143,29 @@ args = parser.parse_args()
23 setup_logging(debug=args.debug, quiet=args.quiet)
24
25 mir_bug_description_template = Template(
26- f"""[Availability]
27-This is a meta package for https://wiki.ubuntu.com/MIRTeam/Exceptions/OEM that means the package doesn't exist in Debian or Ubuntu archive yet.
28+ f"""[Background]
29+
30+Please see https://wiki.ubuntu.com/MIRTeam/Exceptions/OEM and https://wiki.ubuntu.com/StableReleaseUpdates/OEMMeta for details.
31+
32+[Impact]
33+
34+ 1. Upgrade path: Users will be upgrading from a package in the associated OEM archive, not the Ubuntu archive.
35+ 2. The background and impact of the situation for this change, and it's impact.
36+
37+[Testing]
38+
39+ 1. Test that `ubuntu-drivers list-oem` lists the meta-package on the relevant hardware
40+ 2. Test that fully installing the meta-package (upgrading to the OEM archive if relevant) works properly on the hardware
41+ 3. Do an offline install. Boot the system. Run update-manager. Check that an upgrade to the OEM package is offered and that it completes successfully and the hardware works properly.
42+
43+[Regression Potential]
44+
45+Most potential regressions will live in the package set that will be installed via dependency of this package, which live in OEM archive (outside of Ubuntu) and control by OEM team. OEM team and other corresponding team need take responsibility of those dependency installed.
46+
47+[When switching kernel flavour] Check that the new kernel flavour works on the target platform.
48+
49+[Availability]
50+This is another OEM metapackage that means the package doesn't exist in Debian or Ubuntu archive yet.
51 The source code of the $metaPkgName for focal:
52 git clone -b $branchName https://git.launchpad.net/~oem-solutions-engineers/pc-enablement/+git/oem-$oemCodenameNogroup-projects-meta
53
54diff --git a/oem-meta-packages b/oem-meta-packages
55index 72d6048..ad37f43 100755
56--- a/oem-meta-packages
57+++ b/oem-meta-packages
58@@ -85,6 +85,7 @@ class PkgData(BaseModel):
59 kernel_flavour: str
60 kernel_meta: str
61 fingerprint: str
62+ market_name: str
63
64
65 class BootstrapGroup(BaseModel):
66@@ -109,7 +110,11 @@ class PkgInfo(BaseModel):
67 new_desc: str
68
69
70-pattern = re.compile(r"oem-([^-]*)-(.*)-meta")
71+meta_pattern = re.compile(r"oem-([^-]*)-(.*)-meta")
72+market_name_pattern = re.compile(
73+ r"Description.*: hardware support for (Dell|HP|Lenovo) (.*)"
74+)
75+
76 parser = argparse.ArgumentParser(
77 formatter_class=argparse.RawDescriptionHelpFormatter,
78 epilog="""
79@@ -827,10 +832,11 @@ class OemMetaPkgInfo(metaclass=ABCMeta):
80 self.kernel_flavour = ""
81 self.kernel_meta = ""
82 self.fingerprint = ""
83+ self.market_name = ""
84 self.parse_meta_name()
85 self.get_info()
86 info(
87- f"{self.__class__.__name__} ({self.version}, {self.kernel_flavour}, {self.kernel_meta}, {self.archive})"
88+ f"{self.__class__.__name__} ({self.version}, {self.kernel_flavour}, {self.kernel_meta}, {self.archive}, {self.market_name})"
89 )
90
91 def get_data(self):
92@@ -841,11 +847,12 @@ class OemMetaPkgInfo(metaclass=ABCMeta):
93 kernel_flavour=self.kernel_flavour,
94 kernel_meta=self.kernel_meta,
95 fingerprint=self.fingerprint,
96+ market_name=self.market_name,
97 )
98 return self.pkg_data
99
100 def parse_meta_name(self):
101- result = pattern.match(self.meta)
102+ result = meta_pattern.match(self.meta)
103 if not result:
104 raise Exception(f"oem-([^-]*)-(.*)-meta is not matched to {self.meta}")
105 if "." in result.group(1):
106@@ -862,6 +869,19 @@ class OemMetaPkgInfo(metaclass=ABCMeta):
107 self.ubuntu_branch = f"{self.platform}-focal-ubuntu"
108 self.oem_branch = f"{self.platform}-focal-oem"
109
110+ @classmethod
111+ def get_market_name(cls, control):
112+ if type(control) is str:
113+ control = control.split("\n")
114+ for line in control:
115+ if line.startswith("Description:") or line.startswith("Description-en:"):
116+ if (
117+ "Dell" in line or "HP" in line or "Lenovo" in line
118+ ) and "(factory)" not in line:
119+ result = market_name_pattern.match(line.strip())
120+ return result.group(2)
121+ return ""
122+
123 @abstractmethod
124 def get_info(self):
125 raise NotImplementedError("Must override get_info()")
126@@ -918,6 +938,10 @@ class BootstrapFromGit(OemMetaPkgInfo):
127 exit(1)
128 else:
129 self.kernel_meta = ""
130+
131+ with open("control") as control:
132+ self.market_name = self.get_market_name(control)
133+
134 if bootstrap_kernel_flavour == "XB-Ubuntu-OEM-Kernel-Flavour: oem":
135 self.kernel_flavour = "oem"
136 elif bootstrap_kernel_flavour == "XB-Ubuntu-OEM-Kernel-Flavour: default":
137@@ -931,15 +955,69 @@ class BootstrapFromGit(OemMetaPkgInfo):
138 class BootstrapFromPPA(OemMetaPkgInfo):
139 def get_info(self):
140 self.archive = "ppa:canonical-oem-metapackage-uploaders/oem-metapackage-staging"
141- self.version = "WIP"
142- self.kernel_flavour = "WIP"
143- self.kernel_meta = "WIP"
144+ self.fingerprint = "EA7BFBE3B33B9D51D225430EC83677AEDFC29884"
145+ with TemporaryDirectory() as tmpdir:
146+ _run_command(
147+ [
148+ "setup-apt-dir.sh",
149+ "-c",
150+ "focal",
151+ "--ppa",
152+ self.archive,
153+ "--disable-base",
154+ "--disable-updates",
155+ "--disable-backports",
156+ "--apt-dir",
157+ tmpdir,
158+ ],
159+ silent=True,
160+ )
161+ self.get_version(tmpdir)
162+ self.get_kernel_flavour_meta(tmpdir)
163
164- def get_version_archive(self):
165- pass
166+ def get_version(self, tmpdir):
167+ ppa_version = ""
168+ output, _, _ = _run_command(
169+ ["pkg-list", "--long", "--apt-dir", tmpdir, self.meta],
170+ returncode=(0, 1),
171+ silent=True,
172+ )
173+ for line in output.split("\n"):
174+ if self.meta in line and "http://ppa.launchpad.net/ubuntu" in line:
175+ ppa_version = line.split(" ")[1]
176+ break
177+ self.version = ppa_version
178
179- def get_kernel_flavour_meta(self):
180- pass
181+ def get_kernel_flavour_meta(self, tmpdir):
182+ output, _, returncode = _run_command(
183+ [
184+ "apt-cache",
185+ "-o",
186+ f"Dir={tmpdir}",
187+ "-o",
188+ f"Dir::State::status={tmpdir}/var/lib/dpkg/status",
189+ "show",
190+ f"{self.meta}={self.version}",
191+ ],
192+ returncode=(0, 100),
193+ silent=True,
194+ )
195+
196+ if returncode == 100:
197+ return
198+
199+ self.market_name = self.get_market_name(output)
200+
201+ for line in output.split("\n"):
202+ if line.startswith("Ubuntu-Oem-Kernel-Flavour:"):
203+ self.kernel_flavour = line.split(" ")[1]
204+ if line.startswith("Depends:"):
205+ for kernel_meta in ALLOWED_KERNEL_META_LIST:
206+ if kernel_meta in line:
207+ error(
208+ f"{self.meta}'s debian/control in Ubuntu archive should not depend on {kernel_meta}."
209+ )
210+ exit(1)
211
212
213 class BootstrapFromProposedArchive(OemMetaPkgInfo):
214@@ -991,8 +1069,12 @@ class BootstrapFromProposedArchive(OemMetaPkgInfo):
215 returncode=(0, 100),
216 silent=True,
217 )
218+
219 if returncode == 100:
220 return
221+
222+ self.market_name = self.get_market_name(output)
223+
224 for line in output.split("\n"):
225 if line.startswith("Ubuntu-Oem-Kernel-Flavour:"):
226 self.kernel_flavour = line.split(" ")[1]
227@@ -1050,8 +1132,12 @@ class BootstrapFromUbuntuArchive(OemMetaPkgInfo):
228 returncode=(0, 100),
229 silent=True,
230 )
231+
232 if returncode == 100:
233 return
234+
235+ self.market_name = self.get_market_name(output)
236+
237 for line in output.split("\n"):
238 if line.startswith("Ubuntu-Oem-Kernel-Flavour:"):
239 self.kernel_flavour = line.split(" ")[1]
240@@ -1113,6 +1199,9 @@ class OemFromGit(OemMetaPkgInfo):
241 f"{self.project} {self.oem_branch} The kernel meta doesn't exist or it is not in the allowed list."
242 )
243
244+ with open("control") as control:
245+ self.market_name = self.get_market_name(control)
246+
247 if oem_kernel_flavour == "XB-Ubuntu-OEM-Kernel-Flavour: oem":
248 self.kernel_flavour = "oem"
249 elif oem_kernel_flavour == "XB-Ubuntu-OEM-Kernel-Flavour: default":
250@@ -1204,6 +1293,7 @@ class OemFromPPA(OemMetaPkgInfo):
251 ],
252 silent=True,
253 )
254+
255 output, _, returncode = _run_command(
256 [
257 "apt-cache",
258@@ -1217,8 +1307,12 @@ class OemFromPPA(OemMetaPkgInfo):
259 returncode=(0, 100),
260 silent=True,
261 )
262+
263 if returncode == 100:
264 return
265+
266+ self.market_name = self.get_market_name(output)
267+
268 for line in output.split("\n"):
269 if line.startswith("Ubuntu-Oem-Kernel-Flavour:"):
270 self.kernel_flavour = line.split(" ")[1]
271@@ -1346,8 +1440,12 @@ class OemFromPrivateArchive(OemMetaPkgInfo):
272 returncode=(0, 100),
273 silent=True,
274 )
275+
276 if returncode == 100:
277 return
278+
279+ self.market_name = self.get_market_name(output)
280+
281 for line in output.split("\n"):
282 if line.startswith("Ubuntu-Oem-Kernel-Flavour:"):
283 self.kernel_flavour = line.split(" ")[1]
284@@ -1434,8 +1532,12 @@ class OemFromPublicArchive(OemMetaPkgInfo):
285 returncode=(0, 100),
286 silent=True,
287 )
288+
289 if returncode == 100:
290 return
291+
292+ self.market_name = self.get_market_name(output)
293+
294 for line in output.split("\n"):
295 if line.startswith("Ubuntu-Oem-Kernel-Flavour:"):
296 self.kernel_flavour = line.split(" ")[1]
297@@ -1475,7 +1577,7 @@ def collect_pkg_info(
298 data, check_private: bool = False, index=None, config=None
299 ) -> dict:
300 if type(data) is str:
301- result = pattern.match(data)
302+ result = meta_pattern.match(data)
303
304 if not result:
305 print(f"{data} is not supported.")
306@@ -1665,7 +1767,7 @@ def process_update_task(pkgInfo) -> None:
307
308
309 def deal_with_meta_git(pkg_name: str, pkg_info: PkgInfo, bootstrap: bool) -> bool:
310- result = pattern.match(pkg_name)
311+ result = meta_pattern.match(pkg_name)
312
313 if not result:
314 return

Subscribers

People subscribed via source and target branches