Patrick Williams | 215c1c3 | 2022-01-06 20:26:26 -0600 | [diff] [blame] | 1 | #!/usr/bin/python3 |
| 2 | import re |
| 3 | |
| 4 | |
| 5 | def project(name: str) -> bool: |
| 6 | reject_regex = [ |
| 7 | ".*-oem", |
| 8 | "openbmc/ibm-.*", |
| 9 | "openbmc/intel-.*", |
Patrick Williams | 215c1c3 | 2022-01-06 20:26:26 -0600 | [diff] [blame] | 10 | "openbmc/google-.*", |
| 11 | "openbmc/meta-.*", |
| 12 | ] |
| 13 | |
| 14 | reject_repo = [ |
| 15 | "openbmc/s2600wf-misc", |
| 16 | ] |
| 17 | |
| 18 | for r in reject_repo: |
| 19 | if r == name: |
| 20 | return False |
| 21 | |
| 22 | for r in reject_regex: |
| 23 | if re.match(r, name): |
| 24 | return False |
| 25 | |
| 26 | return True |
| 27 | |
| 28 | |
| 29 | def file(proj: str, filename: str) -> bool: |
| 30 | reject_regex = { |
| 31 | "all": [ |
Patrick Williams | b0ce01d | 2022-01-07 10:12:33 -0600 | [diff] [blame] | 32 | ".*/create_pel.*", |
Patrick Williams | 215c1c3 | 2022-01-06 20:26:26 -0600 | [diff] [blame] | 33 | ".*/google/", |
| 34 | ".*/ibm/", |
| 35 | ".*/intel/", |
| 36 | "MAINTAINERS", |
| 37 | "OWNERS", |
| 38 | "ibm-.*", |
| 39 | "ibm_.*", |
| 40 | ], |
| 41 | "openbmc/entity-manager": ["configurations/.*"], |
| 42 | "openbmc/libmctp": ["docs/bindings/vendor-.*"], |
| 43 | "openbmc/openbmc": ["meta-(?!phosphor).*", "poky/.*"], |
| 44 | "openbmc/openbmc-test-automation": ["oem/.*", "openpower/.*"], |
Patrick Williams | b0ce01d | 2022-01-07 10:12:33 -0600 | [diff] [blame] | 45 | "openbmc/openpower-libhei": [ |
| 46 | "test/simulator/sample_data/.*", |
| 47 | "test/simulator/test_*cases/.*", |
| 48 | "xml/.*", |
| 49 | ], |
| 50 | "openbmc/openpower-hw-diags": [ |
| 51 | ".*/pel/.*", |
| 52 | ".*/ras-data/.*", |
| 53 | ], |
Patrick Williams | 215c1c3 | 2022-01-06 20:26:26 -0600 | [diff] [blame] | 54 | "openbmc/phosphor-debug-collector": [ |
| 55 | "dump-extensions/.*", |
| 56 | "tools/dreport.d/ibm.d/.*", |
| 57 | ], |
| 58 | "openbmc/phosphor-fan-presence": [".*/config_files/.*"], |
| 59 | "openbmc/phosphor-power": [".*/config_files/.*"], |
| 60 | "openbmc/phosphor-led-manager": ["configs/.*"], |
| 61 | "openbmc/phosphor-logging": [".*/openpower-pels/.*"], |
| 62 | "openbmc/webui-vue": [ |
| 63 | "src/env/.*", |
| 64 | ], |
| 65 | } |
| 66 | |
Patrick Williams | d0269de | 2022-01-06 21:04:25 -0600 | [diff] [blame] | 67 | reject_files = ["/COMMIT_MSG", "/PATCHSET_LEVEL"] |
Patrick Williams | 215c1c3 | 2022-01-06 20:26:26 -0600 | [diff] [blame] | 68 | |
| 69 | for r in reject_files: |
| 70 | if r == filename: |
| 71 | return False |
| 72 | |
| 73 | for r in reject_regex.get(proj, []) + reject_regex.get("all", []): |
| 74 | if re.match(r, filename): |
| 75 | return False |
| 76 | |
| 77 | return True |