Skip to content

Commit 09608c3

Browse files
author
Nichol Yip
committed
Removed dead commented code and fixed du test with the correct sizes.
Signed-off-by: Nichol Yip <[email protected]>
1 parent 3d6ce60 commit 09608c3

File tree

7 files changed

+11
-54
lines changed

7 files changed

+11
-54
lines changed

Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/spk-cli/cmd-du/src/cmd_du_test.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ async fn test_du_trivially_works() {
7272

7373
let mut expected_output = vec![
7474
"2local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/options.json",
75-
"160local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/spec.yaml",
75+
"82local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/spec.yaml",
7676
"0local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/build.cmpt",
7777
"17local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/build.sh",
7878
"0local/my-pkg/1.0.0/3I42H3S6/:run/spk/pkg/my-pkg/1.0.0/3I42H3S6/options.json",
@@ -343,7 +343,7 @@ async fn test_du_summarize_output_enabled() {
343343
let mut opt = Opt::try_parse_from(["du", "local/my-pkg", "-s"]).unwrap();
344344
opt.du.run().await.unwrap();
345345

346-
let expected_output = format!("179local/my-pkg/{}", "".red());
346+
let expected_output = format!("101local/my-pkg/{}", "".red());
347347
let mut generated_output = opt.du.output.vec.lock().unwrap()[0].clone();
348348
generated_output.retain(|c| !c.is_whitespace());
349349

@@ -382,7 +382,7 @@ async fn test_du_summarize_output_is_not_enabled() {
382382
"2local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/options.json",
383383
"0local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/build.cmpt",
384384
"17local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/build.sh",
385-
"160local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/spec.yaml",
385+
"82local/my-pkg/1.0.0/3I42H3S6/:build/spk/pkg/my-pkg/1.0.0/3I42H3S6/spec.yaml",
386386
"0local/my-pkg/1.0.0/3I42H3S6/:run/spk/pkg/my-pkg/1.0.0/3I42H3S6/spec.yaml",
387387
"0local/my-pkg/1.0.0/3I42H3S6/:run/spk/pkg/my-pkg/1.0.0/3I42H3S6/options.json",
388388
"0local/my-pkg/1.0.0/3I42H3S6/:run/spk/pkg/my-pkg/1.0.0/3I42H3S6/run.cmpt",
@@ -440,7 +440,7 @@ async fn test_deprecate_flag() {
440440

441441
let mut opt_with_deprecate_flag = Opt::try_parse_from(["du", "local/my-pkg", "-ds"]).unwrap();
442442
opt_with_deprecate_flag.du.run().await.unwrap();
443-
let expected_output = format!("196local/my-pkg/{}", "DEPRECATED".red());
443+
let expected_output = format!("118local/my-pkg/{}", "DEPRECATED".red());
444444
let mut generated_output = opt_with_deprecate_flag.du.output.vec.lock().unwrap()[0].clone();
445445
generated_output.retain(|c| !c.is_whitespace());
446446
assert_eq!(expected_output, generated_output);

crates/spk-schema/crates/foundation/src/name/mod.rs

-6
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,6 @@ impl OptName {
176176
unsafe { Self::from_str("distro") }
177177
}
178178

179-
/// Standard option used to identify unrecognized keys for linting
180-
pub const fn unrecognized_key() -> &'static Self {
181-
// Safety: from_str skips validation, but this is a known good value
182-
unsafe { Self::from_str("unrecognized_key") }
183-
}
184-
185179
/// Validate the given string as an option name
186180
pub fn validate<S: AsRef<str> + ?Sized>(s: &S) -> Result<()> {
187181
validate_opt_name(s)

crates/spk-schema/crates/ident/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ format_serde_error = { version = "0.3", default_features = false, features = [
1616
"colored",
1717
] }
1818
itertools = "0.10"
19-
ngrammatic = "0.4.0"
2019
nom = { workspace = true }
2120
nom-supreme = { workspace = true }
2221
relative-path = "1.3"

crates/spk-schema/crates/ident/src/request.rs

-12
Original file line numberDiff line numberDiff line change
@@ -337,18 +337,6 @@ impl<'de> Deserialize<'de> for Request {
337337
}
338338
}
339339

340-
/// Stores the error message of the unrecognized key
341-
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
342-
pub struct UnrecognizedKey {
343-
pub error: String,
344-
}
345-
346-
impl std::fmt::Display for UnrecognizedKey {
347-
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
348-
f.write_fmt(format_args!("{self:?}"))
349-
}
350-
}
351-
352340
/// A set of restrictions placed on selected packages' build options.
353341
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
354342
pub struct VarRequest<T = PinnableValue> {

crates/spk-schema/src/spec.rs

-30
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,6 @@ impl Template for SpecTemplate {
163163
.map_err(Error::InvalidTemplate)?;
164164
Ok(SpecRecipe::from_yaml(rendered)?)
165165
}
166-
167-
// fn render_lint(&self, options: &OptionMap) -> Result<Self::Output> {
168-
// let data = super::TemplateData::new(options);
169-
// let rendered = spk_schema_liquid::render_template(&self.template, &data)
170-
// .map_err(Error::InvalidTemplate)?;
171-
// Ok(SpecRecipe::from_yaml(rendered)?)
172-
// }
173166
}
174167

175168
impl TemplateExt for SpecTemplate {
@@ -230,29 +223,6 @@ impl TemplateExt for SpecTemplate {
230223
}
231224
}
232225

233-
// #[derive(Debug, Clone, Hash, Eq, PartialEq, Serialize)]
234-
// // #[enum_dispatch(Deprecate, DeprecateMut)]
235-
// pub enum SpecRecipeKind {
236-
// DefaultSpec(super::v0::Spec<VersionIdent>),
237-
// LintSpec(super::v0::LintedSpec<VersionIdent>)
238-
// }
239-
240-
// impl SpecRecipeKind {
241-
// pub fn spec(&self) -> &super::v0::Spec<VersionIdent> {
242-
// match self {
243-
// SpecRecipeKind::DefaultSpec(s) => s,
244-
// SpecRecipeKind::LintSpec(lint) => &lint.spec,
245-
// }
246-
// }
247-
248-
// pub fn lints(&self) -> Vec<String> {
249-
// match self {
250-
// SpecRecipeKind::DefaultSpec(_) => Vec::default(),
251-
// SpecRecipeKind::LintSpec(lint) => lint.lints.clone(),
252-
// }
253-
// }
254-
// }
255-
256226
/// Specifies some buildable object within the spk ecosystem.
257227
///
258228
/// All build-able types have a recipe representation

crates/spk-schema/src/v0/spec.rs

+7
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,13 @@ where
992992
.as_ref()
993993
.ok_or_else(|| serde::de::Error::missing_field("pkg"))?;
994994

995+
// if self.check_build_spec {
996+
// if let Some(build_spec) = self.build {
997+
// let unchecked_build_spec: UncheckedBuildSpec = build_spec.item;
998+
// unchecked_build_spec.try_into().map_err(serde::de::Error::custom)?;
999+
// }
1000+
// }
1001+
9951002
Ok(self)
9961003
// let pkg = self
9971004
// .pkg

0 commit comments

Comments
 (0)