From 54d876838f352805a2dd1f7a766eb0dae25e9e4b Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 23 Feb 2023 01:00:57 +0000 Subject: [PATCH] Bug 1817900 - Update cargo_metadata to 0.15.3. r=emilio,supply-chain-reviewers Differential Revision: https://phabricator.services.mozilla.com/D170429 --- Cargo.lock | 4 +-- supply-chain/audits.toml | 5 +++ .../rust/cargo_metadata/.cargo-checksum.json | 2 +- third_party/rust/cargo_metadata/Cargo.toml | 2 +- third_party/rust/cargo_metadata/src/lib.rs | 32 +++++++++++++++++++ 5 files changed, 41 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fcbae7518b75..c9fb240c2388 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -658,9 +658,9 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.15.2" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982a0cf6a99c350d7246035613882e376d58cebe571785abc5da4f648d53ac0a" +checksum = "08a1ec454bc3eead8719cb56e15dbbfecdbc14e4b3a3ae4936cc6e31f5fc0d07" dependencies = [ "camino", "cargo-platform", diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml index bd736d11f16b..c0c9cca90adf 100644 --- a/supply-chain/audits.toml +++ b/supply-chain/audits.toml @@ -284,6 +284,11 @@ criteria = "safe-to-deploy" version = "0.15.2" notes = "I reviewed the whole code base. Parser for the output of cargo-metadata, relying mostly on serde. No unsafe code used." +[[audits.cargo_metadata]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "0.15.2 -> 0.15.3" + [[audits.chardetng]] who = "Henri Sivonen " criteria = "safe-to-deploy" diff --git a/third_party/rust/cargo_metadata/.cargo-checksum.json b/third_party/rust/cargo_metadata/.cargo-checksum.json index ca44cf52979b..7838a4a29d7e 100644 --- a/third_party/rust/cargo_metadata/.cargo-checksum.json +++ b/third_party/rust/cargo_metadata/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"8b3e29799cdedf02f169bb519072ace2e2b6b9413f4ce8fa0666c2d1d964084e","Cargo.toml":"4985edbf3071a2f67c7b6292840634b73f26dd667981bf9cbebb5b254416ced2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"d51a5b3347bed2441b20986be81bfd4611ca2c5614f950116b273199a9bcf2de","src/dependency.rs":"c593ddc73d863c5712e2aba58b5f4d9bd915a5ac0bc17df71642aa79aa93bfdc","src/diagnostic.rs":"fee47d27390f1026ff99ffade5dfd2ab3e9b9839c3f33ce91a7dcde875551374","src/errors.rs":"797afd61efdd843ae570d9e972dd2425d33823d4a78c0c488028493dffb45c7a","src/lib.rs":"20216b98b9af855b9ef61cb4ecf68ae17b443add83e6888d14f578b8de4ad6ea","src/messages.rs":"a8e3ee31dc8cce5762b4b085be29fe4d7189a789f3a149ef2b6c17604d94528b","tests/selftest.rs":"73afd494c1bf7dd4e1a99971e9ff66a0e21fc7bf3e327663df15d2350dcdfc70","tests/test_samples.rs":"ee2b4737adfa1930c1610bb3ec0fc94b7f1a3691bb09545da69044eef2f5ba6b"},"package":"982a0cf6a99c350d7246035613882e376d58cebe571785abc5da4f648d53ac0a"} \ No newline at end of file +{"files":{"CHANGELOG.md":"8b3e29799cdedf02f169bb519072ace2e2b6b9413f4ce8fa0666c2d1d964084e","Cargo.toml":"57d432cd172cc87ee4c31b0e4c21c52d06ba1a48da9decd34581b2671c47d71d","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"d51a5b3347bed2441b20986be81bfd4611ca2c5614f950116b273199a9bcf2de","src/dependency.rs":"c593ddc73d863c5712e2aba58b5f4d9bd915a5ac0bc17df71642aa79aa93bfdc","src/diagnostic.rs":"fee47d27390f1026ff99ffade5dfd2ab3e9b9839c3f33ce91a7dcde875551374","src/errors.rs":"797afd61efdd843ae570d9e972dd2425d33823d4a78c0c488028493dffb45c7a","src/lib.rs":"5ec701f3589c5d71c152b5abe7ad5f222aee4d4a5f9992bced1d357bad36e227","src/messages.rs":"a8e3ee31dc8cce5762b4b085be29fe4d7189a789f3a149ef2b6c17604d94528b","tests/selftest.rs":"73afd494c1bf7dd4e1a99971e9ff66a0e21fc7bf3e327663df15d2350dcdfc70","tests/test_samples.rs":"ee2b4737adfa1930c1610bb3ec0fc94b7f1a3691bb09545da69044eef2f5ba6b"},"package":"08a1ec454bc3eead8719cb56e15dbbfecdbc14e4b3a3ae4936cc6e31f5fc0d07"} \ No newline at end of file diff --git a/third_party/rust/cargo_metadata/Cargo.toml b/third_party/rust/cargo_metadata/Cargo.toml index 6f720e09dc05..25a28ef4f64b 100644 --- a/third_party/rust/cargo_metadata/Cargo.toml +++ b/third_party/rust/cargo_metadata/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" rust-version = "1.42.0" name = "cargo_metadata" -version = "0.15.2" +version = "0.15.3" authors = ["Oliver Schneider "] description = "structured access to the output of `cargo metadata`" readme = "README.md" diff --git a/third_party/rust/cargo_metadata/src/lib.rs b/third_party/rust/cargo_metadata/src/lib.rs index 5ab6030b5cfe..27c72da0d3a1 100644 --- a/third_party/rust/cargo_metadata/src/lib.rs +++ b/third_party/rust/cargo_metadata/src/lib.rs @@ -83,6 +83,7 @@ use camino::Utf8PathBuf; use derive_builder::Builder; use std::collections::HashMap; use std::env; +use std::ffi::OsString; use std::fmt; use std::hash::Hash; use std::path::PathBuf; @@ -592,6 +593,9 @@ pub struct MetadataCommand { /// Arbitrary command line flags to pass to `cargo`. These will be added /// to the end of the command line invocation. other_options: Vec, + /// Arbitrary environment variables to set when running `cargo`. These will be merged into + /// the calling environment, overriding any which clash. + env: HashMap, /// Show stderr verbose: bool, } @@ -689,6 +693,32 @@ impl MetadataCommand { self } + /// Arbitrary environment variables to set when running `cargo`. These will be merged into + /// the calling environment, overriding any which clash. + /// + /// Some examples of when you may want to use this: + /// 1. Setting cargo config values without needing a .cargo/config.toml file, e.g. to set + /// `CARGO_NET_GIT_FETCH_WITH_CLI=true` + /// 2. To specify a custom path to RUSTC if your rust toolchain components aren't laid out in + /// the way cargo expects by default. + /// + /// ```no_run + /// # use cargo_metadata::{CargoOpt, MetadataCommand}; + /// MetadataCommand::new() + /// .env("CARGO_NET_GIT_FETCH_WITH_CLI", "true") + /// .env("RUSTC", "/path/to/rustc") + /// // ... + /// # ; + /// ``` + pub fn env, V: Into>( + &mut self, + key: K, + val: V, + ) -> &mut MetadataCommand { + self.env.insert(key.into(), val.into()); + self + } + /// Set whether to show stderr pub fn verbose(&mut self, verbose: bool) -> &mut MetadataCommand { self.verbose = verbose; @@ -729,6 +759,8 @@ impl MetadataCommand { } cmd.args(&self.other_options); + cmd.envs(&self.env); + cmd }