Skip to content

Commit 2ab91d9

Browse files
authored
Merge pull request #15 from scality/maintenance-version-1.2.3
Maintenance version 1.2.3
2 parents 7999c5c + f8f5cd5 commit 2ab91d9

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/lib/convert.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,14 @@ def check_mediatype(image_dir, excluded_mediatypes=None):
8888
for layer in data["layers"]:
8989
if "mediaType" in layer:
9090
media_types.append(layer["mediaType"])
91-
excluded_types = [
91+
# Use a set to collect unique excluded media types
92+
excluded_types = set([
9293
media_type
9394
for media_type in media_types
9495
if media_type in excluded_mediatypes
95-
]
96+
])
9697
if excluded_types:
97-
print(f"Excluded media types found: {excluded_types} in {image_dir}")
98+
print(f"Excluded media types found: {list(excluded_types)} in {image_dir}")
9899
excluded = True
99100
else:
100101
print("No excluded media types found, continuing.")

src/lib/install.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from pyunpack import Archive
88

99
# Define the scanners and their versions
10-
scanners = {"syft": "1.3.0", "grype": "0.77.3", "trivy": "0.51.1"}
10+
scanners = {"syft": "1.8.0", "grype": "0.79.1", "trivy": "0.53.0"}
1111

1212
# Define the base URLs for the scanners
1313
ANCHORE_BASE_URL = (
@@ -68,8 +68,10 @@ def install_package(package_name, version):
6868
os.makedirs(f"tmp_{package_name}", exist_ok=True)
6969
# Extract tarball
7070
Archive(f"{package_name}_v{version}.tar.gz").extractall(f"tmp_{package_name}")
71-
# Move binary to "/usr/local/bin/"
72-
shutil.move(f"tmp_{package_name}/{package_name}", f"/usr/local/bin/{package_name}")
71+
# Instead of shutil.move, use shutil.copy and os.remove for cross-device compatibility
72+
shutil.copy(f"tmp_{package_name}/{package_name}", f"/usr/local/bin/{package_name}")
73+
# Delete the original file after copying
74+
os.remove(f"tmp_{package_name}/{package_name}")
7375
# Delete temporary files and directories
7476
shutil.rmtree(f"tmp_{package_name}", ignore_errors=True)
7577
os.remove(f"{package_name}_v{version}.tar.gz")

0 commit comments

Comments
 (0)