Skip to content

Commit

Permalink
Let the download_manually source property default to false
Browse files Browse the repository at this point in the history
This is an optional setting that should only have to be set for sources
that have to be downloaded manually. The example in
`examples/packages/repo/pkg.toml` isn't a proper default as it only
applies to the source "src" (packages could have multiples sources or
choose a different name).

Signed-off-by: Michael Weiss <michael.weiss@eviden.com>
  • Loading branch information
primeos-work committed Sep 11, 2024
1 parent 2ced300 commit ad1eff4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 0 additions & 1 deletion examples/packages/repo/pkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ runtime = []

[sources.src]
hash.type = "sha1"
download_manually = false

[phases]

Expand Down
8 changes: 8 additions & 0 deletions src/package/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,20 @@ use serde::Serialize;
use tracing::trace;
use url::Url;

fn default_download_manually() -> bool {
false
}

#[derive(Clone, Debug, Serialize, Deserialize, Getters)]
pub struct Source {
#[getset(get = "pub")]
url: Url,
#[getset(get = "pub")]
hash: SourceHash,

// This is only required for some special packages that cannot be downloaded automatically for
// various reasons so it defaults to `false`:
#[serde(default = "default_download_manually")]
#[getset(get = "pub")]
download_manually: bool,
}
Expand Down

0 comments on commit ad1eff4

Please sign in to comment.