summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@chromium.org>2019-04-10 17:59:15 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-04-12 14:49:56 -0700
commitfd67ec5ffc84d8726ebcb141ddb93e10a046ee72 (patch)
tree1372d65c4a93f144a0ef39afc0e4ceaffd52f6a2
parent0268e26e1ac9e09aa51d733482c5df139cd8d588 (diff)
downloadcrosvm-fd67ec5ffc84d8726ebcb141ddb93e10a046ee72.tar
crosvm-fd67ec5ffc84d8726ebcb141ddb93e10a046ee72.tar.gz
crosvm-fd67ec5ffc84d8726ebcb141ddb93e10a046ee72.tar.bz2
crosvm-fd67ec5ffc84d8726ebcb141ddb93e10a046ee72.tar.lz
crosvm-fd67ec5ffc84d8726ebcb141ddb93e10a046ee72.tar.xz
crosvm-fd67ec5ffc84d8726ebcb141ddb93e10a046ee72.tar.zst
crosvm-fd67ec5ffc84d8726ebcb141ddb93e10a046ee72.zip
protos: Update to protobuf 2.3
This matches the version already used by crostini_client.

The newer protobuf version depends on the tempfile crate rather than
tempdir, the latter being now deprecated. So I replaced our immitation
tempdir crate with one that matches the API of tempfile instead. As a
reminder, we use this crate as a patch to avoid pulling in all of the
rand crate and its many dependencies.

TEST=cargo check --features plugin
CQ-DEPEND=CL:1553971

