Skip to content

Commit

Permalink
Fix FileNotFoundError for container remote sources
Browse files Browse the repository at this point in the history
  • Loading branch information
qduanmu committed Feb 10, 2023
1 parent 324a06c commit 5c4aa4f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 4 additions & 3 deletions openlcs/libs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,15 @@ def get_component_flat(data, comp_type):
return component


def uncompress_blob_gzip_files(dest_dir):
def uncompress_blob_gzip_files(src_file, dest_dir):
# Uncompress the blob files that come from source container registry.
# Under the directory, most of the files are gzip files that need to
# decompress. There are some metadata files that no need to decompress.
err_msg_list = []
blob_files = os.listdir(dest_dir)
src_dir = os.path.dirname(src_file)
blob_files = os.listdir(src_dir)
for blob_file in blob_files:
blob_file = os.path.join(dest_dir, blob_file)
blob_file = os.path.join(src_dir, blob_file)
file_type = get_mime_type(blob_file)
if file_type == "application/gzip":
cmd = ['tar', '-xvf', blob_file]
Expand Down
7 changes: 3 additions & 4 deletions openlcs/libs/sc_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def unpack_source_container_remote_source(self):
uncompress_source_tarball(rs_tarball_path, rs_dest_dir)
return rs_dir

def get_source_container_srpms_metadata(self):
def get_source_container_metadata(self):
"""
Get metadata files of source RPMs in source container.
"""
Expand Down Expand Up @@ -202,8 +202,7 @@ def unpack_source_container_image(self):
for tarball in tarballs:
uncompress_source_tarball(tarball)
else:
self.dest_dir = os.path.dirname(self.src_file)
errs = uncompress_blob_gzip_files(self.dest_dir)
errs = uncompress_blob_gzip_files(self.src_file, self.dest_dir)
# Get source RPMs in the source container.
srpm_dir = self.get_source_container_srpms()

Expand All @@ -212,7 +211,7 @@ def unpack_source_container_image(self):

# Get metadata files of source RPMs to metadata dir, will add the
# remote source metadata in this directory at the other steps.
misc_dir = self.get_source_container_srpms_metadata()
misc_dir = self.get_source_container_metadata()

return srpm_dir, rs_dir, misc_dir, errs

Expand Down

0 comments on commit 5c4aa4f

Please sign in to comment.