@@ -43,9 +43,13 @@ def main():
4343 sys .exit (1 )
4444
4545 with tempfile .TemporaryDirectory (prefix = 'cosa-import-' , dir = 'tmp' ) as tmpd :
46- # create the OCI archive and manifest
46+ # create the OCI archive
4747 tmp_oci_archive = generate_oci_archive (args , tmpd )
48- tmp_oci_manifest = generate_oci_manifest (args , tmpd )
48+ # extract the OCI manifest from it. Note here that we operate
49+ # on the ociarchive directly rather than args.srcimg because
50+ # otherwise the manifest we fetch with skopeo *could* be a
51+ # manifest list.
52+ tmp_oci_manifest = generate_oci_manifest (tmp_oci_archive , tmpd )
4953
5054 # import into the tmp/repo to get the ostree-commit but also so it's cached
5155 ostree_commit = import_oci_archive (tmpd , tmp_oci_archive , buildid )
@@ -87,10 +91,10 @@ def generate_oci_archive(args, tmpd):
8791 return tmpf
8892
8993
90- def generate_oci_manifest (args , tmpd ):
94+ def generate_oci_manifest (ociarchive , tmpd ):
9195 tmpf = os .path .join (tmpd , 'oci-manifest.json' )
9296 with open (tmpf , 'wb' ) as f :
93- f .write (subprocess .check_output (["skopeo" , "inspect" , "--raw" , args . srcimg ]))
97+ f .write (subprocess .check_output (["skopeo" , "inspect" , "--raw" , f"oci-archive:// { ociarchive } " ]))
9498 os .fchmod (f .fileno (), S_IREAD | S_IRGRP | S_IROTH )
9599 return tmpf
96100
0 commit comments