autopkg-wrapper 2024.5.1__py3-none-any.whl → 2024.5.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- autopkg_wrapper/__init__.py +1 -1
- autopkg_wrapper/autopkg_wrapper.py +38 -28
- {autopkg_wrapper-2024.5.1.dist-info → autopkg_wrapper-2024.5.3.dist-info}/METADATA +1 -1
- {autopkg_wrapper-2024.5.1.dist-info → autopkg_wrapper-2024.5.3.dist-info}/RECORD +7 -7
- {autopkg_wrapper-2024.5.1.dist-info → autopkg_wrapper-2024.5.3.dist-info}/LICENSE +0 -0
- {autopkg_wrapper-2024.5.1.dist-info → autopkg_wrapper-2024.5.3.dist-info}/WHEEL +0 -0
- {autopkg_wrapper-2024.5.1.dist-info → autopkg_wrapper-2024.5.3.dist-info}/entry_points.txt +0 -0
autopkg_wrapper/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "2024.5.
|
|
1
|
+
__version__ = "2024.5.3"
|
|
@@ -4,6 +4,7 @@ import logging
|
|
|
4
4
|
import plistlib
|
|
5
5
|
import subprocess
|
|
6
6
|
import sys
|
|
7
|
+
from datetime import datetime
|
|
7
8
|
from itertools import chain
|
|
8
9
|
from pathlib import Path
|
|
9
10
|
|
|
@@ -32,8 +33,10 @@ class Recipe(object):
|
|
|
32
33
|
|
|
33
34
|
return name
|
|
34
35
|
|
|
35
|
-
def verify_trust_info(self):
|
|
36
|
-
|
|
36
|
+
def verify_trust_info(self, debug):
|
|
37
|
+
verbose_output = ["-vvvv"]
|
|
38
|
+
cmd = ["/usr/local/bin/autopkg", "verify-trust-info", self.filename]
|
|
39
|
+
cmd = cmd + verbose_output if debug else cmd
|
|
37
40
|
cmd = " ".join(cmd)
|
|
38
41
|
logging.debug(f"cmd: {str(cmd)}")
|
|
39
42
|
|
|
@@ -77,26 +80,32 @@ class Recipe(object):
|
|
|
77
80
|
|
|
78
81
|
return {"imported": imported_items, "failed": failed_items}
|
|
79
82
|
|
|
80
|
-
def run(self):
|
|
83
|
+
def run(self, debug):
|
|
81
84
|
if self.verified is False:
|
|
82
85
|
self.error = True
|
|
83
86
|
self.results["failed"] = True
|
|
84
87
|
self.results["imported"] = ""
|
|
85
88
|
else:
|
|
86
|
-
|
|
89
|
+
report_dir = Path("/tmp/autopkg")
|
|
90
|
+
report_time = datetime.now().strftime("%Y-%m-%dT%H-%M-%S")
|
|
91
|
+
report_name = Path(f"{self.name}-{report_time}.plist")
|
|
92
|
+
|
|
93
|
+
report_dir.mkdir(parents=True, exist_ok=True)
|
|
94
|
+
report = report_dir / report_name
|
|
87
95
|
report.touch(exist_ok=True)
|
|
88
96
|
|
|
89
97
|
try:
|
|
90
98
|
post_processor_cmd = list(chain.from_iterable([("--post", processor) for processor in self.post_processors])) if self.post_processors else None
|
|
91
|
-
|
|
99
|
+
verbose_output = ["-vvvv"]
|
|
100
|
+
cmd = [
|
|
92
101
|
"/usr/local/bin/autopkg",
|
|
93
102
|
"run",
|
|
94
103
|
self.filename,
|
|
95
|
-
"-v",
|
|
96
104
|
"--report-plist",
|
|
97
105
|
str(report),
|
|
98
106
|
]
|
|
99
|
-
cmd =
|
|
107
|
+
cmd = cmd + post_processor_cmd if post_processor_cmd else cmd
|
|
108
|
+
cmd = cmd + verbose_output if debug else cmd
|
|
100
109
|
cmd = " ".join(cmd)
|
|
101
110
|
|
|
102
111
|
logging.debug(f"cmd: {str(cmd)}")
|
|
@@ -192,21 +201,23 @@ def parse_recipe_list(recipes, recipe_file, post_processors):
|
|
|
192
201
|
logging.info(f"Recipes: {recipes}") if recipes else None
|
|
193
202
|
logging.info(f"Recipe List: {recipe_file}") if recipe_file else None
|
|
194
203
|
|
|
195
|
-
if recipe_file
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
204
|
+
if recipe_file:
|
|
205
|
+
if recipe_file.suffix == ".json":
|
|
206
|
+
with open(recipe_file, "r") as f:
|
|
207
|
+
recipe_list = json.load(f)
|
|
208
|
+
elif recipe_file.suffix == ".txt":
|
|
209
|
+
with open(recipe_file, "r") as f:
|
|
210
|
+
recipe_list = f.read().splitlines()
|
|
211
|
+
if recipes:
|
|
212
|
+
if isinstance(recipes, list):
|
|
213
|
+
recipe_list = recipes
|
|
214
|
+
elif isinstance(recipes, str):
|
|
215
|
+
if recipes.find(",") != -1:
|
|
216
|
+
# Assuming recipes separated by commas
|
|
217
|
+
recipe_list = [recipe.strip() for recipe in recipes.split(",") if recipe]
|
|
218
|
+
else:
|
|
219
|
+
# Assuming recipes separated by space
|
|
220
|
+
recipe_list = [recipe.strip() for recipe in recipes.split(" ") if recipe]
|
|
210
221
|
|
|
211
222
|
if recipe_list is None:
|
|
212
223
|
logging.error(
|
|
@@ -245,21 +256,21 @@ def parse_post_processors(post_processors):
|
|
|
245
256
|
return post_processors_list
|
|
246
257
|
|
|
247
258
|
|
|
248
|
-
def process_recipe(recipe, disable_recipe_trust_check):
|
|
259
|
+
def process_recipe(recipe, disable_recipe_trust_check, debug):
|
|
249
260
|
if disable_recipe_trust_check:
|
|
250
261
|
logging.debug("Setting Recipe verification to None")
|
|
251
262
|
recipe.verified = None
|
|
252
263
|
else:
|
|
253
264
|
logging.debug("Checking Recipe verification")
|
|
254
|
-
recipe.verify_trust_info()
|
|
265
|
+
recipe.verify_trust_info(debug)
|
|
255
266
|
|
|
256
267
|
match recipe.verified:
|
|
257
268
|
case False | None if disable_recipe_trust_check:
|
|
258
269
|
logging.debug("Running Recipe without verification")
|
|
259
|
-
recipe.run()
|
|
270
|
+
recipe.run(debug)
|
|
260
271
|
case True:
|
|
261
272
|
logging.debug("Running Recipe after successful verification")
|
|
262
|
-
recipe.run()
|
|
273
|
+
recipe.run(debug)
|
|
263
274
|
case False:
|
|
264
275
|
recipe.update_trust_info()
|
|
265
276
|
|
|
@@ -267,7 +278,6 @@ def process_recipe(recipe, disable_recipe_trust_check):
|
|
|
267
278
|
|
|
268
279
|
|
|
269
280
|
def main():
|
|
270
|
-
print("Hello World")
|
|
271
281
|
args = setup_args()
|
|
272
282
|
setup_logger(args.debug if args.debug else False)
|
|
273
283
|
logging.info("Running autopkg_wrapper")
|
|
@@ -279,7 +289,7 @@ def main():
|
|
|
279
289
|
|
|
280
290
|
for recipe in recipe_list:
|
|
281
291
|
logging.info(f"Processing Recipe: {recipe.name}")
|
|
282
|
-
process_recipe(recipe=recipe, disable_recipe_trust_check=args.disable_recipe_trust_check)
|
|
292
|
+
process_recipe(recipe=recipe, disable_recipe_trust_check=args.disable_recipe_trust_check, debug=args.debug)
|
|
283
293
|
update_recipe_repo(git_info=override_repo_info, recipe=recipe, disable_recipe_trust_check=args.disable_recipe_trust_check, args=args)
|
|
284
294
|
slack.send_notification(recipe=recipe, token=args.slack_token) if args.slack_token else None
|
|
285
295
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: autopkg-wrapper
|
|
3
|
-
Version: 2024.5.
|
|
3
|
+
Version: 2024.5.3
|
|
4
4
|
Summary: A package used to execute some autopkg functions, primarily within the context of a GitHub Actions runner.
|
|
5
5
|
Home-page: https://github.com/smithjw/autopkg-wrapper
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
autopkg_wrapper/__init__.py,sha256=
|
|
2
|
-
autopkg_wrapper/autopkg_wrapper.py,sha256=
|
|
1
|
+
autopkg_wrapper/__init__.py,sha256=sEEjA7US77WrM1AT1k9D_cLsb_eUPgC78YSEwNKoE2c,25
|
|
2
|
+
autopkg_wrapper/autopkg_wrapper.py,sha256=9t3d58w24P2yU3jZGsmO_hjPK4vFlW4meJ_hBuHgcuo,10940
|
|
3
3
|
autopkg_wrapper/notifier/__init__.py,sha256=ShXQBVjyiSOHxoQJS2BvNG395W4KZfqMxZWBAR0MZrE,22
|
|
4
4
|
autopkg_wrapper/notifier/slack.py,sha256=nKHeSmgDaTaSUo19ZgnjjjKzeWgg34fMHUwNj9C5FMY,1982
|
|
5
5
|
autopkg_wrapper/utils/__init__.py,sha256=ShXQBVjyiSOHxoQJS2BvNG395W4KZfqMxZWBAR0MZrE,22
|
|
6
6
|
autopkg_wrapper/utils/args.py,sha256=BGbskLzeBeq7ae0Vp1XuoAD5gqKGILOTaNUHvo2DhNY,3934
|
|
7
7
|
autopkg_wrapper/utils/git_functions.py,sha256=zMMzwRG9V2VFaQk3y_o1H63_hzI1qohwBKaetNDS2mY,2975
|
|
8
8
|
autopkg_wrapper/utils/logging.py,sha256=3knpMViO_zAU8WM5bSImQaz5M01vMFk_raB4lt1cbvo,324
|
|
9
|
-
autopkg_wrapper-2024.5.
|
|
10
|
-
autopkg_wrapper-2024.5.
|
|
11
|
-
autopkg_wrapper-2024.5.
|
|
12
|
-
autopkg_wrapper-2024.5.
|
|
13
|
-
autopkg_wrapper-2024.5.
|
|
9
|
+
autopkg_wrapper-2024.5.3.dist-info/LICENSE,sha256=PpNOQjZGcsKFuA0wU16YU7PueVxqPX4OnyZ7TlLQlq4,1602
|
|
10
|
+
autopkg_wrapper-2024.5.3.dist-info/METADATA,sha256=zpWifwE0cHU6s4cdS0BqkKNAOcVwQhdHCmbfjqeuEF0,2659
|
|
11
|
+
autopkg_wrapper-2024.5.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
12
|
+
autopkg_wrapper-2024.5.3.dist-info/entry_points.txt,sha256=w9VfrX4aY0ZzJndvzjSI5lLe_sCP2tIq0I5bRLlEKJc,125
|
|
13
|
+
autopkg_wrapper-2024.5.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|