Patrick Williams | cb882f8 | 2022-12-07 17:53:19 -0600 | [diff] [blame^] | 1 | #!/usr/bin/env python3 |
Patrick Williams | a523cec | 2022-09-12 16:15:25 -0500 | [diff] [blame] | 2 | |
Patrick Williams | a523cec | 2022-09-12 16:15:25 -0500 | [diff] [blame] | 3 | from typing import List |
| 4 | |
Patrick Williams | cb882f8 | 2022-12-07 17:53:19 -0600 | [diff] [blame^] | 5 | from sh import curl # type: ignore |
| 6 | |
Patrick Williams | a523cec | 2022-09-12 16:15:25 -0500 | [diff] [blame] | 7 | ENTERPRISES = { |
| 8 | 0: "Reserved", |
| 9 | 2: "IBM", |
| 10 | 343: "Intel Corporation", |
| 11 | 674: "Dell Inc.", |
| 12 | 1694: "HCL Technologies Limited", |
| 13 | 2487: "Phoenix Technologies Ltd.", |
| 14 | 4128: "ARM Ltd.", |
| 15 | 6569: "INVENTEC CORPORATION", |
| 16 | 7244: "Quanta Computer Inc.", |
| 17 | 8554: "Departement Elektrotechnik, ETH Zuerich", |
| 18 | 11129: "Google, Inc.", |
| 19 | 11183: "Mitac International Corp.", |
| 20 | 19046: "Lenovo Enterprise Business Group", |
| 21 | 20974: "American Megatrends, Inc", |
| 22 | 33049: "Mellanox Technologies LTD", |
| 23 | 40092: "Wiwynn Corporation", |
| 24 | 40981: "Facebook, Inc.", |
| 25 | 42817: "IBM Platform Firmware Division", |
| 26 | 45065: "Insyde", |
| 27 | 48482: "Linaro Ltd", |
| 28 | 48512: "Inspur Group Co.,Ltd.", |
| 29 | 49150: "Vertiv Co", |
| 30 | 49769: "YADRO", |
| 31 | 51974: "Raptor Computing Systems, LLC", |
| 32 | 52538: "Ampere Computing", |
George Liu | c328a09 | 2022-09-11 14:27:13 +0800 | [diff] [blame] | 33 | 52893: "Inspur Power Systems Co.,Ltd.", |
Patrick Williams | a523cec | 2022-09-12 16:15:25 -0500 | [diff] [blame] | 34 | } |
| 35 | |
Patrick Williams | cb882f8 | 2022-12-07 17:53:19 -0600 | [diff] [blame^] | 36 | HEADER = """\ |
Patrick Williams | a523cec | 2022-09-12 16:15:25 -0500 | [diff] [blame] | 37 | This file has been reduced to entities signing CLAs with OpenBMC |
| 38 | https://drive.google.com/drive/folders/1Ooi0RdTcaOWF1DWFJUAJDdN7tRKde7Nl\ |
Patrick Williams | cb882f8 | 2022-12-07 17:53:19 -0600 | [diff] [blame^] | 39 | """ |
Patrick Williams | a523cec | 2022-09-12 16:15:25 -0500 | [diff] [blame] | 40 | |
| 41 | found_first: bool = False |
| 42 | org: List[str] = [] |
| 43 | |
Patrick Williams | cb882f8 | 2022-12-07 17:53:19 -0600 | [diff] [blame^] | 44 | for ln in curl( |
Patrick Williams | a523cec | 2022-09-12 16:15:25 -0500 | [diff] [blame] | 45 | "-L", "http://www.iana.org/assignments/enterprise-numbers" |
| 46 | ).splitlines(): |
Patrick Williams | cb882f8 | 2022-12-07 17:53:19 -0600 | [diff] [blame^] | 47 | line = ln.rstrip() |
Patrick Williams | a523cec | 2022-09-12 16:15:25 -0500 | [diff] [blame] | 48 | |
| 49 | # Look for Reserved/EN-0 as the start of the data. |
| 50 | if "0" == line: |
| 51 | found_first = True |
| 52 | |
| 53 | # Haven't found EN-0, emit as is. |
| 54 | if not found_first: |
| 55 | print(line) |
| 56 | # Look for magic string. |
| 57 | if line.startswith("This file is "): |
| 58 | print(HEADER) |
| 59 | continue |
| 60 | |
| 61 | # Add line into 'org' set. |
| 62 | org.append(line) |
| 63 | |
| 64 | # Every 4 lines (EN, Org, Contact, Email) make an org. |
| 65 | if len(org) == 4: |
| 66 | if int(org[0]) in ENTERPRISES: |
| 67 | for g in org: |
| 68 | print(g) |
| 69 | |
| 70 | org = [] |