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", |
Patrick Williams | 7bbf5a9 | 2023-01-24 17:31:19 -0600 | [diff] [blame] | 30 | 49622: "ASRock Rack Incorporation", |
Patrick Williams | a523cec | 2022-09-12 16:15:25 -0500 | [diff] [blame] | 31 | 49769: "YADRO", |
| 32 | 51974: "Raptor Computing Systems, LLC", |
| 33 | 52538: "Ampere Computing", |
George Liu | c328a09 | 2022-09-11 14:27:13 +0800 | [diff] [blame] | 34 | 52893: "Inspur Power Systems Co.,Ltd.", |
Patrick Williams | a523cec | 2022-09-12 16:15:25 -0500 | [diff] [blame] | 35 | } |
| 36 | |
Patrick Williams | cb882f8 | 2022-12-07 17:53:19 -0600 | [diff] [blame] | 37 | HEADER = """\ |
Patrick Williams | a523cec | 2022-09-12 16:15:25 -0500 | [diff] [blame] | 38 | This file has been reduced to entities signing CLAs with OpenBMC |
| 39 | https://drive.google.com/drive/folders/1Ooi0RdTcaOWF1DWFJUAJDdN7tRKde7Nl\ |
Patrick Williams | cb882f8 | 2022-12-07 17:53:19 -0600 | [diff] [blame] | 40 | """ |
Patrick Williams | a523cec | 2022-09-12 16:15:25 -0500 | [diff] [blame] | 41 | |
| 42 | found_first: bool = False |
| 43 | org: List[str] = [] |
| 44 | |
Patrick Williams | cb882f8 | 2022-12-07 17:53:19 -0600 | [diff] [blame] | 45 | for ln in curl( |
Patrick Williams | 7bbf5a9 | 2023-01-24 17:31:19 -0600 | [diff] [blame] | 46 | "-L", "https://www.iana.org/assignments/enterprise-numbers.txt" |
Patrick Williams | a523cec | 2022-09-12 16:15:25 -0500 | [diff] [blame] | 47 | ).splitlines(): |
Patrick Williams | cb882f8 | 2022-12-07 17:53:19 -0600 | [diff] [blame] | 48 | line = ln.rstrip() |
Patrick Williams | a523cec | 2022-09-12 16:15:25 -0500 | [diff] [blame] | 49 | |
| 50 | # Look for Reserved/EN-0 as the start of the data. |
| 51 | if "0" == line: |
| 52 | found_first = True |
| 53 | |
| 54 | # Haven't found EN-0, emit as is. |
| 55 | if not found_first: |
| 56 | print(line) |
| 57 | # Look for magic string. |
| 58 | if line.startswith("This file is "): |
| 59 | print(HEADER) |
| 60 | continue |
| 61 | |
| 62 | # Add line into 'org' set. |
| 63 | org.append(line) |
| 64 | |
| 65 | # Every 4 lines (EN, Org, Contact, Email) make an org. |
| 66 | if len(org) == 4: |
| 67 | if int(org[0]) in ENTERPRISES: |
| 68 | for g in org: |
| 69 | print(g) |
| 70 | |
| 71 | org = [] |