Skip to content

Commit

Permalink
fix: fixed arm64 architecture regex filter
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbraun89 authored Sep 30, 2023
1 parent 25a47ae commit 4903464
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
12 changes: 11 additions & 1 deletion nanolayer/installers/gh_release/resolvers/asset_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AssetResolver:
LinuxInformationDesk.Architecture.I386: r"(i386|\-386|_386)",
LinuxInformationDesk.Architecture.I686: r"(i686|\-686|_686)",
LinuxInformationDesk.Architecture.ARM32: r"([Aa]rm32|ARM32)",
LinuxInformationDesk.Architecture.ARM64: r"([Aa]rm64|ARM64|\-ARM|\-arm\-)",
LinuxInformationDesk.Architecture.ARM64: r"([Aa]rm64|ARM64)",
LinuxInformationDesk.Architecture.S390: r"(s390x|s390)",
LinuxInformationDesk.Architecture.PPC64: r"(\-ppc|ppc64|PPC64|_ppc)",
LinuxInformationDesk.Architecture.x86_64: r"([Aa]md64|\-x64|x64|x86[_-]64)",
Expand Down Expand Up @@ -286,6 +286,16 @@ def resolve(
),
]

# if arm64 - accept also simple "arm/ARM" mentions
if arch == LinuxInformationDesk.Architecture.ARM64:
positive_filters += [
cls.FindAllRegexFilter(
name="prefer own distro-like", # prefer own distro like
regex=r"\-ARM\-?|\-arm\-",
negative=False,
)
]

bad_distros_regexes = {
key: val
for key, val in cls.DISTRO_REGEX_MAP.items()
Expand Down
9 changes: 9 additions & 0 deletions tests/installers/gh_release/test_gh_release_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@
"--asset-regex '^extractor\.linux-.+\.exe$' --no-filter-assets-by-platform",
"linux/arm64",
),
(
"trivy --version",
0,
"mcr.microsoft.com/vscode/devcontainers/python:3.10-bullseye",
"aquasecurity/trivy",
"trivy",
"",
"linux/arm64",
),
],
)
def test_gh_release_install(
Expand Down

0 comments on commit 4903464

Please sign in to comment.