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

Make source archive download command configurable #1815

Merged
merged 17 commits into from
Jan 9, 2025

Conversation

Seb-MCaw
Copy link
Contributor

@Seb-MCaw Seb-MCaw commented Jan 6, 2025

At the moment, the biggest obstacle to using Alire for private development is that source archives cannot be fetched from servers which require user authentication (this is already possible for private Git repositories, since the git command implements all authentication schemes commonly used for Git repositories).

Unfortunately, there is a much wider variety of commonly used schemes and protocols for authenticated file downloads than for Git repos, so it does not seem feasible to support all of them natively. This PR therefore makes the command used for downloads (globally) configurable with the alr settings key origins.archive.download_cmd, without changing the default behaviour.

This PR also:

  • Prevents the editor.cmd setting being read from the local crate's settings.toml (this seemed to me unexpected behaviour, and possibly something of a security vulnerability)
  • Adds support for mocking commands when testing on Windows
  • Fixes validation of the distribution.override setting
  • Fixes the deprecated (and ignored) fail_on_error in the spellcheck workflow
  • Adds a first draft of a new section to the documentation to better signpost support for private crates/indexes

PR creation checklist
  • A test is included, if required by the changes.
  • doc/user-changes.md has been updated.

@Seb-MCaw Seb-MCaw marked this pull request as draft January 6, 2025 17:07
@Seb-MCaw Seb-MCaw changed the title Feat/archive download command Make source archive download command configurable Jan 6, 2025
@Seb-MCaw Seb-MCaw marked this pull request as ready for review January 7, 2025 10:03
@Seb-MCaw
Copy link
Contributor Author

Seb-MCaw commented Jan 7, 2025

Ready for review @mosteo.

Copy link
Member

@mosteo mosteo left a comment

Choose a reason for hiding this comment

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

A nice set of improvements, I identified just a couple of minor changes.

function Valid_Builtin_Check (Lvl : Level) return CLIC.Config.Check_Import
is (case Lvl is
when Global => Valid_Global_Builtin'Access,
when others => Valid_Local_Builtin'Access);
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather have here the explicit case instead of others.

assert_match(r"arg1 abproject1\.gprab arg3", p.out)

# Verify that an `editor.cmd` value in a crate's local `settings.toml` is
# ignored with a warning (otherwise this would offer an inconspicouous vector
Copy link
Member

Choose a reason for hiding this comment

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

s/inconspicouous/inconspicuous/

Comment on lines 643 to 654
def unset_setting(key: str, local: bool = False):
"""
Unset a key with `alr settings`

Sets the value globally unless `local` is `True`.
"""
if local:
run_alr("settings", "--unset", key)
else:
run_alr("settings", "--global", "--unset", key)

def set_setting(key: str, value: str, local: bool = False):
Copy link
Member

Choose a reason for hiding this comment

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

For consistency with other alr_blah, I'd rename those to alr_settings_set and alr_settings_unset.

@Seb-MCaw Seb-MCaw requested a review from mosteo January 9, 2025 10:23
@mosteo mosteo merged commit 79a8353 into alire-project:master Jan 9, 2025
25 checks passed
@Seb-MCaw Seb-MCaw deleted the feat/archive-download-command branch January 9, 2025 11:27
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.

2 participants