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