Change-Id: I28eed3ceadb1013f015400b4c582aaf8dc89eee1
Reviewed-on: https://chromium-review.googlesource.com/1562924
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: David Tolnay <dtolnay@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
-rw-r--r--Cargo.lock40
-rw-r--r--Cargo.toml6
-rw-r--r--crosvm_plugin/Cargo.toml2
-rw-r--r--plugin_proto/Cargo.toml4
-rw-r--r--plugin_proto/build.rs1
-rw-r--r--tempfile/Cargo.toml (renamed from tempdir/Cargo.toml)4
-rw-r--r--tempfile/src/lib.rs (renamed from tempdir/src/lib.rs)36
7 files changed, 62 insertions, 31 deletions
diff --git a/Cargo.lock b/Cargo.lock
index f22dcd6..1b28355 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -101,7 +101,7 @@ dependencies = [
  "net_util 0.1.0",
  "p9 0.1.0",
  "plugin_proto 0.17.0",
- "protobuf 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "protobuf 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "qcow 0.1.0",
  "rand_ish 0.1.0",
  "render_node_forward 0.1.0",
@@ -121,7 +121,7 @@ dependencies = [
  "kvm_sys 0.1.0",
  "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)",
  "plugin_proto 0.17.0",
- "protobuf 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "protobuf 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "sys_util 0.1.0",
 ]
 
@@ -331,8 +331,8 @@ version = "0.17.0"
 dependencies = [
  "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
  "kvm_sys 0.1.0",
- "protobuf 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "protoc-rust 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "protobuf 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "protoc-rust 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -354,12 +354,20 @@ dependencies = [
 
 [[package]]
 name = "protobuf"
-version = "1.4.3"
+version = "2.4.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
+name = "protobuf-codegen"
+version = "2.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "protobuf 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
 name = "protoc"
-version = "1.4.3"
+version = "2.4.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -367,12 +375,13 @@ dependencies = [
 
 [[package]]
 name = "protoc-rust"
-version = "1.4.3"
+version = "2.4.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "protobuf 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "protoc 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "tempdir 0.3.7",
+ "protobuf 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "protobuf-codegen 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "protoc 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tempfile 3.0.7",
 ]
 
 [[package]]
@@ -453,8 +462,8 @@ name = "syscall_defines"
 version = "0.1.0"
 
 [[package]]
-name = "tempdir"
-version = "0.3.7"
+name = "tempfile"
+version = "3.0.7"
 dependencies = [
  "rand_ish 0.1.0",
 ]
@@ -563,9 +572,10 @@ dependencies = [
 "checksum num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238"
 "checksum pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "110d5ee3593dbb73f56294327fe5668bcc997897097cbc76b51e7aed3f52452f"
 "checksum proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)" = "ab2fc21ba78ac73e4ff6b3818ece00be4e175ffbef4d0a717d978b48b24150c4"
-"checksum protobuf 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bec26e67194b7d991908145fdf21b7cae8b08423d96dcb9e860cd31f854b9506"
-"checksum protoc 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5379c34ea2f9c69b99e6f25f6d0e6619876195ae7a3dcaf69f66bdb6c2e4dceb"
-"checksum protoc-rust 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e211a7f56b2d020a59d483f652cfdfa6fd42e37bf544c0231e373807aa316c45"
+"checksum protobuf 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "524d165d95627ddebba768db728216c4429bbb62882f7e6ab1a6c3c54a7ed830"
+"checksum protobuf-codegen 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e142c5972a0736674d647714ac7a454f20aef31b09902d330583b8d8a96401a1"
+"checksum protoc 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "82ac4c59bf852f415c62a1d30da3348f977322dc66bdb283c92b3df9bee2073a"
+"checksum protoc-rust 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0e9dc0547688715431c954528a3dabe7559b4d53b3161426981e19419ea7b1f0"
 "checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c"
 "checksum syn 0.15.21 (registry+https://github.com/rust-lang/crates.io-index)" = "816b7af21405b011a23554ea2dc3f6576dc86ca557047c34098c1d741f10f823"
 "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
diff --git a/Cargo.toml b/Cargo.toml
index 4a6edc5..27b128c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,7 +17,7 @@ exclude = [
     "sync",
     "sys_util",
     "syscall_defines",
-    "tempdir",
+    "tempfile",
 ]
 
 [features]
@@ -50,7 +50,7 @@ msg_socket = { path = "msg_socket" }
 net_util = { path = "net_util" }
 p9 = { path = "p9" }
 plugin_proto = { path = "plugin_proto", optional = true }
-protobuf = { version = "=1.4.3", optional = true }
+protobuf = { version = "2.3", optional = true }
 qcow = { path = "qcow" }
 rand_ish = { path = "rand_ish" }
 render_node_forward = { path = "render_node_forward", optional = true }
@@ -78,4 +78,4 @@ poll_token_derive = { path = "sys_util/poll_token_derive" }
 sync = { path = "sync" }
 sys_util = { path = "sys_util" }
 syscall_defines = { path = "syscall_defines" }
-tempdir = { path = "tempdir" }
+tempfile = { path = "tempfile" }
diff --git a/crosvm_plugin/Cargo.toml b/crosvm_plugin/Cargo.toml
index 84d9847..379d837 100644
--- a/crosvm_plugin/Cargo.toml
+++ b/crosvm_plugin/Cargo.toml
@@ -12,5 +12,5 @@ kvm = { path = "../kvm" }
 kvm_sys = { path = "../kvm_sys" }
 libc = "*"
 plugin_proto = { path = "../plugin_proto" }
-protobuf = "=1.4.3"
+protobuf = "2.3"
 sys_util = { path = "../sys_util" }
diff --git a/plugin_proto/Cargo.toml b/plugin_proto/Cargo.toml
index a1d9902..ea2dac9 100644
--- a/plugin_proto/Cargo.toml
+++ b/plugin_proto/Cargo.toml
@@ -5,9 +5,9 @@ authors = ["The Chromium OS Authors"]
 build = "build.rs"
 
 [dependencies]
-protobuf = "=1.4.3"
+protobuf = "2.3"
 kvm_sys = { path = "../kvm_sys" }
 
 [build-dependencies]
 cc = "=1.0.25"
-protoc-rust = "=1.4.3"
+protoc-rust = "2.3"
diff --git a/plugin_proto/build.rs b/plugin_proto/build.rs
index 726f454..d2ef8c9 100644
--- a/plugin_proto/build.rs
+++ b/plugin_proto/build.rs
@@ -16,6 +16,7 @@ fn main() {
         out_dir: out_dir.as_os_str().to_str().unwrap(),
         input: &["protos/plugin.proto"],
         includes: &["protos"],
+        ..Default::default()
     })
     .expect("protoc");
 
diff --git a/tempdir/Cargo.toml b/tempfile/Cargo.toml
index 49cd6cc..b12e976 100644
--- a/tempdir/Cargo.toml
+++ b/tempfile/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
-name = "tempdir"
-version = "0.3.7"
+name = "tempfile"
+version = "3.0.7"
 authors = ["The Chromium OS Authors"]
 edition = "2018"
 
diff --git a/tempdir/src/lib.rs b/tempfile/src/lib.rs
index 0d96736..c04f0f7 100644
--- a/tempdir/src/lib.rs
+++ b/tempfile/src/lib.rs
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-//! Simplified tempdir which doesn't depend on the `rand` crate, instead using
+//! Simplified tempfile which doesn't depend on the `rand` crate, instead using
 //! /dev/urandom as a source of entropy
 
 extern crate rand_ish;
@@ -10,24 +10,36 @@ extern crate rand_ish;
 use rand_ish::urandom_str;
 use std::env;
 use std::fs;
-use std::io::{self, Error, ErrorKind};
+use std::io::{Error, ErrorKind, Result};
 use std::path::{Path, PathBuf};
 
-pub struct TempDir {
-    path: PathBuf,
+pub struct Builder {
+    prefix: String,
 }
 
-const NUM_RETRIES: u32 = 4;
+impl Builder {
+    pub fn new() -> Self {
+        Builder {
+            prefix: ".tmp".to_owned(),
+        }
+    }
+
+    /// Set a custom filename prefix.
+    ///
+    /// Default: `.tmp`
+    pub fn prefix(&mut self, prefix: &str) -> &mut Self {
+        self.prefix = prefix.to_owned();
+        self
+    }
 
-impl TempDir {
     /// Tries to make a tempdir inside of `env::temp_dir()` with a specified
     /// prefix. The directory and it's content is destroyed when TempDir is
     /// dropped.
     /// If the directory can not be created, `Err` is returned.
-    pub fn new(prefix: &str) -> io::Result<TempDir> {
+    pub fn tempdir(&self) -> Result<TempDir> {
         for _ in 0..NUM_RETRIES {
             let suffix = urandom_str(12)?;
-            let path = env::temp_dir().join(format!("{}.{}", prefix, suffix));
+            let path = env::temp_dir().join(format!("{}.{}", self.prefix, suffix));
 
             match fs::create_dir(&path) {
                 Ok(_) => return Ok(TempDir { path }),
@@ -41,7 +53,15 @@ impl TempDir {
             "too many tempdirs exist",
         ))
     }
+}
+
+pub struct TempDir {
+    path: PathBuf,
+}
+
+const NUM_RETRIES: u32 = 4;
 
+impl TempDir {
     /// Accesses the tempdir's [`Path`].
     ///
     /// [`Path`]: http://doc.rust-lang.org/std/path/struct.Path.html