Skip to content

Commit 1852669

Browse files
authored
Merge pull request #64 from homebysix/MunkiOptionalReceiptEditor
1.12.4 merge to main
2 parents f093f23 + 4793705 commit 1852669

6 files changed

Lines changed: 32 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ All notable changes to this project will be documented in this file. This projec
1414

1515
Nothing yet.
1616

17+
## [1.12.4] - 2023-02-26
18+
19+
### Added
20+
21+
- Added compatibility checks for MunkiOptionalReceiptEditor processor, included in AutoPkg 2.7+.
22+
- Added a `--require-pkg-blocking-apps` argument for the `check-munki-pkgsinfo` hook. If specified, tests will fail for any pkg installer that does not have a `blocking_applications` array (even an empty one). This change maintains the alignment with Munki's design established in 1.12.3 while allowing Munki repo admins flexibility to be stricter in their own environments.
23+
24+
### Changed
25+
26+
- Improved compatibility with Munki repos where the pkgsinfo folder is not at the root level. (#63, thanks to @kbrewersq)
27+
1728
## [1.12.3] - 2022-04-09
1829

1930
### Changed
@@ -293,7 +304,8 @@ Nothing yet.
293304

294305
- Initial release
295306

296-
[Unreleased]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.12.3...HEAD
307+
[Unreleased]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.12.4...HEAD
308+
[1.12.4]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.12.3...v1.12.4
297309
[1.12.3]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.12.2...v1.12.3
298310
[1.12.2]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.12.1...v1.12.2
299311
[1.12.1]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.12.0...v1.12.1

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ For any hook in this repo you wish to use, add the following to your pre-commit
1515

1616
```yaml
1717
- repo: https://github.com/homebysix/pre-commit-macadmin
18-
rev: v1.12.3
18+
rev: v1.12.4
1919
hooks:
2020
- id: check-plists
2121
# - id: ...
@@ -121,7 +121,7 @@ When combining arguments that take lists (for example: `--required-keys`, `--cat
121121

122122
```yaml
123123
- repo: https://github.com/homebysix/pre-commit-macadmin
124-
rev: v1.12.3
124+
rev: v1.12.4
125125
hooks:
126126
- id: check-munki-pkgsinfo
127127
args: ['--catalogs', 'testing', 'stable', '--']
@@ -131,7 +131,7 @@ But if you also use the `--categories` argument, you would move the trailing `--
131131

132132
```yaml
133133
- repo: https://github.com/homebysix/pre-commit-macadmin
134-
rev: v1.12.3
134+
rev: v1.12.4
135135
hooks:
136136
- id: check-munki-pkgsinfo
137137
args: ['--catalogs', 'testing', 'stable', '--categories', 'Design', 'Engineering', 'Web Browsers', '--']
@@ -143,7 +143,7 @@ If it looks better to your eye, feel free to use a multi-line list for long argu
143143

144144
```yaml
145145
- repo: https://github.com/homebysix/pre-commit-macadmin
146-
rev: v1.12.3
146+
rev: v1.12.4
147147
hooks:
148148
- id: check-munki-pkgsinfo
149149
args: [

pre_commit_hooks/check_autopkg_recipes.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ def validate_minimumversion(process, min_vers, ignore_min_vers_before, filename)
208208
"MunkiCatalogBuilder": "0.1.0",
209209
"MunkiImporter": "0.1.0",
210210
"MunkiInstallsItemsCreator": "0.1.0",
211+
"MunkiOptionalReceiptEditor": "2.7",
211212
"MunkiPkginfoMerger": "0.1.0",
212213
"MunkiSetDefaultCatalog": "0.4.2",
213214
"PackageRequired": "0.5.1",
@@ -376,7 +377,7 @@ def validate_proc_type_conventions(process, filename):
376377
"""Ensure that processors used align with recipe type conventions."""
377378

378379
# For each processor type, this is the list of processors that
379-
# we only expect to see in that type.
380+
# we only expect to see in that type. List order is unimportant.
380381
proc_type_conventions = {
381382
"download": [
382383
"SparkleUpdateInfoProvider",
@@ -390,6 +391,7 @@ def validate_proc_type_conventions(process, filename):
390391
"MunkiPkginfoMerger",
391392
"MunkiCatalogBuilder",
392393
"MunkiSetDefaultCatalog",
394+
"MunkiOptionalReceiptEditor",
393395
"MunkiImporter",
394396
],
395397
"pkg": ["AppPkgCreator", "PkgCreator"],

pre_commit_hooks/check_munki_pkgsinfo.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ def build_argument_parser():
2828
default=["description", "name"],
2929
help="List of required top-level keys.",
3030
)
31+
parser.add_argument(
32+
"--require-pkg-blocking-apps",
33+
action="store_true",
34+
help="Require a blocking_applications array for pkg installers.",
35+
)
3136
parser.add_argument("filenames", nargs="*", help="Filenames to check.")
3237
return parser
3338

@@ -120,7 +125,7 @@ def main(argv=None):
120125

121126
# Checking for the absence of blocking_applications for pkg installers.
122127
# If a pkg doesn't require blocking_applications, use empty "<array/>" in pkginfo.
123-
if all(
128+
if args.require_pkg_blocking_apps and all(
124129
(
125130
"blocking_applications" not in pkginfo,
126131
pkginfo.get("installer_item_location", "").endswith(".pkg"),
@@ -129,10 +134,11 @@ def main(argv=None):
129134
)
130135
):
131136
print(
132-
"WARNING: {}: contains a pkg installer but has no blocking applications".format(
137+
"{}: contains a pkg installer but missing a blocking applications array".format(
133138
filename
134139
)
135140
)
141+
retval = 1
136142

137143
# Ensure an icon exists for the item.
138144
if not any(

pre_commit_hooks/munki_makecatalogs.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,16 @@ def build_argument_parser():
1414
parser = argparse.ArgumentParser(
1515
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
1616
)
17-
parser.add_argument("--munki_repo", default='.',
18-
help="path to local munki repo defaults to '.'")
17+
parser.add_argument(
18+
"--munki_repo", default=".", help="Path to local Munki repo. (Defaults to '.')"
19+
)
1920
# TODO: Support makecatalogs options, ideally with kwargs for flexibility.
2021
return parser
2122

2223

2324
def main(argv=None):
2425
"""Main process."""
2526

26-
# Path to munki's python.
27-
python = "/usr/local/munki/munki-python"
28-
2927
# Path to makecatalogs.
3028
makecatalogs = "/usr/local/munki/makecatalogs"
3129

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
name="pre-commit-macadmin",
88
description="Pre-commit hooks for Mac admins, client engineers, and IT consultants.",
99
url="https://github.com/homebysix/pre-commit-macadmin",
10-
version="1.12.3",
10+
version="1.12.4",
1111
author="Elliot Jordan",
1212
author_email="elliot@elliotjordan.com",
1313
packages=["pre_commit_hooks"],

0 commit comments

Comments
 (0)