Skip to content

Make source archive download command configurable#1815

Merged
mosteo merged 17 commits into
alire-project:masterfrom
Seb-MCaw:feat/archive-download-command
Jan 9, 2025
Merged

Make source archive download command configurable#1815
mosteo merged 17 commits into
alire-project:masterfrom
Seb-MCaw:feat/archive-download-command

Conversation

@Seb-MCaw

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

Copy link
Copy Markdown
Contributor

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

Seb-MCaw commented Jan 7, 2025

Copy link
Copy Markdown
Contributor Author

Ready for review @mosteo.

@mosteo mosteo left a comment

Copy link
Copy Markdown
Member

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.

Comment thread src/alire/alire-settings-edit.adb Outdated
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
Copy Markdown
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.

Comment thread testsuite/tests/workflows/edit/test.py Outdated
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
Copy Markdown
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 thread testsuite/drivers/alr.py Outdated
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
Copy Markdown
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
@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