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: 181c9f8261ed8ec531a24990f7a2441e9eed6575
Merged at revision: 81ea3aa8aa449a6e65b58b867a9eb4b78ed1ec5b
Proposed branch: ~fourdollars/pc-enablement/+git/oem-scripts:master
Merge into: ~oem-solutions-engineers/pc-enablement/+git/oem-scripts:master
Diff against target: 253 lines (+110/-13)
4 files modified
debian/changelog (+8/-0)
debian/tests/oem-meta-packages (+12/-5)
mir-bug (+71/-2)
oem-meta-packages (+19/-6)
Reviewer Review Type Date Requested Status
Yuan-Chen Cheng (community) Approve
Review via email: mp+406227@code.launchpad.net

Description of the change

./mir-bug -q check 1891988 --json ~/projects/oem-hw-info/platform-info/somerville/fossa-beric-tgl.json
...
diff --git a/debian/control b/debian/control
index 0a41830..271e6f9 100644
--- a/debian/control
+++ b/debian/control
@@ -12,6 +12,6 @@ Architecture: all
 Depends: ${misc:Depends}, ubuntu-oem-keyring
 XB-Modaliases: ${modaliases}
 XB-Ubuntu-OEM-Kernel-Flavour: oem
-Description: hardware support for Somerville Beric-Tgl platform
- This is a metapackage for Somerville Beric-Tgl platform. It installs
+Description: hardware support for Dell Inspiron 3501, Vostro 3400/3500
+ This is a metapackage for Dell Inspiron 3501, Vostro 3400/3500. It installs
  packages needed to support this hardware fully.
...

$ ./mir-bug -q check 1925019 --json ~/projects/oem-hw-info/platform-info/stella.cmit/fossa-rattata.json
...
diff --git a/debian/control b/debian/control
index 07aa4b2..fd6d608 100644
--- a/debian/control
+++ b/debian/control
@@ -12,6 +12,6 @@ Architecture: all
 Depends: ${misc:Depends}, ubuntu-oem-keyring
 XB-Modaliases: ${modaliases}
 XB-Ubuntu-OEM-Kernel-Flavour: oem
-Description: hardware support for Stella Cmit Rattata platform
- This is a metapackage for Stella Cmit Rattata platform. It installs
+Description: hardware support for HP ProBook 440 G8 Notebook PC
+ This is a metapackage for HP ProBook 440 G8 Notebook PC. It installs
  packages needed to support this hardware fully.
...

$ ./mir-bug -q check 1924726 --json ~/projects/oem-hw-info/platform-info/sutton.newell/fossa-aelfwine.json
...
diff --git a/debian/control b/debian/control
index af0527e..8172068 100644
--- a/debian/control
+++ b/debian/control
@@ -12,14 +12,13 @@ Architecture: all
 Depends: ${misc:Depends}, ubuntu-oem-keyring, linux-oem-20.04b | linux-oem-20.04, oem-sutton.newell-meta
 XB-Modaliases: ${modaliases}
 XB-Ubuntu-OEM-Kernel-Flavour: oem
-Description: hardware support for Sutton Newell Aelfwine platform
- This is a metapackage for Sutton Newell Aelfwine platform. It installs
+Description: hardware support for Lenovo ThinkPad T14s Gen 2, X13 Gen 2
+ This is a metapackage for Lenovo ThinkPad T14s Gen 2, X13 Gen 2. It installs
  packages needed to support this hardware fully.

 Package: oem-sutton.newell-factory-aelfwine-meta
 Architecture: all
 Depends: ${misc:Depends}, oem-sutton.newell-factory-meta
-Suggests: lenovo-doc-aelfwine
-Description: hardware support for Sutton Newell Aelfwine platform (factory)
- This is a factory metapackage for Sutton Newell Aelfwine platform.
+Description: hardware support for Lenovo ThinkPad T14s Gen 2, X13 Gen 2 (factory)
+ This is a factory metapackage for Lenovo ThinkPad T14s Gen 2, X13 Gen 2.
  It installs packages needed to support this hardware fully. (factory)
...

To post a comment you must log in.
Revision history for this message
Shih-Yuan Lee (fourdollars) wrote :

[BOT]
$ cat oem-scripts-1.5-181c9f8-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/MmhYx3PgBN/ oem-scripts-1.5-181c9f8-in-docker-focal-complete.log

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

I am not a fan of re-use variable like this

+ if args.json:
+ args.json = json.load(args.json)

