From e0e49a4694df153f88d5448d12fdd9398b882535 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Fri, 9 May 2025 13:02:51 -0400 Subject: [PATCH 1/4] rustup-components-history: Add "version" and "git_commit_hash" fields to the manifest --- library/src/manifest.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/src/manifest.rs b/library/src/manifest.rs index 8f3ee38c412..e6f22af625e 100644 --- a/library/src/manifest.rs +++ b/library/src/manifest.rs @@ -37,6 +37,10 @@ pub struct Rename { /// Package info. #[derive(Debug, Serialize, Deserialize, PartialEq)] pub struct PackageTargets { + /// The package version + pub version: String, + /// The commit hash of the package + pub git_commit_hash: String, /// Maps targets onto package availability info. #[serde(rename = "target")] pub targets: HashMap, From c02797b3d972fd0803ecce116803a17da006a9d4 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Fri, 9 May 2025 13:12:18 -0400 Subject: [PATCH 2/4] rustup-components-history: fixup tests to include version and git_commit_hash --- library/src/availability.rs | 9 +++++++++ library/src/manifest.rs | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/library/src/availability.rs b/library/src/availability.rs index 8d48063bc8b..192cbfa97f2 100644 --- a/library/src/availability.rs +++ b/library/src/availability.rs @@ -139,8 +139,14 @@ mod tests { #[test] fn check() { let data = r#"date = "2018-09-03" +[pkg.rust-src] +version = "0.0.0" +git_commit_hash = "0123456789abcdef" [pkg.rust-src.target."*"] available = true +[pkg.ahaha] +version = "0.0.0" +git_commit_hash = "0123456789abcdef" [pkg.ahaha.target.lol] available = true "#; @@ -179,6 +185,9 @@ available = true #[test] fn check_rename() { let data = r#"date = "2018-09-03" +[pkg.ahaha] +version = "0.0.0" +git_commit_hash = "0123456789abcdef" [pkg.ahaha.target.lol] available = true [renames.kek] diff --git a/library/src/manifest.rs b/library/src/manifest.rs index e6f22af625e..98a22b914fa 100644 --- a/library/src/manifest.rs +++ b/library/src/manifest.rs @@ -83,6 +83,9 @@ mod tests { #[test] fn check() { let data = r#"date = "2018-09-03" +[pkg.cargo] +version = "0.89.0-nightly (7918c7eb5 2025-04-27)" +git_commit_hash = "e9f8103f93f8ce2fa2c15c0c6796ec821f8ae15d" [pkg.cargo.target.aarch64-unknown-linux-gnu] available = true @@ -92,6 +95,10 @@ available = true [pkg.cargo.target.arm-unknown-linux-gnueabihf] available = false +[pkg.rustfmt-preview] +version = "1.8.0-nightly" +git_commit_hash = "e9f8103f93f8ce2fa2c15c0c6796ec821f8ae15d" + [pkg.rustfmt-preview.target.aarch64-unknown-linux-gnu] available = true @@ -114,6 +121,8 @@ to = "rustfmt-preview" ( "cargo".to_string(), PackageTargets { + version: "0.89.0-nightly (7918c7eb5 2025-04-27)".to_string(), + git_commit_hash: "e9f8103f93f8ce2fa2c15c0c6796ec821f8ae15d".to_string(), targets: vec![ ( "aarch64-unknown-linux-gnu".to_string(), @@ -135,6 +144,8 @@ to = "rustfmt-preview" ( "rustfmt-preview".to_string(), PackageTargets { + version: "1.8.0-nightly".to_string(), + git_commit_hash: "e9f8103f93f8ce2fa2c15c0c6796ec821f8ae15d".to_string(), targets: vec![ ( "aarch64-unknown-linux-gnu".to_string(), @@ -179,6 +190,9 @@ to = "rustfmt-preview" #[test] fn check_wildcard() { let data = r#"date = "2018-09-03" +[pkg.rust-src] +version = "1.88.0-nightly (e9f8103f9 2025-05-07)" +git_commit_hash = "e9f8103f93f8ce2fa2c15c0c6796ec821f8ae15d" [pkg.rust-src.target."*"] available = true url = "https://static.rust-lang.org/dist/2018-09-03/rust-src-nightly.tar.gz" @@ -192,6 +206,8 @@ xz_hash = "dbb913da0a207ae80c53bc6a42074b637920c2a80121420416579fed3e7f2499" packages: vec![( "rust-src".to_string(), PackageTargets { + version: "1.88.0-nightly (e9f8103f9 2025-05-07)".to_string(), + git_commit_hash: "e9f8103f93f8ce2fa2c15c0c6796ec821f8ae15d".to_string(), targets: vec![("*".to_string(), PackageInfo { available: true })] .into_iter() .collect(), @@ -210,6 +226,7 @@ xz_hash = "dbb913da0a207ae80c53bc6a42074b637920c2a80121420416579fed3e7f2499" date = "2018-09-03" [pkg.cargo] version = "0.30.0-nightly (0ec7281b9 2018-08-20)" +git_commit_hash = "0ec7281b9c3f8e2fa2c15c0c6796ec821f8ae15d" [pkg.cargo.target.aarch64-unknown-linux-gnu] available = true url = "https://static.rust-lang.org/dist/2018-09-04/cargo-nightly-aarch64-unknown-linux-gnu.tar.gz" @@ -233,6 +250,7 @@ xz_hash = "ca0e68e7e9827ba6221a40bb17170e8dc6271a9f6991ee5030dcf6acb1a1d8c8" [pkg.rustfmt-preview] version = "0.99.2-nightly (5c9a2b6c1 2018-08-07)" +git_commit_hash = "0ec7281b9c3f8e2fa2c15c0c6796ec821f8ae15d" [pkg.rustfmt-preview.target.aarch64-unknown-linux-gnu] available = true url = "https://static.rust-lang.org/dist/2018-09-03/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.gz" From 4215aa23969c9fd2b85010fba235154f6bfda60a Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Mon, 12 May 2025 15:34:12 -0400 Subject: [PATCH 3/4] if package is unavailable, git_commit_hash may be missing --- library/src/manifest.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/src/manifest.rs b/library/src/manifest.rs index 98a22b914fa..88eb5f2820c 100644 --- a/library/src/manifest.rs +++ b/library/src/manifest.rs @@ -37,10 +37,10 @@ pub struct Rename { /// Package info. #[derive(Debug, Serialize, Deserialize, PartialEq)] pub struct PackageTargets { - /// The package version + /// The package version. May be empty if the package is not available. pub version: String, - /// The commit hash of the package - pub git_commit_hash: String, + /// The commit hash of the package. May be `None` if the package is not available. + pub git_commit_hash: Option, /// Maps targets onto package availability info. #[serde(rename = "target")] pub targets: HashMap, From 44f4dd8d33553830f4dfa01c08124b6f134945f0 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Mon, 12 May 2025 15:36:46 -0400 Subject: [PATCH 4/4] Allow missing git_commit_hash --- library/src/manifest.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/library/src/manifest.rs b/library/src/manifest.rs index 88eb5f2820c..315c55df855 100644 --- a/library/src/manifest.rs +++ b/library/src/manifest.rs @@ -40,6 +40,7 @@ pub struct PackageTargets { /// The package version. May be empty if the package is not available. pub version: String, /// The commit hash of the package. May be `None` if the package is not available. + #[serde(default)] pub git_commit_hash: Option, /// Maps targets onto package availability info. #[serde(rename = "target")] @@ -122,7 +123,9 @@ to = "rustfmt-preview" "cargo".to_string(), PackageTargets { version: "0.89.0-nightly (7918c7eb5 2025-04-27)".to_string(), - git_commit_hash: "e9f8103f93f8ce2fa2c15c0c6796ec821f8ae15d".to_string(), + git_commit_hash: Some( + "e9f8103f93f8ce2fa2c15c0c6796ec821f8ae15d".to_string(), + ), targets: vec![ ( "aarch64-unknown-linux-gnu".to_string(), @@ -145,7 +148,9 @@ to = "rustfmt-preview" "rustfmt-preview".to_string(), PackageTargets { version: "1.8.0-nightly".to_string(), - git_commit_hash: "e9f8103f93f8ce2fa2c15c0c6796ec821f8ae15d".to_string(), + git_commit_hash: Some( + "e9f8103f93f8ce2fa2c15c0c6796ec821f8ae15d".to_string(), + ), targets: vec![ ( "aarch64-unknown-linux-gnu".to_string(), @@ -207,7 +212,7 @@ xz_hash = "dbb913da0a207ae80c53bc6a42074b637920c2a80121420416579fed3e7f2499" "rust-src".to_string(), PackageTargets { version: "1.88.0-nightly (e9f8103f9 2025-05-07)".to_string(), - git_commit_hash: "e9f8103f93f8ce2fa2c15c0c6796ec821f8ae15d".to_string(), + git_commit_hash: Some("e9f8103f93f8ce2fa2c15c0c6796ec821f8ae15d".to_string()), targets: vec![("*".to_string(), PackageInfo { available: true })] .into_iter() .collect(),