| 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-.*", | 
|  | 10 | "openbmc/openpower-.*", | 
|  | 11 | "openbmc/google-.*", | 
|  | 12 | "openbmc/meta-.*", | 
|  | 13 | ] | 
|  | 14 |  | 
|  | 15 | reject_repo = [ | 
|  | 16 | "openbmc/s2600wf-misc", | 
|  | 17 | ] | 
|  | 18 |  | 
|  | 19 | for r in reject_repo: | 
|  | 20 | if r == name: | 
|  | 21 | return False | 
|  | 22 |  | 
|  | 23 | for r in reject_regex: | 
|  | 24 | if re.match(r, name): | 
|  | 25 | return False | 
|  | 26 |  | 
|  | 27 | return True | 
|  | 28 |  | 
|  | 29 |  | 
|  | 30 | def file(proj: str, filename: str) -> bool: | 
|  | 31 | reject_regex = { | 
|  | 32 | "all": [ | 
|  | 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/.*"], | 
|  | 45 | "openbmc/phosphor-debug-collector": [ | 
|  | 46 | "dump-extensions/.*", | 
|  | 47 | "tools/dreport.d/ibm.d/.*", | 
|  | 48 | ], | 
|  | 49 | "openbmc/phosphor-fan-presence": [".*/config_files/.*"], | 
|  | 50 | "openbmc/phosphor-power": [".*/config_files/.*"], | 
|  | 51 | "openbmc/phosphor-led-manager": ["configs/.*"], | 
|  | 52 | "openbmc/phosphor-logging": [".*/openpower-pels/.*"], | 
|  | 53 | "openbmc/webui-vue": [ | 
|  | 54 | "src/env/.*", | 
|  | 55 | ], | 
|  | 56 | } | 
|  | 57 |  | 
| Patrick Williams | d0269de | 2022-01-06 21:04:25 -0600 | [diff] [blame^] | 58 | reject_files = ["/COMMIT_MSG", "/PATCHSET_LEVEL"] | 
| Patrick Williams | 215c1c3 | 2022-01-06 20:26:26 -0600 | [diff] [blame] | 59 |  | 
|  | 60 | for r in reject_files: | 
|  | 61 | if r == filename: | 
|  | 62 | return False | 
|  | 63 |  | 
|  | 64 | for r in reject_regex.get(proj, []) + reject_regex.get("all", []): | 
|  | 65 | if re.match(r, filename): | 
|  | 66 | return False | 
|  | 67 |  | 
|  | 68 | return True |