Merge pull request #2758 from cgwalters/treefile-validate-repos
compose: Move repos/lockfile-repos validation to Rust
This commit is contained in:
commit
2ad8543b3e
@ -612,6 +612,11 @@ impl Treefile {
|
||||
}
|
||||
}
|
||||
}
|
||||
if config.repos.is_none() && config.lockfile_repos.is_none() {
|
||||
return Err(anyhow!(
|
||||
r#"Treefile has neither "repos" nor "lockfile-repos""#
|
||||
));
|
||||
}
|
||||
if let Some(version_suffix) = config.automatic_version_suffix.as_ref() {
|
||||
if !(version_suffix.len() == 1 && version_suffix.is_ascii()) {
|
||||
return Err(io::Error::new(
|
||||
@ -1235,6 +1240,8 @@ pub(crate) mod tests {
|
||||
|
||||
pub(crate) static VALID_PRELUDE: &str = indoc! {r#"
|
||||
ref: "exampleos/x86_64/blah"
|
||||
repos:
|
||||
- baserepo
|
||||
packages:
|
||||
- foo bar
|
||||
- baz
|
||||
@ -1485,6 +1492,8 @@ pub(crate) mod tests {
|
||||
"foo.yaml",
|
||||
0o644,
|
||||
indoc! {"
|
||||
repos:
|
||||
- foo
|
||||
packages:
|
||||
- fooinclude
|
||||
"},
|
||||
@ -1506,6 +1515,8 @@ pub(crate) mod tests {
|
||||
"foo-x86_64.yaml",
|
||||
0o644,
|
||||
r#"
|
||||
repos:
|
||||
- foo
|
||||
packages:
|
||||
- foo-x86_64-include
|
||||
"#,
|
||||
|
@ -185,12 +185,6 @@ rpmostree_composeutil_get_treespec (RpmOstreeContext *ctx,
|
||||
return NULL;
|
||||
if (!treespec_bind_array (treedata, treespec, "lockfile-repos", NULL, FALSE, error))
|
||||
return NULL;
|
||||
|
||||
/* at least one of `repos` and `lockfile-repos` should be defined */
|
||||
if (!json_object_has_member (treedata, "repos") &&
|
||||
!json_object_has_member (treedata, "lockfile-repos"))
|
||||
return (RpmOstreeTreespec*)glnx_null_throw (error, "Treefile has neither \"repos\" nor \"lockfile-repos\" members");
|
||||
|
||||
if (!treespec_bind_array (treedata, treespec, "install-langs", "instlangs", FALSE, error))
|
||||
return NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user