From 3a082c108ba0399799e144d763eb8579ab6ce231 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Tue, 1 Dec 2020 15:44:02 -0700 Subject: [PATCH] appmgr: update to tokio 0.3.4 --- appmgr/Cargo.lock | 321 +++++++++++++++++++++++++++++++----------- appmgr/Cargo.toml | 11 +- appmgr/src/inspect.rs | 17 +-- appmgr/src/install.rs | 42 +++--- appmgr/src/pack.rs | 19 +-- appmgr/src/tor.rs | 4 +- appmgr/src/util.rs | 25 +++- 7 files changed, 310 insertions(+), 129 deletions(-) diff --git a/appmgr/Cargo.lock b/appmgr/Cargo.lock index 827858433..7e32f62bb 100644 --- a/appmgr/Cargo.lock +++ b/appmgr/Cargo.lock @@ -45,7 +45,7 @@ dependencies = [ "emver", "failure", "file-lock", - "futures 0.3.7", + "futures 0.3.8", "git-version", "itertools 0.9.0", "lazy_static", @@ -64,7 +64,8 @@ dependencies = [ "serde_json", "serde_yaml", "simple-logging", - "tokio", + "tokio 0.3.4", + "tokio-compat-02", "tokio-tar", ] @@ -105,9 +106,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "async-trait" -version = "0.1.41" +version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b246867b8b3b6ae56035f1eb1ed557c1d8eae97f0d53696138a50fa0e3a3b8c0" +checksum = "8d3a45e77e34375a7923b1e8febb049bb011f064714a8e17a1a616fef01da13d" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", @@ -172,6 +173,12 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + [[package]] name = "bindgen" version = "0.48.1" @@ -289,6 +296,12 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" +[[package]] +name = "bytes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0dcbc35f504eb6fc275a6d20e4ebcda18cf50d40ba6fabff8c711fa16cb3b16" + [[package]] name = "cc" version = "1.0.61" @@ -354,6 +367,25 @@ dependencies = [ "bitflags", ] +[[package]] +name = "cloudabi" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" +dependencies = [ + "bitflags", +] + +[[package]] +name = "console_error_panic_hook" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8d976903543e0c48546a91908f21588a680a8c8f984df9a5d69feccb2b2a211" +dependencies = [ + "cfg-if 0.1.10", + "wasm-bindgen", +] + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -495,7 +527,8 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "emver" version = "0.1.0" -source = "git+https://github.com/Start9Labs/emver-rs.git#9007920a8e361669fb83b29dd8506b32eeb20180" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7621f4df0519152a2ceb5f8cc0685e9fa6c8b7aec289e1afb37c66849cb71ffe" dependencies = [ "either", "fp-core", @@ -604,6 +637,16 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +[[package]] +name = "form_urlencoded" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00" +dependencies = [ + "matches", + "percent-encoding", +] + [[package]] name = "fp-core" version = "0.1.9" @@ -649,9 +692,9 @@ checksum = "4c7e4c2612746b0df8fed4ce0c69156021b704c9aefa360311c04e6e9e002eed" [[package]] name = "futures" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95314d38584ffbfda215621d723e0a3906f032e03ae5551e650058dac83d4797" +checksum = "9b3b0c040a1fe6529d30b3c5944b280c7f0dcb2930d2c3062bca967b602583d0" dependencies = [ "futures-channel", "futures-core", @@ -664,9 +707,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0448174b01148032eed37ac4aed28963aaaa8cfa93569a08e5b479bbc6c2c151" +checksum = "4b7109687aa4e177ef6fe84553af6280ef2778bdb7783ba44c9dc3399110fe64" dependencies = [ "futures-core", "futures-sink", @@ -674,9 +717,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18eaa56102984bed2c88ea39026cff3ce3b4c7f508ca970cedf2450ea10d4e46" +checksum = "847ce131b72ffb13b6109a221da9ad97a64cbe48feb1028356b836b47b8f1748" [[package]] name = "futures-cpupool" @@ -690,9 +733,9 @@ dependencies = [ [[package]] name = "futures-executor" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5f8e0c9258abaea85e78ebdda17ef9666d390e987f006be6080dfe354b708cb" +checksum = "4caa2b2b68b880003057c1dd49f1ed937e38f22fcf6c212188a121f08cf40a65" dependencies = [ "futures-core", "futures-task", @@ -701,15 +744,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1798854a4727ff944a7b12aa999f58ce7aa81db80d2dfaaf2ba06f065ddd2b" +checksum = "611834ce18aaa1bd13c4b374f5d653e1027cf99b6b502584ff8c9a64413b30bb" [[package]] name = "futures-macro" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36fccf3fc58563b4a14d265027c627c3b665d7fed489427e88e7cc929559efe" +checksum = "77408a692f1f97bcc61dc001d752e00643408fbc922e4d634c655df50d595556" dependencies = [ "proc-macro-hack", "proc-macro2 1.0.24", @@ -719,24 +762,24 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e3ca3f17d6e8804ae5d3df7a7d35b2b3a6fe89dac84b31872720fc3060a0b11" +checksum = "f878195a49cee50e006b02b93cf7e0a95a38ac7b776b4c4d9cc1207cd20fcb3d" [[package]] name = "futures-task" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d502af37186c4fef99453df03e374683f8a1eec9dcc1e66b3b82dc8278ce3c" +checksum = "7c554eb5bf48b2426c4771ab68c6b14468b6e76cc90996f528c3338d761a4d0d" dependencies = [ "once_cell", ] [[package]] name = "futures-util" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abcb44342f62e6f3e8ac427b8aa815f724fd705dfad060b18ac7866c15bb8e34" +checksum = "d304cff4a7b99cfb7986f7d43fbe93d175e72e704a8860787cc95e9ffd85cbd2" dependencies = [ "futures-channel", "futures-core", @@ -828,7 +871,7 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" dependencies = [ - "bytes", + "bytes 0.5.6", "fnv", "futures-core", "futures-sink", @@ -836,7 +879,7 @@ dependencies = [ "http", "indexmap", "slab", - "tokio", + "tokio 0.2.22", "tokio-util", "tracing", "tracing-futures", @@ -879,7 +922,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" dependencies = [ - "bytes", + "bytes 0.5.6", "fnv", "itoa", ] @@ -890,7 +933,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" dependencies = [ - "bytes", + "bytes 0.5.6", "http", ] @@ -921,7 +964,7 @@ version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f3afcfae8af5ad0576a31e768415edb627824129e8e5a29b8bfccb2f234e835" dependencies = [ - "bytes", + "bytes 0.5.6", "futures-channel", "futures-core", "futures-util", @@ -933,7 +976,7 @@ dependencies = [ "itoa", "pin-project 0.4.27", "socket2", - "tokio", + "tokio 0.2.22", "tower-service", "tracing", "want", @@ -945,10 +988,10 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed" dependencies = [ - "bytes", + "bytes 0.5.6", "hyper", "native-tls", - "tokio", + "tokio 0.2.22", "tokio-tls", ] @@ -973,6 +1016,15 @@ dependencies = [ "hashbrown 0.9.1", ] +[[package]] +name = "instant" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "iovec" version = "0.1.4" @@ -1091,6 +1143,15 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" +[[package]] +name = "lock_api" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312" +dependencies = [ + "scopeguard 1.1.0", +] + [[package]] name = "log" version = "0.4.11" @@ -1164,26 +1225,16 @@ dependencies = [ ] [[package]] -name = "mio-named-pipes" -version = "0.1.7" +name = "mio" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" +checksum = "f33bc887064ef1fd66020c9adfc45bb9f33d75a42096c81e7c56c65b75dd1a8b" dependencies = [ - "log", - "mio", - "miow 0.3.5", - "winapi 0.3.9", -] - -[[package]] -name = "mio-uds" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" -dependencies = [ - "iovec", "libc", - "mio", + "log", + "miow 0.3.6", + "ntapi", + "winapi 0.3.9", ] [[package]] @@ -1200,9 +1251,9 @@ dependencies = [ [[package]] name = "miow" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" +checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897" dependencies = [ "socket2", "winapi 0.3.9", @@ -1281,6 +1332,15 @@ dependencies = [ "version_check 0.9.2", ] +[[package]] +name = "ntapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "num_cpus" version = "1.13.0" @@ -1348,6 +1408,32 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "parking_lot" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" +dependencies = [ + "cfg-if 0.1.10", + "cloudabi 0.1.0", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi 0.3.9", +] + [[package]] name = "peeking_take_while" version = "0.1.2" @@ -1449,6 +1535,12 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b" +[[package]] +name = "pin-project-lite" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b063f57ec186e6140e2b8b6921e5f1bd89c7356dda5b33acc5401203ca6131c" + [[package]] name = "pin-utils" version = "0.1.0" @@ -1684,7 +1776,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" dependencies = [ - "cloudabi", + "cloudabi 0.0.3", "fuchsia-cprng", "libc", "rand_core 0.4.2", @@ -1775,12 +1867,12 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.10.8" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9eaa17ac5d7b838b7503d118fa16ad88f440498bf9ffe5424e621f93190d61e" +checksum = "fb15d6255c792356a0f578d8a645c677904dc02e862bebe2ecc18e0c01b9a0ce" dependencies = [ - "base64 0.12.3", - "bytes", + "base64 0.13.0", + "bytes 0.5.6", "encoding_rs", "futures-core", "futures-util", @@ -1796,15 +1888,16 @@ dependencies = [ "mime_guess", "native-tls", "percent-encoding", - "pin-project-lite", + "pin-project-lite 0.2.0", "serde", "serde_json", "serde_urlencoded", - "tokio", + "tokio 0.2.22", "tokio-tls", "url", "wasm-bindgen", "wasm-bindgen-futures", + "wasm-bindgen-test", "web-sys", "winreg", ] @@ -1859,6 +1952,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "scoped-tls" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" + [[package]] name = "scopeguard" version = "0.3.3" @@ -1946,14 +2045,14 @@ dependencies = [ [[package]] name = "serde_urlencoded" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" +checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" dependencies = [ - "dtoa", + "form_urlencoded", "itoa", + "ryu", "serde", - "url", ] [[package]] @@ -2026,12 +2125,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" [[package]] -name = "socket2" -version = "0.3.15" +name = "smallvec" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44" +checksum = "7acad6f34eb9e8a259d3283d1e8c1d34d7415943d4895f65cc73813c7396fc85" + +[[package]] +name = "socket2" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c29947abdee2a218277abeca306f25789c938e500ea5a9d4b12a5a504466902" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", "redox_syscall", "winapi 0.3.9", @@ -2169,18 +2274,34 @@ version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" dependencies = [ - "bytes", + "bytes 0.5.6", "fnv", "futures-core", "iovec", "lazy_static", + "memchr", + "mio 0.6.22", + "num_cpus", + "pin-project-lite 0.1.11", + "slab", +] + +[[package]] +name = "tokio" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dfe2523e6fa84ddf5e688151d4e5fddc51678de9752c6512a24714c23818d61" +dependencies = [ + "autocfg 1.0.1", + "bytes 0.6.0", + "futures-core", + "lazy_static", "libc", "memchr", - "mio", - "mio-named-pipes", - "mio-uds", + "mio 0.7.6", "num_cpus", - "pin-project-lite", + "parking_lot", + "pin-project-lite 0.2.0", "signal-hook-registry", "slab", "tokio-macros", @@ -2188,10 +2309,23 @@ dependencies = [ ] [[package]] -name = "tokio-macros" -version = "0.2.5" +name = "tokio-compat-02" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" +checksum = "bb4cec419b8b6f06c32e74aae6d8c5e79646d038a38e5ea2b36045f2c3296e22" +dependencies = [ + "bytes 0.5.6", + "once_cell", + "pin-project-lite 0.1.11", + "tokio 0.2.22", + "tokio 0.3.4", +] + +[[package]] +name = "tokio-macros" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21d30fdbb5dc2d8f91049691aa1a9d4d4ae422a21c334ce8936e5886d30c5c45" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", @@ -2208,7 +2342,7 @@ dependencies = [ "futures-core", "libc", "redox_syscall", - "tokio", + "tokio 0.2.22", "xattr", ] @@ -2219,7 +2353,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" dependencies = [ "native-tls", - "tokio", + "tokio 0.2.22", ] [[package]] @@ -2228,12 +2362,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" dependencies = [ - "bytes", + "bytes 0.5.6", "futures-core", "futures-sink", "log", - "pin-project-lite", - "tokio", + "pin-project-lite 0.1.11", + "tokio 0.2.22", ] [[package]] @@ -2250,7 +2384,7 @@ checksum = "b0987850db3733619253fe60e17cb59b82d37c7e6c0236bb81e4d6b87c879f27" dependencies = [ "cfg-if 0.1.10", "log", - "pin-project-lite", + "pin-project-lite 0.1.11", "tracing-core", ] @@ -2338,10 +2472,11 @@ checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "url" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" +checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e" dependencies = [ + "form_urlencoded", "idna", "matches", "percent-encoding", @@ -2471,6 +2606,30 @@ version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" +[[package]] +name = "wasm-bindgen-test" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34d1cdc8b98a557f24733d50a1199c4b0635e465eecba9c45b214544da197f64" +dependencies = [ + "console_error_panic_hook", + "js-sys", + "scoped-tls", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-test-macro", +] + +[[package]] +name = "wasm-bindgen-test-macro" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8fb9c67be7439ee8ab1b7db502a49c05e51e2835b66796c705134d9b8e1a585" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.7", +] + [[package]] name = "web-sys" version = "0.3.45" diff --git a/appmgr/Cargo.toml b/appmgr/Cargo.toml index d7a3590c1..b0754018c 100644 --- a/appmgr/Cargo.toml +++ b/appmgr/Cargo.toml @@ -18,15 +18,15 @@ portable = [] production = [] [dependencies] -emver = { git = "https://github.com/Start9Labs/emver-rs.git", version = "0.1.0", features = ["serde"] } +emver = { version = "0.1.0", features = ["serde"] } argonautica = "0.2.0" -async-trait = "0.1.41" +async-trait = "0.1.42" base32 = "0.4.0" clap = "2.33" ed25519-dalek = "1.0.1" failure = "0.1.8" file-lock = "1.1" -futures = "0.3.7" +futures = "0.3.8" git-version = "0.3.4" itertools = "0.9.0" lazy_static = "1.4" @@ -38,12 +38,13 @@ pest_derive = "2.1" prettytable-rs = "0.8.0" rand = "0.7.3" regex = "1.4.2" -reqwest = { version = "0.10.8", features = ["stream", "json"] } +reqwest = { version = "0.10.9", features = ["stream", "json"] } rpassword = "5.0.0" serde = { version = "1.0.117", features = ["derive", "rc"] } serde_yaml = "0.8.14" serde_cbor = "0.11.1" serde_json = "1.0.59" simple-logging = "2.0" -tokio = { version = "0.2.22", features = ["full"] } +tokio = { version = "0.3.4", features = ["full"] } +tokio-compat-02 = "0.1.2" tokio-tar = "0.2.0" diff --git a/appmgr/src/inspect.rs b/appmgr/src/inspect.rs index 6ef9c5b63..005ef8ec1 100644 --- a/appmgr/src/inspect.rs +++ b/appmgr/src/inspect.rs @@ -2,6 +2,7 @@ use std::path::Path; use failure::ResultExt as _; use futures::stream::StreamExt; +use tokio_compat_02::IoCompat; use tokio_tar as tar; use crate::config::{ConfigRuleEntry, ConfigSpec}; @@ -48,7 +49,7 @@ pub async fn info_full>( .with_context(|e| format!("{}: {}", p.display(), e)) .with_code(crate::error::FILESYSTEM_ERROR)?; log::info!("Extracting archive."); - let mut pkg = tar::Archive::new(r); + let mut pkg = tar::Archive::new(IoCompat::new(r)); let mut entries = pkg.entries()?; log::info!("Opening manifest from archive."); let manifest = entries @@ -62,7 +63,7 @@ pub async fn info_full>( "Package File Invalid or Corrupted" ); log::trace!("Deserializing manifest."); - let manifest: Manifest = from_cbor_async_reader(manifest).await?; + let manifest: Manifest = from_cbor_async_reader(IoCompat::new(manifest)).await?; let manifest = manifest.into_latest(); crate::ensure_code!( crate::version::Current::new() @@ -93,7 +94,7 @@ pub async fn info_full>( "Package File Invalid or Corrupted" ); log::trace!("Deserializing config spec."); - let spec = from_cbor_async_reader(spec).await?; + let spec = from_cbor_async_reader(IoCompat::new(spec)).await?; log::info!("Opening config rules from archive."); let rules = entries .next() @@ -108,7 +109,7 @@ pub async fn info_full>( "Package File Invalid or Corrupted" ); log::trace!("Deserializing config rules."); - let rules = from_cbor_async_reader(rules).await?; + let rules = from_cbor_async_reader(IoCompat::new(rules)).await?; Some(AppConfig { spec, rules }) } else { None @@ -124,7 +125,7 @@ pub async fn print_instructions>(path: P) -> Result<(), Error> { .with_context(|e| format!("{}: {}", p.display(), e)) .with_code(crate::error::FILESYSTEM_ERROR)?; log::info!("Extracting archive."); - let mut pkg = tar::Archive::new(r); + let mut pkg = tar::Archive::new(IoCompat::new(r)); let mut entries = pkg.entries()?; log::info!("Opening manifest from archive."); let manifest = entries @@ -138,7 +139,7 @@ pub async fn print_instructions>(path: P) -> Result<(), Error> { "Package File Invalid or Corrupted" ); log::trace!("Deserializing manifest."); - let manifest: Manifest = from_cbor_async_reader(manifest).await?; + let manifest: Manifest = from_cbor_async_reader(IoCompat::new(manifest)).await?; let manifest = manifest.into_latest(); crate::ensure_code!( crate::version::Current::new() @@ -166,7 +167,7 @@ pub async fn print_instructions>(path: P) -> Result<(), Error> { if manifest.has_instructions { use tokio::io::AsyncWriteExt; - let mut instructions = entries + let instructions = entries .next() .await .ok_or(crate::install::Error::CorruptedPkgFile( @@ -175,7 +176,7 @@ pub async fn print_instructions>(path: P) -> Result<(), Error> { .no_code()??; let mut stdout = tokio::io::stdout(); - tokio::io::copy(&mut instructions, &mut stdout) + tokio::io::copy(&mut IoCompat::new(instructions), &mut stdout) .await .with_code(crate::error::FILESYSTEM_ERROR)?; stdout diff --git a/appmgr/src/install.rs b/appmgr/src/install.rs index bdeb72550..23b99214d 100644 --- a/appmgr/src/install.rs +++ b/appmgr/src/install.rs @@ -14,8 +14,9 @@ use std::time::Duration; use failure::ResultExt as _; use futures::stream::StreamExt; use futures::stream::TryStreamExt; -use tokio::io::AsyncRead; use tokio::io::AsyncWriteExt; +use tokio::io::{AsyncRead, ReadBuf}; +use tokio_compat_02::IoCompat; use tokio_tar as tar; use crate::config::{ConfigRuleEntry, ConfigSpec}; @@ -62,13 +63,13 @@ where fn poll_read( self: Pin<&mut Self>, cx: &mut Context<'_>, - buf: &mut [u8], - ) -> Poll> { + buf: &mut ReadBuf, + ) -> Poll> { let atomic = self.as_ref().1.clone(); // TODO: not efficient match unsafe { self.map_unchecked_mut(|a| &mut a.0) }.poll_read(cx, buf) { - Poll::Ready(Ok(res)) => { - atomic.fetch_add(res as u64, atomic::Ordering::SeqCst); - Poll::Ready(Ok(res)) + Poll::Ready(Ok(())) => { + atomic.fetch_add(buf.filled().len() as u64, atomic::Ordering::SeqCst); + Poll::Ready(Ok(())) } a => a, } @@ -141,7 +142,7 @@ pub async fn download(url: &str, name: Option<&str>) -> Result>(p: P, name: Option<&str>) -> Result<() if is_done { break; } - tokio::time::delay_for(Duration::from_millis(10)).await; + tokio::time::sleep(Duration::from_millis(10)).await; } if !*crate::QUIET.read().await { println!("\rInstalling... 100%"); @@ -213,7 +214,7 @@ pub async fn install( name: Option<&str>, ) -> Result<(), crate::Error> { log::info!("Extracting archive."); - let mut pkg = tar::Archive::new(r); + let mut pkg = tar::Archive::new(IoCompat::new(r)); let mut entries = pkg.entries()?; log::info!("Opening manifest from archive."); let manifest = entries @@ -227,7 +228,9 @@ pub async fn install( "Package File Invalid or Corrupted" ); log::trace!("Deserializing manifest."); - let manifest: Manifest = from_cbor_async_reader(manifest).await.no_code()?; + let manifest: Manifest = from_cbor_async_reader(IoCompat::new(manifest)) + .await + .no_code()?; match manifest { Manifest::V0(m) => install_v0(m, entries, name).await?, }; @@ -236,7 +239,7 @@ pub async fn install( pub async fn install_v0( manifest: ManifestV0, - mut entries: tar::Entries, + mut entries: tar::Entries>, name: Option<&str>, ) -> Result<(), crate::Error> { crate::ensure_code!( @@ -291,7 +294,7 @@ pub async fn install_v0( "Package File Invalid or Corrupted" ); log::trace!("Deserializing config spec."); - let config_spec: ConfigSpec = from_cbor_async_reader(config_spec).await?; + let config_spec: ConfigSpec = from_cbor_async_reader(IoCompat::new(config_spec)).await?; log::info!("Saving config spec."); let mut config_spec_out = app_dir.join("config_spec.yaml").write(None).await?; to_yaml_async_writer(&mut *config_spec_out, &config_spec).await?; @@ -308,14 +311,15 @@ pub async fn install_v0( "Package File Invalid or Corrupted" ); log::trace!("Deserializing config rules."); - let config_rules: Vec = from_cbor_async_reader(config_rules).await?; + let config_rules: Vec = + from_cbor_async_reader(IoCompat::new(config_rules)).await?; log::info!("Saving config rules."); let mut config_rules_out = app_dir.join("config_rules.yaml").write(None).await?; to_yaml_async_writer(&mut *config_rules_out, &config_rules).await?; config_rules_out.commit().await?; if manifest.has_instructions { log::info!("Opening instructions from archive."); - let mut instructions = entries + let instructions = entries .next() .await .ok_or(Error::CorruptedPkgFile("missing config rules")) @@ -327,7 +331,7 @@ pub async fn install_v0( ); log::info!("Saving instructions."); let mut instructions_out = app_dir.join("instructions.md").write(None).await?; - tokio::io::copy(&mut instructions, &mut *instructions_out) + tokio::io::copy(&mut IoCompat::new(instructions), &mut *instructions_out) .await .with_code(crate::error::FILESYSTEM_ERROR)?; instructions_out.commit().await?; @@ -407,11 +411,13 @@ pub async fn install_v0( .arg("stop") .arg(&manifest.id) .spawn()? + .wait() .await?; tokio::process::Command::new("docker") .arg("rm") .arg(&manifest.id) .spawn()? + .wait() .await?; crate::ensure_code!( tokio::process::Command::new("docker") @@ -426,7 +432,7 @@ pub async fn install_v0( ) } log::info!("Opening image.tar from archive."); - let mut image = entries + let image = entries .next() .await .ok_or(Error::CorruptedPkgFile("missing image.tar")) @@ -452,12 +458,12 @@ pub async fn install_v0( }) .spawn()?; let mut child_in = child.stdin.take().unwrap(); - tokio::io::copy(&mut image, &mut child_in).await?; + tokio::io::copy(&mut IoCompat::new(image), &mut child_in).await?; child_in.flush().await?; child_in.shutdown().await?; drop(child_in); crate::ensure_code!( - child.await?.success(), + child.wait().await?.success(), crate::error::DOCKER_ERROR, "Failed to Load Docker Image From Tar" ); diff --git a/appmgr/src/pack.rs b/appmgr/src/pack.rs index 86ec98619..1036b4b57 100644 --- a/appmgr/src/pack.rs +++ b/appmgr/src/pack.rs @@ -5,6 +5,7 @@ use failure::ResultExt; use futures::stream::StreamExt; use linear_map::LinearMap; use rand::SeedableRng; +use tokio_compat_02::IoCompat; use tokio_tar as tar; use crate::config::{ConfigRuleEntry, ConfigSpec}; @@ -41,7 +42,7 @@ pub async fn pack(path: &str, output: &str) -> Result<(), failure::Error> { output.display(), ); let out_file = tokio::fs::File::create(output).await?; - let mut out = tar::Builder::new(out_file); + let mut out = tar::Builder::new(IoCompat::new(out_file)); log::info!("Reading {}/manifest.yaml.", path.display()); let manifest: Manifest = crate::util::from_yaml_async_reader( tokio::fs::File::open(path.join("manifest.yaml")) @@ -130,7 +131,7 @@ pub async fn pack(path: &str, output: &str) -> Result<(), failure::Error> { h.set_size(0); h.set_path(format!("APPMGR_DIR_END:{}", asset.src.display()))?; h.set_cksum(); - out.append(&h, tokio::io::empty()).await?; + out.append(&h, IoCompat::new(tokio::io::empty())).await?; } else { out.append_path_with_name(&file_path, &asset.src).await?; } @@ -144,7 +145,8 @@ pub async fn pack(path: &str, output: &str) -> Result<(), failure::Error> { log::info!("Writing image.tar to archive."); let mut header = tar::Header::new_gnu(); header.set_size(image.metadata().await?.len()); - out.append_data(&mut header, "image.tar", image).await?; + out.append_data(&mut header, "image.tar", IoCompat::new(image)) + .await?; } } out.into_inner().await?; @@ -199,7 +201,7 @@ pub async fn verify(path: &str) -> Result<(), failure::Error> { .await .with_context(|e| format!("{}: {}", path.display(), e))?; log::info!("Extracting archive."); - let mut pkg = tar::Archive::new(r); + let mut pkg = tar::Archive::new(IoCompat::new(r)); let mut entries = pkg.entries()?; log::info!("Opening manifest from archive."); let manifest = entries @@ -212,7 +214,7 @@ pub async fn verify(path: &str) -> Result<(), failure::Error> { manifest.path()?.display() ); log::trace!("Deserializing manifest."); - let manifest: Manifest = from_cbor_async_reader(manifest).await?; + let manifest: Manifest = from_cbor_async_reader(IoCompat::new(manifest)).await?; let manifest = manifest.into_latest(); ensure!( crate::version::Current::new() @@ -245,7 +247,7 @@ pub async fn verify(path: &str) -> Result<(), failure::Error> { config_spec.path()?.display() ); log::trace!("Deserializing config spec."); - let config_spec: ConfigSpec = from_cbor_async_reader(config_spec).await?; + let config_spec: ConfigSpec = from_cbor_async_reader(IoCompat::new(config_spec)).await?; log::trace!("Validating config spec."); config_spec.validate(&manifest)?; let config = config_spec.gen(&mut rand::rngs::StdRng::from_entropy(), &None)?; @@ -261,7 +263,8 @@ pub async fn verify(path: &str) -> Result<(), failure::Error> { config_rules.path()?.display() ); log::trace!("Deserializing config rules."); - let config_rules: Vec = from_cbor_async_reader(config_rules).await?; + let config_rules: Vec = + from_cbor_async_reader(IoCompat::new(config_rules)).await?; log::trace!("Validating config rules against config spec."); let mut cfgs = LinearMap::new(); cfgs.insert(name, Cow::Borrowed(&config)); @@ -375,7 +378,7 @@ pub async fn verify(path: &str) -> Result<(), failure::Error> { .await .ok_or_else(|| format_err!("image.tar is missing manifest.json"))??; let image_manifest: Vec = - from_json_async_reader(image_manifest).await?; + from_json_async_reader(IoCompat::new(image_manifest)).await?; image_manifest .into_iter() .flat_map(|a| a.repo_tags) diff --git a/appmgr/src/tor.rs b/appmgr/src/tor.rs index a565aa585..1aaa5702d 100644 --- a/appmgr/src/tor.rs +++ b/appmgr/src/tor.rs @@ -198,7 +198,7 @@ pub async fn read_tor_address(name: &str, timeout: Option) -> Result { fn poll_read( self: std::pin::Pin<&mut Self>, cx: &mut std::task::Context<'_>, - buf: &mut [u8], - ) -> std::task::Poll> { + buf: &mut ReadBuf, + ) -> std::task::Poll> { unsafe { self.map_unchecked_mut(|a| a.file.file.as_mut().unwrap()) }.poll_read(cx, buf) } } @@ -371,7 +371,13 @@ where cx: &mut std::task::Context<'_>, buf: &mut [u8], ) -> std::task::Poll> { - tokio::io::AsyncRead::poll_read(unsafe { self.map_unchecked_mut(|a| &mut a.0) }, cx, buf) + let mut read_buf = ReadBuf::new(buf); + tokio::io::AsyncRead::poll_read( + unsafe { self.map_unchecked_mut(|a| &mut a.0) }, + cx, + &mut read_buf, + ) + .map(|res| res.map(|_| read_buf.filled().len())) } } impl tokio::io::AsyncRead for AsyncCompat @@ -381,9 +387,14 @@ where fn poll_read( self: std::pin::Pin<&mut Self>, cx: &mut std::task::Context<'_>, - buf: &mut [u8], - ) -> std::task::Poll> { - futures::io::AsyncRead::poll_read(unsafe { self.map_unchecked_mut(|a| &mut a.0) }, cx, buf) + buf: &mut ReadBuf, + ) -> std::task::Poll> { + futures::io::AsyncRead::poll_read( + unsafe { self.map_unchecked_mut(|a| &mut a.0) }, + cx, + buf.initialize_unfilled(), + ) + .map(|res| res.map(|len| buf.set_filled(len))) } } impl futures::io::AsyncWrite for AsyncCompat