-
Notifications
You must be signed in to change notification settings - Fork 71
feat: add support for relative URLs #2305
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
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
1c3cd61
feat(rust): add a Url enum to support relative URLs
imobachgs 5ba274c
feat(rust): add support for relative URLs to scripts
imobachgs 9f119ca
feat(rust): resolve scripts URLs
imobachgs a86549f
feat(ruby): remove the relurl:// prefix
imobachgs 5e17732
refactor(rust): replace our own Url with fluent_uri
imobachgs 1223996
fix(rust): drop unneeded serde_as
imobachgs 0c60dd4
chore(rust): imprrove ScriptSource OpenAPI description
imobachgs 714c163
refactor(rust): unify ScriptSouce y FileSource
imobachgs e7b3271
refactor(rust): move logic to resolve URLs to a WithFileSource trait
imobachgs c5fcb9a
feat(rust): support relative URLs for files
imobachgs b8700ed
fix(ruby): fix conversion of file_owner
imobachgs b214bd9
chore(ruby): add tests for the FilesReader class
imobachgs 720c9d8
feat(ruby): remove the relurl:// schema when reading files
imobachgs eeee638
fix(rust): do not export the chroot if not given
imobachgs f0f2b48
chore(rust): drop unneeded use
imobachgs 60b9cee
fix(rust): fix a typo
imobachgs a8dc194
docs: update changes files
imobachgs e54ba2a
feat(rust): report the URL when curl fails
imobachgs 0447c49
Apply suggestions from code review
imobachgs 3bbe066
Apply suggestion from code review
imobachgs 4640833
refactor(rust): make StoreContext source mandatory
imobachgs 85af008
fix(rust): use 0o700 for scripts
imobachgs dd81167
Apply suggestions from code review
imobachgs 153bdd2
refactor(rust): move URL solving to InstallSettings
imobachgs 7262a2e
refactor(rust): remove duplication in scripts::model
imobachgs 280a496
refactor(rust): remove unused code
imobachgs 85db3a7
doc(rust): update JSON schema regarding files/scripts
imobachgs 8728f12
fix(rust): drop an unused test
imobachgs 77ecd10
chore(rust): add comment about Transfer::get
imobachgs f736c67
feat(rust): support relative URLs in "agama download"
imobachgs 9a1deb3
Apply suggestions from code review
imobachgs 0ec22e6
docs(rust): update CLI
imobachgs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // Copyright (c) [2025] SUSE LLC | ||
| // | ||
| // All Rights Reserved. | ||
| // | ||
| // This program is free software; you can redistribute it and/or modify it | ||
| // under the terms of the GNU General Public License as published by the Free | ||
| // Software Foundation; either version 2 of the License, or (at your option) | ||
| // any later version. | ||
| // | ||
| // This program is distributed in the hope that it will be useful, but WITHOUT | ||
| // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| // more details. | ||
| // | ||
| // You should have received a copy of the GNU General Public License along | ||
| // with this program; if not, contact SUSE LLC. | ||
| // | ||
| // To contact SUSE LLC about this file by physical or electronic mail, you may | ||
| // find current contact information at www.suse.com. | ||
|
|
||
| use fluent_uri::Uri; | ||
|
|
||
| #[derive(Debug, thiserror::Error)] | ||
| #[error("Could not determine the installation context")] | ||
| pub struct InstallationContextError(String); | ||
|
|
||
| /// It contains context information for the store. | ||
| #[derive(Debug)] | ||
| pub struct InstallationContext { | ||
| /// Where the installation settings are from. | ||
imobachgs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /// Used for resolving relative URL references. | ||
| pub source: Uri<String>, | ||
| } | ||
|
|
||
| impl InstallationContext { | ||
| /// Sets _source_ to the current directory. | ||
| pub fn from_env() -> Result<Self, InstallationContextError> { | ||
| let current_path = | ||
| std::env::current_dir().map_err(|e| InstallationContextError(e.to_string()))?; | ||
| let url = format!("file://{}", current_path.as_path().display()); | ||
| let url = Uri::parse(url.as_str()).map_err(|e| InstallationContextError(e.to_string()))?; | ||
| Ok(Self { | ||
| source: url.to_owned(), | ||
| }) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation! Again we are adding a secret feature. Please locate the 2 occurrences of
relurlin Agama source, both are affected by this PR, one by this commit :)