Skip to content

Commit d9a2d13

Browse files
committed
ci(signingscript): PR changes + Prevent mixed formats
Removed noop sign sign in tasks.py since we don't allow for mixed formats anymore
1 parent 9b6f65d commit d9a2d13

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

signingscript/src/signingscript/script.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,16 @@ async def async_main(context):
4545
context.session = session
4646
context.autograph_configs = load_autograph_configs(context.config["autograph_configs"])
4747

48+
# TODO: Make task.sign take in the whole filelist_dict and return a dict of output files.
49+
# That would likely mean changing all behaviors to accept and deal with multiple files at once.
50+
4851
filelist_dict = build_filelist_dict(context)
4952
for path, path_dict in filelist_dict.items():
5053
if path_dict["formats"] == ["apple_notarization_stacked"]:
5154
# Skip if only format is notarization_stacked - handled below
5255
continue
56+
if "apple_notarization_stacked" in path_dict["formats"]:
57+
continue
5358
copy_to_dir(path_dict["full_path"], context.config["work_dir"], target=path)
5459
log.info("signing %s", path)
5560
output_files = await sign(context, os.path.join(work_dir, path), path_dict["formats"], authenticode_comment=path_dict.get("comment"))

signingscript/src/signingscript/sign.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,11 @@ async def _notarize_geckodriver(context, path, workdir):
16011601

16021602

16031603
async def _notarize_all(context, path, workdir):
1604-
"""Notarizes all files in a tarball"""
1604+
"""
1605+
Notarizes all files in a tarball
1606+
1607+
@Deprecated: This function is deprecated and will be removed in the future. Use apple_notarize_stacked instead.
1608+
"""
16051609
_, extension = os.path.splitext(path)
16061610
# Attempt extracting
16071611
await _extract_tarfile(context, path, extension, tmp_dir=workdir)
@@ -1631,6 +1635,8 @@ async def _notarize_all(context, path, workdir):
16311635
async def apple_notarize(context, path, *args, **kwargs):
16321636
"""
16331637
Notarizes given package(s) using rcodesign.
1638+
1639+
@Deprecated: This function is deprecated and will be removed in the future. Use apple_notarize_stacked instead.
16341640
"""
16351641
# Setup workdir
16361642
notarization_workdir = os.path.join(context.config["work_dir"], "apple_notarize")
@@ -1707,6 +1713,7 @@ async def apple_notarize_stacked(context, filelist_dict):
17071713
retry_exceptions=RCodesignError,
17081714
)
17091715

1716+
# Staple files
17101717
for path in submissions_map.keys():
17111718
await retry_async(
17121719
func=rcodesign_staple,
@@ -1715,13 +1722,14 @@ async def apple_notarize_stacked(context, filelist_dict):
17151722
retry_exceptions=RCodesignError,
17161723
)
17171724

1718-
# Staple + create tarball where necessary
1725+
# Wrap up
17191726
stapled_files = []
17201727
for relpath, path_dict in filelist_dict.items():
17211728
task_index = relpath_index_map[relpath]
17221729
notarization_workdir = os.path.join(context.config["work_dir"], f"apple_notarize-{task_index}")
17231730
target_path = os.path.join(context.config["work_dir"], relpath)
17241731
_, extension = os.path.splitext(relpath)
1732+
# Pkgs don't need to be tarred
17251733
if extension == ".pkg":
17261734
utils.copy_to_dir(os.path.join(notarization_workdir, relpath), os.path.dirname(target_path))
17271735
else:

signingscript/src/signingscript/task.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535
log = logging.getLogger(__name__)
3636

3737

38-
async def noop_sign(*args, **kwargs):
39-
return []
40-
4138
FORMAT_TO_SIGNING_FUNCTION = immutabledict(
4239
{
4340
"autograph_hash_only_mar384": sign_mar384_with_autograph_hash,
@@ -63,7 +60,6 @@ async def noop_sign(*args, **kwargs):
6360
"apple_notarization_geckodriver": apple_notarize_geckodriver,
6461
# This format is handled in script.py
6562
# "apple_notarization_stacked": apple_notarize_stacked,
66-
"apple_notarization_stacked": noop_sign,
6763
"default": sign_file,
6864
}
6965
)

0 commit comments

Comments
 (0)