Fix async installation

Signed-off-by: trivernis <trivernis@protonmail.com>
i18n
trivernis 2 years ago
parent 6975492f99
commit 43e55480b8
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

621
Cargo.lock generated

@ -7,8 +7,10 @@ name = "Amethyst"
version = "4.0.0"
dependencies = [
"async-recursion",
"aur-rpc",
"clap",
"colored",
"futures",
"libc",
"mimalloc",
"native-tls",
@ -16,6 +18,8 @@ dependencies = [
"rusqlite",
"serde",
"tokio",
"tracing",
"tracing-subscriber",
"ureq",
]
@ -30,6 +34,15 @@ dependencies = [
"version_check",
]
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi",
]
[[package]]
name = "async-recursion"
version = "1.0.0"
@ -52,6 +65,18 @@ dependencies = [
"winapi",
]
[[package]]
name = "aur-rpc"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e34866076a1b9a1af170e30ff8bb5f3d82ab8b3c204d8f11f3b93f41d55e8f15"
dependencies = [
"reqwest",
"serde",
"thiserror",
"tracing",
]
[[package]]
name = "autocfg"
version = "1.1.0"
@ -70,6 +95,12 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bumpalo"
version = "3.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3"
[[package]]
name = "bytes"
version = "1.1.0"
@ -96,9 +127,9 @@ checksum = "fff857943da45f546682664a79488be82e69e43c1a7a2307679ab9afb3a66d2e"
[[package]]
name = "clap"
version = "3.2.8"
version = "3.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "190814073e85d238f31ff738fcb0bf6910cedeb73376c87cd69291028966fd83"
checksum = "29e724a68d9319343bb3328c9cc2dfde263f4b3142ee1059a9980580171c954b"
dependencies = [
"atty",
"bitflags",
@ -114,9 +145,9 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "3.2.7"
version = "3.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "759bf187376e1afa7b85b959e6a664a3e7a95203415dba952ad19139e798f902"
checksum = "13547f7012c01ab4a0e8f8967730ada8f9fdf419e8b6c792788f39cf4e46eefa"
dependencies = [
"heck",
"proc-macro-error",
@ -161,6 +192,15 @@ version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
[[package]]
name = "encoding_rs"
version = "0.8.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b"
dependencies = [
"cfg-if",
]
[[package]]
name = "fallible-iterator"
version = "0.2.0"
@ -182,6 +222,12 @@ dependencies = [
"instant",
]
[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "foreign-types"
version = "0.3.2"
@ -207,6 +253,95 @@ dependencies = [
"percent-encoding",
]
[[package]]
name = "futures"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab30e97ab6aacfe635fad58f22c2bb06c8b685f7421eb1e064a729e2a5f481fa"
dependencies = [
"futures-channel",
"futures-core",
"futures-executor",
"futures-io",
"futures-sink",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-channel"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bfc52cbddcfd745bf1740338492bb0bd83d76c67b445f91c5fb29fae29ecaa1"
dependencies = [
"futures-core",
"futures-sink",
]
[[package]]
name = "futures-core"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2acedae88d38235936c3922476b10fced7b2b68136f5e3c03c2d5be348a1115"
[[package]]
name = "futures-executor"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d11aa21b5b587a64682c0094c2bdd4df0076c5324961a40cc3abd7f37930528"
dependencies = [
"futures-core",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-io"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93a66fc6d035a26a3ae255a6d2bca35eda63ae4c5512bef54449113f7a1228e5"
[[package]]
name = "futures-macro"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0db9cce532b0eae2ccf2766ab246f114b56b9cf6d445e00c2549fbc100ca045d"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "futures-sink"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca0bae1fe9752cf7fd9b0064c674ae63f97b37bc714d745cbde0afb7ec4e6765"
[[package]]
name = "futures-task"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "842fc63b931f4056a24d59de13fb1272134ce261816e063e634ad0c15cdc5306"
[[package]]
name = "futures-util"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0828a5471e340229c11c77ca80017937ce3c58cb788a17e5f1c2d5c485a9577"
dependencies = [
"futures-channel",
"futures-core",
"futures-io",
"futures-macro",
"futures-sink",
"futures-task",
"memchr",
"pin-project-lite",
"pin-utils",
"slab",
]
[[package]]
name = "getrandom"
version = "0.2.7"
@ -219,12 +354,22 @@ dependencies = [
]
[[package]]
name = "hashbrown"
version = "0.11.2"
name = "h2"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57"
dependencies = [
"ahash",
"bytes",
"fnv",
"futures-core",
"futures-sink",
"futures-util",
"http",
"indexmap",
"slab",
"tokio",
"tokio-util",
"tracing",
]
[[package]]
@ -232,14 +377,17 @@ name = "hashbrown"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3"
dependencies = [
"ahash",
]
[[package]]
name = "hashlink"
version = "0.7.0"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf"
checksum = "d452c155cb93fecdfb02a73dd57b5d8e442c2063bd7aac72f1bc5e4263a43086"
dependencies = [
"hashbrown 0.11.2",
"hashbrown",
]
[[package]]
@ -257,6 +405,77 @@ dependencies = [
"libc",
]
[[package]]
name = "http"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"
dependencies = [
"bytes",
"fnv",
"itoa",
]
[[package]]
name = "http-body"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
dependencies = [
"bytes",
"http",
"pin-project-lite",
]
[[package]]
name = "httparse"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c"
[[package]]
name = "httpdate"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
[[package]]
name = "hyper"
version = "0.14.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac"
dependencies = [
"bytes",
"futures-channel",
"futures-core",
"futures-util",
"h2",
"http",
"http-body",
"httparse",
"httpdate",
"itoa",
"pin-project-lite",
"socket2",
"tokio",
"tower-service",
"tracing",
"want",
]
[[package]]
name = "hyper-tls"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
dependencies = [
"bytes",
"hyper",
"native-tls",
"tokio",
"tokio-native-tls",
]
[[package]]
name = "idna"
version = "0.2.3"
@ -275,7 +494,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
dependencies = [
"autocfg",
"hashbrown 0.12.1",
"hashbrown",
]
[[package]]
@ -287,12 +506,27 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "ipnet"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b"
[[package]]
name = "itoa"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d"
[[package]]
name = "js-sys"
version = "0.3.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
@ -301,9 +535,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.126"
version = "0.2.132"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5"
[[package]]
name = "libmimalloc-sys"
@ -316,9 +550,9 @@ dependencies = [
[[package]]
name = "libsqlite3-sys"
version = "0.23.2"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2cafc7c74096c336d9d27145f7ebd4f4b6f95ba16aa5a282387267e6925cb58"
checksum = "9f0455f2c1bc9a7caa792907026e469c1d91761fb0ea37cbb16427c77280cf35"
dependencies = [
"pkg-config",
"vcpkg",
@ -333,6 +567,15 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "matchers"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
dependencies = [
"regex-automata",
]
[[package]]
name = "matches"
version = "0.1.9"
@ -354,6 +597,12 @@ dependencies = [
"libmimalloc-sys",
]
[[package]]
name = "mime"
version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
[[package]]
name = "mio"
version = "0.8.4"
@ -386,9 +635,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.12.1"
version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac8b1a9b2518dc799a2271eff1688707eb315f0d4697aa6b0871369ca4c4da55"
checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e"
[[package]]
name = "openssl"
@ -453,6 +702,12 @@ version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
[[package]]
name = "pin-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
version = "0.3.25"
@ -512,18 +767,27 @@ dependencies = [
[[package]]
name = "regex"
version = "1.5.6"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1"
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
dependencies = [
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
dependencies = [
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.26"
version = "0.6.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64"
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
[[package]]
name = "remove_dir_all"
@ -534,18 +798,54 @@ dependencies = [
"winapi",
]
[[package]]
name = "reqwest"
version = "0.11.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92"
dependencies = [
"base64",
"bytes",
"encoding_rs",
"futures-core",
"futures-util",
"h2",
"http",
"http-body",
"hyper",
"hyper-tls",
"ipnet",
"js-sys",
"lazy_static",
"log",
"mime",
"native-tls",
"percent-encoding",
"pin-project-lite",
"serde",
"serde_json",
"serde_urlencoded",
"tokio",
"tokio-native-tls",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"winreg",
]
[[package]]
name = "rusqlite"
version = "0.26.3"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ba4d3462c8b2e4d7f4fcfcf2b296dc6b65404fbbc7b63daa37fd485c149daf7"
checksum = "01e213bc3ecb39ac32e81e51ebe31fd888a940515173e3a18a35f8c6e896422a"
dependencies = [
"bitflags",
"fallible-iterator",
"fallible-streaming-iterator",
"hashlink",
"libsqlite3-sys",
"memchr",
"smallvec",
]
@ -590,18 +890,18 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.138"
version = "1.0.144"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1578c6245786b9d168c5447eeacfb96856573ca56c9d68fdcf394be134882a47"
checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.138"
version = "1.0.144"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "023e9b1467aef8a10fb88f25611870ada9800ef7e22afce356bb0d2387b6f27c"
checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00"
dependencies = [
"proc-macro2",
"quote",
@ -619,6 +919,27 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
dependencies = [
"form_urlencoded",
"itoa",
"ryu",
"serde",
]
[[package]]
name = "sharded-slab"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31"
dependencies = [
"lazy_static",
]
[[package]]
name = "signal-hook-registry"
version = "1.4.0"
@ -628,12 +949,28 @@ dependencies = [
"libc",
]
[[package]]
name = "slab"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32"
[[package]]
name = "smallvec"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1"
[[package]]
name = "socket2"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "strsim"
version = "0.10.0"
@ -693,6 +1030,35 @@ dependencies = [
"terminal_size",
]
[[package]]
name = "thiserror"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "thread_local"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"
dependencies = [
"once_cell",
]
[[package]]
name = "tinyvec"
version = "1.6.0"
@ -710,10 +1076,11 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tokio"
version = "1.19.2"
version = "1.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439"
checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581"
dependencies = [
"autocfg",
"bytes",
"libc",
"memchr",
@ -721,6 +1088,7 @@ dependencies = [
"once_cell",
"pin-project-lite",
"signal-hook-registry",
"socket2",
"tokio-macros",
"tracing",
"winapi",
@ -737,26 +1105,104 @@ dependencies = [
"syn",
]
[[package]]
name = "tokio-native-tls"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b"
dependencies = [
"native-tls",
"tokio",
]
[[package]]
name = "tokio-util"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
"pin-project-lite",
"tokio",
"tracing",
]
[[package]]
name = "tower-service"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
[[package]]
name = "tracing"
version = "0.1.35"
version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160"
checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307"
dependencies = [
"cfg-if",
"pin-project-lite",
"tracing-attributes",
"tracing-core",
]
[[package]]
name = "tracing-attributes"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tracing-core"
version = "0.1.28"
version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7"
dependencies = [
"once_cell",
"valuable",
]
[[package]]
name = "tracing-log"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
dependencies = [
"lazy_static",
"log",
"tracing-core",
]
[[package]]
name = "tracing-subscriber"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7"
checksum = "60db860322da191b40952ad9affe65ea23e7dd6a5c442c2c42865810c6ab8e6b"
dependencies = [
"ansi_term",
"matchers",
"once_cell",
"regex",
"sharded-slab",
"smallvec",
"thread_local",
"tracing",
"tracing-core",
"tracing-log",
]
[[package]]
name = "try-lock"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
[[package]]
name = "unicode-bidi"
version = "0.3.8"
@ -780,9 +1226,9 @@ dependencies = [
[[package]]
name = "ureq"
version = "2.4.0"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9399fa2f927a3d327187cbd201480cee55bee6ac5d3c77dd27f0c6814cff16d5"
checksum = "b97acb4c28a254fd7a4aeec976c46a7fa404eac4d7c134b30c75144846d7cb8f"
dependencies = [
"base64",
"chunked_transfer",
@ -806,6 +1252,12 @@ dependencies = [
"percent-encoding",
]
[[package]]
name = "valuable"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
[[package]]
name = "vcpkg"
version = "0.2.15"
@ -818,12 +1270,98 @@ version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "want"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"
dependencies = [
"log",
"try-lock",
]
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a"
dependencies = [
"bumpalo",
"lazy_static",
"log",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f"
dependencies = [
"cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be"
[[package]]
name = "web-sys"
version = "0.3.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "winapi"
version = "0.3.9"
@ -897,3 +1435,12 @@ name = "windows_x86_64_msvc"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
[[package]]
name = "winreg"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
dependencies = [
"winapi",
]

@ -52,16 +52,20 @@ codegen-units = 1
[dependencies]
mimalloc = { version = "0.1.29", default-features = false }
clap = { version = "3.2.8", features = [ "derive", "wrap_help" ] }
regex = { version = "1.5.6", default-features = false, features = [ "std", "unicode-perl" ] }
rusqlite = { version = "0.26.3", default-features = false }
clap = { version = "3.2.17", features = [ "derive", "wrap_help" ] }
regex = { version = "1.6.0", default-features = false, features = [ "std", "unicode-perl" ] }
rusqlite = { version = "0.28.0", default-features = false }
colored = "2.0.0"
ureq = { version = "2.4.0", default-features = false, features = [ "native-tls", "json" ] }
serde = { version = "1.0.138", default-features = false, features = [ "derive", "serde_derive" ] }
ureq = { version = "2.5.0", default-features = false, features = [ "native-tls", "json" ] }
serde = { version = "1.0.144", default-features = false, features = [ "derive", "serde_derive" ] }
native-tls = { version = "0.2.10", default-features = false }
libc = { version = "0.2.126", default-features = false }
libc = { version = "0.2.132", default-features = false }
async-recursion = "1.0.0"
aur-rpc = "0.1.2"
futures = "0.3.23"
tracing = "0.1.36"
tracing-subscriber = { version = "0.3.15", features = ["env-filter"] }
[dependencies.tokio]
version = "1.19.2"
version = "1.20.1"
features = ["rt", "io-std", "io-util", "process", "time", "macros", "tracing", "fs"]

@ -0,0 +1,32 @@
ARG BASE_IMAGE=docker.io/archlinux:latest
FROM ${BASE_IMAGE} as build_base
RUN pacman -Syu --noconfirm
RUN pacman -S --noconfirm base-devel curl bash
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
FROM build_base as builder
WORKDIR /usr/src
RUN cargo new amethyst
WORKDIR /usr/src/amethyst
COPY Cargo.toml Cargo.lock ./
RUN cargo fetch
COPY src ./src
RUN cargo build --frozen
RUN mkdir /tmp/ame
RUN cp target/debug/ame /tmp/ame/
FROM ${BASE_IMAGE} as runtime
RUN pacman -Syu --noconfirm
RUN pacman -S --noconfirm base-devel zsh wget vim git binutils fakeroot pacman-contrib sudo
RUN useradd -r -d /home/ame -p $(echo "ame" | openssl passwd -1 -stdin) ame -G wheel
RUN echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN mkdir /home/ame
RUN chown ame:ame /home/ame
COPY --from=builder /tmp/ame/ame /usr/bin/
RUN rm -f $(pacdiff -o -f)
USER ame
RUN mkdir -p /home/ame/.local/share
RUN touch /home/ame/.zshrc
ENV AME_LOG=debug
ENTRYPOINT ["zsh"]

@ -0,0 +1,4 @@
#!/bin/bash
podman build . -t ame-debug \
&& podman container rm ame-debug \
&& podman run -i -t --name ame-debug ame-debug

@ -1,21 +0,0 @@
use crate::internal::exit_code::AppExitCode;
use crate::internal::rpc::Package;
use crate::{crash, log, Options};
use super::get_database_connection;
pub fn add(pkg: Package, options: Options) {
let conn = get_database_connection();
if options.verbosity >= 1 {
log!("Adding package {} to database", pkg.name);
}
let pkg_description = pkg
.description
.unwrap_or_else(|| "No description found.".parse().unwrap());
conn.execute("INSERT OR REPLACE INTO packages (name, version, description, depends, make_depends) VALUES (?1, ?2, ?3, ?4, ?5)",
[&pkg.name, &pkg.version, &pkg_description, &pkg.depends.join(" "), &pkg.make_depends.join(" ")],
).unwrap_or_else(|e|
crash!(AppExitCode::FailedAddingPkg, "Failed adding package {} to the database: {}", pkg.name, e)
);
}

@ -1,41 +0,0 @@
use rusqlite::Connection;
use std::env;
use std::path::Path;
use crate::internal::exit_code::AppExitCode;
use crate::{crash, log, Options};
pub fn init(options: Options) {
let path = format!("{}/.local/share/ame/db.sqlite", env::var("HOME").unwrap());
let dbpath = Path::new(&path);
let verbosity = options.verbosity;
if verbosity >= 1 {
log!("Creating database at {}", &path);
}
let conn =
Connection::open(dbpath).expect("Couldn't create database at ~/.local/share/ame/db.sqlite");
if verbosity >= 1 {
log!("Populating database with table");
}
conn.execute(
"CREATE TABLE packages (
name TEXT PRIMARY KEY NOT NULL,
version TEXT NOT NULL,
description TEXT,
depends BLOB,
make_depends BLOB
)",
[],
)
.unwrap_or_else(|e| {
crash!(
AppExitCode::FailedInitDb,
"Couldn't initialise database: {}",
e,
)
});
}

@ -1,17 +0,0 @@
use std::{env, path::PathBuf};
pub mod add;
pub mod initialise;
pub mod query;
pub mod remove;
pub use add::*;
pub use initialise::*;
pub use query::*;
pub use remove::*;
use rusqlite::Connection;
fn get_database_connection() -> Connection {
let db_path = format!("{}/.local/share/ame/db.sqlite", env::var("HOME").unwrap());
Connection::open(PathBuf::from(db_path)).expect("Couldn't connect to database")
}

@ -1,63 +0,0 @@
use rusqlite::Connection;
use std::env;
use std::path::Path;
use crate::internal::rpc::Package;
use crate::{log, Options};
pub fn query(options: Options) -> Vec<Package> {
let verbosity = options.verbosity;
if verbosity >= 1 {
log!("Connecting to database");
}
let conn = Connection::open(Path::new(&format!(
"{}/.local/share/ame/db.sqlite",
env::var("HOME").unwrap()
)))
.expect("Couldn't connect to database");
if verbosity >= 1 {
log!("Querying database for input");
}
let mut rs = conn.prepare("SELECT * FROM packages;").unwrap();
let packages_iter = rs
.query_map([], |row| {
Ok(Package {
name: row.get(0).unwrap(),
version: row.get(1).unwrap(),
description: row.get(2).unwrap(),
depends: row
.get::<usize, String>(3)
.unwrap()
.split(' ')
.map(|s| s.to_string())
.collect::<Vec<String>>(),
make_depends: row
.get::<usize, String>(4)
.unwrap()
.split(' ')
.map(|s| s.to_string())
.collect::<Vec<String>>(),
})
})
.expect("Couldn't query database for packages");
if verbosity >= 1 {
log!("Retrieved results");
}
let mut results: Vec<Package> = vec![];
for package in packages_iter {
results.push(package.unwrap());
}
if verbosity >= 1 {
log!("Collected results");
}
results
}

@ -1,23 +0,0 @@
use crate::{log, Options};
use super::get_database_connection;
pub fn remove(pkg: &str, options: Options) {
let conn = get_database_connection();
let verbosity = options.verbosity;
if verbosity >= 1 {
log!("Removing package {} from database", pkg);
}
conn.execute(
"DELETE FROM packages
WHERE EXISTS
(SELECT *
FROM packages
WHERE name = ?);",
[pkg],
)
.expect("Couldn't delete package from database");
}

@ -11,6 +11,7 @@ pub type AppResult<T> = Result<T, AppError>;
pub enum AppError {
Io(std::io::Error),
Other(String),
Rpc(aur_rpc::error::RPCError),
NonZeroExit,
}
@ -20,6 +21,7 @@ impl Display for AppError {
AppError::Io(io) => Display::fmt(io, f),
AppError::Other(s) => Display::fmt(s, f),
AppError::NonZeroExit => Display::fmt("exited with non zero code", f),
AppError::Rpc(e) => Display::fmt(e, f),
}
}
}
@ -32,6 +34,12 @@ impl From<io::Error> for AppError {
}
}
impl From<aur_rpc::error::RPCError> for AppError {
fn from(e: aur_rpc::error::RPCError) -> Self {
Self::Rpc(e)
}
}
impl From<String> for AppError {
fn from(string: String) -> Self {
Self::Other(string)

@ -1,12 +1,11 @@
pub enum AppExitCode {
RunAsRoot = 1,
FailedAddingPkg = 2,
FailedInitDb = 3,
FailedCreatingPaths = 4,
MissingDeps = 5,
UserCancellation = 6,
PacmanError = 7,
GitError = 8,
MakePkgError = 9,
RpcError = 10,
Other = 102,
}

@ -0,0 +1,49 @@
use std::{
collections::VecDeque,
path::{Path, PathBuf},
};
use futures::future;
use tokio::fs;
#[tracing::instrument(level = "debug")]
pub async fn rmdir_recursive(path: &Path) -> std::io::Result<()> {
let mut files: Vec<PathBuf> = Vec::new();
let mut folders: Vec<PathBuf> = Vec::new();
if path.is_dir() {
folders.push(path.into());
} else {
files.push(path.into());
}
let mut folders_to_scan: VecDeque<_> = folders.clone().into();
while let Some(path) = folders_to_scan.pop_front() {
let mut dir_content = fs::read_dir(&path).await?;
while let Some(entry) = dir_content.next_entry().await? {
let entry = entry.path();
if entry.is_dir() {
folders_to_scan.push_back(entry.clone());
folders.push(entry);
} else {
files.push(entry);
}
}
}
tracing::debug!("Deleting {} files", files.len());
future::try_join_all(files.into_iter().map(fs::remove_file)).await?;
tracing::debug!("Deleting {} folders", folders.len());
folders.reverse();
for folder in folders {
tracing::trace!("Deleting {folder:?}");
fs::remove_dir(folder).await?;
}
Ok(())
}

@ -27,10 +27,6 @@ pub fn init(options: Options) {
}
}
if !Path::new(&format!("{}/.local/share/ame/db.sqlite", homedir)).exists() {
crate::database::init(options);
}
if !Path::new(&format!("{}/.cache/ame/", homedir)).exists() {
let r = std::fs::create_dir_all(format!("{}/.cache/ame", homedir));
match r {

@ -9,6 +9,7 @@ pub mod commands;
mod detect;
pub mod error;
pub mod exit_code;
pub mod fs_utils;
mod initialise;
pub mod rpc;
mod sort;

@ -1,75 +1,16 @@
use std::sync::Arc;
#[derive(serde::Deserialize, Debug, Clone)]
pub struct Package {
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "Version")]
pub version: String,
#[serde(rename = "Description")]
pub description: Option<String>,
#[serde(rename = "Depends")]
#[serde(default)]
pub depends: Vec<String>,
#[serde(rename = "MakeDepends")]
#[serde(default)]
pub make_depends: Vec<String>,
}
#[derive(serde::Deserialize)]
pub struct SearchResults {
pub resultcount: u32,
pub results: Vec<Package>,
}
#[derive(Clone)]
pub struct InfoResults {
pub found: bool,
pub package: Option<Package>,
}
use aur_rpc::{PackageInfo, PackageMetadata};
use super::error::AppResult;
pub const URL: &str = "https://aur.archlinux.org/";
pub fn rpcinfo(pkg: &String) -> InfoResults {
let tls_connector = Arc::new(native_tls::TlsConnector::new().unwrap());
let agent = ureq::AgentBuilder::new()
.tls_connector(tls_connector)
.build();
let res: SearchResults = agent
.get(&format!(
"https://aur.archlinux.org/rpc/?v=5&type=info&arg={}",
pkg
))
.call()
.unwrap()
.into_json()
.unwrap();
pub async fn rpcinfo(pkg: &str) -> AppResult<Option<PackageInfo>> {
let packages = aur_rpc::info(vec![pkg]).await?;
if res.results.is_empty() {
InfoResults {
found: false,
package: None,
}
} else {
InfoResults {
found: true,
package: Some(res.results[0].clone()),
}
}
Ok(packages.into_iter().next())
}
pub fn rpcsearch(pkg: String) -> SearchResults {
let tls_connector = Arc::new(native_tls::TlsConnector::new().unwrap());
let agent = ureq::AgentBuilder::new()
.tls_connector(tls_connector)
.build();
agent
.get(&format!(
"https://aur.archlinux.org/rpc/?v=5&type=search&arg={}",
pkg
))
.call()
.unwrap()
.into_json::<SearchResults>()
.unwrap()
pub async fn rpcsearch(pkg: String) -> AppResult<Vec<PackageMetadata>> {
let search_results = aur_rpc::search(pkg).await?;
Ok(search_results)
}

@ -3,7 +3,10 @@ use std::process::{Command, Stdio};
use crate::internal::{clean, rpc, structs};
use crate::{log, Options};
pub fn sort(input: &[String], options: Options) -> structs::Sorted {
use super::error::SilentUnwrap;
use super::exit_code::AppExitCode;
pub async fn sort(input: &[String], options: Options) -> structs::Sorted {
let mut repo_packages: Vec<String> = vec![];
let mut aur_packages: Vec<String> = vec![];
let mut missing_packages: Vec<String> = vec![];
@ -28,7 +31,11 @@ pub fn sort(input: &[String], options: Options) -> structs::Sorted {
log!("{} found in repos", package);
}
repo_packages.push(package.to_string());
} else if rpc::rpcinfo(&package).found {
} else if rpc::rpcinfo(&package)
.await
.silent_unwrap(AppExitCode::RpcError)
.is_some()
{
if verbosity >= 1 {
log!("{} found in AUR", package);
}

@ -7,12 +7,14 @@ use crate::args::{InstallArgs, Operation, QueryArgs, RemoveArgs, SearchArgs};
use crate::internal::detect;
use crate::internal::exit_code::AppExitCode;
use crate::internal::{init, sort, start_sudoloop, structs::Options};
use tracing_subscriber::fmt::format::FmtSpan;
use tracing_subscriber::EnvFilter;
use std::str::FromStr;
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
mod args;
mod database;
mod internal;
mod operations;
@ -21,6 +23,7 @@ async fn main() {
if unsafe { libc::geteuid() } == 0 {
crash!( AppExitCode::RunAsRoot, "Running amethyst as root is disallowed as it can lead to system breakage. Instead, amethyst will prompt you when it needs superuser permissions");
}
init_logger();
let args: Args = Args::parse();
@ -57,9 +60,25 @@ async fn main() {
detect().await;
}
/// Initializes the tracing logger
/// Can be used for debug purposes _or_ verbose output
fn init_logger() {
const DEFAULT_ENV_FILTER: &str = "warn";
let filter_string =
std::env::var("AME_LOG").unwrap_or_else(|_| DEFAULT_ENV_FILTER.to_string());
let env_filter =
EnvFilter::from_str(&*filter_string).expect("failed to parse env filter string");
tracing_subscriber::fmt::SubscriberBuilder::default()
.with_env_filter(env_filter)
.with_writer(std::io::stdout)
.with_span_events(FmtSpan::NEW | FmtSpan::CLOSE)
.compact()
.init();
}
async fn cmd_install(args: InstallArgs, options: Options) {
let packages = args.packages;
let sorted = sort(&packages, options);
let sorted = sort(&packages, options).await;
info!("Attempting to install packages: {}", packages.join(", "));

@ -1,7 +1,7 @@
use async_recursion::async_recursion;
use std::env;
use std::env::set_current_dir;
use std::path::Path;
use std::path::{Path, PathBuf};
use std::process::Command;
use tokio::fs;
@ -9,7 +9,7 @@ use crate::internal::commands::ShellCommand;
use crate::internal::error::SilentUnwrap;
use crate::internal::exit_code::AppExitCode;
use crate::internal::rpc::rpcinfo;
use crate::{crash, info, log, prompt, Options};
use crate::{crash, info, internal::fs_utils::rmdir_recursive, log, prompt, Options};
/// Installs a given list of packages from the aur
#[async_recursion]
@ -25,17 +25,20 @@ pub async fn aur_install(packages: Vec<String>, options: Options) {
info!("Installing packages {} from the AUR", packages.join(", "));
for package in packages {
let rpcres = rpcinfo(&package);
for package_name in packages {
let rpcres = rpcinfo(&package_name)
.await
.silent_unwrap(AppExitCode::RpcError);
if !rpcres.found {
if rpcres.is_none() {
break;
}
let pkg = &rpcres.package.as_ref().unwrap().name;
let package = rpcres.unwrap();
let pkg_name = package.metadata.name;
if verbosity >= 1 {
log!("Cloning {} into cachedir", pkg);
log!("Cloning {} into cachedir", pkg_name);
}
info!("Cloning package source");
@ -43,7 +46,7 @@ pub async fn aur_install(packages: Vec<String>, options: Options) {
set_current_dir(Path::new(&cachedir)).unwrap();
ShellCommand::git()
.arg("clone")
.arg(format!("{}/{}", url, pkg))
.arg(format!("{}/{}", url, pkg_name))
.wait()
.await
.silent_unwrap(AppExitCode::GitError);
@ -51,30 +54,29 @@ pub async fn aur_install(packages: Vec<String>, options: Options) {
if verbosity >= 1 {
log!(
"Cloned {} into cachedir, moving on to resolving dependencies",
pkg
pkg_name
);
log!(
"Raw dependencies for package {} are:\n{:?}",
pkg,
rpcres.package.as_ref().unwrap().depends.join(", ")
pkg_name,
package.depends,
);
log!(
"Raw makedepends for package {} are:\n{:?}",
pkg,
rpcres.package.as_ref().unwrap().make_depends.join(", ")
pkg_name,
package.make_depends.join(", "),
);
}
// dep sorting
log!("Sorting dependencies");
let sorted = crate::internal::sort(&rpcres.package.as_ref().unwrap().depends, options);
let sorted = crate::internal::sort(&package.depends, options).await;
log!("Sorting make dependencies");
let md_sorted =
crate::internal::sort(&rpcres.package.as_ref().unwrap().make_depends, options);
let md_sorted = crate::internal::sort(&package.make_depends, options).await;
if verbosity >= 1 {
log!("Sorted dependencies for {} are:\n{:?}", pkg, &sorted);
log!("Sorted makedepends for {} are:\n{:?}", pkg, &md_sorted);
log!("Sorted dependencies for {} are:\n{:?}", pkg_name, &sorted);
log!("Sorted makedepends for {} are:\n{:?}", pkg_name, &md_sorted);
}
let newopts = Options {
@ -88,20 +90,20 @@ pub async fn aur_install(packages: Vec<String>, options: Options) {
AppExitCode::MissingDeps,
"Could not find dependencies {} for package {}, aborting",
sorted.nf.join(", "),
pkg,
pkg_name,
);
}
if !noconfirm {
let p1 = prompt!(default false,
"Would you like to review {}'s PKGBUILD (and any .install files if present)?",
pkg
pkg_name,
);
let editor: &str = &env::var("PAGER").unwrap_or_else(|_| "less".parse().unwrap());
if p1 {
Command::new(editor)
.arg(format!("{}/PKGBUILD", pkg))
.arg(format!("{}/PKGBUILD", pkg_name))
.spawn()
.unwrap()
.wait()
@ -109,7 +111,7 @@ pub async fn aur_install(packages: Vec<String>, options: Options) {
let status = ShellCommand::bash()
.arg("-c")
.arg(format!("ls {}/*.install &> /dev/null", pkg))
.arg(format!("ls {}/*.install &> /dev/null", pkg_name))
.wait()
.await
.silent_unwrap(AppExitCode::Other);
@ -117,15 +119,15 @@ pub async fn aur_install(packages: Vec<String>, options: Options) {
if status.success() {
ShellCommand::bash()
.arg("-c")
.arg(format!("{} {}/*.install", editor, pkg))
.arg(format!("{} {}/*.install", editor, pkg_name))
.wait()
.await
.silent_unwrap(AppExitCode::Other);
}
let p2 = prompt!(default true, "Would you still like to install {}?", pkg);
let p2 = prompt!(default true, "Would you still like to install {}?", pkg_name);
if !p2 {
fs::remove_dir_all(format!("{}/{}", cachedir, pkg))
fs::remove_dir_all(format!("{}/{}", cachedir, pkg_name))
.await
.unwrap();
crash!(AppExitCode::UserCancellation, "Not proceeding");
@ -155,7 +157,7 @@ pub async fn aur_install(packages: Vec<String>, options: Options) {
// package building and installing
info!("Building time!");
set_current_dir(format!("{}/{}", cachedir, pkg)).unwrap();
set_current_dir(format!("{}/{}", cachedir, pkg_name)).unwrap();
let status = ShellCommand::makepkg()
.args(makepkg_args)
.wait()
@ -163,22 +165,18 @@ pub async fn aur_install(packages: Vec<String>, options: Options) {
.silent_unwrap(AppExitCode::MakePkgError);
if !status.success() {
fs::remove_dir_all(format!("{}/{}", cachedir, pkg))
fs::remove_dir_all(format!("{}/{}", cachedir, pkg_name))
.await
.unwrap();
crash!(
AppExitCode::PacmanError,
"Error encountered while installing {}, aborting",
pkg,
pkg_name,
);
}
set_current_dir(&cachedir).unwrap();
fs::remove_dir_all(format!("{}/{}", cachedir, &pkg))
.await
.unwrap();
// pushes package to database
crate::database::add(rpcres.package.unwrap(), options);
let package_cache = PathBuf::from(format!("{cachedir}/{pkg_name}"));
rmdir_recursive(&package_cache).await.unwrap()
}
}

@ -6,22 +6,20 @@ use crate::{log, Options};
pub async fn aur_search(query: &str, options: Options) {
let verbosity = options.verbosity;
let res = rpcsearch(query.to_string());
let packages = rpcsearch(query.to_string())
.await
.silent_unwrap(AppExitCode::RpcError);
let total_results = packages.len();
for package in &res.results {
for package in &packages {
println!(
"aur/{} {}\n {}",
package.name,
package.version,
package
.description
.as_ref()
.unwrap_or(&"No description".to_string())
package.name, package.version, package.description
)
}
if verbosity >= 1 {
log!("Found {} resuls for \"{}\" in AUR", res.resultcount, query);
log!("Found {total_results} resuls for \"{query}\" in AUR",);
}
}

@ -31,7 +31,6 @@ pub async fn uninstall(packages: Vec<String>, options: Options) {
}
for package in packages {
crate::database::remove(&package, options);
if Path::new(&format!(
"{}/.cache/ame/{}",
env::var("HOME").unwrap(),

@ -3,7 +3,7 @@ use crate::internal::error::SilentUnwrap;
use crate::internal::exit_code::AppExitCode;
use crate::internal::rpc::rpcinfo;
use crate::operations::aur_install::aur_install;
use crate::{info, log, prompt, Options};
use crate::{info, log, prompt, warn, Options};
/// Upgrades all installed packages
pub async fn upgrade(options: Options) {
@ -42,18 +42,40 @@ pub async fn upgrade(options: Options) {
log!("Upgrading AUR packages");
}
let packages = crate::database::query(options);
let pacman_output = ShellCommand::pacman()
.arg("-Qm")
.args(&["--color", "never"])
.wait_with_output()
.await
.silent_unwrap(AppExitCode::PacmanError);
let non_native_pkgs = pacman_output
.stdout
.split('\n')
.filter(|p| !p.is_empty())
.filter_map(|p| p.split_once(' '))
.collect::<Vec<(&str, &str)>>();
if verbosity >= 1 {
log!("{:?}", &packages);
log!("{:?}", non_native_pkgs);
}
let mut aur_upgrades = vec![];
for package in packages {
let remote_package = rpcinfo(&package.name);
for (pkg_name, pkg_version) in non_native_pkgs {
if verbosity >= 1 {
log!(
"remote package: name = {}, version = {}",
pkg_name,
pkg_version
);
}
let remote_package = rpcinfo(pkg_name).await.silent_unwrap(AppExitCode::RpcError);
if remote_package.package.unwrap().version != package.version {
aur_upgrades.push(package.name);
if let Some(remote_package) = remote_package {
if remote_package.metadata.version != pkg_version {
aur_upgrades.push(pkg_name.to_string());
}
} else {
warn!("Could not find the remote package for {}", pkg_name);
}
}

Loading…
Cancel
Save