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

Ignore __MACOSX folder in tool archives when launching core install #2162

Conversation

alessio-perugini
Copy link
Contributor

Please check if the PR fulfills these requirements

See how to contribute

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • configuration.schema.json updated if new parameters are added.

What kind of change does this PR introduce?

This ignore __MACOSX autogenerated folder inside the archives. When we launch the core install command
if the downloaded archive, besides the root dir, contains also the __MACOSX we simply ignore that dir.

What is the current behavior?

If we encounter a __MACOSX folder we throw an error.

What is the new behavior?

We ignore every __MACOSX folder when searching for the package root.

Does this PR introduce a breaking change, and is titled accordingly?

nope

Other information

I've added a commit to propose a small refactoring feel free to revert it.

@codecov
Copy link

codecov bot commented Apr 28, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.03 ⚠️

Comparison is base (ebdef4d) 62.57% compared to head (9e4e5e0) 62.55%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2162      +/-   ##
==========================================
- Coverage   62.57%   62.55%   -0.03%     
==========================================
  Files         223      223              
  Lines       19462    19459       -3     
==========================================
- Hits        12179    12172       -7     
- Misses       6192     6196       +4     
  Partials     1091     1091              
Flag Coverage Δ
unit 62.55% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
arduino/resources/install.go 53.33% <100.00%> (+8.46%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@alessio-perugini alessio-perugini marked this pull request as ready for review April 28, 2023 15:34
Copy link
Member

@cmaglie cmaglie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! just a missing license header.

arduino/resources/install_test.go Show resolved Hide resolved
@cmaglie
Copy link
Member

cmaglie commented May 2, 2023

We should also update the documentation and explicitly say that in the archives the subdirectory __MACOSX is ignored.

BTW I can't really find a place where the archive format is specified, the only place where this topic is discussed is at the bottom of docs/package_index_json-specification.md:

Installation archive structure

The installation archives contain the Board support files.

Supported formats are .zip, .tar.bz2, and .tar.gz. Starting from Arduino CLI >=0.30.0 support for .tar.xz, and
.tar.zst has been added, by the way, if you want to keep compatiblity with older versions of Arduino IDE and Arduino
CLI we recommend using one of the older formats.

The folder structure of the core archive is slightly different from the standard manually installed Arduino IDE 1.5+
compatible hardware folder structure. You must remove the architecture folder(e.g., avr or arm), moving all the
files and folders within the architecture folder up a level.

the hint for "The folder structure of the core archive" is referred specifically for platform archives. So... I guess this documentation requires a bit of refactoring, maybe it's worth opening another issue.

@alessio-perugini alessio-perugini force-pushed the 1790-auto-generated-__macosx-folder-in-tool-archive-causes-core-install-to-fail-cannot-install-platform-searching-package-root-dir-no-unique-root-dir-in-archive-1 branch from 0c67cf0 to 9e4e5e0 Compare May 2, 2023 12:32
@alessio-perugini
Copy link
Contributor Author

We should also update the documentation and explicitly say that in the archives the subdirectory __MACOSX is ignored.

BTW I can't really find a place where the archive format is specified, the only place where this topic is discussed is at the bottom of docs/package_index_json-specification.md:

Installation archive structure

The installation archives contain the Board support files.
Supported formats are .zip, .tar.bz2, and .tar.gz. Starting from Arduino CLI >=0.30.0 support for .tar.xz, and
.tar.zst has been added, by the way, if you want to keep compatiblity with older versions of Arduino IDE and Arduino
CLI we recommend using one of the older formats.
The folder structure of the core archive is slightly different from the standard manually installed Arduino IDE 1.5+
compatible hardware folder structure. You must remove the architecture folder(e.g., avr or arm), moving all the
files and folders within the architecture folder up a level.

the hint for "The folder structure of the core archive" is referred specifically for platform archives. So... I guess this documentation requires a bit of refactoring, maybe it's worth opening another issue.

We'll be taking care to improve docs in a separate PR. Tracking on #2167 🚀

@alessio-perugini alessio-perugini merged commit 2a5c83a into master May 2, 2023
@alessio-perugini alessio-perugini deleted the 1790-auto-generated-__macosx-folder-in-tool-archive-causes-core-install-to-fail-cannot-install-platform-searching-package-root-dir-no-unique-root-dir-in-archive-1 branch May 2, 2023 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: CLI Related to the command line interface type: imperfection Perceived defect in any part of project
Projects
None yet
2 participants