other look good. Up to the author to change it or not.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index 676969f..9180f60 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
1oem-scripts (1.5) UNRELEASED; urgency=medium
2
3 * oem-meta-packages: Make the '--output' of the 'collect' subcommand
4 unnecessary.
5 * mir-bug: Make it able to read the product names from the platform json.
6
7 -- Shih-Yuan Lee (FourDollars) <sylee@canonical.com> Mon, 19 Jul 2021 18:09:17 +0800
8
1oem-scripts (1.4) focal; urgency=medium9oem-scripts (1.4) focal; urgency=medium
210
3 * debian/tests/mir-bug-verification: Workaround for update-grub in Linux11 * debian/tests/mir-bug-verification: Workaround for update-grub in Linux
diff --git a/debian/tests/oem-meta-packages b/debian/tests/oem-meta-packages
index de367d5..65466a7 100644
--- a/debian/tests/oem-meta-packages
+++ b/debian/tests/oem-meta-packages
@@ -24,7 +24,7 @@ cat > platforms.json << ENDLINE
24 "Customer": "Dell",24 "Customer": "Dell",
25 "Group": "N/A",25 "Group": "N/A",
26 "Codename": "fossa-beric-icl",26 "Codename": "fossa-beric-icl",
27 "Platform": "Bullseye N3 15 ICL-U(SMB0) ",27 "Platform": "Bullseye N3 15 ICL-U(SMB0)",
28 "MarketName": "Inspiron 3501",28 "MarketName": "Inspiron 3501",
29 "PlatformLPTag": "fossa-beric-icl"29 "PlatformLPTag": "fossa-beric-icl"
30 }30 }
@@ -35,10 +35,17 @@ export LAUNCHPAD_API="https://api.launchpad.net/"
3535
36oem-meta-packages --quiet list36oem-meta-packages --quiet list
3737
38oem-meta-packages --quiet collect --json platforms.json -o meta-info.json38oem-meta-packages --quiet collect --json platforms.json # --output meta-info.json (by default)
39jq -r < meta-info.json39if [ "x$(jq -r '."oem-somerville-beric-icl-meta".new_desc' < meta-info.json)" != "xDell Inspiron 3501, Vostro 3401/3501" ]; then
40oem-meta-packages --quiet collect --meta oem-somerville-beric-icl-meta -o meta-info.json40 jq -S -M < meta-info.json
41jq -r < meta-info.json41 exit 1
42fi
43
44oem-meta-packages --quiet collect --meta oem-somerville-beric-icl-meta # --output oem-somerville-beric-icl-meta.json (by default)
45if [ "x$(jq -r '."oem-somerville-beric-icl-meta".oem.git.market_name' < oem-somerville-beric-icl-meta.json)" != "xInspiron 3501, Vostro 3401/3501" ]; then
46 jq -S -M < oem-somerville-beric-icl-meta.json
47 exit 1
48fi
4249
43oem-meta-packages --dry-run update --json meta-info.json50oem-meta-packages --dry-run update --json meta-info.json
4451
diff --git a/mir-bug b/mir-bug
index 37f38fc..f954f62 100755
--- a/mir-bug
+++ b/mir-bug
@@ -19,6 +19,7 @@
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2020
21import argparse21import argparse
22import collections
22import difflib23import difflib
23import json24import json
24import lazr25import lazr
@@ -100,6 +101,11 @@ update.add_argument(
100 action="store_true",101 action="store_true",
101 help="Update the bug to Fix Committed, also affects 'Ubuntu', and subscribe 'ubuntu-sponsors' and 'ubuntu-desktop'.",102 help="Update the bug to Fix Committed, also affects 'Ubuntu', and subscribe 'ubuntu-sponsors' and 'ubuntu-desktop'.",
102)103)
104update.add_argument(
105 "--json",
106 help="Specify the platform json file to read the information.",
107 type=argparse.FileType("r", encoding="UTF-8"),
108)
103109
104check = subparsers.add_parser(110check = subparsers.add_parser(
105 "check", help="[-h] [--ready] [--skip] [--tz=UTC-8] bugNumber"111 "check", help="[-h] [--ready] [--skip] [--tz=UTC-8] bugNumber"
@@ -120,6 +126,11 @@ check.add_argument(
120 action="store_true",126 action="store_true",
121 help="Check if the bug is Fix Committed, also affects 'Ubuntu', and subscribe 'ubuntu-sponsors' and 'ubuntu-desktop'.",127 help="Check if the bug is Fix Committed, also affects 'Ubuntu', and subscribe 'ubuntu-sponsors' and 'ubuntu-desktop'.",
122)128)
129check.add_argument(
130 "--json",
131 help="Specify the platform json file to read the information.",
132 type=argparse.FileType("r", encoding="UTF-8"),
133)
123134
124collect = subparsers.add_parser("collect", help="[-h] [--ubuntu-certified] jsonFile")135collect = subparsers.add_parser("collect", help="[-h] [--ubuntu-certified] jsonFile")
125collect.add_argument(136collect.add_argument(
@@ -197,6 +208,38 @@ Please use "oem-metapackage-mir-check" in lp:ubuntu-archive-tools to verify this
197pattern = re.compile(r".*\[MIR\]\W*oem-([^-]*)-(.*)-meta\W*")208pattern = re.compile(r".*\[MIR\]\W*oem-([^-]*)-(.*)-meta\W*")
198209
199210
211# Python 3.9 supports this.
212def remove_prefix(s, prefix):
213 return s[len(prefix) :] if s.startswith(prefix) else s
214
215
216def _grouping_market_names(market_names: list, maxsplit=1) -> str:
217 # Remove empty item
218 while "" in market_names:
219 market_names.remove("")
220 tmp = collections.defaultdict(list)
221 space_in_model = False
222 try:
223 for market_name in sorted(market_names):
224 if maxsplit == 1:
225 name, model = market_name.split(maxsplit=maxsplit)
226 tmp[name].append(model)
227 if " " in model:
228 space_in_model = True
229 elif maxsplit == 2:
230 brand, name, model = market_name.split(maxsplit=maxsplit)
231 tmp[brand + " " + name].append(model)
232 if " " in model:
233 space_in_model = True
234 except ValueError:
235 return ", ".join(sorted(market_names))
236
237 if space_in_model:
238 return ", ".join(f"{name} {', '.join(models)}" for name, models in tmp.items())
239 else:
240 return ", ".join(f"{name} {'/'.join(models)}" for name, models in tmp.items())
241
242
200def create_bug(lp, oemCodename, platformCodename, deviceName):243def create_bug(lp, oemCodename, platformCodename, deviceName):
201 info("Creating bug...")244 info("Creating bug...")
202 tempList = oemCodename.split(".")245 tempList = oemCodename.split(".")
@@ -963,6 +1006,28 @@ def check_and_update_git_repo(
963 kernel_flavour, kernel_meta, market_name, ids = _get_items_from_git(1006 kernel_flavour, kernel_meta, market_name, ids = _get_items_from_git(
964 project, branch, pkg_name1007 project, branch, pkg_name
965 )1008 )
1009
1010 if args.json:
1011 if group == "cmit":
1012 new_market_name = _grouping_market_names(
1013 args.json["productnames"], maxsplit=2
1014 )
1015 new_market_name = remove_prefix(new_market_name, "HP ")
1016 else:
1017 new_market_name = _grouping_market_names(args.json["productnames"])
1018 if market_name is None:
1019 market_name = new_market_name
1020 if market_name != new_market_name:
1021 if args.skip or not update:
1022 warning(
1023 f"You may need to use '{new_market_name}' instead of '{market_name}'?"
1024 )
1025 elif yes_or_ask(
1026 yes,
1027 f"Do you want to use '{new_market_name}' instead of '{market_name}'?",
1028 ):
1029 market_name = new_market_name
1030
966 if kernel_flavour == "default":1031 if kernel_flavour == "default":
967 if kernel_meta is None:1032 if kernel_meta is None:
968 kernel_meta = "linux-generic-hwe-20.04"1033 kernel_meta = "linux-generic-hwe-20.04"
@@ -970,7 +1035,7 @@ def check_and_update_git_repo(
970 pass1035 pass
971 else:1036 else:
972 critical(1037 critical(
973 f"{pkg_name}'s {branch} branch has unexpected kernel_flavour=${kernel_flavour}, kernel_meta={kernel_meta}."1038 f"{pkg_name}'s {branch} branch has unexpected kernel_flavour={kernel_flavour}, kernel_meta={kernel_meta}."
974 )1039 )
975 exit(1)1040 exit(1)
976 elif kernel_flavour == "oem":1041 elif kernel_flavour == "oem":
@@ -980,7 +1045,7 @@ def check_and_update_git_repo(
980 pass1045 pass
981 else:1046 else:
982 critical(1047 critical(
983 f"{pkg_name}'s {branch} branch has unexpected kernel_flavour=${kernel_flavour}, kernel_meta={kernel_meta}."1048 f"{pkg_name}'s {branch} branch has unexpected kernel_flavour={kernel_flavour}, kernel_meta={kernel_meta}."
984 )1049 )
985 exit(1)1050 exit(1)
9861051
@@ -1142,8 +1207,12 @@ if args.subcommand:
1142if args.subcommand == "create":1207if args.subcommand == "create":
1143 create_bug(lp, args.oemCodename, args.platformCodename, args.deviceName)1208 create_bug(lp, args.oemCodename, args.platformCodename, args.deviceName)
1144elif args.subcommand == "update":1209elif args.subcommand == "update":
1210 if args.json:
1211 args.json = json.load(args.json)
1145 update_bug(lp, args.bugNumber, args.yes)1212 update_bug(lp, args.bugNumber, args.yes)
1146elif args.subcommand == "check":1213elif args.subcommand == "check":
1214 if args.json:
1215 args.json = json.load(args.json)
1147 check_bug(lp, args.bugNumber)1216 check_bug(lp, args.bugNumber)
1148elif args.subcommand == "collect":1217elif args.subcommand == "collect":
1149 collect_bugs(lp, args.json)1218 collect_bugs(lp, args.json)
diff --git a/oem-meta-packages b/oem-meta-packages
index ad37f43..24d7d4b 100755
--- a/oem-meta-packages
+++ b/oem-meta-packages
@@ -166,11 +166,11 @@ subparsers = parser.add_subparsers(dest="subcommand")
166166
167collect = subparsers.add_parser(167collect = subparsers.add_parser(
168 "collect",168 "collect",
169 help="[-h] --json platforms.json | --meta oem-qemu-meta -o|--output meta-info.json",169 help="[-h] --json platforms.json | --meta oem-qemu-meta [-o|--output meta-info.json]",
170 formatter_class=argparse.RawDescriptionHelpFormatter,170 formatter_class=argparse.RawDescriptionHelpFormatter,
171 epilog="""171 epilog="""
172For example,172For example,
173 oem-meta-packages collect --json platforms.json --output meta-info.json173 oem-meta-packages collect --json platforms.json [--output meta-info.json]
174174
175platforms.json:175platforms.json:
176176
@@ -204,7 +204,7 @@ platforms.json:
204 ...204 ...
205]205]
206206
207oem-meta-packages collect --meta oem-qemu-meta --output meta-info.json207oem-meta-packages collect --meta oem-qemu-meta [--output oem-qemu-meta.json]
208208
209Collect the information of OEM metapackages in PPAs and devel/staging archives.""",209Collect the information of OEM metapackages in PPAs and devel/staging archives.""",
210)210)
@@ -220,7 +220,6 @@ collect.add_argument(
220collect.add_argument(220collect.add_argument(
221 "-o",221 "-o",
222 "--output",222 "--output",
223 required=True,
224 help="Specify a filename to write the meta information.",223 help="Specify a filename to write the meta information.",
225 type=argparse.FileType("w", encoding="UTF-8"),224 type=argparse.FileType("w", encoding="UTF-8"),
226)225)
@@ -322,6 +321,7 @@ update.add_argument(
322)321)
323322
324args = parser.parse_args()323args = parser.parse_args()
324BASEDIR = os.getcwd()
325325
326setup_logging(debug=args.debug, quiet=args.quiet)326setup_logging(debug=args.debug, quiet=args.quiet)
327327
@@ -2126,8 +2126,21 @@ elif args.subcommand == "collect":
2126 else:2126 else:
2127 print("You need to use --json or --meta.")2127 print("You need to use --json or --meta.")
2128 exit(1)2128 exit(1)
2129 args.output.write(json.dumps(pkgInfo, indent=4, sort_keys=True, cls=CustomEncoder))2129 if args.output:
2130 args.output.write("\n")2130 args.output.write(
2131 json.dumps(pkgInfo, indent=4, sort_keys=True, cls=CustomEncoder) + "\n"
2132 )
2133 args.output.write("\n")
2134 elif args.json:
2135 with open(f"{BASEDIR}/meta-info.json", "w+") as f:
2136 f.write(
2137 json.dumps(pkgInfo, indent=4, sort_keys=True, cls=CustomEncoder) + "\n"
2138 )
2139 elif args.meta:
2140 with open(f"{BASEDIR}/{args.meta}.json", "w+") as f:
2141 f.write(
2142 json.dumps(pkgInfo, indent=4, sort_keys=True, cls=CustomEncoder) + "\n"
2143 )
2131elif args.subcommand == "staging-copy":2144elif args.subcommand == "staging-copy":
2132 oem_scripts_config_ini = os.path.join(2145 oem_scripts_config_ini = os.path.join(
2133 os.environ["HOME"], ".config/oem-scripts/config.ini"2146 os.environ["HOME"], ".config/oem-scripts/config.ini"

Subscribers

People subscribed via source and target branches