|
16 | 16 | validate_pkginfo_key_types, |
17 | 17 | validate_required_keys, |
18 | 18 | validate_restart_action_key, |
| 19 | + validate_uninstall_method, |
19 | 20 | ) |
20 | 21 |
|
21 | 22 |
|
@@ -580,6 +581,7 @@ def main(argv=None): |
580 | 581 | # recipe_text = openfile.read() |
581 | 582 |
|
582 | 583 | # Top level keys that all AutoPkg recipes should contain. |
| 584 | + # TODO: Make required recipe keys configurable. |
583 | 585 | required_keys = ["Identifier"] |
584 | 586 | if not validate_required_keys(recipe, filename, required_keys): |
585 | 587 | retval = 1 |
@@ -615,12 +617,30 @@ def main(argv=None): |
615 | 617 | # If the Input key contains a pkginfo dict, make a best effort to validate its contents. |
616 | 618 | input_key = recipe.get("Input", recipe.get("input", recipe.get("INPUT"))) |
617 | 619 | if input_key and "pkginfo" in input_key: |
| 620 | + |
| 621 | + # Check for presence of required pkginfo keys. |
| 622 | + # TODO: Make required pkginfo keys within a recipe configurable. |
| 623 | + req_keys = ["name", "description"] |
| 624 | + if not validate_required_keys(input_key["pkginfo"], filename, req_keys): |
| 625 | + retval = 1 |
| 626 | + |
| 627 | + # Ensure pkginfo keys have expected types. |
618 | 628 | if not validate_pkginfo_key_types(input_key["pkginfo"], filename): |
619 | 629 | retval = 1 |
| 630 | + |
| 631 | + # Validate RestartAction key. |
620 | 632 | if not validate_restart_action_key(input_key["pkginfo"], filename): |
621 | 633 | retval = 1 |
| 634 | + |
| 635 | + # Validate uninstall method. |
| 636 | + if not validate_uninstall_method(input_key["pkginfo"], filename): |
| 637 | + retval = 1 |
| 638 | + |
| 639 | + # Check for deprecated pkginfo keys. |
622 | 640 | if not detect_deprecated_keys(input_key["pkginfo"], filename): |
623 | 641 | retval = 1 |
| 642 | + |
| 643 | + # Check for common mistakes in key names. |
624 | 644 | if not detect_typoed_keys(input_key["pkginfo"], filename): |
625 | 645 | retval = 1 |
626 | 646 |
|
|
0 commit comments