Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extension stripping, add tests, improve artifact module organization #40

Merged
merged 4 commits into from
Jul 15, 2024

Conversation

filiptibell
Copy link
Collaborator

In version 0.1.6 of Rokit, more specifically commit 1c6b7ef, Rokit started stripping extensions from file names to fix artifact names such as toolname-win64.zip not correctly being detected as Windows OS.

It turns out however that the stripping mechanism was too greedy, and tool names such as lune-0.8.6-linux-x86_64.zip, with version numbers in them, had 8, 6-linux-x86_64, and zip "extensions" stripped away, leaving no OS or architecture information left for Rokit to parse.

This PR fixes the above issue and adds two safety mechanisms to prevent it from happening again:

  • Only known extensions such as "zip", "tar", and others are stripped.
  • A maximum of 2 extensions (the maximum amount useful to Rokit) are stripped.

Stricter tests, including real world tool artifacts, have also been added.


Business logic for the artifact module has now also been split into three modules to make debugging and reading easier:

  • format.rs for the ArtifactFormat enum and its parsing
  • provider.rs for the ArtifactProvider enum and its parsing
  • util.rs for the new extension splitting mechanism, and its tests

@filiptibell filiptibell merged commit a8a2cfb into main Jul 15, 2024
9 checks passed
@filiptibell filiptibell deleted the fix-extension-stripping branch July 16, 2024 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant