autopkg-wrapper 2024.2.8__tar.gz → 2024.5.1__tar.gz
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-2024.2.8 → autopkg_wrapper-2024.5.1}/PKG-INFO +3 -3
- autopkg_wrapper-2024.5.1/autopkg_wrapper/__init__.py +1 -0
- {autopkg_wrapper-2024.2.8 → autopkg_wrapper-2024.5.1}/autopkg_wrapper/autopkg_wrapper.py +25 -12
- {autopkg_wrapper-2024.2.8 → autopkg_wrapper-2024.5.1}/autopkg_wrapper/utils/args.py +22 -7
- {autopkg_wrapper-2024.2.8 → autopkg_wrapper-2024.5.1}/pyproject.toml +3 -3
- autopkg_wrapper-2024.2.8/autopkg_wrapper/__init__.py +0 -1
- {autopkg_wrapper-2024.2.8 → autopkg_wrapper-2024.5.1}/LICENSE +0 -0
- {autopkg_wrapper-2024.2.8 → autopkg_wrapper-2024.5.1}/README.md +0 -0
- {autopkg_wrapper-2024.2.8 → autopkg_wrapper-2024.5.1}/autopkg_wrapper/notifier/__init__.py +0 -0
- {autopkg_wrapper-2024.2.8 → autopkg_wrapper-2024.5.1}/autopkg_wrapper/notifier/slack.py +0 -0
- {autopkg_wrapper-2024.2.8 → autopkg_wrapper-2024.5.1}/autopkg_wrapper/utils/__init__.py +0 -0
- {autopkg_wrapper-2024.2.8 → autopkg_wrapper-2024.5.1}/autopkg_wrapper/utils/git_functions.py +0 -0
- {autopkg_wrapper-2024.2.8 → autopkg_wrapper-2024.5.1}/autopkg_wrapper/utils/logging.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: autopkg-wrapper
|
|
3
|
-
Version: 2024.
|
|
3
|
+
Version: 2024.5.1
|
|
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
|
|
@@ -11,8 +11,8 @@ Classifier: License :: OSI Approved :: BSD License
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
13
|
Requires-Dist: chardet (==5.2.0)
|
|
14
|
-
Requires-Dist: idna (==3.
|
|
15
|
-
Requires-Dist: pygithub (==2.
|
|
14
|
+
Requires-Dist: idna (==3.7)
|
|
15
|
+
Requires-Dist: pygithub (==2.3.0)
|
|
16
16
|
Requires-Dist: requests (==2.31.0)
|
|
17
17
|
Requires-Dist: ruamel-yaml (==0.18.6)
|
|
18
18
|
Requires-Dist: toml (==0.10.2)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2024.5.1"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
import json
|
|
2
3
|
import logging
|
|
3
4
|
import plistlib
|
|
4
5
|
import subprocess
|
|
@@ -32,7 +33,7 @@ class Recipe(object):
|
|
|
32
33
|
return name
|
|
33
34
|
|
|
34
35
|
def verify_trust_info(self):
|
|
35
|
-
cmd = ["/usr/local/bin/autopkg", "verify-trust-info", self.filename, "-
|
|
36
|
+
cmd = ["/usr/local/bin/autopkg", "verify-trust-info", self.filename, "-v"]
|
|
36
37
|
cmd = " ".join(cmd)
|
|
37
38
|
logging.debug(f"cmd: {str(cmd)}")
|
|
38
39
|
|
|
@@ -91,7 +92,7 @@ class Recipe(object):
|
|
|
91
92
|
"/usr/local/bin/autopkg",
|
|
92
93
|
"run",
|
|
93
94
|
self.filename,
|
|
94
|
-
"-
|
|
95
|
+
"-v",
|
|
95
96
|
"--report-plist",
|
|
96
97
|
str(report),
|
|
97
98
|
]
|
|
@@ -153,7 +154,7 @@ def get_override_repo_info(args):
|
|
|
153
154
|
return git_info
|
|
154
155
|
|
|
155
156
|
|
|
156
|
-
def update_recipe_repo(recipe, git_info, disable_recipe_trust_check):
|
|
157
|
+
def update_recipe_repo(recipe, git_info, disable_recipe_trust_check, args):
|
|
157
158
|
logging.debug(f"recipe.verified: {recipe.verified}")
|
|
158
159
|
logging.debug(f"disable_recipe_trust_check: {disable_recipe_trust_check}")
|
|
159
160
|
|
|
@@ -168,6 +169,10 @@ def update_recipe_repo(recipe, git_info, disable_recipe_trust_check):
|
|
|
168
169
|
logging.debug("Updating repo as recipe verification failed")
|
|
169
170
|
current_branch = git.get_current_branch(git_info)
|
|
170
171
|
|
|
172
|
+
if args.disable_git_commands:
|
|
173
|
+
logging.info("Not runing git commands as --disable-git-commands has been set")
|
|
174
|
+
return
|
|
175
|
+
|
|
171
176
|
if current_branch != git_info["override_trust_branch"]:
|
|
172
177
|
logging.debug(f"override_trust_branch: {git_info["override_trust_branch"]}")
|
|
173
178
|
git.create_branch(git_info)
|
|
@@ -184,10 +189,16 @@ def parse_recipe_list(recipes, recipe_file, post_processors):
|
|
|
184
189
|
"""Parsing list of recipes into a common format"""
|
|
185
190
|
recipe_list = None
|
|
186
191
|
|
|
187
|
-
logging.
|
|
188
|
-
logging.
|
|
192
|
+
logging.info(f"Recipes: {recipes}") if recipes else None
|
|
193
|
+
logging.info(f"Recipe List: {recipe_file}") if recipe_file else None
|
|
189
194
|
|
|
190
|
-
if
|
|
195
|
+
if recipe_file.suffix == ".json":
|
|
196
|
+
with open(recipe_file, "r") as f:
|
|
197
|
+
recipe_list = json.load(f)
|
|
198
|
+
elif recipe_file.suffix == ".txt":
|
|
199
|
+
with open(recipe_file, "r") as f:
|
|
200
|
+
recipe_list = f.read().splitlines()
|
|
201
|
+
elif isinstance(recipes, list):
|
|
191
202
|
recipe_list = recipes
|
|
192
203
|
elif isinstance(recipes, str):
|
|
193
204
|
if recipes.find(",") != -1:
|
|
@@ -199,13 +210,14 @@ def parse_recipe_list(recipes, recipe_file, post_processors):
|
|
|
199
210
|
|
|
200
211
|
if recipe_list is None:
|
|
201
212
|
logging.error(
|
|
202
|
-
"""Please provide
|
|
203
|
-
--recipes
|
|
204
|
-
--recipe-
|
|
213
|
+
"""Please provide recipes to run via the following methods:
|
|
214
|
+
--recipes recipe_one.download recipe_two.download
|
|
215
|
+
--recipe-file path/to/recipe_list.json
|
|
205
216
|
Comma separated list in the AUTOPKG_RECIPES env variable"""
|
|
206
217
|
)
|
|
207
218
|
sys.exit(1)
|
|
208
219
|
|
|
220
|
+
logging.info(f"Processing the following recipes: {recipe_list}")
|
|
209
221
|
recipe_map = [Recipe(name, post_processors=post_processors) for name in recipe_list]
|
|
210
222
|
|
|
211
223
|
return recipe_map
|
|
@@ -228,7 +240,7 @@ def parse_post_processors(post_processors):
|
|
|
228
240
|
case str():
|
|
229
241
|
post_processors_list = [post_processor.strip() for post_processor in post_processors.split(" ") if post_processor.strip()]
|
|
230
242
|
|
|
231
|
-
logging.
|
|
243
|
+
logging.info(f"Post Processors List: {post_processors_list}") if post_processors_list else None
|
|
232
244
|
|
|
233
245
|
return post_processors_list
|
|
234
246
|
|
|
@@ -255,6 +267,7 @@ def process_recipe(recipe, disable_recipe_trust_check):
|
|
|
255
267
|
|
|
256
268
|
|
|
257
269
|
def main():
|
|
270
|
+
print("Hello World")
|
|
258
271
|
args = setup_args()
|
|
259
272
|
setup_logger(args.debug if args.debug else False)
|
|
260
273
|
logging.info("Running autopkg_wrapper")
|
|
@@ -265,9 +278,9 @@ def main():
|
|
|
265
278
|
recipe_list = parse_recipe_list(recipes=args.recipes, recipe_file=args.recipe_file, post_processors=post_processors_list)
|
|
266
279
|
|
|
267
280
|
for recipe in recipe_list:
|
|
268
|
-
logging.
|
|
281
|
+
logging.info(f"Processing Recipe: {recipe.name}")
|
|
269
282
|
process_recipe(recipe=recipe, disable_recipe_trust_check=args.disable_recipe_trust_check)
|
|
270
|
-
update_recipe_repo(git_info=override_repo_info, recipe=recipe, disable_recipe_trust_check=args.disable_recipe_trust_check)
|
|
283
|
+
update_recipe_repo(git_info=override_repo_info, recipe=recipe, disable_recipe_trust_check=args.disable_recipe_trust_check, args=args)
|
|
271
284
|
slack.send_notification(recipe=recipe, token=args.slack_token) if args.slack_token else None
|
|
272
285
|
|
|
273
286
|
recipe.pr_url = git.create_pull_request(git_info=override_repo_info, recipe=recipe) if args.create_pr else None
|
|
@@ -30,19 +30,27 @@ def setup_args():
|
|
|
30
30
|
recipe_arguments.add_argument(
|
|
31
31
|
"--recipe-file",
|
|
32
32
|
type=validate_file,
|
|
33
|
-
default=None,
|
|
34
|
-
help="
|
|
33
|
+
default=os.getenv("AW_RECIPE_FILE", None),
|
|
34
|
+
help="Provide the list of recipes to run via a JSON file for easier management.",
|
|
35
35
|
)
|
|
36
36
|
recipe_arguments.add_argument(
|
|
37
37
|
"--recipes",
|
|
38
|
-
"--recipe",
|
|
39
38
|
nargs="*",
|
|
40
|
-
default=os.getenv("
|
|
41
|
-
help="
|
|
39
|
+
default=os.getenv("AW_RECIPES", None),
|
|
40
|
+
help="""
|
|
41
|
+
Recipes to run via CLI flag or environment variable. If the '--recipes' flag is used, simply
|
|
42
|
+
provide a space-separated list on the command line:
|
|
43
|
+
`autopkg-wrapper --recipes recipe_one.download recipe_two.download`
|
|
44
|
+
Alternatively, you can provide a space/comma-separated list in the 'AW_RECIPES' environment
|
|
45
|
+
variable:
|
|
46
|
+
`export AW_RECIPES="recipe_one.download recipe_two.download"`
|
|
47
|
+
`export AW_RECIPES="recipe_one.pkg,recipe_two.pkg"`
|
|
48
|
+
`autopkg-wrapper`
|
|
49
|
+
""",
|
|
42
50
|
)
|
|
43
51
|
parser.add_argument(
|
|
44
52
|
"--debug",
|
|
45
|
-
default=os.getenv("
|
|
53
|
+
default=os.getenv("AW_DEBUG", False),
|
|
46
54
|
action="store_true",
|
|
47
55
|
help="Enable debug logging when running script",
|
|
48
56
|
)
|
|
@@ -55,6 +63,13 @@ def setup_args():
|
|
|
55
63
|
of this application.
|
|
56
64
|
""",
|
|
57
65
|
)
|
|
66
|
+
parser.add_argument(
|
|
67
|
+
"--disable-git-commands",
|
|
68
|
+
action="store_true",
|
|
69
|
+
help="""
|
|
70
|
+
If this option is used, git commands won't be run
|
|
71
|
+
""",
|
|
72
|
+
)
|
|
58
73
|
parser.add_argument("--slack-token", default=os.getenv("SLACK_WEBHOOK_TOKEN", None), help=argparse.SUPPRESS)
|
|
59
74
|
parser.add_argument("--github-token", default=os.getenv("GITHUB_TOKEN", None))
|
|
60
75
|
parser.add_argument(
|
|
@@ -67,7 +82,7 @@ def setup_args():
|
|
|
67
82
|
)
|
|
68
83
|
parser.add_argument(
|
|
69
84
|
"--create-pr",
|
|
70
|
-
default=os.getenv("
|
|
85
|
+
default=os.getenv("AW_CREATE_PR", False),
|
|
71
86
|
action="store_true",
|
|
72
87
|
help="If enabled, autopkg_wrapper will open a PR for updated trust information",
|
|
73
88
|
)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
name = "autopkg-wrapper"
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
repository = "https://github.com/smithjw/autopkg-wrapper"
|
|
8
|
-
version = "2024.
|
|
8
|
+
version = "2024.5.1"
|
|
9
9
|
|
|
10
10
|
[tool.poetry.scripts]
|
|
11
11
|
# When built and installed by pip, the command autopkg_wrapper will be availble in to run within that environment
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
[tool.poetry.dependencies]
|
|
16
16
|
chardet = "5.2.0"
|
|
17
|
-
idna = "3.
|
|
18
|
-
pygithub = "2.
|
|
17
|
+
idna = "3.7"
|
|
18
|
+
pygithub = "2.3.0"
|
|
19
19
|
python = "^3.12"
|
|
20
20
|
requests = "2.31.0"
|
|
21
21
|
ruamel-yaml = "0.18.6"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2024.2.8"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{autopkg_wrapper-2024.2.8 → autopkg_wrapper-2024.5.1}/autopkg_wrapper/utils/git_functions.py
RENAMED
|
File without changes
|
|
File without changes
|