diff --git a/CHANGELOG.md b/CHANGELOG.md index 3252c43e..514d6a27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to the Brane framework will be documented in this file. ## [3.1.0] - TODO ### Added - The `branectl wizard` subcommand, which interactively goes through the steps of setting up a node. +- Commands for cross-compiling to macOS x86-64 _and_ ARM 64-bit from Linux :) ### Fixed - CI/CD in the repository by moving most of it to scripts which we _can_ test offline. @@ -21,11 +22,14 @@ All notable changes to the Brane framework will be documented in this file. - A garbage collector to `brane-drv` for running sessions, to terminate them if they haven't been accessed for over 24 hours. - An `overview`-crate acting as a proper entrypoint to auto-generated docs. - This overview includes a proper crate overview. +- `brane import` now has a `--branch` flag to import a package on the non-`main` branch instead \[**breaking change**\]. + - This is breaking because it used to be the _default_ branch instead of the `main`-branch. ### Changed -- Bumped `brane-tsk` packages to newest version (base64). - The `backend.yml` and `data.yml` files to use the default tagging option in serde (i.e., use `!` instead of the `kind`-field) \[**breaking change**\]. - The `node.yml` file to accept `delegate` as an alias for `job` instead of `driver` \[**breaking change**\]. +- Bumped `brane-tsk` packages to newest version (base64). +- No longer depending on git2 in any fashion. ### Fixed - Lots of `clippy` errors. diff --git a/Cargo.lock b/Cargo.lock index 4bdc79ef..f73c94aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,9 +31,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -163,7 +163,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror", - "time 0.3.29", + "time 0.3.30", ] [[package]] @@ -204,9 +204,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb42b2197bf15ccb092b62c74515dbd8b86d0effd934795f6687c93b6e679a2c" +checksum = "f658e2baef915ba0f26f1f7c42bfb8e12f532a01f449a090ded75ae7a07e9ba2" dependencies = [ "flate2", "futures-core", @@ -223,7 +223,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -245,18 +245,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -419,9 +419,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "bitmaps" @@ -530,7 +530,7 @@ dependencies = [ "serde_yaml 0.9.25", "specifications", "tempfile", - "time 0.3.29", + "time 0.3.30", "tokio", "tokio-stream", "tokio-tar", @@ -571,6 +571,7 @@ dependencies = [ "expanduser", "human-panic", "log", + "openssl-sys", "serde_json", "specifications", "tokio", @@ -599,7 +600,7 @@ name = "brane-cli" version = "3.0.0" dependencies = [ "anyhow", - "async-compression 0.4.3", + "async-compression 0.4.4", "async-trait", "base64 0.21.4", "bollard", @@ -625,7 +626,6 @@ dependencies = [ "fs_extra", "futures", "futures-util", - "git2", "graphql_client", "human-panic", "hyper", @@ -633,6 +633,7 @@ dependencies = [ "lazy_static", "log", "openapiv3", + "openssl-sys", "parking_lot", "path-clean", "prettytable-rs", @@ -641,10 +642,10 @@ dependencies = [ "rustls", "rustyline", "rustyline-derive", - "semver 1.0.19", + "semver 1.0.20", "serde", "serde_json", - "serde_with 3.3.0", + "serde_with 3.4.0", "serde_yaml 0.9.25", "specifications", "tar", @@ -671,6 +672,7 @@ dependencies = [ "humanlog", "libc", "log", + "openssl-sys", "parking_lot", "serde_json", "specifications", @@ -695,6 +697,7 @@ dependencies = [ "humanlog", "lazy_static", "log", + "openssl-sys", "rand 0.8.5", "serde", "serde_json", @@ -746,7 +749,7 @@ dependencies = [ "nom_locate", "rand 0.8.5", "regex", - "semver 1.0.19", + "semver 1.0.20", "serde", "serde_json", "specifications", @@ -772,7 +775,7 @@ dependencies = [ "simplelog", "specifications", "tokio", - "uuid 1.4.1", + "uuid 1.5.0", ] [[package]] @@ -856,11 +859,15 @@ dependencies = [ "scylla", "serde", "serde_json", - "time 0.3.29", + "time 0.3.30", "tokio", "warp", ] +[[package]] +name = "brane-meta" +version = "3.0.0" + [[package]] name = "brane-oas" version = "3.0.0" @@ -1059,9 +1066,9 @@ checksum = "ad152d03a2c813c80bb94fedbf3a3f02b28f793e39e7c214c8a0bcc196343de7" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" @@ -1075,7 +1082,6 @@ version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ - "jobserver", "libc", ] @@ -1131,7 +1137,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1212,18 +1218,18 @@ checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" [[package]] name = "const_format" -version = "0.2.31" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c990efc7a285731f9a4378d81aff2f0e85a2c8781a05ef0f8baa8dac54d0ff48" +checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" dependencies = [ "const_format_proc_macros", ] [[package]] name = "const_format_proc_macros" -version = "0.2.31" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e026b6ce194a874cb9cf32cd5772d1ef9767cc8fcb5765948d74f37a9d8b2bf6" +checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" dependencies = [ "proc-macro2", "quote", @@ -1260,7 +1266,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ "percent-encoding", - "time 0.3.29", + "time 0.3.30", "version_check", ] @@ -1293,7 +1299,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "time 0.3.29", + "time 0.3.30", "url", ] @@ -1315,9 +1321,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "3fbc60abd742b35f2492f808e1abbb83d45f72db402e14c55057edc9c7b1e9e4" dependencies = [ "libc", ] @@ -1352,9 +1358,9 @@ dependencies = [ [[package]] name = "csv" -version = "1.2.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "626ae34994d3d8d668f4269922248239db4ae42d538b14c398b74a52208e8086" +checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" dependencies = [ "csv-core", "itoa", @@ -1364,9 +1370,9 @@ dependencies = [ [[package]] name = "csv-core" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" dependencies = [ "memchr", ] @@ -1428,7 +1434,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1450,7 +1456,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1470,7 +1476,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown 0.14.1", + "hashbrown 0.14.2", "lock_api", "once_cell", "parking_lot_core", @@ -1498,10 +1504,11 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" dependencies = [ + "powerfmt", "serde", ] @@ -1640,7 +1647,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1726,25 +1733,14 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add4f07d43996f76ef320709726a556a9d4f965d9410d8d0271132d2f8293480" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" dependencies = [ - "errno-dragonfly", "libc", "windows-sys 0.48.0", ] -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "error-code" version = "2.3.1" @@ -1819,9 +1815,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "libz-sys", @@ -1947,7 +1943,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -2018,21 +2014,6 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" -[[package]] -name = "git2" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b989d6a7ca95a362cf2cfc5ad688b3a467be1f87e480b8dad07fee8c79b0044" -dependencies = [ - "bitflags 1.3.2", - "libc", - "libgit2-sys", - "log", - "openssl-probe", - "openssl-sys", - "url", -] - [[package]] name = "graphql-introspection-query" version = "0.2.0" @@ -2128,9 +2109,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" [[package]] name = "headers" @@ -2248,7 +2229,7 @@ dependencies = [ "serde", "serde_derive", "toml", - "uuid 1.4.1", + "uuid 1.5.0", ] [[package]] @@ -2286,7 +2267,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.9", + "socket2 0.4.10", "tokio", "tower-service", "tracing", @@ -2349,16 +2330,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.57" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows 0.48.0", + "windows-core", ] [[package]] @@ -2439,7 +2420,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" dependencies = [ "equivalent", - "hashbrown 0.14.1", + "hashbrown 0.14.2", "serde", ] @@ -2467,9 +2448,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" @@ -2506,15 +2487,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" -[[package]] -name = "jobserver" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.64" @@ -2526,9 +2498,9 @@ dependencies = [ [[package]] name = "json-patch" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f7765dccf8c39c3a470fc694efe322969d791e713ca46bc7b5c506886157572" +checksum = "55ff1e1486799e3f64129f8ccad108b38290df9cd7015cd31bed17239f0789d6" dependencies = [ "serde", "serde_json", @@ -2806,37 +2778,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.148" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" - -[[package]] -name = "libgit2-sys" -version = "0.15.2+1.6.4" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a80df2e11fb4a61f4ba2ab42dbe7f74468da143f1a75c74e11dee7c813f694fa" -dependencies = [ - "cc", - "libc", - "libssh2-sys", - "libz-sys", - "openssl-sys", - "pkg-config", -] - -[[package]] -name = "libssh2-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee" -dependencies = [ - "cc", - "libc", - "libz-sys", - "openssl-sys", - "pkg-config", - "vcpkg", -] +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libz-sys" @@ -2858,15 +2802,15 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.4.8" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3852614a3bd9ca9804678ba6be5e3b8ce76dfc902cae004e3e0c44051b6e88db" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -3022,7 +2966,7 @@ version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "cfg-if", "libc", "memoffset", @@ -3113,13 +3057,13 @@ dependencies = [ [[package]] name = "num-derive" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6a0fd4f737c707bd9086cc16c925f294943eb62eb71499e9fd4cf71f8b9f4e" +checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -3157,9 +3101,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] @@ -3252,7 +3196,7 @@ version = "0.10.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "cfg-if", "foreign-types", "libc", @@ -3269,7 +3213,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -3308,9 +3252,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "ordered-float" -version = "2.10.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" dependencies = [ "num-traits", ] @@ -3342,13 +3286,13 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "smallvec", "windows-targets 0.48.5", ] @@ -3391,7 +3335,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -3418,6 +3362,12 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31114a898e107c51bb1609ffaf55a0e011cf6a4d7f1170d0015a165082c0338b" +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -3480,9 +3430,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -3736,6 +3686,15 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "redox_users" version = "0.2.0" @@ -3772,9 +3731,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.6" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", @@ -3784,9 +3743,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.9" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", @@ -3795,15 +3754,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.21" +version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78fdbab6a7e1d7b13cc8ff10197f47986b41c639300cc3c8158cac7847c9bbef" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ "base64 0.21.4", "bytes", @@ -3907,7 +3866,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.19", + "semver 1.0.20", ] [[package]] @@ -3921,11 +3880,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.15" +version = "0.38.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2f9da0cbd88f9f09e7814e388301c8414c51c62aa6ce1e4b5c551d49d96e531" +checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", @@ -4139,9 +4098,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "semver-parser" @@ -4151,9 +4110,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" dependencies = [ "serde_derive", ] @@ -4170,13 +4129,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -4209,7 +4168,7 @@ checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -4264,14 +4223,14 @@ dependencies = [ "indexmap 1.9.3", "serde", "serde_json", - "time 0.3.29", + "time 0.3.30", ] [[package]] name = "serde_with" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ca3b16a3d82c4088f343b7480a93550b3eabe1a358569c2dfe38bbcead07237" +checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" dependencies = [ "base64 0.21.4", "chrono", @@ -4280,8 +4239,8 @@ dependencies = [ "indexmap 2.0.2", "serde", "serde_json", - "serde_with_macros 3.3.0", - "time 0.3.29", + "serde_with_macros 3.4.0", + "time 0.3.30", ] [[package]] @@ -4298,14 +4257,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e6be15c453eb305019bfa438b1593c731f36a289a7853f7707ee29e870b3b3c" +checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" dependencies = [ "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -4408,7 +4367,7 @@ checksum = "acee08041c5de3d5048c8b3f6f13fafb3026b24ba43c6a695a0c76179b844369" dependencies = [ "log", "termcolor", - "time 0.3.29", + "time 0.3.30", ] [[package]] @@ -4455,9 +4414,9 @@ checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" [[package]] name = "socket2" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", @@ -4465,9 +4424,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys 0.48.0", @@ -4476,7 +4435,7 @@ dependencies = [ [[package]] name = "socksx" version = "0.1.2" -source = "git+https://github.com/epi-project/socksx#2d8163c7980b6f884f7c5a84d159bbba7b37837e" +source = "git+https://github.com/epi-project/socksx#db310a01415ae5e0bba82962e32bb4016982e2e2" dependencies = [ "anyhow", "async-trait", @@ -4490,12 +4449,12 @@ dependencies = [ "libc", "log", "nix 0.27.1", - "num-derive 0.4.0", + "num-derive 0.4.1", "num-traits", "thiserror", "tokio", "url", - "windows 0.51.1", + "windows", ] [[package]] @@ -4514,12 +4473,12 @@ dependencies = [ "prost", "prost-types", "reqwest", - "semver 1.0.19", + "semver 1.0.20", "serde", "serde_json", "serde_repr", "serde_test", - "serde_with 3.3.0", + "serde_with 3.4.0", "serde_yaml 0.9.25", "strum", "strum_macros", @@ -4657,9 +4616,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.37" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -4751,22 +4710,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -4786,14 +4745,15 @@ dependencies = [ [[package]] name = "time" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ "deranged", "itoa", "libc", "num_threads", + "powerfmt", "serde", "time-core", "time-macros 0.2.15", @@ -4854,9 +4814,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.32.0" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" dependencies = [ "backtrace", "bytes", @@ -4866,7 +4826,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.4", + "socket2 0.5.5", "tokio-macros", "windows-sys 0.48.0", ] @@ -4889,7 +4849,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -5068,7 +5028,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" dependencies = [ "base64 0.21.4", - "bitflags 2.4.0", + "bitflags 2.4.1", "bytes", "futures-core", "futures-util", @@ -5096,11 +5056,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "log", "pin-project-lite", "tracing-attributes", @@ -5109,20 +5068,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", ] @@ -5271,9 +5230,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" dependencies = [ "getrandom 0.2.10", "rand 0.8.5", @@ -5370,7 +5329,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", "wasm-bindgen-shared", ] @@ -5404,7 +5363,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5469,15 +5428,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.5", -] - [[package]] name = "windows" version = "0.51.1" @@ -5631,9 +5581,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.15" +version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" dependencies = [ "memchr", ] @@ -5662,7 +5612,7 @@ dependencies = [ "oid-registry", "rusticata-macros", "thiserror", - "time 0.3.29", + "time 0.3.30", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index cbbcc483..5f7401ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,3 +60,9 @@ version = "3.0.0" authors = [ "Onno Valkering", "Tim Müller" ] description = "The Brane Framework is a workflow execution system that is capable of dealing with sensitive dataset. Created for the [EPI project](https://enablingpersonalizedinterventions.nl)." documentation = "https://wiki.enablingpersonalizedinterventions.nl" + + +[package] +name = "brane-meta" +version.workspace = true +edition = "2021" diff --git a/Dockerfile.mac b/Dockerfile.mac new file mode 100644 index 00000000..f7da0632 --- /dev/null +++ b/Dockerfile.mac @@ -0,0 +1,5 @@ +FROM messense/cargo-zigbuild:0.17.3 + +# Add our own dependencies +RUN apt-get update && apt-get install -y cmake \ + && rm -rf /var/lib/apt/lists/* diff --git a/brane-cc/Cargo.toml b/brane-cc/Cargo.toml index 96c05441..2308d517 100644 --- a/brane-cc/Cargo.toml +++ b/brane-cc/Cargo.toml @@ -25,3 +25,8 @@ brane-shr = { path = "../brane-shr" } brane-tsk = { path = "../brane-tsk" } serde_json = "1" specifications = { path = "../specifications" } + + +# Hacky indeed but necessary to dodge OpenSSL linking, which we need to make cross-compilation _so_ much easier +[dependencies.openssl-sys] +features = ["vendored"] diff --git a/brane-cli-c/Cargo.toml b/brane-cli-c/Cargo.toml index b1775e49..ba130bbb 100644 --- a/brane-cli-c/Cargo.toml +++ b/brane-cli-c/Cargo.toml @@ -26,3 +26,8 @@ brane-cli = { path = "../brane-cli" } brane-exe = { path = "../brane-exe" } brane-tsk = { path = "../brane-tsk" } specifications = { path = "../specifications" } + + +# Hacky indeed but necessary to dodge OpenSSL linking, which we need to make cross-compilation _so_ much easier +[dependencies.openssl-sys] +features = ["vendored"] diff --git a/brane-cli/Cargo.toml b/brane-cli/Cargo.toml index 1e17a24c..fe4764da 100644 --- a/brane-cli/Cargo.toml +++ b/brane-cli/Cargo.toml @@ -28,7 +28,7 @@ flate2 = { version = "1.0", features = ["zlib"], default-features = false } fs_extra = "1.2" futures = "0.3" futures-util = "0.3" -git2 = { version = "0.17", features = ["vendored-libgit2"] } +# git2 = { version = "0.17", features = ["vendored-libgit2"] } graphql_client = "0.13" human-panic = "1.0" hyper = "0.14" @@ -71,5 +71,10 @@ brane-tsk = { path = "../brane-tsk" } specifications = { path = "../specifications" } +# Hacky indeed but necessary to dodge OpenSSL linking, which we need to make cross-compilation _so_ much easier +[dependencies.openssl-sys] +features = ["vendored"] + + [features] print_exec_path = [ "brane-exe/print_exec_path" ] diff --git a/brane-cli/src/errors.rs b/brane-cli/src/errors.rs index 85ed77bf..20284eb8 100644 --- a/brane-cli/src/errors.rs +++ b/brane-cli/src/errors.rs @@ -4,7 +4,7 @@ // Created: // 17 Feb 2022, 10:27:28 // Last edited: -// 03 Oct 2023, 11:36:00 +// 22 Oct 2023, 22:58:55 // Auto updated? // Yes // @@ -605,8 +605,8 @@ pub enum ImportError { TempDirError{ err: std::io::Error }, /// Could not resolve the path to the temporary repository directory TempDirCanonicalizeError{ path: PathBuf, err: std::io::Error }, - /// Error for when we failed to clone a repository - RepoCloneError{ repo: String, target: PathBuf, err: git2::Error }, + /// Error for when we failed to download a repository + RepoCloneError{ repo: String, target: PathBuf, err: brane_shr::fs::Error }, /// Error for when a path supposed to refer inside the repository escaped out of it RepoEscapeError{ path: PathBuf }, diff --git a/brane-cli/src/main.rs b/brane-cli/src/main.rs index d0a65d06..fed212fd 100644 --- a/brane-cli/src/main.rs +++ b/brane-cli/src/main.rs @@ -4,7 +4,7 @@ // Created: // 21 Sep 2022, 14:34:28 // Last edited: -// 03 Oct 2023, 11:36:15 +// 22 Oct 2023, 23:23:57 // Auto updated? // Yes // @@ -23,11 +23,12 @@ use anyhow::Result; use clap::Parser; use console::style; use dotenvy::dotenv; -use git2::Repository; +// use git2::Repository; use log::LevelFilter; -use tempfile::tempdir; +use tempfile::TempDir; use brane_dsl::Language; +use brane_shr::fs::DownloadSecurity; use brane_tsk::spec::AppId; use brane_tsk::docker::{ClientVersion, DockerOptions}; use specifications::arch::Arch; @@ -91,6 +92,8 @@ enum SubCommand { arch: Option, #[clap(name = "REPO", help = "Name of the GitHub repository containing the package")] repo: String, + #[clap(short, long, default_value = "main", help = "Name of the GitHub branch containing the package")] + branch: String, #[clap(short, long, help = "Path to the directory to use as container working directory, relative to the repository (defaults to the folder of the package file itself)")] workdir: Option, #[clap(name = "FILE", help = "Path to the file to build, relative to the repository")] @@ -676,21 +679,27 @@ async fn run(options: Cli) -> Result<(), CliError> { }, } } - Import { arch, repo, workdir, file, kind, init, crlf_ok } => { + Import { arch, repo, branch, workdir, file, kind, init, crlf_ok } => { // Prepare the input URL and output directory - let url = format!("https://github.com/{repo}"); - let dir = match tempdir() { + let url = format!("https://api.github.com/repos/{repo}/tarball/{branch}"); + let dir = match TempDir::new() { Ok(dir) => dir, Err(err) => { return Err(CliError::ImportError{ err: ImportError::TempDirError{ err } }); } }; - let dir_path = match std::fs::canonicalize(dir.path()) { - Ok(dir_path) => dir_path, - Err(err) => { return Err(CliError::ImportError{ err: ImportError::TempDirCanonicalizeError{ path: dir.path().to_path_buf(), err } }); } - }; - // Pull the repository - if let Err(err) = Repository::clone(&url, &dir_path) { + // Download the file + let tar_path: PathBuf = dir.path().join(format!("repo.tar.gz")); + let dir_path: PathBuf = dir.path().join(format!("repo")); + if let Err(err) = brane_shr::fs::download_file_async(&url, &tar_path, DownloadSecurity { checksum: None, https: true }, None).await { + return Err(CliError::ImportError{ err: ImportError::RepoCloneError{ repo: url, target: dir_path, err } }); + } + if let Err(err) = brane_shr::fs::unarchive_async(&tar_path, &dir_path).await { return Err(CliError::ImportError{ err: ImportError::RepoCloneError{ repo: url, target: dir_path, err } }); + } + // Resolve that one weird folder in there + let dir_path: PathBuf = match brane_shr::fs::recurse_in_only_child_async(&dir_path).await { + Ok(path) => path, + Err(err) => { return Err(CliError::ImportError{ err: ImportError::RepoCloneError{ repo: url, target: dir_path, err } }); }, }; // Try to get which file we need to use as package file diff --git a/brane-ctl/Cargo.toml b/brane-ctl/Cargo.toml index a232b65a..671bc8ac 100644 --- a/brane-ctl/Cargo.toml +++ b/brane-ctl/Cargo.toml @@ -33,3 +33,8 @@ brane-cfg = { path = "../brane-cfg" } brane-shr = { path = "../brane-shr" } brane-tsk = { path = "../brane-tsk" } specifications = { path = "../specifications" } + + +# Hacky indeed but necessary to dodge OpenSSL linking, which we need to make cross-compilation _so_ much easier +[dependencies.openssl-sys] +features = ["vendored"] diff --git a/brane-shr/src/fs.rs b/brane-shr/src/fs.rs index 8107e842..bd84232c 100644 --- a/brane-shr/src/fs.rs +++ b/brane-shr/src/fs.rs @@ -4,7 +4,7 @@ // Created: // 09 Nov 2022, 11:12:06 // Last edited: -// 02 Oct 2023, 16:59:28 +// 22 Oct 2023, 23:23:14 // Auto updated? // Yes // @@ -25,7 +25,7 @@ use console::{style, Style}; use fs2::FileExt as _; use indicatif::{ProgressBar, ProgressStyle}; use log::{debug, warn}; -use reqwest::{Response, StatusCode, Url}; +use reqwest::{Client, Request, Response, StatusCode, Url}; use sha2::{Digest as _, Sha256}; use tokio::fs as tfs; use tokio::io::{self as tio, AsyncWriteExt}; @@ -267,6 +267,10 @@ pub enum Error { DirEntryReadError{ what: &'static str, path: PathBuf, entry: usize, err: std::io::Error }, /// Failed to remove a directory. DirRemoveError{ path: PathBuf, err: std::io::Error }, + /// A given dir had not exactly one child. + DirNotOneEntry { what: &'static str, path: PathBuf }, + /// A given dir had not a directory as child. + DirNonDirChild { what: &'static str, path: PathBuf, child: OsString }, /// The given address did not have HTTPS enabled. NotHttpsError{ address: String }, @@ -319,7 +323,9 @@ impl Display for Error { DirCreateError{ what, path, err } => write!(f, "Failed to create {} directory '{}': {}", what, path.display(), err), DirReadError{ what, path, err } => write!(f, "Failed to read {} directory '{}': {}", what, path.display(), err), DirEntryReadError{ what, path, entry, err } => write!(f, "Failed to read entry {} from {} directory '{}': {}", entry, what, path.display(), err), - DirRemoveError{ path, err } => write!(f, "Failed to remove director '{}': {}", path.display(), err), + DirRemoveError{ path, err } => write!(f, "Failed to remove directory '{}': {}", path.display(), err), + DirNotOneEntry { what, path } => write!(f, "{} directory '{}' does not have exactly one entry", what.capitalize(), path.display()), + DirNonDirChild { what, path, child } => write!(f, "Entry '{}' in {} directory '{}' is not a directory", child.to_string_lossy(), what, path.display()), NotHttpsError{ address } => write!(f, "Security policy requires HTTPS is enabled, but '{address}' does not enable it (or we cannot parse the URL)"), RequestError{ address, err } => write!(f, "Failed to send GET-request to '{address}': {err}"), @@ -664,6 +670,44 @@ pub fn set_executable(path: impl AsRef) -> Result<(), Error> { +/// Unwraps a folder into its only child folder. +/// +/// # Arguments +/// - `dir`: The directory to recurse in. +/// +/// # Returns +/// The path of the nested directory. +/// +/// # Errors +/// This function may error if: +/// - The given `dir` is not a directory; +/// - It has another number than 1 entries; or +/// - That entry is not a directory. +pub async fn recurse_in_only_child_async(dir: impl AsRef) -> Result { + let dir : &Path = dir.as_ref(); + debug!("Recursing into only directory child of '{}'...", dir.display()); + + // Attempt to go thru the child's directories + match tfs::read_dir(dir).await { + Ok(mut entries) => if let (Some(entry), None) = (entries.next_entry().await.transpose(), entries.next_entry().await.transpose()) { + // Assert it's a directory + match entry { + Ok(entry) => { + let path: PathBuf = entry.path(); + if path.is_dir() { Ok(path) } + else { Err(Error::DirNonDirChild { what: "to-be-trivially-recursed", path: dir.into(), child: entry.file_name() }) } + }, + Err(err) => { return Err(Error::DirEntryReadError { what: "to-be-trivially-recursed", path: dir.into(), entry: 0, err }); }, + } + } else { + return Err(Error::DirNotOneEntry { what: "to-be-trivially-recursed", path: dir.into() }); + }, + Err(err) => { return Err(Error::DirReadError { what: "to-be-trivially-recursed", path: dir.into(), err }); }, + } +} + + + /// Moves the given or directory from one location to another. /// /// If possible, it will attempt to use the efficient `rename()`; otherwise, it will perform te extensive copy. @@ -834,15 +878,27 @@ pub async fn download_file_async(source: impl AsRef, target: impl AsRef req, + Err(err) => { return Err(Error::RequestError{ address: source.into(), err }); }, + }; + match client.execute(req).await { Ok(req) => req, Err(err) => { return Err(Error::RequestError{ address: source.into(), err }); }, } } else { debug!("Sending download request to '{}'...", source); - match reqwest::get(source).await { + + // Send the request with a user-agent header (to make GitHub happy) + let client: Client = Client::new(); + let req: Request = match client.get(source).header("User-Agent", "reqwest").build() { + Ok(req) => req, + Err(err) => { return Err(Error::RequestError{ address: source.into(), err }); }, + }; + match client.execute(req).await { Ok(req) => req, Err(err) => { return Err(Error::RequestError{ address: source.into(), err }); }, } diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 00000000..403a7d02 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,19 @@ +// MAIN.rs +// by Lut99 +// +// Created: +// 22 Oct 2023, 21:45:41 +// Last edited: +// 22 Oct 2023, 21:45:54 +// Auto updated? +// Yes +// +// Description: +//! Dummy binary such that we can run zigbuild +// + + +/***** ENTRYPOINT *****/ +fn main() { + +}