├── rustfmt.toml ├── .gitignore ├── rust-toolchain.toml ├── makedeb ├── mist.postinst └── PKGBUILD ├── tests └── tests.bats ├── justfile ├── .drone ├── scripts │ ├── setup-pbmpr.sh │ ├── create-release.sh │ └── publish-mpr.sh └── drone.jsonnet ├── renovate.json ├── src ├── message.rs ├── whoami.rs ├── list.rs ├── clone.rs ├── search.rs ├── remove.rs ├── upgrade.rs ├── list_comments.rs ├── install.rs ├── comment.rs ├── progress.rs ├── style.rs ├── update.rs ├── main.rs ├── util.rs ├── install_util.rs └── cache.rs ├── .github └── workflows │ └── pr.yml ├── toast.yml ├── Cargo.toml ├── man └── mist.1.adoc ├── README.md ├── CHANGELOG.md ├── completions └── mist.bash ├── LICENSE └── Cargo.lock /rustfmt.toml: -------------------------------------------------------------------------------- 1 | wrap_comments = true -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk 3 | -------------------------------------------------------------------------------- /rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "nightly" -------------------------------------------------------------------------------- /makedeb/mist.postinst: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | chown 'root:root' /usr/bin/mist 3 | chmod a+s /usr/bin/mist -------------------------------------------------------------------------------- /tests/tests.bats: -------------------------------------------------------------------------------- 1 | @test "run update" { 2 | target/debug/mist update 3 | } 4 | 5 | @test "search with no results" { 6 | run ! target/debug/mist search 'nonexistent' 7 | } 8 | 9 | @test "list with no results" { 10 | run ! target/debug/mist list 'nonexistent' 11 | } -------------------------------------------------------------------------------- /justfile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env just --justfile 2 | # Some wrappers to aid in the build process during local development. 3 | set positional-arguments 4 | 5 | default: 6 | @just --list 7 | 8 | build *args: 9 | cargo build "${@}" 10 | sudo chown 'root:root' target/*/mist 11 | sudo chmod a+s target/*/mist 12 | 13 | run *args: 14 | just build 15 | target/debug/mist "${@}" -------------------------------------------------------------------------------- /.drone/scripts/setup-pbmpr.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | curl -q 'https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub' | gpg --dearmor | sudo tee /usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg 1> /dev/null 3 | echo "deb [signed-by=/usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg] https://proget.makedeb.org prebuilt-mpr $(lsb_release -cs)" | sudo tee /etc/apt/sources.list.d/prebuilt-mpr.list 4 | sudo apt-get update 5 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:base" 4 | ], 5 | "groupName": "all dependencies", 6 | "separateMajorMinor": false, 7 | "groupSlug": "all", 8 | "packageRules": [ 9 | { 10 | "matchPackagePatterns": [ 11 | "*" 12 | ], 13 | "groupName": "all dependencies", 14 | "groupSlug": "all" 15 | } 16 | ], 17 | "lockFileMaintenance": { 18 | "enabled": false 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/message.rs: -------------------------------------------------------------------------------- 1 | use crate::style::Colorize; 2 | 3 | pub fn info(string: &str) { 4 | print!("{} {}", "Info:".cyan().bold(), string); 5 | } 6 | 7 | pub fn warning(string: &str) { 8 | print!("{} {}", "Warning:".yellow().bold(), string); 9 | } 10 | 11 | pub fn error(string: &str) { 12 | print!("{} {}", "Err:".red().bold(), string); 13 | } 14 | 15 | pub fn question(string: &str) { 16 | print!("{} {}", "Question:".magenta().bold(), string); 17 | } 18 | -------------------------------------------------------------------------------- /.github/workflows/pr.yml: -------------------------------------------------------------------------------- 1 | name: Run unit tests 2 | on: {"pull_request"} 3 | env: {"DEBIAN_FRONTEND": "noninteractive"} 4 | jobs: 5 | run-tests: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - name: Install CI prerequisites 9 | run: sudo -E apt-get install git -y 10 | 11 | - name: Checkout Git repository 12 | uses: actions/checkout@v3 13 | 14 | - name: Run unit tests 15 | uses: stepchowfun/toast/.github/actions/toast@main 16 | 17 | # vim: expandtab ts=2 sw=2 18 | -------------------------------------------------------------------------------- /.drone/scripts/create-release.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -ex 3 | 4 | if echo "${DRONE_COMMIT_MESSAGE}" | grep -q 'GH SKIP'; then 5 | echo "Skipping GitHub release creation!" 6 | exit 0 7 | fi 8 | 9 | .drone/scripts/setup-pbmpr.sh 10 | sudo apt-get install gh parse-changelog -y 11 | 12 | source makedeb/PKGBUILD 13 | 14 | release_notes="$(parse-changelog CHANGELOG.md "${pkgver}")" 15 | echo "${github_api_key}" | gh auth login --with-token 16 | gh release create "v${pkgver}" --title "v${pkgver}" --target "${DRONE_COMMIT_SHA}" -n "${release_notes}" 17 | 18 | # vim: set sw=4 expandtab: 19 | -------------------------------------------------------------------------------- /src/whoami.rs: -------------------------------------------------------------------------------- 1 | use crate::{message, util}; 2 | use serde::Deserialize; 3 | 4 | #[derive(Deserialize)] 5 | struct Authenticated { 6 | user: String, 7 | } 8 | 9 | pub fn whoami(args: &clap::ArgMatches) { 10 | let api_token: &String = match args.get_one("token") { 11 | Some(token) => token, 12 | None => { 13 | message::error("No API key was provided."); 14 | quit::with_code(exitcode::USAGE); 15 | } 16 | }; 17 | let mpr_url: &String = args.get_one("mpr-url").unwrap(); 18 | 19 | let request = util::AuthenticatedRequest::new(api_token, mpr_url); 20 | let resp_text = request.get("test"); 21 | let json = serde_json::from_str::(&resp_text).unwrap(); 22 | 23 | println!("Authenticated to the MPR as {}.", json.user); 24 | } 25 | -------------------------------------------------------------------------------- /toast.yml: -------------------------------------------------------------------------------- 1 | image: proget.makedeb.org/docker/makedeb/makedeb:ubuntu-jammy 2 | tasks: 3 | install-deps: 4 | command: | 5 | curl -q 'https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub' | gpg --dearmor | sudo tee /usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg 1> /dev/null 6 | echo "deb [signed-by=/usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg] https://proget.makedeb.org prebuilt-mpr $(lsb_release -cs)" | sudo tee /etc/apt/sources.list.d/prebuilt-mpr.list 7 | sudo apt-get update 8 | sudo apt-get install bats g++ just libssl-dev libapt-pkg-dev lsb-release pkg-config rustup sudo -y 9 | run-tests: 10 | dependencies: ["install-deps"] 11 | input_paths: 12 | - Cargo.toml 13 | - Cargo.lock 14 | - src/ 15 | - rust-toolchain.toml 16 | - rustfmt.toml 17 | - justfile 18 | command: | 19 | cargo fmt --check 20 | cargo clippy -- -D warnings 21 | just build 22 | run-e2e-tests: 23 | dependencies: ["run-tests"] 24 | input_paths: 25 | - tests/ 26 | command: bats tests/ -------------------------------------------------------------------------------- /.drone/scripts/publish-mpr.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -ex 3 | 4 | sudo apt install curl jq git -y 5 | curl -Ls "https://shlink.${hw_url}/ci-utils" | sudo bash - 6 | 7 | mkdir ~/.ssh 8 | echo -e "Host ${mpr_url}\n Hostname ${mpr_url}\n IdentityFile ${HOME}/.ssh/ssh_key" | tee -a "${HOME}/.ssh/config" 9 | echo "${ssh_key}" | tee "/${HOME}/.ssh/ssh_key" 10 | 11 | MPR_SSH_KEY="$(curl "https://${mpr_url}/api/meta" | jq -r '.ssh_key_fingerprints.ECDSA')" 12 | 13 | SSH_HOST="${mpr_url}" \ 14 | SSH_EXPECTED_FINGERPRINT="${MPR_SSH_KEY}" \ 15 | SET_PERMS=true \ 16 | get-ssh-key 17 | 18 | cd makedeb/ 19 | source PKGBUILD 20 | 21 | git clone "ssh://mpr@${mpr_url}/${pkgname}" 22 | cp PKGBUILD mist.postinst "${pkgname}/" 23 | cd "${pkgname}/" 24 | 25 | git config --global user.name 'Kavplex Bot' 26 | git config --global user.email 'kavplex@hunterwittenborn.com' 27 | 28 | makedeb --print-srcinfo | tee .SRCINFO 29 | git add . 30 | git commit -m "Bump version to '${pkgver}-${pkgrel}'" 31 | git push 32 | 33 | # Clean up, as crates.io publishing doesn't like a Git directory with uncommitted changes. 34 | cd ../ 35 | rm "${pkgname}/" -rf 36 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "mist" 3 | version = "0.12.0" 4 | authors = ["Hunter Wittenborn 2 | 3 | # NOTE: If you're installing this from the MPR you'll need to pass 4 | # `-H 'MPR-Package: yes'` to your `makedeb` call if you want Mist to be able to 5 | # automatically update itself. 6 | pkgname=mist 7 | pkgver=0.12.0 8 | pkgrel=1 9 | pkgdesc='The official command-line interface for the makedeb Package Repository' 10 | arch=('any') 11 | depends=( 12 | 'libapt-pkg-dev' 13 | 'libssl-dev' 14 | 'makedeb|makedeb-beta|makedeb-alpha' 15 | 'sudo' 16 | ) 17 | optdepends=( 18 | 'r!less' 19 | ) 20 | makedepends=( 21 | 'asciidoctor' 22 | 'rustup' 23 | 'pkg-config' 24 | ) 25 | license=('GPL3') 26 | url='https://github.com/makedeb/mist' 27 | postinst='mist.postinst' 28 | 29 | source=("${url}/archive/refs/tags/v${pkgver}.tar.gz") 30 | sha256sums=('SKIP') 31 | 32 | build() { 33 | cd "${pkgname}-${pkgver}/" 34 | cargo build --release 35 | sed -i "s|:mansource: Git|:mansource: ${pkgver}|" man/mist.1.adoc 36 | } 37 | 38 | package() { 39 | cd "${pkgname}-${pkgver}/" 40 | install -Dm 755 target/release/mist "${pkgdir}/usr/bin/mist" 41 | asciidoctor -b manpage -o - man/mist.1.adoc | install -Dm 644 /dev/stdin "${pkgdir}/usr/share/man/man1/mist.1" 42 | install -Dm 644 completions/mist.bash "${pkgdir}/usr/share/bash-completion/completions/mist" 43 | } 44 | 45 | # vim: set sw=4 expandtab: 46 | -------------------------------------------------------------------------------- /src/list.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | cache::{Cache, MprCache}, 3 | style, 4 | }; 5 | use rust_apt::cache::{Cache as AptCache, PackageSort}; 6 | 7 | pub fn list(args: &clap::ArgMatches) { 8 | let pkglist: Vec<&String> = match args.get_many("pkg") { 9 | Some(pkglist) => pkglist.collect(), 10 | None => Vec::new(), 11 | }; 12 | let apt_only = args.is_present("apt-only"); 13 | let mpr_only = args.is_present("mpr-only"); 14 | let installed_only = args.is_present("installed-only"); 15 | let name_only = args.is_present("name-only"); 16 | 17 | let cache = Cache::new(AptCache::new(), MprCache::new()); 18 | let mut candidates = Vec::new(); 19 | 20 | if !pkglist.is_empty() { 21 | for pkg in pkglist { 22 | if cache.apt_cache().get(pkg).is_some() 23 | || cache.mpr_cache().packages().get(pkg).is_some() 24 | { 25 | candidates.push(pkg.to_string()); 26 | } 27 | } 28 | } else { 29 | for pkg in Cache::get_nonvirtual_packages(cache.apt_cache(), &PackageSort::default()) { 30 | let pkgname = pkg.name(); 31 | if !candidates.contains(&pkgname) { 32 | candidates.push(pkgname); 33 | } 34 | } 35 | 36 | for pkg in cache.mpr_cache().packages().values() { 37 | if !candidates.contains(&pkg.pkgname) { 38 | candidates.push(pkg.pkgname.to_string()); 39 | } 40 | } 41 | } 42 | 43 | if candidates.is_empty() { 44 | quit::with_code(exitcode::UNAVAILABLE); 45 | } 46 | 47 | print!( 48 | "{}", 49 | style::generate_pkginfo_entries( 50 | &candidates, 51 | &cache, 52 | apt_only, 53 | mpr_only, 54 | installed_only, 55 | name_only 56 | ) 57 | ); 58 | } 59 | -------------------------------------------------------------------------------- /src/clone.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | cache::{Cache, MprCache}, 3 | message, util, 4 | }; 5 | use rust_apt::cache::Cache as AptCache; 6 | 7 | pub fn clone(args: &clap::ArgMatches) { 8 | let pkg: &String = args.get_one("pkg").unwrap(); 9 | let mpr_url: &String = args.get_one("mpr-url").unwrap(); 10 | let cache = Cache::new(AptCache::new(), MprCache::new()); 11 | let mut pkgbases: Vec<&String> = Vec::new(); 12 | 13 | // Get a list of package bases. 14 | for pkg in cache.mpr_cache().packages().values() { 15 | pkgbases.push(&pkg.pkgbase); 16 | } 17 | 18 | // Abort if the package base doesn't exist. 19 | if !pkgbases.contains(&pkg) { 20 | message::error(&format!( 21 | "Package base '{}' doesn't exist on the MPR.\n", 22 | pkg 23 | )); 24 | 25 | // If there's a pkgbase that builds this package, guide the user to clone that 26 | // package instead. 27 | if let Some(pkgbase) = cache.find_pkgbase(pkg) { 28 | message::error(&format!( 29 | "Package base '{}' exists on the MPR though, which builds '{}'. You probably want to clone that instead:\n", 30 | pkgbase, 31 | &pkg 32 | )); 33 | message::error(&format!( 34 | " {} clone '{}'\n", 35 | clap::crate_name!(), 36 | pkgbase 37 | )); 38 | } 39 | 40 | quit::with_code(exitcode::USAGE); 41 | } 42 | 43 | // Clone the package. 44 | let pkg_url = format!("{}/{}", mpr_url, pkg); 45 | let mut cmd = util::sudo::run_as_normal_user("git"); 46 | cmd.args(["clone", &pkg_url]); 47 | let exit_code = cmd.output().unwrap().status; 48 | 49 | if !exit_code.success() { 50 | message::error("Failed to clone package.\n"); 51 | quit::with_code(exitcode::UNAVAILABLE); 52 | }; 53 | } 54 | -------------------------------------------------------------------------------- /src/search.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | cache::{Cache, MprCache}, 3 | style, 4 | }; 5 | use rust_apt::cache::{Cache as AptCache, PackageSort}; 6 | 7 | pub fn search(args: &clap::ArgMatches) { 8 | let query_list: Vec<&String> = args.get_many("query").unwrap().collect(); 9 | let apt_only = args.is_present("apt-only"); 10 | let mpr_only = args.is_present("mpr-only"); 11 | let installed_only = args.is_present("installed-only"); 12 | let name_only = args.is_present("name-only"); 13 | 14 | let cache = Cache::new(AptCache::new(), MprCache::new()); 15 | let mut candidates = Vec::new(); 16 | 17 | for query in query_list { 18 | for pkg in Cache::get_nonvirtual_packages(cache.apt_cache(), &PackageSort::default()) { 19 | let pkgname = pkg.name(); 20 | if (pkgname.contains(query) 21 | || pkg 22 | .candidate() 23 | .unwrap() 24 | .description() 25 | .unwrap_or_default() 26 | .contains(query)) 27 | && !candidates.contains(&pkgname) 28 | { 29 | candidates.push(pkgname); 30 | } 31 | } 32 | 33 | for pkg in cache.mpr_cache().packages().values() { 34 | if (pkg.pkgname.contains(query) 35 | || pkg.pkgdesc.clone().unwrap_or_default().contains(query)) 36 | && !candidates.contains(&pkg.pkgname) 37 | { 38 | candidates.push(pkg.pkgname.to_string()); 39 | } 40 | } 41 | } 42 | 43 | if candidates.is_empty() { 44 | quit::with_code(exitcode::UNAVAILABLE); 45 | } 46 | 47 | print!( 48 | "{}", 49 | style::generate_pkginfo_entries( 50 | &candidates, 51 | &cache, 52 | apt_only, 53 | mpr_only, 54 | installed_only, 55 | name_only 56 | ) 57 | ); 58 | } 59 | -------------------------------------------------------------------------------- /src/remove.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | apt_util, 3 | cache::{Cache, MprCache}, 4 | message, util, 5 | }; 6 | use rust_apt::cache::{Cache as AptCache, PackageSort}; 7 | 8 | pub fn remove(args: &clap::ArgMatches) { 9 | let pkglist: Vec<&String> = { 10 | if let Some(pkglist) = args.get_many("pkg") { 11 | pkglist.collect() 12 | } else { 13 | Vec::new() 14 | } 15 | }; 16 | let purge = args.is_present("purge"); 17 | let autoremove = args.is_present("autoremove"); 18 | let mpr_url: &String = args.get_one("mpr-url").unwrap(); 19 | let cache = Cache::new(AptCache::new(), MprCache::new()); 20 | 21 | // Lock the cache. 22 | if let Err(err) = apt_util::apt_lock() { 23 | util::handle_errors(&err); 24 | quit::with_code(exitcode::UNAVAILABLE); 25 | } 26 | 27 | // Remove the user requested packages. 28 | for pkgname in pkglist { 29 | if let Some(pkg) = cache.apt_cache().get(pkgname) { 30 | if !pkg.is_installed() { 31 | message::warning(&format!( 32 | "Package '{}' isn't installed, so not removing.\n", 33 | pkg.name(), 34 | )); 35 | continue; 36 | } 37 | 38 | pkg.mark_delete(purge).then_some(()).unwrap(); 39 | pkg.protect(); 40 | } 41 | } 42 | 43 | // Remove any packages that are no longer needed. 44 | if autoremove { 45 | for pkg in Cache::get_nonvirtual_packages(cache.apt_cache(), &PackageSort::default()) { 46 | if pkg.is_auto_removable() { 47 | pkg.mark_delete(purge).then_some(()).unwrap(); 48 | pkg.protect(); 49 | } 50 | } 51 | } 52 | 53 | if let Err(err) = cache.apt_cache().resolve(true) { 54 | util::handle_errors(&err); 55 | quit::with_code(exitcode::UNAVAILABLE); 56 | } 57 | 58 | // Unlock the cache so our transaction can complete. 59 | apt_util::apt_unlock(); 60 | 61 | // Commit our changes. 62 | cache.commit(&Vec::new(), mpr_url); 63 | } 64 | -------------------------------------------------------------------------------- /man/mist.1.adoc: -------------------------------------------------------------------------------- 1 | = MAKEDEB(1) 2 | :doctype: manpage 3 | :hardbreaks: 4 | :manmanual: Mist 5 | :mansource: Git 6 | 7 | == NAME 8 | mist - The official command-line interface for the makedeb Package Repository 9 | 10 | == SYNOPSIS 11 | *mist* clone _pkgbase_ [_options_] ... 12 | *mist* comment _pkgbase_ [_options_] ... 13 | *mist* install _pkg_ ... [_options_] ... 14 | *mist* list _pkg_ [_options_] ... 15 | *mist* list-comments _pkgbase_ [_options_] ... 16 | *mist* remove _pkgname_ ... [_options_] ... 17 | *mist* search _query_ ... [_options_] ... 18 | *mist* update [_options_] ... 19 | *mist* upgrade [_options_] ... 20 | *mist* whoami [_options_] ... 21 | 22 | == DESCRIPTION 23 | *mist* is a command-line interface for interacting with the makedeb Package Repository. 24 | 25 | The *comment* and *whoami* commands both require authentication via an API key in order to run. An API key can be obtained via the MPR web interface on the user's account page, and can be passed into this program via the *--token* argument or the *MPR_TOKEN* environment variable, the former being described in *OPTIONS*, and the latter in *ENVIRONMENT*. 26 | 27 | *clone*:: 28 | Clone the build files for a package base from the MPR. 29 | 30 | *comment*:: 31 | Comment on a package base's page on the MPR. 32 | 33 | *list*:: 34 | Get information about APT or MPR packages. 35 | 36 | *list-comments*:: 37 | List comments of a package base on the MPR. 38 | 39 | *search*:: 40 | Search the package list on the MPR. 41 | 42 | *update*:: 43 | Updates the APT cache on the system. The MPR cache is not updated as part of this process, as it automatically gets updated when needed commands find it to be old. 44 | 45 | *whoami*:: 46 | Show the currently authenticated user. 47 | 48 | == OPTIONS 49 | Run each command with *--help* to see available options. 50 | 51 | == BUGS 52 | Issues, as well as feature requests, should be reported on the project's GitHub page: 53 | 54 | https://github.com/makedeb/mist/issues 55 | 56 | Matrix is also used as our primary method of real-time communication, being where most discussions (outside of the issue tracker) take place. All rooms are joined via a Matrix space, which can be accessed via the following: 57 | 58 | #makedeb:hunterwittenborn.com 59 | 60 | == AUTHORS 61 | Hunter Wittenborn <\hunter@hunterwittenborn.com> 62 | 63 | A full list of contributors can be found by running *git shortlog -esn* in the Mist's Git repository (linked under *BUGS*). 64 | 65 | == SEE ALSO 66 | *makedeb*(8) 67 | -------------------------------------------------------------------------------- /src/upgrade.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | cache::{Cache, MprCache}, 3 | install_util, util, 4 | }; 5 | use rust_apt::{ 6 | cache::{Cache as AptCache, PackageSort}, 7 | tagfile, 8 | }; 9 | use std::{collections::HashMap, fs}; 10 | 11 | pub fn upgrade(args: &clap::ArgMatches) { 12 | let apt_only = args.is_present("apt-only"); 13 | let mpr_only = args.is_present("mpr-only"); 14 | let mpr_url: &String = args.get_one("mpr-url").unwrap(); 15 | 16 | let cache = Cache::new(AptCache::new(), MprCache::new()); 17 | 18 | // Get the list of packages on this system. 19 | let dpkg_pkgs = 20 | tagfile::parse_tagfile(&fs::read_to_string("/var/lib/dpkg/status").unwrap()).unwrap(); 21 | 22 | // Convert it into a [`HashMap`] for easier access. 23 | let mut dpkg_map = HashMap::new(); 24 | 25 | for pkg in dpkg_pkgs { 26 | dpkg_map.insert(pkg.get("Package").unwrap().to_owned(), pkg); 27 | } 28 | 29 | // The list of MPR packages we're going to update. 30 | let mut mpr_pkgs = vec![]; 31 | 32 | // Check which APT packages need upgrading, and mark any for such if needed. 33 | for pkg in Cache::get_nonvirtual_packages(cache.apt_cache(), &PackageSort::default()) { 34 | let pkgname = pkg.name(); 35 | 36 | if !mpr_only && pkg.is_upgradable(false) && let Some(pkg_control) = dpkg_map.get(&pkgname) && pkg_control.get("MPR-Package").is_none() { 37 | pkg.mark_install(false, !pkg.is_auto_installed()); 38 | pkg.protect(); 39 | } else if !apt_only && let Some(pkg_control) = dpkg_map.get(&pkgname) && pkg_control.get("MPR-Package").is_some() { 40 | // See if the MPR version is more recent. If so, add the package for installation. 41 | if crate::apt_util::cmp_versions( 42 | dpkg_map.get(&pkgname).unwrap().get("Version").unwrap(), 43 | &cache.mpr_cache().packages().get(&pkgname).unwrap().version, 44 | ) 45 | .is_lt() 46 | { 47 | mpr_pkgs.push(pkgname); 48 | } 49 | } 50 | } 51 | 52 | // Get the ordering for MPR package installation. 53 | let mpr_install_order = install_util::order_mpr_packages( 54 | &cache, 55 | &mpr_pkgs.iter().map(|pkg| pkg.as_str()).collect(), 56 | ); 57 | 58 | // Make sure any new marked APT packages are resolved properly. 59 | if let Err(err) = cache.apt_cache().resolve(true) { 60 | util::handle_errors(&err); 61 | quit::with_code(exitcode::UNAVAILABLE); 62 | } 63 | 64 | crate::message::warning(&format!("{}\n", mpr_install_order.len())); 65 | cache.commit(&mpr_install_order, mpr_url); 66 | } 67 | -------------------------------------------------------------------------------- /src/list_comments.rs: -------------------------------------------------------------------------------- 1 | use crate::{cache::MprCache, message}; 2 | use bat::{self, PrettyPrinter}; 3 | use chrono::{TimeZone, Utc}; 4 | use serde::Deserialize; 5 | use std::fmt::Write; 6 | 7 | #[derive(Deserialize)] 8 | struct Comment { 9 | date: i64, 10 | msg: String, 11 | user: String, 12 | } 13 | 14 | pub fn list_comments(args: &clap::ArgMatches) { 15 | let pkgbase: &String = args.get_one("pkg").unwrap(); 16 | let mpr_url: &String = args.get_one("mpr-url").unwrap(); 17 | let paging = args.get_one::("paging").unwrap().as_str(); 18 | let mpr_cache = MprCache::new(); 19 | 20 | let mut pkgbases: Vec<&String> = Vec::new(); 21 | 22 | // Get a list of packages. 23 | for pkg in mpr_cache.packages().values() { 24 | pkgbases.push(&pkg.pkgbase); 25 | } 26 | 27 | // Abort if the package base doesn't exist. 28 | if !pkgbases.contains(&pkgbase) { 29 | message::error(&format!( 30 | "Package base '{}' doesn't exist on the MPR.", 31 | pkgbase 32 | )); 33 | quit::with_code(exitcode::USAGE); 34 | } 35 | 36 | // Get package comments. 37 | let resp = match reqwest::blocking::get(format!("{}/api/list-comments/{}", mpr_url, pkgbase)) { 38 | Ok(resp) => resp, 39 | Err(err) => { 40 | message::error(&format!("Failed to make request. [{}]", err)); 41 | quit::with_code(exitcode::UNAVAILABLE); 42 | } 43 | }; 44 | 45 | let resp_text = resp.text().unwrap(); 46 | let resp_json = match serde_json::from_str::>(&resp_text) { 47 | Ok(json) => json, 48 | Err(err) => { 49 | message::error(&format!("Failed to unpack response. [{}]", err)); 50 | quit::with_code(exitcode::UNAVAILABLE); 51 | } 52 | }; 53 | 54 | // Generate a markdown string to show the user. 55 | let comments_len = resp_json.len() - 1; // We'll be using indexes to compare against this, so subtract 1. 56 | let mut comments_str = String::new(); 57 | 58 | for (index, comment) in resp_json.iter().enumerate() { 59 | let date = Utc 60 | .timestamp(comment.date, 0) 61 | .format("%Y-%m-%d") 62 | .to_string(); 63 | 64 | write!( 65 | comments_str, 66 | "# Date: {}\n# Author: {}\n\n{}", 67 | date, 68 | comment.user, 69 | comment.msg.trim() 70 | ) 71 | .unwrap(); 72 | 73 | if index < comments_len { 74 | comments_str.push_str("\n\n --------------------\n\n"); 75 | } 76 | } 77 | 78 | // Get the paging mode from the user. 79 | let paging_mode = match paging { 80 | "always" => bat::PagingMode::Always, 81 | "never" => bat::PagingMode::Never, 82 | &_ => bat::PagingMode::QuitIfOneScreen, 83 | }; 84 | 85 | PrettyPrinter::new() 86 | .input_from_bytes(comments_str.as_bytes()) 87 | .language("md") 88 | .paging_mode(paging_mode) 89 | .print() 90 | .unwrap(); 91 | } 92 | -------------------------------------------------------------------------------- /src/install.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | cache::{Cache, MprCache}, 3 | install_util, message, 4 | style::Colorize, 5 | util, 6 | }; 7 | use rust_apt::cache::Cache as AptCache; 8 | 9 | pub fn install(args: &clap::ArgMatches) { 10 | let pkglist: Vec<&String> = args.get_many("pkg").unwrap().collect(); 11 | let mpr_url: &String = args.get_one("mpr-url").unwrap(); 12 | let cache = Cache::new(AptCache::new(), MprCache::new()); 13 | 14 | // Package sources. 15 | let mut apt_pkgs: Vec<&str> = Vec::new(); 16 | let mut mpr_pkgs: Vec<&str> = Vec::new(); 17 | 18 | // Check real quick for any packages that cannot be found. We don't want to ask 19 | // the user anything else if there's packages that cannot be found, instead we 20 | // should just show those packages and abort. 21 | let mut unfindable = false; 22 | 23 | for pkg in &pkglist { 24 | if cache.apt_cache().get(pkg).is_none() && !cache.mpr_cache().packages().contains_key(*pkg) 25 | { 26 | message::error(&format!( 27 | "Unable to find package '{}'.\n", 28 | pkg.green().bold() 29 | )); 30 | unfindable = true; 31 | } 32 | } 33 | 34 | if unfindable { 35 | quit::with_code(exitcode::USAGE); 36 | } 37 | 38 | for pkg in &pkglist { 39 | let apt_pkg = cache.apt_cache().get(pkg); 40 | let mpr_pkg = cache.mpr_cache().packages().get(*pkg); 41 | 42 | if apt_pkg.is_some() && mpr_pkg.is_some() { 43 | let resp = util::ask_question( 44 | &format!("Package '{}' is available from multiple sources. Please select one to install:\n", pkg.green().bold()), 45 | &vec!["APT", "MPR"], 46 | false 47 | ).remove(0); 48 | println!(); 49 | 50 | if resp == "APT" { 51 | apt_pkgs.push(pkg); 52 | } else { 53 | mpr_pkgs.push(pkg); 54 | } 55 | } else if apt_pkg.is_some() { 56 | apt_pkgs.push(pkg); 57 | } else if mpr_pkg.is_some() { 58 | mpr_pkgs.push(pkg); 59 | } 60 | } 61 | 62 | // Mark any APT packages for installation. 63 | for pkg in apt_pkgs { 64 | let apt_pkg = cache.apt_cache().get(pkg).unwrap(); 65 | 66 | if !apt_pkg.mark_install(false, true) { 67 | message::error(&format!( 68 | "There was an issue marking '{}' for installation.\n", 69 | pkg.green().bold() 70 | )); 71 | quit::with_code(exitcode::UNAVAILABLE); 72 | } 73 | } 74 | 75 | // Get the ordering for MPR package installation. 76 | let mpr_install_order = install_util::order_mpr_packages(&cache, &mpr_pkgs); 77 | 78 | // Make sure any new marked APT packages are resolved properly. 79 | if let Err(err) = cache.apt_cache().resolve(true) { 80 | util::handle_errors(&err); 81 | quit::with_code(exitcode::UNAVAILABLE); 82 | } 83 | 84 | cache.commit(&mpr_install_order, mpr_url); 85 | } 86 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > [!WARNING] 2 | > makedeb is currently unmaintained: https://hunterwittenborn.com/blog/stepping-back-from-open-source/ 3 | 4 | # Mist 5 | [![Latest deployment status](https://img.shields.io/drone/build/makedeb/mist?logo=drone&server=https%3A%2F%2Fdrone.hunterwittenborn.com)](https://drone.hunterwittenborn.com/makedeb/mist/latest) 6 | [![MPR - mist](https://img.shields.io/badge/mpr-mist-orange)](https://mpr.makedeb.org/packages/mist) 7 | [![MPR - mist-bin](https://img.shields.io/badge/mpr-mist--bin-orange)](https://mpr.makedeb.org/packages/mist-bin) 8 | 9 | This is the repository for Mist, the official command-line interface for the makedeb Package Repository. 10 | 11 | Mist makes it easier for users to interact with the MPR in a variety of ways. Some of its most notable features include: 12 | 13 | - Functioning as a wrapper around APT, adding in MPR functionality such as: 14 | - - The ability to install, upgrade, and remove both APT and MPR packages. 15 | - - Automatic dependency resolution for packages from the MPR, as well as APT. 16 | - - Searching and listing both APT and MPR packages. 17 | - Cloning packages from the MPR. 18 | - Listing comments for packages from the MPR. 19 | - Commenting packages from the MPR. 20 | 21 | ## Installation 22 | Users have a few options for installing Mist: 23 | 24 | ### From the Prebuilt-MPR (Recommended) 25 | This is the recommended way to install Mist. It avoids the need to compile any software, allows for automatic upgrades via APT (and Mist once it's installed), and gets you set up in just a couple of minutes. 26 | 27 | First, [set up the Prebuilt-MPR on your system](https://docs.makedeb.org/prebuilt-mpr/getting-started), then just run the following to install Mist: 28 | 29 | ```sh 30 | sudo apt install mist 31 | ``` 32 | 33 | > You'll also need to have [makedeb installed](https://docs.makedeb.org/installing) if it is not already. 34 | 35 | ### From the MPR 36 | You can also install Mist directly from the MPR if you'd prefer that. 37 | 38 | #### From Source 39 | To install from source, install `mist` from the MPR: 40 | 41 | ```sh 42 | git clone 'https://mpr.makedeb.org/mist' 43 | cd mist/ 44 | makedeb -si -H 'MPR-Package: yes' 45 | ``` 46 | 47 | > If you omit `-H 'MPR-Package: yes'`, Mist will be **unable to update itself**. 48 | 49 | > Mist currently requires the nightly version of the Rust compiler toolchain in order to build. To build it locally, it's recommended to use [rustup](https://rustup.rs), which will automatically manage and update the nightly toolchain on your local system. If preferred, rustup can be installed from the [MPR](https://mpr.makedeb.org/packages/rustup) or the Prebuilt-MPR. 50 | 51 | #### From a Binary 52 | To install Mist from a prebuilt binary, install the `mist-bin` package: 53 | 54 | ```sh 55 | git clone 'https://mpr.makedeb.org/mist-bin' 56 | cd mist-bin/ 57 | makedeb -si 58 | ``` 59 | 60 | ## Contributing 61 | If there's something you want added/fixed in Mist, feel free to open a pull request. There aren't many guidelines on what you should do quite yet, so just submit your changes and we can figure out what to do from there! 62 | -------------------------------------------------------------------------------- /src/comment.rs: -------------------------------------------------------------------------------- 1 | use crate::{cache::MprCache, message, util}; 2 | use serde::Deserialize; 3 | use serde_json::json; 4 | use std::fs::File; 5 | use std::io::prelude::*; 6 | 7 | #[derive(Deserialize)] 8 | struct CommentResult { 9 | link: String, 10 | } 11 | 12 | pub fn comment(args: &clap::ArgMatches) { 13 | let pkg: &String = args.get_one("pkg").unwrap(); 14 | let mpr_url: &String = args.get_one("mpr-url").unwrap(); 15 | let api_token: &String = match args.get_one("token") { 16 | Some(token) => token, 17 | None => { 18 | message::error("No API token was provided.\n"); 19 | quit::with_code(exitcode::USAGE); 20 | } 21 | }; 22 | 23 | // Get a list of packages. 24 | let mpr_cache = MprCache::new(); 25 | let mut pkgnames: Vec<&String> = Vec::new(); 26 | 27 | for pkg in mpr_cache.packages().values() { 28 | pkgnames.push(&pkg.pkgname); 29 | } 30 | 31 | // Abort if the package base doesn't exist. 32 | if !pkgnames.contains(&pkg) { 33 | message::error(&format!("Package '{}' doesn't exist on the MPR.\n", pkg)); 34 | quit::with_code(exitcode::USAGE); 35 | } 36 | 37 | // Get the message. 38 | // If no message was supplied, get one from the user. 39 | let msg: String = match args.get_one::("msg") { 40 | Some(msg) => (msg).to_owned(), 41 | None => { 42 | // Get the editor. 43 | let editor = match edit::get_editor() { 44 | Ok(editor) => editor.into_os_string().into_string().unwrap(), 45 | Err(err) => { 46 | message::error(&format!( 47 | "Couldn't find an editor to write a comment with. [{}]\n", 48 | err 49 | )); 50 | 51 | quit::with_code(exitcode::UNAVAILABLE); 52 | } 53 | }; 54 | 55 | // Generate a temporary file to write the message in. 56 | let file = match tempfile::Builder::new().suffix(".md").tempfile_in("/tmp") { 57 | Ok(file) => file.path().to_str().unwrap().to_owned(), 58 | Err(err) => { 59 | message::error(&format!( 60 | "Failed to create temporary file to write comment in. [{}]\n", 61 | err 62 | )); 63 | quit::with_code(exitcode::UNAVAILABLE); 64 | } 65 | }; 66 | 67 | // Open the file in the editor. 68 | message::info(&format!("Opening '{}' in '{}'...\n", &file, editor)); 69 | 70 | let mut cmd = util::sudo::run_as_normal_user(&editor); 71 | cmd.arg(&file); 72 | let status = cmd.spawn().unwrap().wait().unwrap(); 73 | util::check_exit_status(&cmd, &status); 74 | 75 | // Read the changed file. 76 | let mut file_content = String::new(); 77 | let mut _file = File::open(file).unwrap(); 78 | _file.read_to_string(&mut file_content).unwrap(); 79 | 80 | file_content 81 | } 82 | }; 83 | 84 | // Upload the message! 85 | let body = json!({ "msg": msg }).to_string(); 86 | 87 | let request = util::AuthenticatedRequest::new(api_token, mpr_url); 88 | let resp_text = request.post(&format!("comment/{}", pkg), body); 89 | 90 | // Parse the message. 91 | let json = serde_json::from_str::(&resp_text).unwrap(); 92 | message::info(&format!("Succesfully posted comment. [{}]\n", json.link)); 93 | } 94 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## [Unreleased] 8 | 9 | ## [0.12.0] - 2023-07-12 10 | ### Fixed 11 | - Remove Gzip processor from MPR package downloader. 12 | 13 | ## [0.11.0] - 2023-07-03 14 | ### Changed 15 | - Return non-zero exit code when no packages are found for `search` and `list` commands. 16 | - Internal performance improvements. 17 | - Use `rustls` instead of `openssl` for network requests. 18 | 19 | ## [0.10.0] - 2022-10-01 20 | ### Changed 21 | - Don't allow running `install` or `upgrade` commands as root. 22 | 23 | ## [0.9.9] - 2022-09-26 24 | ### Changed 25 | - Pass in each file manually to `${EDITOR}` during file review. 26 | 27 | ### Fixed 28 | - Fix issues with MPR dependency resolver. 29 | 30 | ## [0.9.8] - 2022-09-26 31 | ### Fixed 32 | - Fix panics when using the `-i` flag with `mist list`. 33 | - Fix panics when installing MPR packages. 34 | - Fix `/var/cache/mist/pkglist.gz` being read in completions even when it doesn't exist. 35 | 36 | ## [0.9.7] - 2022-09-26 37 | ### Fixed 38 | - Ensure Mist's cache directory in `${HOME}` is owned by the current user when Mist has to create it. 39 | 40 | ## [0.9.6] - 2022-09-25 41 | ### Fixed 42 | - Ensure virtual packages don't get included in package results. 43 | 44 | ## [0.9.5] - 2022-09-25 45 | ### Security 46 | - Ensure `sudo` binary used for permission checks isn't one supplied by the user in the `PATH` variable. 47 | 48 | ## [0.9.4] - 2022-09-25 49 | ### Fixed 50 | - Ensure cache directories exist before they're used. 51 | 52 | ## [0.9.3] - 2022-09-25 53 | ### Fixed 54 | - Add `postinst` script during deployments. 55 | 56 | ## [0.9.2] - 2022-09-25 57 | ### Fixed 58 | - Add `postinst` script to set permissions on executable in installed package. 59 | - Ensure MPR cache files exist before trying to write to them. 60 | 61 | ## [0.9.1] - 2022-09-25 62 | ### Fixed 63 | - Allow passing the `NO_SUDO` environment variable to builds. 64 | 65 | ## [0.9.0] - 2022-09-25 66 | ### Added 67 | - Added `install` command. 68 | - Added `upgrade` command. 69 | - Added `remove` command. 70 | - Added `list` command. 71 | 72 | ### Removed 73 | - Removed `info` command. 74 | 75 | ## [0.8.0] - 2022-08-04 76 | ### Changed 77 | - Renamed project back to `Mist`. 78 | 79 | ## [0.7.0] - 2022-08-04 80 | ### Changed 81 | - Renamed project to `Mari`. 82 | 83 | ## [0.6.2] - 2022-08-03 84 | ### Added 85 | - Added symlink in PKGBUILD for ease of transition from `mpr-cli` to `mist`. 86 | 87 | ## [0.6.1] - 2022-08-03 88 | ### Added 89 | - Added needed fields in PKGBUILD for transition from `mpr-cli` to `mist`. 90 | 91 | ## [0.6.0] - 2022-08-03 92 | ### Changed 93 | - Renamed project to `Mist`. 94 | 95 | ## [0.5.0] - 2022-07-23 96 | ### Added 97 | - Added `update` command. 98 | 99 | ## [0.4.2] - 2022-07-11 100 | Internal changes used to test CI. No changes have been made for end users. 101 | 102 | ## [0.4.1] - 2022-07-11 103 | Internal changes used to test CI. No changes have been made for end users. 104 | 105 | ## [0.4.0] - 2022-07-11 106 | ### Added 107 | - Added APT integration to `search` and `info` commands. 108 | 109 | ## [0.3.4] 2022-07-11 110 | ### Changed 111 | Internal changes used to test CI. No changes have been made for end users. 112 | 113 | ## [0.3.3] - 2022-07-02 114 | ### Security 115 | - Updated dependencies. 116 | 117 | ## [0.3.2] - 2022-06-25 118 | ### Fixed 119 | - Make `libssl-dev` a runtime dependency instead of just a build dependency. 120 | 121 | ## [0.3.1] - 2022-06-14 122 | ### Fixed 123 | - Fixed `sed` command used to set version in man page during builds. 124 | 125 | ## [0.3.0] - 2022-06-13 126 | ### Added 127 | - Add `info` command. 128 | - Add `comment` command. 129 | - Add `list-comments` command. 130 | 131 | ## [0.2.0] - 2022-06-11 132 | ### Added 133 | - Add `clone` command. 134 | 135 | ## [0.1.1] - 2022-06-06 136 | ### Fixed 137 | - Recursively created cache directory if it doesn't exist. 138 | 139 | ## [0.1.0] - 2022-06-06 140 | The beginning of the project! 🥳 141 | 142 | ### Added 143 | - The beginning of the project! 144 | - Add `search` command. 145 | - Add `whoami` command. 146 | -------------------------------------------------------------------------------- /src/progress.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | apt_util::{self, NumSys}, 3 | style::Colorize, 4 | }; 5 | use rust_apt::progress::{AcquireProgress, InstallProgress, Worker}; 6 | use std::io::{self, Write}; 7 | 8 | /// Acquire progress struct. 9 | pub struct MistAcquireProgress {} 10 | 11 | impl AcquireProgress for MistAcquireProgress { 12 | fn pulse_interval(&self) -> usize { 13 | 500000 14 | } 15 | 16 | fn hit(&mut self, id: u32, description: String) { 17 | println!( 18 | "{}{} {}", 19 | "Hit:".green().bold(), 20 | id.to_string().green().bold(), 21 | description 22 | ); 23 | } 24 | 25 | fn fetch(&mut self, id: u32, description: String, _file_size: u64) { 26 | println!( 27 | "{}{} {}", 28 | "Get:".green().bold(), 29 | id.to_string().green().bold(), 30 | description 31 | ); 32 | } 33 | 34 | fn fail(&mut self, id: u32, description: String, status: u32, error_text: String) { 35 | if status == 0 || status == 2 { 36 | println!( 37 | "{} {}", 38 | format!("{}{} ({})", "Ign:", id, error_text).yellow().bold(), 39 | description 40 | ); 41 | } else { 42 | println!( 43 | "{} {}", 44 | format!("{}{} ({})", "Err:", id, error_text).red().bold(), 45 | description 46 | ); 47 | } 48 | } 49 | 50 | fn pulse( 51 | &mut self, 52 | _workers: Vec, 53 | _percent: f32, 54 | _total_bytes: u64, 55 | _current_bytes: u64, 56 | _current_cps: u64, 57 | ) { 58 | } 59 | 60 | fn done(&mut self) {} 61 | 62 | fn start(&mut self) {} 63 | 64 | fn stop( 65 | &mut self, 66 | fetched_bytes: u64, 67 | elapsed_time: u64, 68 | current_cps: u64, 69 | _pending_errors: bool, 70 | ) { 71 | if fetched_bytes == 0 { 72 | return; 73 | } 74 | 75 | println!( 76 | "{}", 77 | format!( 78 | "Fetched {} in {} ({}/s)", 79 | apt_util::unit_str(fetched_bytes, NumSys::Decimal), 80 | apt_util::time_str(elapsed_time), 81 | apt_util::unit_str(current_cps, NumSys::Decimal) 82 | ) 83 | .bold() 84 | ) 85 | } 86 | } 87 | 88 | /// Install progress struct. 89 | pub struct MistInstallProgress {} 90 | 91 | impl InstallProgress for MistInstallProgress { 92 | fn status_changed( 93 | &mut self, 94 | _pkgname: String, 95 | steps_done: u64, 96 | total_steps: u64, 97 | _action: String, 98 | ) { 99 | // Get the terminal's width and height. 100 | let term_height = apt_util::terminal_height(); 101 | let term_width = apt_util::terminal_width(); 102 | 103 | // Save the current cursor position. 104 | print!("\x1b7"); 105 | 106 | // Go to the progress reporting line. 107 | print!("\x1b[{};0f", term_height); 108 | io::stdout().flush().unwrap(); 109 | 110 | // Convert the float to a percentage string. 111 | let percent = steps_done as f32 / total_steps as f32; 112 | let mut percent_str = (percent * 100.0).round().to_string(); 113 | 114 | let percent_padding = match percent_str.len() { 115 | 1 => " ", 116 | 2 => " ", 117 | 3 => "", 118 | _ => unreachable!(), 119 | }; 120 | 121 | percent_str = percent_padding.to_owned() + &percent_str; 122 | 123 | print!( 124 | "{}", 125 | format!("Progress: [{}{}] ", percent_str.blue(), "%".blue()).bold() 126 | ); 127 | 128 | // The length of "Progress: [100%] ". 129 | const PROGRESS_STR_LEN: usize = 17; 130 | 131 | // Print the progress bar. 132 | // We should safely be able to convert the `usize`.try_into() into the `u32` 133 | // needed by `get_apt_progress_string`, as usize ints only take up 8 bytes on a 134 | // 64-bit processor. 135 | print!( 136 | "{}", 137 | apt_util::get_apt_progress_string( 138 | percent, 139 | (term_width - PROGRESS_STR_LEN).try_into().unwrap() 140 | ) 141 | .bold() 142 | ); 143 | io::stdout().flush().unwrap(); 144 | 145 | // Finally, go back to the previous cursor position. 146 | print!("\x1b8"); 147 | io::stdout().flush().unwrap(); 148 | } 149 | 150 | fn error(&mut self, _pkgname: String, _steps_done: u64, _total_steps: u64, _error: String) {} 151 | } 152 | -------------------------------------------------------------------------------- /src/style.rs: -------------------------------------------------------------------------------- 1 | pub use colored::Colorize; 2 | use colored::CustomColor; 3 | use lazy_static::lazy_static; 4 | 5 | use chrono::{TimeZone, Utc}; 6 | 7 | use crate::cache::Cache; 8 | use std::fmt::Write; 9 | 10 | lazy_static! { 11 | pub static ref UBUNTU_ORANGE: CustomColor = CustomColor::new(255, 175, 0); 12 | pub static ref UBUNTU_PURPLE: CustomColor = CustomColor::new(95, 95, 255); 13 | } 14 | 15 | /// Generate a colored package information entry. 16 | /// If `name_only` is [`true`], the package name will be returned by itself. 17 | pub fn generate_pkginfo_entry(pkgname: &str, cache: &Cache, name_only: bool) -> String { 18 | if name_only { 19 | return pkgname.to_string(); 20 | } 21 | 22 | // Set up the string we'll return at the end of the function. 23 | let mut return_string = String::new(); 24 | 25 | // Fancy colored pkgname to the max! :OOOOOOOOOOOOOOOOOO 26 | write!(return_string, "{}", pkgname.custom_color(*UBUNTU_ORANGE)).unwrap(); 27 | 28 | // Get the APT and MPR packages. 29 | let apt_pkg = cache.apt_cache().get(pkgname); 30 | let mpr_pkg = cache.mpr_cache().packages().get(pkgname); 31 | 32 | // Get the package sources. 33 | let mut src_str = String::new(); 34 | { 35 | let mut sources = vec![]; 36 | 37 | if apt_pkg.is_some() { 38 | sources.push("APT".custom_color(*UBUNTU_PURPLE)); 39 | } 40 | if mpr_pkg.is_some() { 41 | sources.push("MPR".custom_color(*UBUNTU_PURPLE)); 42 | } 43 | 44 | let mut sources_str = String::new(); 45 | 46 | for src in sources { 47 | sources_str.push_str(&format!("{}, ", src)); 48 | } 49 | 50 | sources_str.pop().unwrap(); 51 | sources_str.pop().unwrap(); 52 | 53 | write!(src_str, "[{}]", sources_str).unwrap(); 54 | } 55 | 56 | // Figure out what version and description to use, in this order: 57 | // 1. APT if installed 58 | // 2. MPR if present 59 | // 3. APT 60 | let pkgver: String; 61 | let pkgdesc: Option; 62 | 63 | if let Some(apt_pkg_unwrapped) = &apt_pkg && apt_pkg_unwrapped.is_installed() { 64 | let version = apt_pkg_unwrapped.candidate().unwrap(); 65 | pkgver = version.version(); 66 | pkgdesc = version.description(); 67 | } else if let Some(mpr_pkg_unwrapped) = mpr_pkg { 68 | pkgver = mpr_pkg_unwrapped.version.to_string(); 69 | pkgdesc = mpr_pkg_unwrapped.pkgdesc.clone(); 70 | } else if let Some(apt_pkg_unwrapped) = &apt_pkg { 71 | let version = apt_pkg_unwrapped.candidate().unwrap(); 72 | pkgver = version.version(); 73 | pkgdesc = version.description(); 74 | } else { 75 | unreachable!(); 76 | } 77 | 78 | // Add the first line and description, at long last. This string is the one 79 | // we'll return at the end of the function. 80 | write!(return_string, "/{} {}", pkgver, src_str).unwrap(); 81 | write!( 82 | return_string, 83 | "\n{} {}", 84 | "Description:".bold(), 85 | pkgdesc.unwrap_or_else(|| "N/A".to_string()) 86 | ) 87 | .unwrap(); 88 | 89 | // If the MPR package exists, add some extra information about that. 90 | if let Some(mpr_pkg_unwrapped) = mpr_pkg { 91 | // Maintainer. 92 | if let Some(maintainer) = &mpr_pkg_unwrapped.maintainer { 93 | write!(return_string, "\n{} {}", "Maintainer:".bold(), maintainer).unwrap(); 94 | } 95 | 96 | // Votes. 97 | write!( 98 | return_string, 99 | "\n{} {}", 100 | "Votes:".bold(), 101 | &mpr_pkg_unwrapped.num_votes 102 | ) 103 | .unwrap(); 104 | 105 | // Popularity. 106 | write!( 107 | return_string, 108 | "\n{} {}", 109 | "Popularity:".bold(), 110 | &mpr_pkg_unwrapped.popularity 111 | ) 112 | .unwrap(); 113 | 114 | // Out of Date. 115 | let ood_date: String; 116 | 117 | if let Some(ood_epoch) = mpr_pkg_unwrapped.ood { 118 | ood_date = Utc 119 | .timestamp(ood_epoch as i64, 0) 120 | .format("%Y-%m-%d") 121 | .to_string(); 122 | } else { 123 | ood_date = "N/A".to_owned(); 124 | } 125 | 126 | write!(return_string, "\n{} {}", "Popularity:".bold(), ood_date).unwrap(); 127 | } 128 | 129 | return_string 130 | } 131 | 132 | pub fn generate_pkginfo_entries>( 133 | pkgs: &[T], 134 | cache: &Cache, 135 | apt_only: bool, 136 | mpr_only: bool, 137 | installed_only: bool, 138 | name_only: bool, 139 | ) -> String { 140 | let mut matches = Vec::new(); 141 | let mut result_string = String::new(); 142 | 143 | for pkg in pkgs { 144 | let pkgname = pkg.as_ref(); 145 | 146 | // APT only. 147 | if apt_only && cache.apt_cache().get(pkgname).is_none() { 148 | continue; 149 | } 150 | 151 | // MPR only. 152 | if mpr_only && cache.mpr_cache().packages().get(pkgname).is_none() { 153 | continue; 154 | } 155 | 156 | // Installed only. 157 | if installed_only 158 | && let Some(pkg) = cache.apt_cache().get(pkgname) 159 | && !pkg.is_installed() 160 | { 161 | continue; 162 | } else if cache.apt_cache().get(pkgname).is_none() { 163 | continue; 164 | } 165 | 166 | // Package be passed all the tests bro. We's be adding it to the vector now. 167 | matches.push(pkgname); 168 | } 169 | 170 | let matches_len = matches.len(); 171 | 172 | for (index, pkgname) in matches.iter().enumerate() { 173 | if name_only { 174 | result_string.push_str(pkgname); 175 | result_string.push('\n'); 176 | } else if index == matches_len - 1 { 177 | result_string.push_str(&generate_pkginfo_entry(pkgname, cache, name_only)); 178 | result_string.push('\n'); 179 | } else { 180 | result_string.push_str(&generate_pkginfo_entry(pkgname, cache, name_only)); 181 | result_string.push_str("\n\n"); 182 | } 183 | } 184 | 185 | result_string 186 | } 187 | -------------------------------------------------------------------------------- /completions/mist.bash: -------------------------------------------------------------------------------- 1 | _mist_get_pkglist() { 2 | if ! printf '%s\n' "${@}" "${words[@]}" | grep -q -- '--mpr-only' || ! printf '%s\n' "${opts[@]}" | grep -q -- '--mpr-only'; then 3 | mapfile -t COMPREPLY < <(apt-cache --no-generate pkgnames "${@: -1}") 4 | fi 5 | 6 | if ! printf '%s\n' "${@}" "${words[@]}" | grep -q -- '--apt-only' || ! printf '%s\n' "${opts[@]}" | grep -q -- '--apt-only'; then 7 | if [[ -f '/var/cache/mist/pkglist.gz' ]]; then 8 | mapfile -O "${#COMPREPLY[@]}" -t COMPREPLY < <(gzip -cd '/var/cache/mist/pkglist.gz' | grep "^${@: -1}") 9 | fi 10 | fi 11 | } 12 | 13 | _mist_gen_compreply() { 14 | mapfile -t COMPREPLY < <(compgen -W "${1}" -- "${2}") 15 | } 16 | 17 | _mist_pkg_specified_check() { 18 | if [[ "${#nonopts[@]}" -gt 3 ]]; then 19 | _mist_gen_compreply '${opts[@]}' "${cur}" 20 | else 21 | _mist_get_pkglist "${@}" 22 | fi 23 | } 24 | 25 | _mist() { 26 | local cur prev words cword 27 | _init_completion || return 28 | 29 | local cmds=( 30 | 'clone' 31 | 'comment' 32 | 'help' 33 | 'install' 34 | 'list' 35 | 'list-comments' 36 | 'remove' 37 | 'search' 38 | 'update' 39 | 'upgrade' 40 | 'whoami' 41 | ) 42 | 43 | # Get a list of arguments that are nonoptions. 44 | mapfile -t nonopts < <(printf '%s\n' "${words[@]}" | grep -v '^-') 45 | 46 | if [[ "${#words[@]}" == 2 ]]; then 47 | mapfile -t COMPREPLY < <(compgen -W '${cmds[@]}' "${cur}") 48 | return 49 | fi 50 | 51 | case "${nonopts[1]}" in 52 | clone) 53 | opts=('--mpr-url') 54 | 55 | case "${prev}" in 56 | --mpr-url) 57 | return 58 | ;; 59 | esac 60 | 61 | case "${cur}" in 62 | -*) 63 | _mist_gen_compreply '${opts[@]}' "${cur}" 64 | return 65 | ;; 66 | *) 67 | _mist_pkg_specified_check "${cur}" 68 | return 69 | ;; 70 | esac 71 | ;; 72 | comment) 73 | opts=('--mpr-url' '--msg' '--token') 74 | 75 | case "${prev}" in 76 | --token|--mpr-url|--msg) 77 | return 78 | ;; 79 | esac 80 | 81 | case "${cur}" in 82 | -*) 83 | _mist_gen_compreply '${opts[@]}' "${cur}" 84 | return 85 | ;; 86 | *) 87 | _mist_pkg_specified_check "${cur}" 88 | return 89 | ;; 90 | esac 91 | ;; 92 | help) 93 | return 94 | ;; 95 | install) 96 | opts=('--mpr-url') 97 | 98 | case "${prev}" in 99 | --mpr-url) 100 | return 101 | ;; 102 | esac 103 | 104 | case "${cur}" in 105 | -*) 106 | _mist_gen_compreply '${opts[@]}' "${cur}" 107 | return 108 | ;; 109 | *) 110 | _mist_pkg_specified_check "${cur}" 111 | return 112 | ;; 113 | esac 114 | ;; 115 | list-comments) 116 | opts=('--mpr-url' '--paging') 117 | 118 | case "${prev}" in 119 | --mpr-url) 120 | return 121 | ;; 122 | --paging) 123 | opts=('auto' 'never' 'always') 124 | _mist_gen_compreply '${opts[@]}' "${cur}" 125 | return 126 | ;; 127 | esac 128 | 129 | case "${cur}" in 130 | -*) 131 | _mist_gen_compreply '${opts[@]}' "${cur}" 132 | return 133 | ;; 134 | *) 135 | _mist_pkg_specified_check "${cur}" 136 | return 137 | ;; 138 | esac 139 | ;; 140 | remove) 141 | opts=('--autoremove' '--purge') 142 | 143 | case "${cur}" in 144 | -*) 145 | _mist_gen_compreply '${opts[@]}' "${cur}" 146 | return 147 | ;; 148 | *) 149 | _mist_get_pkglist '--apt-only' "${cur}" 150 | return 151 | ;; 152 | esac 153 | ;; 154 | 155 | search|list) 156 | opts=('--mpr-url' '--apt-only' '--mpr-only' '--name-only' '--installed') 157 | 158 | case "${prev}" in 159 | --mpr-url) 160 | return 161 | ;; 162 | esac 163 | 164 | case "${cur}" in 165 | -*) 166 | _mist_gen_compreply '${opts[@]}' "${cur}" 167 | return 168 | ;; 169 | *) 170 | _mist_pkg_specified_check "${cur}" 171 | return 172 | ;; 173 | esac 174 | ;; 175 | update) 176 | opts=('--mpr-url') 177 | 178 | case "${prev}" in 179 | --mpr-url) 180 | return 181 | ;; 182 | esac 183 | 184 | _mist_gen_compreply '${opts[@]}' "${cur}" 185 | return 186 | ;; 187 | upgrade) 188 | opts=('--apt-only' '--mpr-only' '--mpr-url') 189 | 190 | case "${prev}" in 191 | --mpr-url) 192 | return 193 | ;; 194 | esac 195 | 196 | _mist_gen_compreply '${opts[@]}' "${cur}" 197 | return 198 | ;; 199 | whoami) 200 | opts=('--token' '--mpr-url') 201 | 202 | case "${prev}" in 203 | --token|--mpr-url) 204 | return 205 | ;; 206 | esac 207 | 208 | _mist_gen_compreply '${opts[@]}' "${cur}" 209 | return 210 | ;; 211 | esac 212 | } 213 | 214 | complete -F _mist mist 215 | # vim: set sw=4 expandtab: 216 | -------------------------------------------------------------------------------- /src/update.rs: -------------------------------------------------------------------------------- 1 | use crate::{cache::MprCache, message, progress::MistAcquireProgress, style::Colorize, util}; 2 | use makedeb_srcinfo::SplitDependency; 3 | use rust_apt::{cache::Cache as AptCache, progress::AcquireProgress, tagfile::TagSection}; 4 | use std::{ 5 | env, fs, 6 | io::{self, Write}, 7 | path, 8 | process::Command, 9 | }; 10 | 11 | pub fn update(args: &clap::ArgMatches) { 12 | let mpr_url: &String = args.get_one("mpr-url").unwrap(); 13 | 14 | // For some reason we have to set our current UID to 0 instead of just the EUID 15 | // when using setuid functionality. TODO: No clue why, but this fixes the 16 | // issue for now. 17 | users::switch::set_current_uid(0).unwrap(); 18 | 19 | // Update APT packages. 20 | let cache = AptCache::new(); 21 | let mut progress: Box = Box::new(MistAcquireProgress {}); 22 | 23 | if let Err(error) = cache.update(&mut progress) { 24 | for msg in error.what().split(';') { 25 | if msg.starts_with("E:") { 26 | message::error(&format!("{}\n", msg.strip_prefix("E:").unwrap())); 27 | } else if msg.starts_with("W:") { 28 | message::warning(&format!("{}\n", msg.strip_prefix("W:").unwrap())); 29 | }; 30 | } 31 | }; 32 | 33 | // Get the new MPR pkglist. 34 | let client = reqwest::blocking::Client::new(); 35 | match client.get(format!("{}/packages.gz", mpr_url)).send() { 36 | Ok(resp) => { 37 | let mut cache_dir = util::xdg::get_global_cache_dir(); 38 | cache_dir.push("pkglist.gz"); 39 | util::fs::create_file(&cache_dir.clone().into_os_string().into_string().unwrap()); 40 | fs::write(&cache_dir, resp.bytes().unwrap()).unwrap(); 41 | } 42 | Err(err) => { 43 | message::error(&format!("Failed to make request [{}]\n", err)); 44 | quit::with_code(exitcode::UNAVAILABLE); 45 | } 46 | }; 47 | 48 | // Get the new MPR cache. 49 | let resp = match client 50 | .get(format!("{}/packages-meta-ext-v2.json.gz", mpr_url)) 51 | .send() 52 | { 53 | Ok(resp) => resp.bytes().unwrap(), 54 | Err(err) => { 55 | message::error(&format!("Failed to make request [{}]\n", err)); 56 | quit::with_code(exitcode::UNAVAILABLE); 57 | } 58 | }; 59 | 60 | let mpr_cache = match MprCache::validate_data(&resp) { 61 | Ok(mpr_cache) => mpr_cache, 62 | Err(_) => { 63 | message::error("There was an issue validating the downloaded MPR cache archive."); 64 | quit::with_code(exitcode::UNAVAILABLE); 65 | } 66 | }; 67 | 68 | // Create the '.deb' files for the packages in the MPR cache. 69 | let mut cache_dir = util::xdg::get_global_cache_dir(); 70 | cache_dir.push("deb-pkgs"); 71 | 72 | { 73 | let dir_string = cache_dir.clone().into_os_string().into_string().unwrap(); 74 | 75 | util::fs::create_dir(&dir_string); 76 | env::set_current_dir(&dir_string).unwrap(); 77 | } 78 | 79 | let (system_distro, system_arch) = util::get_distro_arch_info(); 80 | 81 | // Get the list of packages we need to build. 82 | let mut to_build: Vec = vec![]; 83 | 84 | for pkg in mpr_cache.packages().values() { 85 | // If the deb doesn't exist, we have to build. 86 | if !path::Path::new(&format!("{}.deb", pkg.pkgname)).exists() { 87 | to_build.push(pkg.pkgname.clone()); 88 | continue; 89 | } 90 | 91 | let mut control_file_path = cache_dir.clone(); 92 | control_file_path.push(&pkg.pkgname); 93 | control_file_path.push("DEBIAN"); 94 | control_file_path.push("control"); 95 | 96 | if path::Path::new(&control_file_path).exists() { 97 | let control_file = 98 | TagSection::new(&fs::read_to_string(&control_file_path).unwrap()).unwrap(); 99 | 100 | // If the version in the control file matches the current MPR package's version, 101 | // then we don't need to update it. 102 | if control_file.get("Version").unwrap() == &pkg.version { 103 | continue; 104 | } else { 105 | to_build.push(pkg.pkgname.clone()); 106 | } 107 | } 108 | } 109 | 110 | let num_of_packages = to_build.len(); 111 | 112 | for (iter, pkg_string) in to_build.iter().enumerate() { 113 | let pkg = mpr_cache.packages().get(pkg_string).unwrap(); 114 | 115 | // Generate the control file. 116 | let mut control_file_str = String::new(); 117 | control_file_str.push_str(&format!("Package: {}\n", pkg.pkgname)); 118 | control_file_str.push_str(&format!("Version: {}\n", pkg.version)); 119 | control_file_str.push_str("Architecture: all\n"); 120 | control_file_str 121 | .push_str("Description: Dummy description so 'dpkg-deb' doesn't complain.\n"); 122 | 123 | let mut depends = vec![]; 124 | let mut predepends = vec![]; 125 | 126 | for dep_group in [ 127 | pkg.get_system_depends(&system_distro, &system_arch), 128 | pkg.get_system_makedepends(&system_distro, &system_arch), 129 | pkg.get_system_checkdepends(&system_distro, &system_arch), 130 | ] 131 | .into_iter() 132 | .flatten() 133 | { 134 | for dep in dep_group { 135 | if let Some(no_prefix_string) = dep.strip_prefix("p!") { 136 | predepends.push(no_prefix_string.to_string()); 137 | } else { 138 | depends.push(dep); 139 | } 140 | } 141 | } 142 | 143 | if !depends.is_empty() { 144 | let mut depends_items = String::new(); 145 | for dep in depends { 146 | depends_items.push_str(&SplitDependency::new(&dep).as_control()); 147 | depends_items.push_str(", "); 148 | } 149 | depends_items.pop().unwrap(); 150 | depends_items.pop().unwrap(); 151 | 152 | control_file_str.push_str(&format!("Depends: {}\n", &depends_items)); 153 | } 154 | 155 | if !predepends.is_empty() { 156 | let mut predepends_items = String::new(); 157 | for predep in predepends { 158 | predepends_items.push_str(&SplitDependency::new(&predep).as_control()); 159 | predepends_items.push_str(", "); 160 | } 161 | predepends_items.pop().unwrap(); 162 | predepends_items.pop().unwrap(); 163 | 164 | control_file_str.push_str(&format!("Pre-Depends: {}\n", &predepends_items)); 165 | } 166 | 167 | if let Some(conflicts) = pkg.get_system_conflicts(&system_distro, &system_arch) { 168 | let mut conflicts_items = String::new(); 169 | 170 | for conflict in conflicts { 171 | conflicts_items.push_str(&SplitDependency::new(&conflict).as_control()); 172 | conflicts_items.push_str(", "); 173 | } 174 | conflicts_items.pop().unwrap(); 175 | conflicts_items.pop().unwrap(); 176 | 177 | control_file_str.push_str(&format!("Conflicts: {}\n", &conflicts_items)); 178 | } 179 | 180 | if let Some(provides) = pkg.get_system_provides(&system_distro, &system_arch) { 181 | let mut provides_items = String::new(); 182 | 183 | for provide in provides { 184 | provides_items.push_str(&SplitDependency::new(&provide).as_control()); 185 | provides_items.push_str(", "); 186 | } 187 | provides_items.pop().unwrap(); 188 | provides_items.pop().unwrap(); 189 | 190 | control_file_str.push_str(&format!("Provides: {}\n", &provides_items)); 191 | } 192 | 193 | // Write the control file. 194 | let control_file_dir = pkg.pkgname.clone() + "/DEBIAN"; 195 | util::fs::create_dir(&control_file_dir); 196 | let mut control_file = util::fs::create_file(&(control_file_dir.clone() + "/control")); 197 | control_file.write_all(control_file_str.as_bytes()).unwrap(); 198 | 199 | // Build the package. 200 | let clear_line = || { 201 | print!("\x1b[2K"); 202 | io::stdout().flush().unwrap(); 203 | print!("\x1b[0G"); 204 | io::stdout().flush().unwrap(); 205 | }; 206 | clear_line(); 207 | message::info(&format!( 208 | "[{}/{}] Processing MPR package '{}'...", 209 | iter + 1, 210 | num_of_packages, 211 | pkg.pkgname.bold().green(), 212 | )); 213 | io::stdout().flush().unwrap(); 214 | 215 | let cmd = Command::new("dpkg-deb") 216 | .args(["-b", &pkg.pkgname]) 217 | .output() 218 | .unwrap(); 219 | if !cmd.status.success() { 220 | clear_line(); 221 | message::error(&format!( 222 | "Failed to process MPR package '{}'. The package won't be available to install from the MPR.\n", 223 | pkg.pkgname.bold().green() 224 | )); 225 | } 226 | } 227 | 228 | println!(); 229 | 230 | // Write the archive file. 231 | cache_dir.pop(); 232 | cache_dir.push("cache.gz"); 233 | util::fs::create_file(&cache_dir.clone().into_os_string().into_string().unwrap()); 234 | fs::write(&cache_dir, resp).unwrap(); 235 | } 236 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | #![feature(let_chains)] 2 | mod cache; 3 | mod clone; 4 | mod comment; 5 | mod install; 6 | mod install_util; 7 | mod list; 8 | mod list_comments; 9 | mod message; 10 | mod progress; 11 | mod remove; 12 | mod search; 13 | mod style; 14 | mod update; 15 | mod upgrade; 16 | mod util; 17 | mod whoami; 18 | 19 | use clap::{self, Arg, Command, PossibleValue}; 20 | pub use rust_apt::util as apt_util; 21 | use std::{ 22 | env, 23 | fs::File, 24 | os::{linux::fs::MetadataExt, unix::fs::PermissionsExt}, 25 | }; 26 | use style::Colorize; 27 | use which::which; 28 | 29 | #[rustfmt::skip] 30 | fn get_cli() -> Command<'static> { 31 | // Common arguments used in multiple commands. 32 | let token_arg = Arg::new("token") 33 | .help("The API token to authenticate to the MPR with") 34 | .long("token") 35 | .env("MPR_TOKEN") 36 | .hide_env_values(true) 37 | .takes_value(true) 38 | .required(true); 39 | 40 | let mpr_url_arg = Arg::new("mpr-url") 41 | .help("URL to access the MPR from") 42 | .long("mpr-url") 43 | .env("MPR_URL") 44 | .hide_env_values(true) 45 | .takes_value(true) 46 | .default_value("https://mpr.makedeb.org"); 47 | 48 | let mpr_only_arg = Arg::new("mpr-only") 49 | .help("Filter results to packages available on the MPR") 50 | .long("mpr-only"); 51 | 52 | let apt_only_arg = Arg::new("apt-only") 53 | .help("Filter results to packages available via APT") 54 | .long("apt-only"); 55 | 56 | let installed_only_arg = Arg::new("installed-only") 57 | .help("Filter results to installed packages") 58 | .short('i') 59 | .long("installed"); 60 | 61 | let name_only_arg = Arg::new("name-only") 62 | .help("Output the package's name without any extra details") 63 | .long("name-only"); 64 | 65 | // The CLI. 66 | Command::new(clap::crate_name!()) 67 | .version(clap::crate_version!()) 68 | .about(clap::crate_description!()) 69 | .arg_required_else_help(true) 70 | .subcommand( 71 | Command::new("clone") 72 | .about("Clone a package base from the MPR") 73 | .arg( 74 | Arg::new("pkg") 75 | .help("The package to clone") 76 | .required(true) 77 | ) 78 | .arg(mpr_url_arg.clone()) 79 | ) 80 | .subcommand( 81 | Command::new("comment") 82 | .arg_required_else_help(true) 83 | .about("Comment on a package page") 84 | .arg( 85 | Arg::new("pkg") 86 | .help("The package to comment on") 87 | .required(true) 88 | .takes_value(true) 89 | ) 90 | .arg( 91 | Arg::new("msg") 92 | .help("The comment to post") 93 | .short('m') 94 | .long("msg") 95 | ) 96 | .arg(token_arg.clone()) 97 | .arg(mpr_url_arg.clone()) 98 | ) 99 | .subcommand( 100 | Command::new("install") 101 | .about("Install packages from APT and the MPR") 102 | .arg( 103 | Arg::new("pkg") 104 | .help("The package(s) to install") 105 | .multiple_values(true) 106 | .required(true) 107 | ) 108 | .arg(mpr_url_arg.clone()) 109 | ) 110 | .subcommand( 111 | Command::new("list") 112 | .about("List packages available via APT and the MPR") 113 | .arg( 114 | Arg::new("pkg") 115 | .help("The package(s) to get information for") 116 | .multiple_values(true) 117 | ) 118 | .arg(mpr_only_arg.clone()) 119 | .arg(apt_only_arg.clone()) 120 | .arg(installed_only_arg.clone()) 121 | .arg(name_only_arg.clone()) 122 | ) 123 | .subcommand( 124 | Command::new("list-comments") 125 | .arg_required_else_help(true) 126 | .about("List the comments on a package") 127 | .arg( 128 | Arg::new("pkg") 129 | .help("The package to view comments for") 130 | .required(true) 131 | ) 132 | .arg( 133 | Arg::new("paging") 134 | .help("When to send output to a pager") 135 | .long("paging") 136 | .takes_value(true) 137 | .default_value("auto") 138 | .value_parser([ 139 | PossibleValue::new("auto"), 140 | PossibleValue::new("always"), 141 | PossibleValue::new("never") 142 | ]) 143 | ) 144 | .arg(mpr_url_arg.clone()) 145 | ) 146 | .subcommand( 147 | Command::new("remove") 148 | .about("Remove packages from the system") 149 | .arg_required_else_help(true) 150 | .arg( 151 | Arg::new("pkg") 152 | .help("The package(s) to remove") 153 | .multiple_values(true) 154 | ) 155 | .arg( 156 | Arg::new("purge") 157 | .help("Remove configuration files along with the package(s)") 158 | .long("purge") 159 | ) 160 | .arg( 161 | Arg::new("autoremove") 162 | .help("Automatically remove any unneeded packages") 163 | .long("autoremove") 164 | ) 165 | .arg(mpr_url_arg.clone().hide(true)) 166 | ) 167 | .subcommand( 168 | Command::new("search") 169 | .about("Search for an APT/MPR package") 170 | .arg_required_else_help(true) 171 | .arg( 172 | Arg::new("query") 173 | .required(true) 174 | .help("The query to search for") 175 | .multiple_values(true) 176 | ) 177 | .arg(mpr_only_arg.clone()) 178 | .arg(apt_only_arg.clone()) 179 | .arg(installed_only_arg.clone()) 180 | .arg(name_only_arg.clone()) 181 | ) 182 | .subcommand( 183 | Command::new("update") 184 | .about("Update the APT cache on the system") 185 | .arg(mpr_url_arg.clone()) 186 | ) 187 | .subcommand( 188 | Command::new("upgrade") 189 | .about("Upgrade the packages on the system") 190 | .arg(Arg::new("apt-only").help("Only upgrade APT packages").long("apt-only").conflicts_with("mpr-only")) 191 | .arg(Arg::new("mpr-only").help("Only upgrade MPR packages").long("mpr-only").conflicts_with("apt-only")) 192 | .arg(mpr_url_arg.clone()) 193 | ) 194 | .subcommand( 195 | Command::new("whoami") 196 | .about("Show the currently authenticated user") 197 | .arg(token_arg.clone()) 198 | .arg(mpr_url_arg.clone()) 199 | ) 200 | } 201 | 202 | #[quit::main] 203 | fn main() { 204 | let cmd_results = get_cli().get_matches(); 205 | 206 | // Make sure that this executable has the `setuid` flag set and is owned by 207 | // root. Parts of this program (intentionally) expect such behavior. 208 | let cmd_name = { 209 | let cmd = env::args().collect::>().remove(0); 210 | if cmd.contains('/') { 211 | cmd 212 | } else { 213 | which(cmd).unwrap().into_os_string().into_string().unwrap() 214 | } 215 | }; 216 | 217 | let cmd_metadata = File::open(cmd_name).unwrap().metadata().unwrap(); 218 | 219 | // Make sure `root` owns the executable. 220 | if cmd_metadata.st_uid() != 0 { 221 | message::error("This executable needs to be owned by `root` in order to run.\n"); 222 | quit::with_code(exitcode::USAGE); 223 | // Make sure the `setuid` bit flag is set. This appears to be third 224 | // digit in the six-digit long mode returned. 225 | } else if format!("{:o}", cmd_metadata.permissions().mode()) 226 | .chars() 227 | .nth(2) 228 | .unwrap() 229 | .to_string() 230 | .parse::() 231 | .unwrap() 232 | < 4 233 | { 234 | message::error( 235 | "This executable needs to have the `setuid` bit flag set in order to run command.\n", 236 | ); 237 | quit::with_code(exitcode::USAGE); 238 | } 239 | 240 | util::sudo::to_root(); 241 | 242 | // If we're running a command that should be permission-checked, then do so. 243 | if vec!["install", "remove", "update", "upgrade"].contains(&cmd_results.subcommand().unwrap().0) 244 | { 245 | // If we're running a command that invokes 'makedeb', ensure that we're not 246 | // running as root. 247 | if vec!["install", "upgrade"].contains(&cmd_results.subcommand().unwrap().0) 248 | && *util::sudo::NORMAL_UID == 0 249 | { 250 | message::error(&format!( 251 | "This command cannot be ran as root, as it needs to call '{}', which is required to run under a non-root user.\n", 252 | "makedeb".bold().green() 253 | )); 254 | quit::with_code(exitcode::USAGE); 255 | } 256 | 257 | util::sudo::check_perms(); 258 | } 259 | 260 | match cmd_results.subcommand() { 261 | Some(("clone", args)) => clone::clone(args), 262 | Some(("comment", args)) => comment::comment(args), 263 | Some(("install", args)) => install::install(args), 264 | Some(("list", args)) => list::list(args), 265 | Some(("list-comments", args)) => list_comments::list_comments(args), 266 | Some(("remove", args)) => remove::remove(args), 267 | Some(("search", args)) => search::search(args), 268 | Some(("update", args)) => update::update(args), 269 | Some(("upgrade", args)) => upgrade::upgrade(args), 270 | Some(("whoami", args)) => whoami::whoami(args), 271 | _ => unreachable!(), 272 | }; 273 | } 274 | -------------------------------------------------------------------------------- /src/util.rs: -------------------------------------------------------------------------------- 1 | use crate::{apt_util, message, style::Colorize}; 2 | use core::fmt::Display; 3 | use lazy_static::lazy_static; 4 | use regex::Regex; 5 | use serde::{Deserialize, Serialize}; 6 | use std::{ 7 | ffi::OsStr, 8 | fs as std_fs, 9 | io::{self, Write}, 10 | path, 11 | process::{Command as ProcCommand, ExitStatus}, 12 | str, 13 | }; 14 | 15 | #[derive(Deserialize, Serialize)] 16 | struct AuthenticationError { 17 | #[serde(rename = "type")] 18 | pub resp_type: String, 19 | pub code: String, 20 | } 21 | 22 | // Struct to handle API-authenticated requests to the MPR. 23 | pub struct AuthenticatedRequest<'a> { 24 | api_token: &'a str, 25 | mpr_url: &'a str, 26 | } 27 | 28 | impl<'a> AuthenticatedRequest<'a> { 29 | pub fn new(api_token: &'a str, mpr_url: &'a str) -> Self { 30 | Self { api_token, mpr_url } 31 | } 32 | 33 | fn handle_response(&self, resp: reqwest::Result) -> String { 34 | let resp = match resp { 35 | Ok(resp) => resp, 36 | Err(err) => { 37 | message::error(&format!("Failed to make request [{}]\n", err)); 38 | quit::with_code(exitcode::UNAVAILABLE); 39 | } 40 | }; 41 | 42 | // Check the response and see if we got a bad API token error. If we did, go 43 | // ahead and abort the program. 44 | let resp_text = resp.text().unwrap(); 45 | 46 | if let Ok(json) = serde_json::from_str::(&resp_text) { 47 | // TODO: We need to define a more suitable way for machine parsing of errors in 48 | // the MPR. Maybe something like '{"err_type": "invalid_api_key"}'. 49 | if json.resp_type == "error" && json.code == "err_invalid_api_key" { 50 | message::error("Invalid API key was passed in.\n"); 51 | quit::with_code(exitcode::USAGE); 52 | } 53 | } 54 | 55 | resp_text 56 | } 57 | 58 | pub fn get(&self, path: &str) -> String { 59 | // Make the request. 60 | let client = reqwest::blocking::Client::new(); 61 | let resp = client 62 | .get(format!("{}/api/{}", self.mpr_url, path)) 63 | .header("Authorization", self.api_token) 64 | .send(); 65 | 66 | self.handle_response(resp) 67 | } 68 | 69 | pub fn post(&self, path: &str, body: String) -> String { 70 | // Make the request. 71 | let client = reqwest::blocking::Client::new(); 72 | let resp = client 73 | .post(format!("{}/api/{}", self.mpr_url, path)) 74 | .body(body) 75 | .header("Authorization", self.api_token) 76 | .send(); 77 | 78 | self.handle_response(resp) 79 | } 80 | } 81 | 82 | /// Handle errors from APT. 83 | pub fn handle_errors(err_str: &apt_util::Exception) { 84 | for msg in err_str.what().split(';') { 85 | if msg.starts_with("E:") { 86 | message::error(&format!("{}\n", msg.strip_prefix("E:").unwrap())); 87 | } else if msg.starts_with("W:") { 88 | message::warning(&format!("{}\n", msg.strip_prefix("W:").unwrap())); 89 | }; 90 | } 91 | } 92 | 93 | /// Run a command, and error out if it fails. 94 | pub fn check_exit_status(cmd: &ProcCommand, status: &ExitStatus) { 95 | if !status.success() { 96 | let mut args = vec![cmd.get_program().to_str().unwrap().to_string()]; 97 | for arg in cmd.get_args() { 98 | args.push(arg.to_str().unwrap().to_string()); 99 | } 100 | 101 | message::error(&format!("Failed to run command: {:?}\n", args)); 102 | quit::with_code(exitcode::UNAVAILABLE); 103 | } 104 | } 105 | 106 | /// Format a list of package names in the way APT would. 107 | pub fn format_apt_pkglist + Display>(pkgnames: &Vec) { 108 | // All package lines always start with two spaces, so pretend like we have two 109 | // less characters. 110 | let term_width = apt_util::terminal_width() - 2; 111 | let mut output = String::from(" "); 112 | let mut current_width = 0; 113 | 114 | for _pkgname in pkgnames { 115 | let pkgname = _pkgname.as_ref(); 116 | output.push_str(pkgname); 117 | current_width += pkgname.len(); 118 | 119 | if current_width > term_width { 120 | output.push_str("\n "); 121 | current_width = 0; 122 | } else { 123 | output.push(' '); 124 | } 125 | } 126 | 127 | println!("{}", output); 128 | } 129 | 130 | /// Check if a response was a "yes" response. 'default' is what to return if 131 | /// 'resp' is empty. 132 | pub fn is_yes(resp: &str, default: bool) -> bool { 133 | resp.to_lowercase() == "y" || (resp.is_empty() && default) 134 | } 135 | 136 | /// Print out a question with options and get the result. 137 | /// `multi_allowed` specifies if only a single option can be chosen. 138 | pub fn ask_question(question: &str, options: &Vec<&str>, multi_allowed: bool) -> Vec { 139 | let num_re = Regex::new("^[0-9]*-[0-9]*$|^[0-9]*$").unwrap(); 140 | let options_len = options.len(); 141 | message::question(question); 142 | 143 | // Panic if no options were passed in, there's nothing to work with there. This 144 | // function should only be used internally anyway, so this just gives a heads up 145 | // that it's being used incorrectly. 146 | if options.is_empty() { 147 | panic!("No values passed in for `options` parameter"); 148 | } 149 | 150 | // Print the options. 151 | let mut str_options: Vec = Vec::new(); 152 | 153 | for (index, item) in options.iter().enumerate() { 154 | str_options.push(format!("[{}] {}", index, item)) 155 | } 156 | 157 | format_apt_pkglist(&str_options); 158 | 159 | let print_question = || -> Option> { 160 | let mut returned_items: Vec = Vec::new(); 161 | 162 | if multi_allowed { 163 | print!( 164 | "{}", 165 | "Please enter a selection (i.e. `1-3 5`, defaults to `0`): ".bold() 166 | ); 167 | } else { 168 | print!( 169 | "{}", 170 | "Please enter a selection (i.e. `1` or `6`, defaults to `0`): ".bold() 171 | ); 172 | } 173 | io::stdout().flush().unwrap(); 174 | let mut input = String::new(); 175 | io::stdin().read_line(&mut input).unwrap(); 176 | 177 | // Pop off the leading newline. 178 | input.pop(); 179 | 180 | // If no response was given, return the first item in the options. 181 | if input.is_empty() { 182 | returned_items.push(options.first().unwrap().to_string()); 183 | return Some(returned_items); 184 | } 185 | 186 | let matched_items: Vec<&str> = input.split(' ').collect(); 187 | 188 | if !multi_allowed 189 | && (matched_items.len() > 1 || matched_items.first().unwrap().contains('-')) 190 | { 191 | message::error("Only one value is allowed to be specified.\n"); 192 | return None; 193 | } 194 | 195 | for item in &matched_items { 196 | if !num_re.is_match(item) { 197 | message::error(&format!( 198 | "Error parsing item `{}`. Please make sure it is valid.\n", 199 | item 200 | )); 201 | return None; 202 | } 203 | 204 | if item.contains('-') { 205 | let (num1_str, num2_str) = item.split_once('-').unwrap(); 206 | let num1: usize = num1_str.parse().unwrap(); 207 | let num2: usize = num2_str.parse().unwrap(); 208 | 209 | if num1 > options_len - 1 { 210 | message::error(&format!("Number is too big: {}\n", num1)); 211 | return None; 212 | } else if num2 > options_len - 1 { 213 | message::error(&format!("Number is too big: {}\n", num2)); 214 | return None; 215 | } 216 | 217 | for num in num1..num2 { 218 | returned_items.push(options.get(num).unwrap().to_string()) 219 | } 220 | } else { 221 | let num: usize = item.parse().unwrap(); 222 | 223 | if num > options_len - 1 { 224 | message::error(&format!("Number is too big: {}\n", num)); 225 | return None; 226 | } 227 | returned_items.push(options.get(num).unwrap().to_string()); 228 | } 229 | } 230 | 231 | Some(returned_items) 232 | }; 233 | 234 | let mut result = print_question(); 235 | while result.is_none() { 236 | result = print_question(); 237 | } 238 | 239 | result.unwrap() 240 | } 241 | 242 | /// Get the system's distro and architecture. The first value returned is the 243 | /// distribution, and the second is the architecture. 244 | pub fn get_distro_arch_info() -> (String, String) { 245 | let mut distro_cmd = ProcCommand::new("lsb_release"); 246 | distro_cmd.arg("-cs"); 247 | let mut arch_cmd = ProcCommand::new("dpkg"); 248 | arch_cmd.arg("--print-architecture"); 249 | 250 | let distro = std::str::from_utf8(&distro_cmd.output().unwrap().stdout) 251 | .unwrap() 252 | .to_owned(); 253 | let arch = std::str::from_utf8(&arch_cmd.output().unwrap().stdout) 254 | .unwrap() 255 | .to_owned(); 256 | 257 | (distro, arch) 258 | } 259 | 260 | /// XDG directory wrapper thingermabobers. 261 | pub mod xdg { 262 | /// Return the cache directory. Also creates it if it doesn't exist. 263 | pub fn get_cache_dir() -> super::path::PathBuf { 264 | let mut cache_dir = dirs::cache_dir().unwrap(); 265 | cache_dir.push("mist"); 266 | super::sudo::to_normal(); 267 | super::fs::create_dir(&cache_dir.clone().into_os_string().into_string().unwrap()); 268 | super::sudo::to_root(); 269 | cache_dir 270 | } 271 | 272 | /// Return the global cache directory that's for use by all users. Also 273 | /// creates it if it doesn't exist. 274 | pub fn get_global_cache_dir() -> super::path::PathBuf { 275 | let path: super::path::PathBuf = ["/var", "cache", "mist"].iter().collect(); 276 | super::fs::create_dir(&path.clone().into_os_string().into_string().unwrap()); 277 | path 278 | } 279 | } 280 | 281 | /// File/Folder wrappers for my joy. 282 | pub mod fs { 283 | use crate::style::Colorize; 284 | 285 | /// Create a folder, aborting if unable to or the specified path already 286 | /// exists and isn't a folder. 287 | pub fn create_dir(directory: &str) { 288 | let path = super::path::Path::new(directory); 289 | if !path.exists() { 290 | if super::std_fs::create_dir_all(path).is_err() { 291 | super::message::error(&format!( 292 | "Failed to create directory ({}).\n", 293 | directory.green().bold() 294 | )); 295 | quit::with_code(exitcode::UNAVAILABLE); 296 | } 297 | } else if !path.is_dir() { 298 | super::message::error(&format!( 299 | "Path '{}' needs to be a directory, but it isn't.\n", 300 | directory.green().bold() 301 | )); 302 | quit::with_code(exitcode::UNAVAILABLE); 303 | } 304 | } 305 | 306 | /// Create a file, aborting if unable to do so. 307 | pub fn create_file(path: &str) -> super::std_fs::File { 308 | match super::std_fs::File::create(path) { 309 | Ok(file) => file, 310 | Err(err) => { 311 | super::message::error(&format!( 312 | "Failed to create file '{}' [{}]\n", 313 | path.bold().green(), 314 | err.to_string().bold() 315 | )); 316 | quit::with_code(exitcode::UNAVAILABLE); 317 | } 318 | } 319 | } 320 | } 321 | 322 | /// Sudo user management stuff. 323 | pub mod sudo { 324 | super::lazy_static! { 325 | pub static ref NORMAL_UID: u32 = users::get_current_uid(); 326 | } 327 | 328 | /// Change the user to root. 329 | pub fn to_root() { 330 | // Make sure the deref is ran on `normal` uid so that it's properly registered. 331 | let _ = *self::NORMAL_UID; 332 | 333 | users::switch::set_effective_uid(0).unwrap(); 334 | users::switch::set_current_uid(0).unwrap(); 335 | } 336 | 337 | pub fn check_perms() { 338 | super::message::info("Obtaining root permissions...\n"); 339 | 340 | let mut cmd = self::run_as_normal_user("/usr/bin/sudo"); 341 | cmd.arg("true"); 342 | 343 | if !cmd.spawn().unwrap().wait().unwrap().success() { 344 | super::message::error("Couldn't obtain root permissions.\n"); 345 | quit::with_code(exitcode::USAGE); 346 | } 347 | } 348 | 349 | /// Change the user to the non-root user. 350 | pub fn to_normal() { 351 | users::switch::set_effective_uid(*self::NORMAL_UID).unwrap(); 352 | } 353 | 354 | // Run a command as the normal user declared by [`NORMAL_UID`]. 355 | pub fn run_as_normal_user>(program: P) -> super::ProcCommand { 356 | let mut cmd = super::ProcCommand::new("/usr/bin/sudo"); 357 | cmd.args(["-E", "-n"]); 358 | cmd.arg(format!("-u#{}", *self::NORMAL_UID)); 359 | cmd.arg("--"); 360 | cmd.arg(program); 361 | cmd 362 | } 363 | } 364 | -------------------------------------------------------------------------------- /src/install_util.rs: -------------------------------------------------------------------------------- 1 | use crate::{cache::Cache, message, style::Colorize, util}; 2 | use rust_apt::{cache::Cache as AptCache, tagfile::TagSection}; 3 | use std::{env, fs}; 4 | 5 | pub fn clone_mpr_pkgs(pkglist: &Vec<&str>, mpr_url: &str) { 6 | let mut cache_dir = util::xdg::get_cache_dir(); 7 | cache_dir.push("git-pkg"); 8 | util::sudo::to_normal(); 9 | util::fs::create_dir(&cache_dir.clone().into_os_string().into_string().unwrap()); 10 | util::sudo::to_root(); 11 | 12 | // Check each package. 13 | for pkg in pkglist { 14 | let mut git_dir = cache_dir.clone(); 15 | git_dir.push(pkg); 16 | 17 | // Clone the repository. 18 | if !git_dir.exists() { 19 | message::info(&format!( 20 | "Cloning '{}' Git repository from the MPR...\n", 21 | pkg.green().bold() 22 | )); 23 | 24 | { 25 | let mut cmd = util::sudo::run_as_normal_user("git"); 26 | cmd.arg("clone"); 27 | cmd.arg(format!("{}/{}", mpr_url, pkg)); 28 | cmd.arg(git_dir.clone().into_os_string().into_string().unwrap()); 29 | 30 | let status = cmd.output().unwrap().status; 31 | util::check_exit_status(&cmd, &status); 32 | } 33 | 34 | env::set_current_dir(git_dir).unwrap(); 35 | // Error out if it isn't a directory. 36 | } else if !git_dir.is_dir() { 37 | message::error(&format!( 38 | "Path '{}' should be a folder, but is isn't.\n", 39 | &git_dir 40 | .into_os_string() 41 | .into_string() 42 | .unwrap() 43 | .green() 44 | .bold() 45 | )); 46 | quit::with_code(exitcode::UNAVAILABLE); 47 | // Otherwise, make sure the repository is up to date. 48 | } else { 49 | env::set_current_dir(git_dir).unwrap(); 50 | 51 | message::info(&format!( 52 | "Making sure Git repository for '{}' is up to date...\n", 53 | pkg.green().bold() 54 | )); 55 | 56 | // Checkout to the right branch. 57 | { 58 | let mut cmd = util::sudo::run_as_normal_user("git"); 59 | cmd.args(["checkout", "master"]); 60 | let status = cmd.output().unwrap().status; 61 | util::check_exit_status(&cmd, &status); 62 | } 63 | 64 | // Pull from the remote. 65 | { 66 | let mut cmd = util::sudo::run_as_normal_user("git"); 67 | cmd.arg("pull"); 68 | let status = cmd.output().unwrap().status; 69 | util::check_exit_status(&cmd, &status); 70 | } 71 | } 72 | } 73 | } 74 | 75 | /// Order marked MPR packages for installation. 76 | /// This function assumes all packages in `pkglist` actually exist and that all 77 | /// changes have already been marked in the `cache` object. 78 | pub fn order_mpr_packages(cache: &Cache, pkglist: &Vec<&str>) -> Vec> { 79 | let mut cache_dir = util::xdg::get_global_cache_dir(); 80 | cache_dir.push("deb-pkgs"); 81 | env::set_current_dir(&cache_dir).unwrap(); 82 | 83 | // Get the list of MPR packages on this system. These are created in 84 | // [`crate::update::update`]. 85 | let mut debs_owned = vec![]; 86 | 87 | for path in fs::read_dir("./").unwrap() { 88 | let filename = path.unwrap().file_name().into_string().unwrap(); 89 | 90 | if filename.ends_with(".deb") { 91 | debs_owned.push(filename); 92 | } 93 | } 94 | 95 | let debs: Vec<&str> = debs_owned.iter().map(|s| s.as_str()).collect(); 96 | 97 | // Create a new cache object that we'll use to find what packages are to be 98 | // installed from the MPR. 99 | let new_cache = AptCache::debs(&debs).unwrap(); 100 | 101 | // Mirror the changes from the passed in cache into this one. 102 | for pkg in cache.apt_cache().get_changes(false) { 103 | let version = pkg.candidate().unwrap().version(); 104 | let new_cache_pkg = new_cache.get(&pkg.name()).unwrap(); 105 | new_cache_pkg.get_version(&version).unwrap().set_candidate(); 106 | 107 | if pkg.marked_install() 108 | || pkg.marked_downgrade() 109 | || pkg.marked_reinstall() 110 | || pkg.marked_upgrade() 111 | { 112 | assert!(new_cache_pkg.mark_install(false, !pkg.is_auto_installed())); 113 | } else if pkg.marked_delete() { 114 | new_cache_pkg.mark_delete(false); 115 | } else if pkg.marked_purge() { 116 | new_cache_pkg.mark_delete(true); 117 | } else if pkg.marked_keep() { 118 | new_cache_pkg.mark_keep(); 119 | } else { 120 | unreachable!( 121 | "Package '{}' is in an unknown state.", 122 | pkg.name().bold().green() 123 | ); 124 | } 125 | 126 | new_cache_pkg.protect(); 127 | } 128 | 129 | // Mark any MPR packages for installation. 130 | for pkg_str in pkglist { 131 | let pkg = new_cache.get(pkg_str).unwrap(); 132 | 133 | // Get the package's version in its control file. 134 | let tagsection = 135 | TagSection::new(&fs::read_to_string(pkg_str.to_string() + "/DEBIAN/control").unwrap()) 136 | .unwrap(); 137 | let version = tagsection.get("Version").unwrap(); 138 | 139 | pkg.get_version(version).unwrap().set_candidate(); 140 | assert!(pkg.mark_install(false, true)); 141 | pkg.protect(); 142 | } 143 | 144 | // Resolve the cache. 145 | if let Err(err) = new_cache.resolve(true) { 146 | message::error("Couldn't resolve MPR packages.\n"); 147 | util::handle_errors(&err); 148 | quit::with_code(exitcode::UNAVAILABLE); 149 | } 150 | 151 | // Get the list of changes for MPR packages. 152 | let mut mpr_pkgs = vec![vec![]]; 153 | let apt_cache = cache.apt_cache(); 154 | 155 | for pkg in new_cache.get_changes(false) { 156 | let mut invalid_change: Option<&str> = None; 157 | let mpr_pkg_change = { 158 | if let Ok(string) = fs::read_to_string(pkg.name() + "/DEBIAN/control") 159 | && let Ok(tagsection) = TagSection::new(&string) 160 | && tagsection.get("Version").unwrap() == &pkg.candidate().unwrap().version() { 161 | true 162 | } else { 163 | false 164 | } 165 | }; 166 | 167 | if apt_cache.get(&pkg.name()).is_some() { 168 | let normal_pkg = apt_cache.get(&pkg.name()).unwrap(); 169 | let normal_pkg_keep = normal_pkg.marked_keep(); 170 | 171 | // Mirror these changes back into the normal cache. 172 | if pkg.marked_install() 173 | || pkg.marked_downgrade() 174 | || pkg.marked_reinstall() 175 | || pkg.marked_upgrade() 176 | { 177 | if !normal_pkg_keep 178 | && !normal_pkg.marked_install() 179 | && pkg.marked_downgrade() 180 | && pkg.marked_reinstall() 181 | && pkg.marked_upgrade() 182 | { 183 | invalid_change = Some("install"); 184 | } 185 | (!mpr_pkg_change).then(|| assert!(normal_pkg.mark_install(false, true))); 186 | } else if pkg.marked_delete() { 187 | if !normal_pkg_keep && !normal_pkg.marked_delete() { 188 | invalid_change = Some("delete"); 189 | } 190 | (!mpr_pkg_change).then(|| normal_pkg.mark_delete(false)); 191 | } else if pkg.marked_purge() { 192 | if !normal_pkg_keep && !normal_pkg.marked_purge() { 193 | invalid_change = Some("purge"); 194 | } 195 | (!mpr_pkg_change).then(|| normal_pkg.mark_delete(true)); 196 | } else if pkg.marked_keep() { 197 | if !normal_pkg_keep { 198 | invalid_change = Some("keep"); 199 | } 200 | (!mpr_pkg_change).then(|| normal_pkg.mark_keep()); 201 | } 202 | 203 | if let Some(change) = invalid_change { 204 | message::error(&format!( 205 | "There was an issue marking '{}', as it was supposed to be marked for {} but wasn't.", 206 | pkg.name().bold().green(), 207 | change 208 | )); 209 | quit::with_code(exitcode::UNAVAILABLE); 210 | } 211 | 212 | normal_pkg.protect(); 213 | } 214 | 215 | if mpr_pkg_change { 216 | mpr_pkgs.first_mut().unwrap().push(pkg); 217 | } 218 | } 219 | 220 | // Order the MPR packages. 221 | // 222 | // The changed index. A tuple containing an array containing the element to 223 | // remove (the vector's position, and the package position in that vector). 224 | let mut changed_index: Option<[usize; 2]> = Some([0, 0]); 225 | 226 | while changed_index.is_some() { 227 | let index_len = mpr_pkgs.len() - 1; 228 | changed_index = None; 229 | 230 | 'main: for (vec_index, pkg_vec) in mpr_pkgs.iter().enumerate() { 231 | for (pkg_index, pkg) in pkg_vec.iter().enumerate() { 232 | // Get the dependencies of this package. 233 | let dependencies: Vec = { 234 | let mut deps = vec![]; 235 | let version = pkg.candidate().unwrap(); 236 | if let Some(dep_groups) = version.dependencies() { 237 | for dep_grp in dep_groups { 238 | for dep in &dep_grp.base_deps { 239 | deps.push(dep.name().to_owned()); 240 | } 241 | } 242 | } 243 | 244 | deps 245 | }; 246 | 247 | // Loop over this vector and each one after this, and see if any of the 248 | // packages it contains is a package from `dependencies`. If it 249 | // is, this package needs to be moved to a vector after that 250 | // package's vector. 251 | if let Some(inner_pkg_vecs) = mpr_pkgs.get(vec_index..=index_len) { 252 | for inner_pkg_vec in inner_pkg_vecs { 253 | for inner_pkg in inner_pkg_vec { 254 | // See if this package or any packages it provides are in the dependency 255 | // list (i.e. 'lbrynet-bin' providing 'lbrynet' on the MPR). 256 | let mut provides_list = inner_pkg.candidate().unwrap().provides_list(); 257 | provides_list.push((inner_pkg.name(), None)); 258 | 259 | for (pkgname, _) in provides_list { 260 | if dependencies.contains(&pkgname) { 261 | changed_index = Some([vec_index, pkg_index]); 262 | break 'main; 263 | } 264 | } 265 | } 266 | } 267 | } 268 | } 269 | } 270 | 271 | if let Some(change) = changed_index { 272 | let new_vec_position = change[0] + 1; 273 | 274 | // Remove the element from the specified position. 275 | let pkg = mpr_pkgs.get_mut(change[0]).unwrap().remove(change[1]); 276 | 277 | if let Some(vec) = mpr_pkgs.get_mut(new_vec_position) { 278 | vec.push(pkg); 279 | } else { 280 | mpr_pkgs.push(vec![pkg]); 281 | } 282 | } 283 | } 284 | 285 | let mut returned_vec = vec![]; 286 | 287 | for vec in mpr_pkgs { 288 | returned_vec.push(vec.iter().map(|pkg| pkg.name()).collect()); 289 | } 290 | 291 | returned_vec 292 | } 293 | 294 | #[allow(clippy::ptr_arg)] 295 | // Convert a list of MPR packages (obtained from [`order_mpr_packages`]) into a 296 | // list of MPR package bases. 297 | pub fn pkgnames_to_pkgbases(cache: &Cache, pkglist: &Vec>) -> Vec> { 298 | let mut returned_vec = vec![]; 299 | 300 | // Replace each entry in the list with its corresponding pkgbase. 301 | for vec in pkglist.iter() { 302 | let mut inner_vec = vec![]; 303 | 304 | for pkgname in vec { 305 | let mpr_pkg = cache.mpr_cache().packages().get(pkgname).unwrap(); 306 | inner_vec.push(mpr_pkg.pkgbase.clone()); 307 | } 308 | 309 | returned_vec.push(inner_vec); 310 | } 311 | 312 | // Remove any entries that are duplicates, considering the last valid option. 313 | // I.e. a `Vec, Vec<"rustc", "toast">>` would turn into 314 | // `Vec>`. 315 | // Keep the element closest to the beginning of the main vector and discord any 316 | // others in order to respect dependency installation order. 317 | let mut removal_index: Option<[usize; 2]> = Some([0, 0]); 318 | 319 | while removal_index.is_some() { 320 | removal_index = None; 321 | let vec_len = returned_vec.len(); 322 | 323 | 'main: for (vec_index, vec) in returned_vec.iter().enumerate() { 324 | for pkg in vec { 325 | // Loop over each index after this one, and see if there's a matching package. 326 | if let Some(inner_vecs) = returned_vec.get(vec_index..=vec_len) { 327 | for (inner_vec_index, inner_vec) in inner_vecs.iter().enumerate() { 328 | for (inner_pkg_index, inner_pkg) in inner_vec.iter().enumerate() { 329 | if pkg == inner_pkg { 330 | removal_index = Some([inner_vec_index, inner_pkg_index]); 331 | break 'main; 332 | } 333 | } 334 | } 335 | } 336 | } 337 | } 338 | 339 | // If we found a matching package later in the index, remove it. 340 | if let Some(index) = removal_index { 341 | returned_vec.get_mut(index[0]).unwrap().remove(index[1]); 342 | } 343 | } 344 | 345 | returned_vec 346 | } 347 | -------------------------------------------------------------------------------- /src/cache.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | install_util, message, 3 | progress::{MistAcquireProgress, MistInstallProgress}, 4 | style::Colorize, 5 | util, 6 | }; 7 | use rust_apt::{ 8 | cache::{Cache as AptCache, PackageSort}, 9 | package::Package, 10 | progress::{AcquireProgress, InstallProgress}, 11 | tagfile::TagSection, 12 | }; 13 | use serde::{Deserialize, Serialize}; 14 | use std::io::prelude::*; 15 | use std::{collections::HashMap, env, fs, io}; 16 | 17 | /////////////////////////// 18 | // Stuff for MPR caches. // 19 | /////////////////////////// 20 | #[derive(Deserialize, Serialize, PartialEq, Eq)] 21 | pub struct MprDependencyGroup { 22 | #[serde(rename = "Distro")] 23 | distro: Option, 24 | #[serde(rename = "Arch")] 25 | arch: Option, 26 | #[serde(rename = "Packages")] 27 | packages: Vec, 28 | } 29 | 30 | #[derive(Deserialize, Serialize, PartialEq)] 31 | pub struct MprPackage { 32 | #[serde(rename = "Name")] 33 | pub pkgname: String, 34 | #[serde(rename = "PackageBase")] 35 | pub pkgbase: String, 36 | #[serde(rename = "Version")] 37 | pub version: String, 38 | #[serde(rename = "Description")] 39 | pub pkgdesc: Option, 40 | #[serde(rename = "Maintainer")] 41 | pub maintainer: Option, 42 | #[serde(rename = "NumVotes")] 43 | pub num_votes: u32, 44 | #[serde(rename = "Popularity")] 45 | pub popularity: f32, 46 | #[serde(rename = "OutOfDate")] 47 | pub ood: Option, 48 | #[serde(rename = "Depends")] 49 | pub depends: Vec, 50 | #[serde(rename = "MakeDepends")] 51 | pub makedepends: Vec, 52 | #[serde(rename = "CheckDepends")] 53 | pub checkdepends: Vec, 54 | #[serde(rename = "Conflicts")] 55 | pub conflicts: Vec, 56 | #[serde(rename = "Provides")] 57 | pub provides: Vec, 58 | } 59 | 60 | impl MprPackage { 61 | fn get_pkg_group( 62 | &self, 63 | distro: Option<&str>, 64 | arch: Option<&str>, 65 | dep_groups: &Vec, 66 | ) -> Option> { 67 | let distro = distro.map(|distro| distro.to_owned()); 68 | let arch = arch.map(|arch| arch.to_owned()); 69 | 70 | for dep_group in dep_groups { 71 | if dep_group.distro == distro && dep_group.arch == arch { 72 | return Some(dep_group.packages.clone()); 73 | } 74 | } 75 | 76 | None 77 | } 78 | 79 | /// Get a list of depends packages for a specific distro/arch pair. 80 | pub fn get_depends(&self, distro: Option<&str>, arch: Option<&str>) -> Option> { 81 | self.get_pkg_group(distro, arch, &self.depends) 82 | } 83 | 84 | /// Get a list of makedepends packages for a specific distro/arch pair. 85 | pub fn get_makedepends(&self, distro: Option<&str>, arch: Option<&str>) -> Option> { 86 | self.get_pkg_group(distro, arch, &self.makedepends) 87 | } 88 | 89 | /// Get a list of checkdepends packages for a specific distro/arch pair. 90 | pub fn get_checkdepends( 91 | &self, 92 | distro: Option<&str>, 93 | arch: Option<&str>, 94 | ) -> Option> { 95 | self.get_pkg_group(distro, arch, &self.checkdepends) 96 | } 97 | 98 | /// Get a list of conflicts packages for a specific distro/arch pair. 99 | pub fn get_conflicts(&self, distro: Option<&str>, arch: Option<&str>) -> Option> { 100 | self.get_pkg_group(distro, arch, &self.conflicts) 101 | } 102 | 103 | /// Get a list of provides packages for a specific distro/arch pair. 104 | pub fn get_provides(&self, distro: Option<&str>, arch: Option<&str>) -> Option> { 105 | self.get_pkg_group(distro, arch, &self.provides) 106 | } 107 | 108 | /// Get one of the above dependency vectors, looping through the order of 109 | /// specificity for distro-architecture variables used by makedeb. 110 | fn get_system_pkgs, Option<&str>) -> Option>>( 111 | &self, 112 | f: F, 113 | distro: &str, 114 | arch: &str, 115 | ) -> Option> { 116 | if let Some(deps) = f(self, Some(distro), Some(arch)) { 117 | Some(deps) 118 | } else if let Some(deps) = f(self, Some(distro), None) { 119 | Some(deps) 120 | } else if let Some(deps) = f(self, None, Some(arch)) { 121 | Some(deps) 122 | } else { 123 | f(self, None, None) 124 | } 125 | } 126 | 127 | /// Get the `depends` values of this package, looping through the order of 128 | /// specificity for distro-architecture variables used by makedeb. 129 | pub fn get_system_depends(&self, distro: &str, arch: &str) -> Option> { 130 | self.get_system_pkgs(Self::get_depends, distro, arch) 131 | } 132 | 133 | /// Get the `makedepends` values of this package, looping through the order 134 | /// of specificity for distro-architecture variables used by makedeb. 135 | pub fn get_system_makedepends(&self, distro: &str, arch: &str) -> Option> { 136 | self.get_system_pkgs(Self::get_makedepends, distro, arch) 137 | } 138 | /// Get the `checkdepends` values of this package, looping through the order 139 | /// of specificity for distro-architecture variables used by makedeb. 140 | pub fn get_system_checkdepends(&self, distro: &str, arch: &str) -> Option> { 141 | self.get_system_pkgs(Self::get_checkdepends, distro, arch) 142 | } 143 | 144 | /// Get the `conflicts` values of this package, looping through the order of 145 | /// specificity for distro-architecture variables used by makedeb. 146 | pub fn get_system_conflicts(&self, distro: &str, arch: &str) -> Option> { 147 | self.get_system_pkgs(Self::get_conflicts, distro, arch) 148 | } 149 | 150 | /// Get the `provides` values of this package, looping through the order of 151 | /// specificity for distro-architecture variables used by makedeb. 152 | pub fn get_system_provides(&self, distro: &str, arch: &str) -> Option> { 153 | self.get_system_pkgs(Self::get_provides, distro, arch) 154 | } 155 | } 156 | 157 | pub struct MprCache { 158 | packages: HashMap, 159 | } 160 | 161 | impl MprCache { 162 | // Convert a Vector of MPR packages (the way they're stored on the MPR itself) 163 | // into a HashMap that's accessible via key-value pairs. 164 | fn vec_to_map(packages: Vec) -> HashMap { 165 | let mut map = HashMap::new(); 166 | 167 | for pkg in packages { 168 | let pkgname = pkg.pkgname.clone(); 169 | map.insert(pkgname, pkg); 170 | } 171 | 172 | map 173 | } 174 | 175 | pub fn validate_data(data: &[u8]) -> Result { 176 | let packages = match String::from_utf8(data.to_vec()) { 177 | Ok(string) => string, 178 | Err(_) => return Err(()), 179 | }; 180 | 181 | let cache = match serde_json::from_str::>(&packages) { 182 | Ok(json) => json, 183 | Err(_) => return Err(()), 184 | }; 185 | 186 | Ok(Self { 187 | packages: Self::vec_to_map(cache), 188 | }) 189 | } 190 | 191 | pub fn new() -> Self { 192 | // Try reading the cache file. If it doesn't exist or it's older than five 193 | // minutes, we have to update the cache file. 194 | let mut cache_file_path = util::xdg::get_global_cache_dir(); 195 | cache_file_path.push("cache.gz"); 196 | 197 | match fs::read(cache_file_path.clone()) { 198 | Ok(file) => match Self::validate_data(&file) { 199 | Ok(cache) => cache, 200 | Err(_) => { 201 | message::error(&format!( 202 | "There was an issue parsing the cache archive. Try running '{}'.\n", 203 | "mist update".bold().green() 204 | )); 205 | quit::with_code(exitcode::UNAVAILABLE); 206 | } 207 | }, 208 | Err(err) => { 209 | message::error(&format!( 210 | "There was an issue reading the cache archive. Try running '{}' [{}].\n", 211 | "mist update".bold().green(), 212 | err.to_string().bold() 213 | )); 214 | quit::with_code(exitcode::UNAVAILABLE); 215 | } 216 | } 217 | } 218 | 219 | pub fn packages(&self) -> &HashMap { 220 | &self.packages 221 | } 222 | } 223 | 224 | ///////////////////////////////////////////// 225 | // Stuff to handled shared APT/MPR caches. // 226 | ///////////////////////////////////////////// 227 | // 228 | // Some of these fields only make sense to one type of package, but this kind of 229 | // cache allows us to combine both types when needed, such as when providing 230 | // search results. 231 | pub struct Cache { 232 | /// The underlying APT cache struct. 233 | apt_cache: AptCache, 234 | /// The underlying MPR cache struct. 235 | mpr_cache: MprCache, 236 | } 237 | 238 | impl Cache { 239 | /// [`PackageSort::default`] isn't supposed to include virtual packages, but 240 | /// it appears to be doing so on some systems. This checks for virtual 241 | /// packages manually and excludes them. 242 | pub fn get_nonvirtual_packages<'a>( 243 | apt_cache: &'a AptCache, 244 | sort: &'a PackageSort, 245 | ) -> Vec> { 246 | let mut vec = vec![]; 247 | 248 | for pkg in apt_cache.packages(sort) { 249 | if pkg.candidate().is_some() { 250 | vec.push(pkg); 251 | } 252 | } 253 | 254 | vec 255 | } 256 | 257 | /// Create a new cache. 258 | pub fn new(apt_cache: AptCache, mpr_cache: MprCache) -> Self { 259 | Self { 260 | apt_cache, 261 | mpr_cache, 262 | } 263 | } 264 | 265 | /// Get a reference to the APT cache passed into this function. 266 | pub fn apt_cache(&self) -> &AptCache { 267 | &self.apt_cache 268 | } 269 | 270 | /// Get a reference to the MPR cache passed into this function. 271 | pub fn mpr_cache(&self) -> &MprCache { 272 | &self.mpr_cache 273 | } 274 | 275 | /// Run a transaction. 276 | /// `mpr_pkgs` is the list of MPR packages to install. 277 | pub fn commit(&self, mpr_pkgs: &Vec>, mpr_url: &str) { 278 | let mut to_install: Vec = Vec::new(); 279 | let mut to_remove: Vec = Vec::new(); 280 | let mut to_purge: Vec = Vec::new(); 281 | let mut to_upgrade: Vec = Vec::new(); 282 | let mut to_downgrade: Vec = Vec::new(); 283 | 284 | // Report APT packages. 285 | for pkg in Self::get_nonvirtual_packages(&self.apt_cache, &PackageSort::default()) { 286 | let pkgname = pkg.name(); 287 | let apt_string = format!("{}{}", "apt/".to_string().green(), &pkgname); 288 | 289 | if pkg.marked_install() { 290 | to_install.push(apt_string); 291 | } else if pkg.marked_delete() { 292 | to_remove.push(apt_string); 293 | } else if pkg.marked_purge() { 294 | to_purge.push(apt_string); 295 | } else if pkg.marked_upgrade() { 296 | to_upgrade.push(apt_string); 297 | } else if pkg.marked_downgrade() { 298 | to_downgrade.push(apt_string); 299 | } 300 | } 301 | 302 | // Report MPR packages. 303 | for pkg in mpr_pkgs.iter().flatten() { 304 | let mpr_string = format!("{}{}", "mpr/".to_owned().green(), pkg); 305 | to_install.push(mpr_string); 306 | } 307 | 308 | // Print out the transaction. 309 | if to_install.is_empty() 310 | && to_remove.is_empty() 311 | && to_purge.is_empty() 312 | && to_upgrade.is_empty() 313 | && to_downgrade.is_empty() 314 | { 315 | println!("{}", "Nothing to do, quitting.".bold()); 316 | quit::with_code(exitcode::OK); 317 | }; 318 | 319 | if !to_install.is_empty() { 320 | println!("{}", "The following packages will be installed:".bold()); 321 | util::format_apt_pkglist(&to_install); 322 | println!(); 323 | } 324 | 325 | if !to_remove.is_empty() { 326 | println!( 327 | "{}", 328 | format!("The following packages will be {}:", "removed".red()).bold() 329 | ); 330 | util::format_apt_pkglist(&to_remove); 331 | println!(); 332 | } 333 | 334 | if !to_purge.is_empty() { 335 | println!( 336 | "{}", 337 | format!( 338 | "The following packages (along with their configuration files) will be {}:", 339 | "removed".red() 340 | ) 341 | .bold() 342 | ); 343 | util::format_apt_pkglist(&to_purge); 344 | println!(); 345 | } 346 | 347 | if !to_upgrade.is_empty() { 348 | println!("{}", "The following packages will be upgraded:".bold()); 349 | util::format_apt_pkglist(&to_upgrade); 350 | println!(); 351 | } 352 | 353 | if !to_downgrade.is_empty() { 354 | println!("{}", "The following packages will be downgraded:".bold()); 355 | util::format_apt_pkglist(&to_downgrade); 356 | println!(); 357 | } 358 | 359 | let (to_install_string, to_install_count) = { 360 | let count = to_install.len(); 361 | let string = match count { 362 | 0 => "install".green(), 363 | _ => "install".magenta(), 364 | }; 365 | (string, count) 366 | }; 367 | let (to_remove_string, to_remove_count) = { 368 | let count = to_remove.len(); 369 | let string = match count { 370 | 0 => "remove".green(), 371 | _ => "remove".magenta(), 372 | }; 373 | (string, count) 374 | }; 375 | let (to_upgrade_string, to_upgrade_count) = { 376 | let count = to_upgrade.len(); 377 | let string = match count { 378 | 0 => "upgrade".green(), 379 | _ => "upgrade".magenta(), 380 | }; 381 | (string, count) 382 | }; 383 | let (to_downgrade_string, to_downgrade_count) = { 384 | let count = to_downgrade.len(); 385 | let string = match count { 386 | 0 => "downgrade".green(), 387 | _ => "downgrade".magenta(), 388 | }; 389 | (string, count) 390 | }; 391 | 392 | println!("{}", "Review:".bold()); 393 | 394 | println!( 395 | "{}", 396 | format!("- {} to {}", to_install_count, to_install_string).bold() 397 | ); 398 | println!( 399 | "{}", 400 | format!("- {} to {}", to_remove_count, to_remove_string).bold() 401 | ); 402 | println!( 403 | "{}", 404 | format!("- {} to {}", to_upgrade_count, to_upgrade_string).bold() 405 | ); 406 | println!( 407 | "{}", 408 | format!("- {} to {}", to_downgrade_count, to_downgrade_string).bold() 409 | ); 410 | 411 | print!("{}", "\nWould you like to continue? [Y/n] ".bold()); 412 | io::stdout().flush().unwrap(); 413 | 414 | let mut resp = String::new(); 415 | io::stdin().read_line(&mut resp).unwrap(); 416 | resp.pop(); 417 | 418 | if !util::is_yes(&resp, true) { 419 | println!("{}", "Aborting...".bold()); 420 | quit::with_code(exitcode::OK); 421 | } 422 | 423 | println!(); 424 | // Clone MPR packages. 425 | // 426 | // We should be able to flatten the `mpr_pkgs` list to get this variable, but I 427 | // haven't gotten it to work yet. TODO: Make it work, duh. 428 | let mut flattened_pkgnames = vec![]; 429 | let mut flattened_pkgbases = vec![]; 430 | let mpr_pkgbases = install_util::pkgnames_to_pkgbases(self, mpr_pkgs); 431 | 432 | for vec in mpr_pkgs { 433 | for pkg in vec { 434 | flattened_pkgnames.push(pkg.as_str()); 435 | } 436 | } 437 | 438 | for vec in &mpr_pkgbases { 439 | for pkg in vec { 440 | flattened_pkgbases.push(pkg.as_str()); 441 | } 442 | } 443 | 444 | install_util::clone_mpr_pkgs(&flattened_pkgbases, mpr_url); 445 | 446 | // Review MPR packages. 447 | 448 | // Get the editor to review package files with. 449 | let editor = match edit::get_editor() { 450 | Ok(editor) => editor.into_os_string().into_string().unwrap(), 451 | Err(err) => { 452 | message::error(&format!( 453 | "Couldn't find an editor to review package files with. [{}]\n", 454 | err 455 | )); 456 | 457 | quit::with_code(exitcode::UNAVAILABLE); 458 | } 459 | }; 460 | 461 | for pkg in flattened_pkgbases { 462 | println!(); 463 | 464 | loop { 465 | message::question(&format!( 466 | "Review files for '{}'? [Y/n] ", 467 | pkg.bold().green() 468 | )); 469 | io::stdout().flush().unwrap(); 470 | 471 | let mut resp = String::new(); 472 | io::stdin().read_line(&mut resp).unwrap(); 473 | resp.pop(); 474 | 475 | if !util::is_yes(&resp, true) { 476 | break; 477 | } 478 | 479 | let mut cache_dir = util::xdg::get_cache_dir(); 480 | cache_dir.push("git-pkg"); 481 | cache_dir.push(pkg); 482 | 483 | let files = { 484 | let mut files = vec![]; 485 | 486 | let mut cmd = util::sudo::run_as_normal_user("git"); 487 | cmd.args(["ls-tree", "master", "--name-only"]); 488 | let output = cmd.output().unwrap(); 489 | util::check_exit_status(&cmd, &output.status); 490 | 491 | let string = std::str::from_utf8(&output.stdout).unwrap(); 492 | 493 | for file in string.lines() { 494 | // There's no point in having the user review the '.SRCINFO' file. 495 | if file == ".SRCINFO" { 496 | continue; 497 | } 498 | 499 | files.push(file.to_string()); 500 | } 501 | 502 | files 503 | }; 504 | 505 | let mut cmd = util::sudo::run_as_normal_user(&editor); 506 | cmd.args(files); 507 | 508 | let status = cmd.spawn().unwrap().wait().unwrap(); 509 | util::check_exit_status(&cmd, &status) 510 | } 511 | } 512 | 513 | // Install APT packages. 514 | let mut updater: Box = Box::new(MistAcquireProgress {}); 515 | if self.apt_cache().get_archives(&mut updater).is_err() { 516 | message::error("Failed to fetch needed archives\n"); 517 | quit::with_code(exitcode::UNAVAILABLE); 518 | } 519 | 520 | let mut installer: Box = Box::new(MistInstallProgress {}); 521 | if let Err(err) = self.apt_cache().do_install(&mut installer) { 522 | util::handle_errors(&err); 523 | quit::with_code(exitcode::UNAVAILABLE); 524 | } 525 | 526 | // If we're not installing any MPR packages, go ahead and quit. 527 | if mpr_pkgs.is_empty() { 528 | quit::with_code(exitcode::OK); 529 | } 530 | 531 | // Build and install MPR packages. 532 | let current_dir = env::current_dir().unwrap(); 533 | let mut cache_dir = util::xdg::get_cache_dir(); 534 | cache_dir.push("git-pkg"); 535 | 536 | for pkg_group in mpr_pkgbases { 537 | let mut debs = vec![]; 538 | // The list of packages to install; A Vector containing pkgname/version pairs. 539 | let mut install_list: Vec<[String; 2]> = vec![]; 540 | 541 | for pkg in pkg_group { 542 | let mut git_dir = cache_dir.clone(); 543 | git_dir.push(pkg.clone()); 544 | env::set_current_dir(&git_dir).unwrap(); 545 | 546 | // See this package has a control field value of 'MPR-Package'. If it does, 547 | // don't add it to our arg list. TODO: We need to add this key 548 | // to makedeb's .SRCINFO files. 549 | let mpr_package_field = { 550 | let mut cmd = util::sudo::run_as_normal_user("bash"); 551 | cmd.arg("-c"); 552 | cmd.arg("source PKGBUILD; printf '%s\n' \"${control_fields[@]}\" | grep -q '^MPR-Package:'"); 553 | cmd.output().unwrap().status.success() 554 | }; 555 | 556 | let mut cmd = util::sudo::run_as_normal_user("makedeb"); 557 | 558 | if !mpr_package_field { 559 | cmd.arg("-H"); 560 | cmd.arg("MPR-Package: yes"); 561 | } 562 | 563 | message::info(&format!("Running makedeb for '{}'...\n", pkg.green())); 564 | if !cmd.spawn().unwrap().wait().unwrap().success() { 565 | message::error("Failed to run makedeb.\n"); 566 | quit::with_code(exitcode::UNAVAILABLE); 567 | } 568 | 569 | // Get the list of '.deb' files that were built. 570 | for dir in fs::read_dir("./pkg").unwrap() { 571 | let mut path = dir.unwrap().path(); 572 | path.push("DEBIAN"); 573 | path.push("control"); 574 | let control_file = 575 | TagSection::new(&fs::read_to_string(&path).unwrap()).unwrap(); 576 | 577 | // Only add this deb for installation if the user asked for it to be installed. 578 | let pkgname = control_file.get("Package").unwrap(); 579 | let version = control_file.get("Version").unwrap(); 580 | let arch = control_file.get("Architecture").unwrap(); 581 | 582 | if flattened_pkgnames.contains(&pkgname.as_str()) { 583 | debs.push(format!( 584 | "{}/{}_{}_{}.deb", 585 | git_dir.display(), 586 | pkgname, 587 | version, 588 | arch 589 | )); 590 | } 591 | 592 | install_list.push([ 593 | pkgname.to_string(), 594 | control_file.get("Version").unwrap().to_string(), 595 | ]); 596 | } 597 | 598 | env::set_current_dir(¤t_dir).unwrap(); 599 | } 600 | 601 | // Convert the debs into the format required by the 602 | // [`rust_apt::cache::Cache::debs`] initializer. 603 | let mut debs_as_str = vec![]; 604 | for deb in &debs { 605 | debs_as_str.push(deb.as_str()); 606 | } 607 | 608 | // Install the packages. 609 | let deb_cache = AptCache::debs(&debs_as_str).unwrap(); 610 | 611 | for pkg in &install_list { 612 | let cache_pkg = deb_cache.get(&pkg[0]).unwrap(); 613 | let version = cache_pkg.get_version(&pkg[1]).unwrap(); 614 | version.set_candidate(); 615 | assert!(cache_pkg.mark_install(false, true)); 616 | cache_pkg.protect(); 617 | } 618 | 619 | if let Err(err) = deb_cache.resolve(true) { 620 | util::handle_errors(&err); 621 | quit::with_code(exitcode::UNAVAILABLE); 622 | } 623 | 624 | if deb_cache.get_archives(&mut updater).is_err() { 625 | message::error("Failed to fetch needed archives\n"); 626 | quit::with_code(exitcode::UNAVAILABLE); 627 | } 628 | 629 | if let Err(err) = deb_cache.do_install(&mut installer) { 630 | util::handle_errors(&err); 631 | quit::with_code(exitcode::UNAVAILABLE); 632 | } 633 | } 634 | } 635 | 636 | // Find the pkgbase of a given MPR package's pkgname. 637 | pub fn find_pkgbase(&self, pkgname: &str) -> Option { 638 | for pkg in self.mpr_cache().packages().values() { 639 | if pkg.pkgname == pkgname { 640 | return Some(pkg.pkgbase.clone()); 641 | } 642 | } 643 | None 644 | } 645 | } 646 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "addr2line" 7 | version = "0.20.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" 10 | dependencies = [ 11 | "gimli", 12 | ] 13 | 14 | [[package]] 15 | name = "adler" 16 | version = "1.0.2" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 19 | 20 | [[package]] 21 | name = "aho-corasick" 22 | version = "1.0.2" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" 25 | dependencies = [ 26 | "memchr", 27 | ] 28 | 29 | [[package]] 30 | name = "android-tzdata" 31 | version = "0.1.1" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" 34 | 35 | [[package]] 36 | name = "android_system_properties" 37 | version = "0.1.5" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" 40 | dependencies = [ 41 | "libc", 42 | ] 43 | 44 | [[package]] 45 | name = "ansi_colours" 46 | version = "1.2.1" 47 | source = "registry+https://github.com/rust-lang/crates.io-index" 48 | checksum = "7db9d9767fde724f83933a716ee182539788f293828244e9d999695ce0f7ba1e" 49 | dependencies = [ 50 | "rgb", 51 | ] 52 | 53 | [[package]] 54 | name = "ansi_term" 55 | version = "0.12.1" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" 58 | dependencies = [ 59 | "winapi 0.3.9", 60 | ] 61 | 62 | [[package]] 63 | name = "atty" 64 | version = "0.2.14" 65 | source = "registry+https://github.com/rust-lang/crates.io-index" 66 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 67 | dependencies = [ 68 | "hermit-abi 0.1.19", 69 | "libc", 70 | "winapi 0.3.9", 71 | ] 72 | 73 | [[package]] 74 | name = "autocfg" 75 | version = "1.1.0" 76 | source = "registry+https://github.com/rust-lang/crates.io-index" 77 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 78 | 79 | [[package]] 80 | name = "backtrace" 81 | version = "0.3.68" 82 | source = "registry+https://github.com/rust-lang/crates.io-index" 83 | checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" 84 | dependencies = [ 85 | "addr2line", 86 | "cc", 87 | "cfg-if", 88 | "libc", 89 | "miniz_oxide", 90 | "object", 91 | "rustc-demangle", 92 | ] 93 | 94 | [[package]] 95 | name = "base64" 96 | version = "0.21.2" 97 | source = "registry+https://github.com/rust-lang/crates.io-index" 98 | checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" 99 | 100 | [[package]] 101 | name = "bat" 102 | version = "0.21.0" 103 | source = "registry+https://github.com/rust-lang/crates.io-index" 104 | checksum = "fd1212d80800b3d7614b3725e0b2ee3b45b2b7484805d54b5660c8fa6f706305" 105 | dependencies = [ 106 | "ansi_colours", 107 | "ansi_term", 108 | "bincode", 109 | "bytesize", 110 | "clircle", 111 | "console", 112 | "content_inspector", 113 | "encoding", 114 | "flate2", 115 | "globset", 116 | "grep-cli", 117 | "once_cell", 118 | "path_abs", 119 | "semver", 120 | "serde", 121 | "serde_yaml", 122 | "shell-words", 123 | "syntect", 124 | "thiserror", 125 | "unicode-width", 126 | ] 127 | 128 | [[package]] 129 | name = "bincode" 130 | version = "1.3.3" 131 | source = "registry+https://github.com/rust-lang/crates.io-index" 132 | checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" 133 | dependencies = [ 134 | "serde", 135 | ] 136 | 137 | [[package]] 138 | name = "bit-set" 139 | version = "0.5.3" 140 | source = "registry+https://github.com/rust-lang/crates.io-index" 141 | checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" 142 | dependencies = [ 143 | "bit-vec", 144 | ] 145 | 146 | [[package]] 147 | name = "bit-vec" 148 | version = "0.6.3" 149 | source = "registry+https://github.com/rust-lang/crates.io-index" 150 | checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" 151 | 152 | [[package]] 153 | name = "bitflags" 154 | version = "1.3.2" 155 | source = "registry+https://github.com/rust-lang/crates.io-index" 156 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 157 | 158 | [[package]] 159 | name = "bitflags" 160 | version = "2.3.3" 161 | source = "registry+https://github.com/rust-lang/crates.io-index" 162 | checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" 163 | 164 | [[package]] 165 | name = "bstr" 166 | version = "1.6.0" 167 | source = "registry+https://github.com/rust-lang/crates.io-index" 168 | checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" 169 | dependencies = [ 170 | "memchr", 171 | "regex-automata", 172 | "serde", 173 | ] 174 | 175 | [[package]] 176 | name = "bumpalo" 177 | version = "3.13.0" 178 | source = "registry+https://github.com/rust-lang/crates.io-index" 179 | checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" 180 | 181 | [[package]] 182 | name = "bytemuck" 183 | version = "1.13.1" 184 | source = "registry+https://github.com/rust-lang/crates.io-index" 185 | checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" 186 | 187 | [[package]] 188 | name = "bytes" 189 | version = "1.4.0" 190 | source = "registry+https://github.com/rust-lang/crates.io-index" 191 | checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" 192 | 193 | [[package]] 194 | name = "bytesize" 195 | version = "1.2.0" 196 | source = "registry+https://github.com/rust-lang/crates.io-index" 197 | checksum = "38fcc2979eff34a4b84e1cf9a1e3da42a7d44b3b690a40cdcb23e3d556cfb2e5" 198 | 199 | [[package]] 200 | name = "cc" 201 | version = "1.0.79" 202 | source = "registry+https://github.com/rust-lang/crates.io-index" 203 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" 204 | 205 | [[package]] 206 | name = "cfg-if" 207 | version = "1.0.0" 208 | source = "registry+https://github.com/rust-lang/crates.io-index" 209 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 210 | 211 | [[package]] 212 | name = "chrono" 213 | version = "0.4.26" 214 | source = "registry+https://github.com/rust-lang/crates.io-index" 215 | checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" 216 | dependencies = [ 217 | "android-tzdata", 218 | "iana-time-zone", 219 | "js-sys", 220 | "num-traits", 221 | "time", 222 | "wasm-bindgen", 223 | "winapi 0.3.9", 224 | ] 225 | 226 | [[package]] 227 | name = "clap" 228 | version = "3.2.25" 229 | source = "registry+https://github.com/rust-lang/crates.io-index" 230 | checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" 231 | dependencies = [ 232 | "atty", 233 | "bitflags 1.3.2", 234 | "clap_lex", 235 | "indexmap", 236 | "once_cell", 237 | "strsim", 238 | "termcolor", 239 | "textwrap", 240 | ] 241 | 242 | [[package]] 243 | name = "clap_lex" 244 | version = "0.2.4" 245 | source = "registry+https://github.com/rust-lang/crates.io-index" 246 | checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" 247 | dependencies = [ 248 | "os_str_bytes", 249 | ] 250 | 251 | [[package]] 252 | name = "clircle" 253 | version = "0.3.0" 254 | source = "registry+https://github.com/rust-lang/crates.io-index" 255 | checksum = "e68bbd985a63de680ab4d1ad77b6306611a8f961b282c8b5ab513e6de934e396" 256 | dependencies = [ 257 | "cfg-if", 258 | "libc", 259 | "serde", 260 | "winapi 0.3.9", 261 | ] 262 | 263 | [[package]] 264 | name = "codespan-reporting" 265 | version = "0.11.1" 266 | source = "registry+https://github.com/rust-lang/crates.io-index" 267 | checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" 268 | dependencies = [ 269 | "termcolor", 270 | "unicode-width", 271 | ] 272 | 273 | [[package]] 274 | name = "colored" 275 | version = "2.0.4" 276 | source = "git+https://github.com/mackwic/colored#b391ff0e3b29262441b6a948dd49344b5645c398" 277 | dependencies = [ 278 | "is-terminal", 279 | "lazy_static", 280 | "windows-sys 0.48.0", 281 | ] 282 | 283 | [[package]] 284 | name = "console" 285 | version = "0.15.7" 286 | source = "registry+https://github.com/rust-lang/crates.io-index" 287 | checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" 288 | dependencies = [ 289 | "encode_unicode", 290 | "lazy_static", 291 | "libc", 292 | "unicode-width", 293 | "windows-sys 0.45.0", 294 | ] 295 | 296 | [[package]] 297 | name = "content_inspector" 298 | version = "0.2.4" 299 | source = "registry+https://github.com/rust-lang/crates.io-index" 300 | checksum = "b7bda66e858c683005a53a9a60c69a4aca7eeaa45d124526e389f7aec8e62f38" 301 | dependencies = [ 302 | "memchr", 303 | ] 304 | 305 | [[package]] 306 | name = "core-foundation-sys" 307 | version = "0.8.4" 308 | source = "registry+https://github.com/rust-lang/crates.io-index" 309 | checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" 310 | 311 | [[package]] 312 | name = "crc32fast" 313 | version = "1.3.2" 314 | source = "registry+https://github.com/rust-lang/crates.io-index" 315 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 316 | dependencies = [ 317 | "cfg-if", 318 | ] 319 | 320 | [[package]] 321 | name = "cxx" 322 | version = "1.0.100" 323 | source = "registry+https://github.com/rust-lang/crates.io-index" 324 | checksum = "e928d50d5858b744d1ea920b790641129c347a770d1530c3a85b77705a5ee031" 325 | dependencies = [ 326 | "cc", 327 | "cxxbridge-flags", 328 | "cxxbridge-macro", 329 | "link-cplusplus", 330 | ] 331 | 332 | [[package]] 333 | name = "cxx-build" 334 | version = "1.0.100" 335 | source = "registry+https://github.com/rust-lang/crates.io-index" 336 | checksum = "8332ba63f8a8040ca479de693150129067304a3496674477fff6d0c372cc34ae" 337 | dependencies = [ 338 | "cc", 339 | "codespan-reporting", 340 | "once_cell", 341 | "proc-macro2", 342 | "quote", 343 | "scratch", 344 | "syn", 345 | ] 346 | 347 | [[package]] 348 | name = "cxxbridge-flags" 349 | version = "1.0.100" 350 | source = "registry+https://github.com/rust-lang/crates.io-index" 351 | checksum = "5966a5a87b6e9bb342f5fab7170a93c77096efe199872afffc4b477cfeb86957" 352 | 353 | [[package]] 354 | name = "cxxbridge-macro" 355 | version = "1.0.100" 356 | source = "registry+https://github.com/rust-lang/crates.io-index" 357 | checksum = "81b2dab6991c7ab1572fea8cb049db819b1aeea1e2dac74c0869f244d9f21a7c" 358 | dependencies = [ 359 | "proc-macro2", 360 | "quote", 361 | "syn", 362 | ] 363 | 364 | [[package]] 365 | name = "dirs" 366 | version = "4.0.0" 367 | source = "registry+https://github.com/rust-lang/crates.io-index" 368 | checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" 369 | dependencies = [ 370 | "dirs-sys", 371 | ] 372 | 373 | [[package]] 374 | name = "dirs-sys" 375 | version = "0.3.7" 376 | source = "registry+https://github.com/rust-lang/crates.io-index" 377 | checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" 378 | dependencies = [ 379 | "libc", 380 | "redox_users", 381 | "winapi 0.3.9", 382 | ] 383 | 384 | [[package]] 385 | name = "edit" 386 | version = "0.1.4" 387 | source = "registry+https://github.com/rust-lang/crates.io-index" 388 | checksum = "c562aa71f7bc691fde4c6bf5f93ae5a5298b617c2eb44c76c87832299a17fbb4" 389 | dependencies = [ 390 | "tempfile", 391 | "which", 392 | ] 393 | 394 | [[package]] 395 | name = "either" 396 | version = "1.8.1" 397 | source = "registry+https://github.com/rust-lang/crates.io-index" 398 | checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" 399 | 400 | [[package]] 401 | name = "encode_unicode" 402 | version = "0.3.6" 403 | source = "registry+https://github.com/rust-lang/crates.io-index" 404 | checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" 405 | 406 | [[package]] 407 | name = "encoding" 408 | version = "0.2.33" 409 | source = "registry+https://github.com/rust-lang/crates.io-index" 410 | checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" 411 | dependencies = [ 412 | "encoding-index-japanese", 413 | "encoding-index-korean", 414 | "encoding-index-simpchinese", 415 | "encoding-index-singlebyte", 416 | "encoding-index-tradchinese", 417 | ] 418 | 419 | [[package]] 420 | name = "encoding-index-japanese" 421 | version = "1.20141219.5" 422 | source = "registry+https://github.com/rust-lang/crates.io-index" 423 | checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" 424 | dependencies = [ 425 | "encoding_index_tests", 426 | ] 427 | 428 | [[package]] 429 | name = "encoding-index-korean" 430 | version = "1.20141219.5" 431 | source = "registry+https://github.com/rust-lang/crates.io-index" 432 | checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" 433 | dependencies = [ 434 | "encoding_index_tests", 435 | ] 436 | 437 | [[package]] 438 | name = "encoding-index-simpchinese" 439 | version = "1.20141219.5" 440 | source = "registry+https://github.com/rust-lang/crates.io-index" 441 | checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7" 442 | dependencies = [ 443 | "encoding_index_tests", 444 | ] 445 | 446 | [[package]] 447 | name = "encoding-index-singlebyte" 448 | version = "1.20141219.5" 449 | source = "registry+https://github.com/rust-lang/crates.io-index" 450 | checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a" 451 | dependencies = [ 452 | "encoding_index_tests", 453 | ] 454 | 455 | [[package]] 456 | name = "encoding-index-tradchinese" 457 | version = "1.20141219.5" 458 | source = "registry+https://github.com/rust-lang/crates.io-index" 459 | checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18" 460 | dependencies = [ 461 | "encoding_index_tests", 462 | ] 463 | 464 | [[package]] 465 | name = "encoding_index_tests" 466 | version = "0.1.4" 467 | source = "registry+https://github.com/rust-lang/crates.io-index" 468 | checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" 469 | 470 | [[package]] 471 | name = "encoding_rs" 472 | version = "0.8.32" 473 | source = "registry+https://github.com/rust-lang/crates.io-index" 474 | checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" 475 | dependencies = [ 476 | "cfg-if", 477 | ] 478 | 479 | [[package]] 480 | name = "errno" 481 | version = "0.3.1" 482 | source = "registry+https://github.com/rust-lang/crates.io-index" 483 | checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" 484 | dependencies = [ 485 | "errno-dragonfly", 486 | "libc", 487 | "windows-sys 0.48.0", 488 | ] 489 | 490 | [[package]] 491 | name = "errno-dragonfly" 492 | version = "0.1.2" 493 | source = "registry+https://github.com/rust-lang/crates.io-index" 494 | checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" 495 | dependencies = [ 496 | "cc", 497 | "libc", 498 | ] 499 | 500 | [[package]] 501 | name = "exitcode" 502 | version = "1.1.2" 503 | source = "registry+https://github.com/rust-lang/crates.io-index" 504 | checksum = "de853764b47027c2e862a995c34978ffa63c1501f2e15f987ba11bd4f9bba193" 505 | 506 | [[package]] 507 | name = "fancy-regex" 508 | version = "0.7.1" 509 | source = "registry+https://github.com/rust-lang/crates.io-index" 510 | checksum = "9d6b8560a05112eb52f04b00e5d3790c0dd75d9d980eb8a122fb23b92a623ccf" 511 | dependencies = [ 512 | "bit-set", 513 | "regex", 514 | ] 515 | 516 | [[package]] 517 | name = "fastrand" 518 | version = "1.9.0" 519 | source = "registry+https://github.com/rust-lang/crates.io-index" 520 | checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" 521 | dependencies = [ 522 | "instant", 523 | ] 524 | 525 | [[package]] 526 | name = "flate2" 527 | version = "1.0.26" 528 | source = "registry+https://github.com/rust-lang/crates.io-index" 529 | checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" 530 | dependencies = [ 531 | "crc32fast", 532 | "miniz_oxide", 533 | ] 534 | 535 | [[package]] 536 | name = "fnv" 537 | version = "1.0.7" 538 | source = "registry+https://github.com/rust-lang/crates.io-index" 539 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 540 | 541 | [[package]] 542 | name = "form_urlencoded" 543 | version = "1.2.0" 544 | source = "registry+https://github.com/rust-lang/crates.io-index" 545 | checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" 546 | dependencies = [ 547 | "percent-encoding", 548 | ] 549 | 550 | [[package]] 551 | name = "futures-channel" 552 | version = "0.3.28" 553 | source = "registry+https://github.com/rust-lang/crates.io-index" 554 | checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" 555 | dependencies = [ 556 | "futures-core", 557 | ] 558 | 559 | [[package]] 560 | name = "futures-core" 561 | version = "0.3.28" 562 | source = "registry+https://github.com/rust-lang/crates.io-index" 563 | checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" 564 | 565 | [[package]] 566 | name = "futures-io" 567 | version = "0.3.28" 568 | source = "registry+https://github.com/rust-lang/crates.io-index" 569 | checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" 570 | 571 | [[package]] 572 | name = "futures-macro" 573 | version = "0.3.28" 574 | source = "registry+https://github.com/rust-lang/crates.io-index" 575 | checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" 576 | dependencies = [ 577 | "proc-macro2", 578 | "quote", 579 | "syn", 580 | ] 581 | 582 | [[package]] 583 | name = "futures-sink" 584 | version = "0.3.28" 585 | source = "registry+https://github.com/rust-lang/crates.io-index" 586 | checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" 587 | 588 | [[package]] 589 | name = "futures-task" 590 | version = "0.3.28" 591 | source = "registry+https://github.com/rust-lang/crates.io-index" 592 | checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" 593 | 594 | [[package]] 595 | name = "futures-util" 596 | version = "0.3.28" 597 | source = "registry+https://github.com/rust-lang/crates.io-index" 598 | checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" 599 | dependencies = [ 600 | "futures-core", 601 | "futures-io", 602 | "futures-macro", 603 | "futures-task", 604 | "memchr", 605 | "pin-project-lite", 606 | "pin-utils", 607 | "slab", 608 | ] 609 | 610 | [[package]] 611 | name = "getrandom" 612 | version = "0.2.10" 613 | source = "registry+https://github.com/rust-lang/crates.io-index" 614 | checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" 615 | dependencies = [ 616 | "cfg-if", 617 | "libc", 618 | "wasi 0.11.0+wasi-snapshot-preview1", 619 | ] 620 | 621 | [[package]] 622 | name = "gimli" 623 | version = "0.27.3" 624 | source = "registry+https://github.com/rust-lang/crates.io-index" 625 | checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" 626 | 627 | [[package]] 628 | name = "globset" 629 | version = "0.4.11" 630 | source = "registry+https://github.com/rust-lang/crates.io-index" 631 | checksum = "1391ab1f92ffcc08911957149833e682aa3fe252b9f45f966d2ef972274c97df" 632 | dependencies = [ 633 | "aho-corasick", 634 | "bstr", 635 | "fnv", 636 | "log", 637 | "regex", 638 | ] 639 | 640 | [[package]] 641 | name = "grep-cli" 642 | version = "0.1.8" 643 | source = "registry+https://github.com/rust-lang/crates.io-index" 644 | checksum = "a174e093eaf510f24dae4b4dd996787d6e299069f05af7437996e91b029a8f8d" 645 | dependencies = [ 646 | "bstr", 647 | "globset", 648 | "lazy_static", 649 | "log", 650 | "regex", 651 | "same-file", 652 | "termcolor", 653 | "winapi-util", 654 | ] 655 | 656 | [[package]] 657 | name = "h2" 658 | version = "0.3.20" 659 | source = "registry+https://github.com/rust-lang/crates.io-index" 660 | checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" 661 | dependencies = [ 662 | "bytes", 663 | "fnv", 664 | "futures-core", 665 | "futures-sink", 666 | "futures-util", 667 | "http", 668 | "indexmap", 669 | "slab", 670 | "tokio", 671 | "tokio-util", 672 | "tracing", 673 | ] 674 | 675 | [[package]] 676 | name = "hashbrown" 677 | version = "0.12.3" 678 | source = "registry+https://github.com/rust-lang/crates.io-index" 679 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 680 | 681 | [[package]] 682 | name = "hermit-abi" 683 | version = "0.1.19" 684 | source = "registry+https://github.com/rust-lang/crates.io-index" 685 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 686 | dependencies = [ 687 | "libc", 688 | ] 689 | 690 | [[package]] 691 | name = "hermit-abi" 692 | version = "0.3.2" 693 | source = "registry+https://github.com/rust-lang/crates.io-index" 694 | checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" 695 | 696 | [[package]] 697 | name = "http" 698 | version = "0.2.9" 699 | source = "registry+https://github.com/rust-lang/crates.io-index" 700 | checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" 701 | dependencies = [ 702 | "bytes", 703 | "fnv", 704 | "itoa", 705 | ] 706 | 707 | [[package]] 708 | name = "http-body" 709 | version = "0.4.5" 710 | source = "registry+https://github.com/rust-lang/crates.io-index" 711 | checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" 712 | dependencies = [ 713 | "bytes", 714 | "http", 715 | "pin-project-lite", 716 | ] 717 | 718 | [[package]] 719 | name = "httparse" 720 | version = "1.8.0" 721 | source = "registry+https://github.com/rust-lang/crates.io-index" 722 | checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" 723 | 724 | [[package]] 725 | name = "httpdate" 726 | version = "1.0.2" 727 | source = "registry+https://github.com/rust-lang/crates.io-index" 728 | checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" 729 | 730 | [[package]] 731 | name = "hyper" 732 | version = "0.14.27" 733 | source = "registry+https://github.com/rust-lang/crates.io-index" 734 | checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" 735 | dependencies = [ 736 | "bytes", 737 | "futures-channel", 738 | "futures-core", 739 | "futures-util", 740 | "h2", 741 | "http", 742 | "http-body", 743 | "httparse", 744 | "httpdate", 745 | "itoa", 746 | "pin-project-lite", 747 | "socket2", 748 | "tokio", 749 | "tower-service", 750 | "tracing", 751 | "want", 752 | ] 753 | 754 | [[package]] 755 | name = "hyper-rustls" 756 | version = "0.24.1" 757 | source = "registry+https://github.com/rust-lang/crates.io-index" 758 | checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" 759 | dependencies = [ 760 | "futures-util", 761 | "http", 762 | "hyper", 763 | "rustls", 764 | "tokio", 765 | "tokio-rustls", 766 | ] 767 | 768 | [[package]] 769 | name = "iana-time-zone" 770 | version = "0.1.57" 771 | source = "registry+https://github.com/rust-lang/crates.io-index" 772 | checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" 773 | dependencies = [ 774 | "android_system_properties", 775 | "core-foundation-sys", 776 | "iana-time-zone-haiku", 777 | "js-sys", 778 | "wasm-bindgen", 779 | "windows", 780 | ] 781 | 782 | [[package]] 783 | name = "iana-time-zone-haiku" 784 | version = "0.1.2" 785 | source = "registry+https://github.com/rust-lang/crates.io-index" 786 | checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" 787 | dependencies = [ 788 | "cc", 789 | ] 790 | 791 | [[package]] 792 | name = "idna" 793 | version = "0.4.0" 794 | source = "registry+https://github.com/rust-lang/crates.io-index" 795 | checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" 796 | dependencies = [ 797 | "unicode-bidi", 798 | "unicode-normalization", 799 | ] 800 | 801 | [[package]] 802 | name = "indexmap" 803 | version = "1.9.3" 804 | source = "registry+https://github.com/rust-lang/crates.io-index" 805 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 806 | dependencies = [ 807 | "autocfg", 808 | "hashbrown", 809 | ] 810 | 811 | [[package]] 812 | name = "instant" 813 | version = "0.1.12" 814 | source = "registry+https://github.com/rust-lang/crates.io-index" 815 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" 816 | dependencies = [ 817 | "cfg-if", 818 | ] 819 | 820 | [[package]] 821 | name = "io-lifetimes" 822 | version = "1.0.11" 823 | source = "registry+https://github.com/rust-lang/crates.io-index" 824 | checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" 825 | dependencies = [ 826 | "hermit-abi 0.3.2", 827 | "libc", 828 | "windows-sys 0.48.0", 829 | ] 830 | 831 | [[package]] 832 | name = "ipnet" 833 | version = "2.8.0" 834 | source = "registry+https://github.com/rust-lang/crates.io-index" 835 | checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" 836 | 837 | [[package]] 838 | name = "is-terminal" 839 | version = "0.4.9" 840 | source = "registry+https://github.com/rust-lang/crates.io-index" 841 | checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" 842 | dependencies = [ 843 | "hermit-abi 0.3.2", 844 | "rustix 0.38.4", 845 | "windows-sys 0.48.0", 846 | ] 847 | 848 | [[package]] 849 | name = "itoa" 850 | version = "1.0.8" 851 | source = "registry+https://github.com/rust-lang/crates.io-index" 852 | checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" 853 | 854 | [[package]] 855 | name = "js-sys" 856 | version = "0.3.64" 857 | source = "registry+https://github.com/rust-lang/crates.io-index" 858 | checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" 859 | dependencies = [ 860 | "wasm-bindgen", 861 | ] 862 | 863 | [[package]] 864 | name = "kernel32-sys" 865 | version = "0.2.2" 866 | source = "registry+https://github.com/rust-lang/crates.io-index" 867 | checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" 868 | dependencies = [ 869 | "winapi 0.2.8", 870 | "winapi-build", 871 | ] 872 | 873 | [[package]] 874 | name = "lazy_static" 875 | version = "1.4.0" 876 | source = "registry+https://github.com/rust-lang/crates.io-index" 877 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 878 | 879 | [[package]] 880 | name = "libc" 881 | version = "0.2.147" 882 | source = "registry+https://github.com/rust-lang/crates.io-index" 883 | checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" 884 | 885 | [[package]] 886 | name = "link-cplusplus" 887 | version = "1.0.9" 888 | source = "registry+https://github.com/rust-lang/crates.io-index" 889 | checksum = "9d240c6f7e1ba3a28b0249f774e6a9dd0175054b52dfbb61b16eb8505c3785c9" 890 | dependencies = [ 891 | "cc", 892 | ] 893 | 894 | [[package]] 895 | name = "linked-hash-map" 896 | version = "0.5.6" 897 | source = "registry+https://github.com/rust-lang/crates.io-index" 898 | checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" 899 | 900 | [[package]] 901 | name = "linux-raw-sys" 902 | version = "0.3.8" 903 | source = "registry+https://github.com/rust-lang/crates.io-index" 904 | checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" 905 | 906 | [[package]] 907 | name = "linux-raw-sys" 908 | version = "0.4.3" 909 | source = "registry+https://github.com/rust-lang/crates.io-index" 910 | checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" 911 | 912 | [[package]] 913 | name = "log" 914 | version = "0.4.19" 915 | source = "registry+https://github.com/rust-lang/crates.io-index" 916 | checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" 917 | 918 | [[package]] 919 | name = "makedeb-srcinfo" 920 | version = "0.8.1" 921 | source = "registry+https://github.com/rust-lang/crates.io-index" 922 | checksum = "75b72267a4ac779b9479ea9b6c2886555123b2fca35629e6a93a3b8bdda0d7fb" 923 | dependencies = [ 924 | "regex", 925 | ] 926 | 927 | [[package]] 928 | name = "memchr" 929 | version = "2.5.0" 930 | source = "registry+https://github.com/rust-lang/crates.io-index" 931 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 932 | 933 | [[package]] 934 | name = "mime" 935 | version = "0.3.17" 936 | source = "registry+https://github.com/rust-lang/crates.io-index" 937 | checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" 938 | 939 | [[package]] 940 | name = "miniz_oxide" 941 | version = "0.7.1" 942 | source = "registry+https://github.com/rust-lang/crates.io-index" 943 | checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" 944 | dependencies = [ 945 | "adler", 946 | ] 947 | 948 | [[package]] 949 | name = "mio" 950 | version = "0.8.8" 951 | source = "registry+https://github.com/rust-lang/crates.io-index" 952 | checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" 953 | dependencies = [ 954 | "libc", 955 | "wasi 0.11.0+wasi-snapshot-preview1", 956 | "windows-sys 0.48.0", 957 | ] 958 | 959 | [[package]] 960 | name = "mist" 961 | version = "0.12.0" 962 | dependencies = [ 963 | "bat", 964 | "chrono", 965 | "clap", 966 | "colored", 967 | "dirs", 968 | "edit", 969 | "exitcode", 970 | "flate2", 971 | "lazy_static", 972 | "makedeb-srcinfo", 973 | "quit", 974 | "regex", 975 | "reqwest", 976 | "rust-apt", 977 | "serde", 978 | "serde_json", 979 | "tempfile", 980 | "termsize", 981 | "users", 982 | "which", 983 | ] 984 | 985 | [[package]] 986 | name = "num-traits" 987 | version = "0.2.15" 988 | source = "registry+https://github.com/rust-lang/crates.io-index" 989 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" 990 | dependencies = [ 991 | "autocfg", 992 | ] 993 | 994 | [[package]] 995 | name = "num_cpus" 996 | version = "1.16.0" 997 | source = "registry+https://github.com/rust-lang/crates.io-index" 998 | checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" 999 | dependencies = [ 1000 | "hermit-abi 0.3.2", 1001 | "libc", 1002 | ] 1003 | 1004 | [[package]] 1005 | name = "numtoa" 1006 | version = "0.1.0" 1007 | source = "registry+https://github.com/rust-lang/crates.io-index" 1008 | checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" 1009 | 1010 | [[package]] 1011 | name = "object" 1012 | version = "0.31.1" 1013 | source = "registry+https://github.com/rust-lang/crates.io-index" 1014 | checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" 1015 | dependencies = [ 1016 | "memchr", 1017 | ] 1018 | 1019 | [[package]] 1020 | name = "once_cell" 1021 | version = "1.18.0" 1022 | source = "registry+https://github.com/rust-lang/crates.io-index" 1023 | checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" 1024 | 1025 | [[package]] 1026 | name = "os_str_bytes" 1027 | version = "6.5.1" 1028 | source = "registry+https://github.com/rust-lang/crates.io-index" 1029 | checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" 1030 | 1031 | [[package]] 1032 | name = "path_abs" 1033 | version = "0.5.1" 1034 | source = "registry+https://github.com/rust-lang/crates.io-index" 1035 | checksum = "05ef02f6342ac01d8a93b65f96db53fe68a92a15f41144f97fb00a9e669633c3" 1036 | dependencies = [ 1037 | "std_prelude", 1038 | ] 1039 | 1040 | [[package]] 1041 | name = "percent-encoding" 1042 | version = "2.3.0" 1043 | source = "registry+https://github.com/rust-lang/crates.io-index" 1044 | checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" 1045 | 1046 | [[package]] 1047 | name = "pin-project-lite" 1048 | version = "0.2.10" 1049 | source = "registry+https://github.com/rust-lang/crates.io-index" 1050 | checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" 1051 | 1052 | [[package]] 1053 | name = "pin-utils" 1054 | version = "0.1.0" 1055 | source = "registry+https://github.com/rust-lang/crates.io-index" 1056 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 1057 | 1058 | [[package]] 1059 | name = "proc-macro2" 1060 | version = "1.0.64" 1061 | source = "registry+https://github.com/rust-lang/crates.io-index" 1062 | checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" 1063 | dependencies = [ 1064 | "unicode-ident", 1065 | ] 1066 | 1067 | [[package]] 1068 | name = "quit" 1069 | version = "1.2.0" 1070 | source = "registry+https://github.com/rust-lang/crates.io-index" 1071 | checksum = "c5084cf776cb910f510c5aa4732a06933edb85f6f5785b6d12af90f364800211" 1072 | dependencies = [ 1073 | "quit_macros", 1074 | ] 1075 | 1076 | [[package]] 1077 | name = "quit_macros" 1078 | version = "1.2.0" 1079 | source = "registry+https://github.com/rust-lang/crates.io-index" 1080 | checksum = "ef1cf4f32c7fe348eefee85d0941afc70da334fc046a3592cc5356bf60624242" 1081 | 1082 | [[package]] 1083 | name = "quote" 1084 | version = "1.0.29" 1085 | source = "registry+https://github.com/rust-lang/crates.io-index" 1086 | checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" 1087 | dependencies = [ 1088 | "proc-macro2", 1089 | ] 1090 | 1091 | [[package]] 1092 | name = "redox_syscall" 1093 | version = "0.2.16" 1094 | source = "registry+https://github.com/rust-lang/crates.io-index" 1095 | checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" 1096 | dependencies = [ 1097 | "bitflags 1.3.2", 1098 | ] 1099 | 1100 | [[package]] 1101 | name = "redox_syscall" 1102 | version = "0.3.5" 1103 | source = "registry+https://github.com/rust-lang/crates.io-index" 1104 | checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" 1105 | dependencies = [ 1106 | "bitflags 1.3.2", 1107 | ] 1108 | 1109 | [[package]] 1110 | name = "redox_termios" 1111 | version = "0.1.2" 1112 | source = "registry+https://github.com/rust-lang/crates.io-index" 1113 | checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" 1114 | dependencies = [ 1115 | "redox_syscall 0.2.16", 1116 | ] 1117 | 1118 | [[package]] 1119 | name = "redox_users" 1120 | version = "0.4.3" 1121 | source = "registry+https://github.com/rust-lang/crates.io-index" 1122 | checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" 1123 | dependencies = [ 1124 | "getrandom", 1125 | "redox_syscall 0.2.16", 1126 | "thiserror", 1127 | ] 1128 | 1129 | [[package]] 1130 | name = "regex" 1131 | version = "1.9.1" 1132 | source = "registry+https://github.com/rust-lang/crates.io-index" 1133 | checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" 1134 | dependencies = [ 1135 | "aho-corasick", 1136 | "memchr", 1137 | "regex-automata", 1138 | "regex-syntax 0.7.4", 1139 | ] 1140 | 1141 | [[package]] 1142 | name = "regex-automata" 1143 | version = "0.3.3" 1144 | source = "registry+https://github.com/rust-lang/crates.io-index" 1145 | checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" 1146 | dependencies = [ 1147 | "aho-corasick", 1148 | "memchr", 1149 | "regex-syntax 0.7.4", 1150 | ] 1151 | 1152 | [[package]] 1153 | name = "regex-syntax" 1154 | version = "0.6.29" 1155 | source = "registry+https://github.com/rust-lang/crates.io-index" 1156 | checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" 1157 | 1158 | [[package]] 1159 | name = "regex-syntax" 1160 | version = "0.7.4" 1161 | source = "registry+https://github.com/rust-lang/crates.io-index" 1162 | checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" 1163 | 1164 | [[package]] 1165 | name = "reqwest" 1166 | version = "0.11.18" 1167 | source = "registry+https://github.com/rust-lang/crates.io-index" 1168 | checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" 1169 | dependencies = [ 1170 | "base64", 1171 | "bytes", 1172 | "encoding_rs", 1173 | "futures-core", 1174 | "futures-util", 1175 | "h2", 1176 | "http", 1177 | "http-body", 1178 | "hyper", 1179 | "hyper-rustls", 1180 | "ipnet", 1181 | "js-sys", 1182 | "log", 1183 | "mime", 1184 | "once_cell", 1185 | "percent-encoding", 1186 | "pin-project-lite", 1187 | "rustls", 1188 | "rustls-pemfile", 1189 | "serde", 1190 | "serde_json", 1191 | "serde_urlencoded", 1192 | "tokio", 1193 | "tokio-rustls", 1194 | "tower-service", 1195 | "url", 1196 | "wasm-bindgen", 1197 | "wasm-bindgen-futures", 1198 | "web-sys", 1199 | "webpki-roots", 1200 | "winreg", 1201 | ] 1202 | 1203 | [[package]] 1204 | name = "rgb" 1205 | version = "0.8.36" 1206 | source = "registry+https://github.com/rust-lang/crates.io-index" 1207 | checksum = "20ec2d3e3fc7a92ced357df9cebd5a10b6fb2aa1ee797bf7e9ce2f17dffc8f59" 1208 | dependencies = [ 1209 | "bytemuck", 1210 | ] 1211 | 1212 | [[package]] 1213 | name = "ring" 1214 | version = "0.16.20" 1215 | source = "registry+https://github.com/rust-lang/crates.io-index" 1216 | checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" 1217 | dependencies = [ 1218 | "cc", 1219 | "libc", 1220 | "once_cell", 1221 | "spin", 1222 | "untrusted", 1223 | "web-sys", 1224 | "winapi 0.3.9", 1225 | ] 1226 | 1227 | [[package]] 1228 | name = "rust-apt" 1229 | version = "0.4.1" 1230 | source = "git+https://gitlab.com/volian/rust-apt?rev=2f1633d26c9dee69d5852d1fcbf84b2586876555#2f1633d26c9dee69d5852d1fcbf84b2586876555" 1231 | dependencies = [ 1232 | "cxx", 1233 | "cxx-build", 1234 | "once_cell", 1235 | "termsize", 1236 | ] 1237 | 1238 | [[package]] 1239 | name = "rustc-demangle" 1240 | version = "0.1.23" 1241 | source = "registry+https://github.com/rust-lang/crates.io-index" 1242 | checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" 1243 | 1244 | [[package]] 1245 | name = "rustix" 1246 | version = "0.37.23" 1247 | source = "registry+https://github.com/rust-lang/crates.io-index" 1248 | checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" 1249 | dependencies = [ 1250 | "bitflags 1.3.2", 1251 | "errno", 1252 | "io-lifetimes", 1253 | "libc", 1254 | "linux-raw-sys 0.3.8", 1255 | "windows-sys 0.48.0", 1256 | ] 1257 | 1258 | [[package]] 1259 | name = "rustix" 1260 | version = "0.38.4" 1261 | source = "registry+https://github.com/rust-lang/crates.io-index" 1262 | checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" 1263 | dependencies = [ 1264 | "bitflags 2.3.3", 1265 | "errno", 1266 | "libc", 1267 | "linux-raw-sys 0.4.3", 1268 | "windows-sys 0.48.0", 1269 | ] 1270 | 1271 | [[package]] 1272 | name = "rustls" 1273 | version = "0.21.5" 1274 | source = "registry+https://github.com/rust-lang/crates.io-index" 1275 | checksum = "79ea77c539259495ce8ca47f53e66ae0330a8819f67e23ac96ca02f50e7b7d36" 1276 | dependencies = [ 1277 | "log", 1278 | "ring", 1279 | "rustls-webpki", 1280 | "sct", 1281 | ] 1282 | 1283 | [[package]] 1284 | name = "rustls-pemfile" 1285 | version = "1.0.3" 1286 | source = "registry+https://github.com/rust-lang/crates.io-index" 1287 | checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" 1288 | dependencies = [ 1289 | "base64", 1290 | ] 1291 | 1292 | [[package]] 1293 | name = "rustls-webpki" 1294 | version = "0.101.1" 1295 | source = "registry+https://github.com/rust-lang/crates.io-index" 1296 | checksum = "15f36a6828982f422756984e47912a7a51dcbc2a197aa791158f8ca61cd8204e" 1297 | dependencies = [ 1298 | "ring", 1299 | "untrusted", 1300 | ] 1301 | 1302 | [[package]] 1303 | name = "ryu" 1304 | version = "1.0.14" 1305 | source = "registry+https://github.com/rust-lang/crates.io-index" 1306 | checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" 1307 | 1308 | [[package]] 1309 | name = "same-file" 1310 | version = "1.0.6" 1311 | source = "registry+https://github.com/rust-lang/crates.io-index" 1312 | checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" 1313 | dependencies = [ 1314 | "winapi-util", 1315 | ] 1316 | 1317 | [[package]] 1318 | name = "scratch" 1319 | version = "1.0.6" 1320 | source = "registry+https://github.com/rust-lang/crates.io-index" 1321 | checksum = "764cad9e7e1ca5fe15b552859ff5d96a314e6ed2934f2260168cd5dfa5891409" 1322 | 1323 | [[package]] 1324 | name = "sct" 1325 | version = "0.7.0" 1326 | source = "registry+https://github.com/rust-lang/crates.io-index" 1327 | checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" 1328 | dependencies = [ 1329 | "ring", 1330 | "untrusted", 1331 | ] 1332 | 1333 | [[package]] 1334 | name = "semver" 1335 | version = "1.0.17" 1336 | source = "registry+https://github.com/rust-lang/crates.io-index" 1337 | checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" 1338 | 1339 | [[package]] 1340 | name = "serde" 1341 | version = "1.0.171" 1342 | source = "registry+https://github.com/rust-lang/crates.io-index" 1343 | checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" 1344 | dependencies = [ 1345 | "serde_derive", 1346 | ] 1347 | 1348 | [[package]] 1349 | name = "serde_derive" 1350 | version = "1.0.171" 1351 | source = "registry+https://github.com/rust-lang/crates.io-index" 1352 | checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" 1353 | dependencies = [ 1354 | "proc-macro2", 1355 | "quote", 1356 | "syn", 1357 | ] 1358 | 1359 | [[package]] 1360 | name = "serde_json" 1361 | version = "1.0.102" 1362 | source = "registry+https://github.com/rust-lang/crates.io-index" 1363 | checksum = "b5062a995d481b2308b6064e9af76011f2921c35f97b0468811ed9f6cd91dfed" 1364 | dependencies = [ 1365 | "itoa", 1366 | "ryu", 1367 | "serde", 1368 | ] 1369 | 1370 | [[package]] 1371 | name = "serde_urlencoded" 1372 | version = "0.7.1" 1373 | source = "registry+https://github.com/rust-lang/crates.io-index" 1374 | checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 1375 | dependencies = [ 1376 | "form_urlencoded", 1377 | "itoa", 1378 | "ryu", 1379 | "serde", 1380 | ] 1381 | 1382 | [[package]] 1383 | name = "serde_yaml" 1384 | version = "0.8.26" 1385 | source = "registry+https://github.com/rust-lang/crates.io-index" 1386 | checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" 1387 | dependencies = [ 1388 | "indexmap", 1389 | "ryu", 1390 | "serde", 1391 | "yaml-rust", 1392 | ] 1393 | 1394 | [[package]] 1395 | name = "shell-words" 1396 | version = "1.1.0" 1397 | source = "registry+https://github.com/rust-lang/crates.io-index" 1398 | checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" 1399 | 1400 | [[package]] 1401 | name = "slab" 1402 | version = "0.4.8" 1403 | source = "registry+https://github.com/rust-lang/crates.io-index" 1404 | checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" 1405 | dependencies = [ 1406 | "autocfg", 1407 | ] 1408 | 1409 | [[package]] 1410 | name = "socket2" 1411 | version = "0.4.9" 1412 | source = "registry+https://github.com/rust-lang/crates.io-index" 1413 | checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" 1414 | dependencies = [ 1415 | "libc", 1416 | "winapi 0.3.9", 1417 | ] 1418 | 1419 | [[package]] 1420 | name = "spin" 1421 | version = "0.5.2" 1422 | source = "registry+https://github.com/rust-lang/crates.io-index" 1423 | checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" 1424 | 1425 | [[package]] 1426 | name = "std_prelude" 1427 | version = "0.2.12" 1428 | source = "registry+https://github.com/rust-lang/crates.io-index" 1429 | checksum = "8207e78455ffdf55661170876f88daf85356e4edd54e0a3dbc79586ca1e50cbe" 1430 | 1431 | [[package]] 1432 | name = "strsim" 1433 | version = "0.10.0" 1434 | source = "registry+https://github.com/rust-lang/crates.io-index" 1435 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 1436 | 1437 | [[package]] 1438 | name = "syn" 1439 | version = "2.0.25" 1440 | source = "registry+https://github.com/rust-lang/crates.io-index" 1441 | checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2" 1442 | dependencies = [ 1443 | "proc-macro2", 1444 | "quote", 1445 | "unicode-ident", 1446 | ] 1447 | 1448 | [[package]] 1449 | name = "syntect" 1450 | version = "5.0.0" 1451 | source = "registry+https://github.com/rust-lang/crates.io-index" 1452 | checksum = "c6c454c27d9d7d9a84c7803aaa3c50cd088d2906fe3c6e42da3209aa623576a8" 1453 | dependencies = [ 1454 | "bincode", 1455 | "bitflags 1.3.2", 1456 | "fancy-regex", 1457 | "flate2", 1458 | "fnv", 1459 | "lazy_static", 1460 | "once_cell", 1461 | "regex-syntax 0.6.29", 1462 | "serde", 1463 | "serde_derive", 1464 | "serde_json", 1465 | "thiserror", 1466 | "walkdir", 1467 | ] 1468 | 1469 | [[package]] 1470 | name = "tempfile" 1471 | version = "3.6.0" 1472 | source = "registry+https://github.com/rust-lang/crates.io-index" 1473 | checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" 1474 | dependencies = [ 1475 | "autocfg", 1476 | "cfg-if", 1477 | "fastrand", 1478 | "redox_syscall 0.3.5", 1479 | "rustix 0.37.23", 1480 | "windows-sys 0.48.0", 1481 | ] 1482 | 1483 | [[package]] 1484 | name = "termcolor" 1485 | version = "1.2.0" 1486 | source = "registry+https://github.com/rust-lang/crates.io-index" 1487 | checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" 1488 | dependencies = [ 1489 | "winapi-util", 1490 | ] 1491 | 1492 | [[package]] 1493 | name = "termion" 1494 | version = "1.5.6" 1495 | source = "registry+https://github.com/rust-lang/crates.io-index" 1496 | checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" 1497 | dependencies = [ 1498 | "libc", 1499 | "numtoa", 1500 | "redox_syscall 0.2.16", 1501 | "redox_termios", 1502 | ] 1503 | 1504 | [[package]] 1505 | name = "termsize" 1506 | version = "0.1.6" 1507 | source = "registry+https://github.com/rust-lang/crates.io-index" 1508 | checksum = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" 1509 | dependencies = [ 1510 | "atty", 1511 | "kernel32-sys", 1512 | "libc", 1513 | "termion", 1514 | "winapi 0.2.8", 1515 | ] 1516 | 1517 | [[package]] 1518 | name = "textwrap" 1519 | version = "0.16.0" 1520 | source = "registry+https://github.com/rust-lang/crates.io-index" 1521 | checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" 1522 | 1523 | [[package]] 1524 | name = "thiserror" 1525 | version = "1.0.43" 1526 | source = "registry+https://github.com/rust-lang/crates.io-index" 1527 | checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42" 1528 | dependencies = [ 1529 | "thiserror-impl", 1530 | ] 1531 | 1532 | [[package]] 1533 | name = "thiserror-impl" 1534 | version = "1.0.43" 1535 | source = "registry+https://github.com/rust-lang/crates.io-index" 1536 | checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" 1537 | dependencies = [ 1538 | "proc-macro2", 1539 | "quote", 1540 | "syn", 1541 | ] 1542 | 1543 | [[package]] 1544 | name = "time" 1545 | version = "0.1.45" 1546 | source = "registry+https://github.com/rust-lang/crates.io-index" 1547 | checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" 1548 | dependencies = [ 1549 | "libc", 1550 | "wasi 0.10.0+wasi-snapshot-preview1", 1551 | "winapi 0.3.9", 1552 | ] 1553 | 1554 | [[package]] 1555 | name = "tinyvec" 1556 | version = "1.6.0" 1557 | source = "registry+https://github.com/rust-lang/crates.io-index" 1558 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 1559 | dependencies = [ 1560 | "tinyvec_macros", 1561 | ] 1562 | 1563 | [[package]] 1564 | name = "tinyvec_macros" 1565 | version = "0.1.1" 1566 | source = "registry+https://github.com/rust-lang/crates.io-index" 1567 | checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 1568 | 1569 | [[package]] 1570 | name = "tokio" 1571 | version = "1.29.1" 1572 | source = "registry+https://github.com/rust-lang/crates.io-index" 1573 | checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" 1574 | dependencies = [ 1575 | "autocfg", 1576 | "backtrace", 1577 | "bytes", 1578 | "libc", 1579 | "mio", 1580 | "num_cpus", 1581 | "pin-project-lite", 1582 | "socket2", 1583 | "windows-sys 0.48.0", 1584 | ] 1585 | 1586 | [[package]] 1587 | name = "tokio-rustls" 1588 | version = "0.24.1" 1589 | source = "registry+https://github.com/rust-lang/crates.io-index" 1590 | checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" 1591 | dependencies = [ 1592 | "rustls", 1593 | "tokio", 1594 | ] 1595 | 1596 | [[package]] 1597 | name = "tokio-util" 1598 | version = "0.7.8" 1599 | source = "registry+https://github.com/rust-lang/crates.io-index" 1600 | checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" 1601 | dependencies = [ 1602 | "bytes", 1603 | "futures-core", 1604 | "futures-sink", 1605 | "pin-project-lite", 1606 | "tokio", 1607 | "tracing", 1608 | ] 1609 | 1610 | [[package]] 1611 | name = "tower-service" 1612 | version = "0.3.2" 1613 | source = "registry+https://github.com/rust-lang/crates.io-index" 1614 | checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" 1615 | 1616 | [[package]] 1617 | name = "tracing" 1618 | version = "0.1.37" 1619 | source = "registry+https://github.com/rust-lang/crates.io-index" 1620 | checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" 1621 | dependencies = [ 1622 | "cfg-if", 1623 | "pin-project-lite", 1624 | "tracing-core", 1625 | ] 1626 | 1627 | [[package]] 1628 | name = "tracing-core" 1629 | version = "0.1.31" 1630 | source = "registry+https://github.com/rust-lang/crates.io-index" 1631 | checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" 1632 | dependencies = [ 1633 | "once_cell", 1634 | ] 1635 | 1636 | [[package]] 1637 | name = "try-lock" 1638 | version = "0.2.4" 1639 | source = "registry+https://github.com/rust-lang/crates.io-index" 1640 | checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" 1641 | 1642 | [[package]] 1643 | name = "unicode-bidi" 1644 | version = "0.3.13" 1645 | source = "registry+https://github.com/rust-lang/crates.io-index" 1646 | checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" 1647 | 1648 | [[package]] 1649 | name = "unicode-ident" 1650 | version = "1.0.10" 1651 | source = "registry+https://github.com/rust-lang/crates.io-index" 1652 | checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" 1653 | 1654 | [[package]] 1655 | name = "unicode-normalization" 1656 | version = "0.1.22" 1657 | source = "registry+https://github.com/rust-lang/crates.io-index" 1658 | checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" 1659 | dependencies = [ 1660 | "tinyvec", 1661 | ] 1662 | 1663 | [[package]] 1664 | name = "unicode-width" 1665 | version = "0.1.10" 1666 | source = "registry+https://github.com/rust-lang/crates.io-index" 1667 | checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" 1668 | 1669 | [[package]] 1670 | name = "untrusted" 1671 | version = "0.7.1" 1672 | source = "registry+https://github.com/rust-lang/crates.io-index" 1673 | checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" 1674 | 1675 | [[package]] 1676 | name = "url" 1677 | version = "2.4.0" 1678 | source = "registry+https://github.com/rust-lang/crates.io-index" 1679 | checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" 1680 | dependencies = [ 1681 | "form_urlencoded", 1682 | "idna", 1683 | "percent-encoding", 1684 | ] 1685 | 1686 | [[package]] 1687 | name = "users" 1688 | version = "0.11.0" 1689 | source = "registry+https://github.com/rust-lang/crates.io-index" 1690 | checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032" 1691 | dependencies = [ 1692 | "libc", 1693 | "log", 1694 | ] 1695 | 1696 | [[package]] 1697 | name = "walkdir" 1698 | version = "2.3.3" 1699 | source = "registry+https://github.com/rust-lang/crates.io-index" 1700 | checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" 1701 | dependencies = [ 1702 | "same-file", 1703 | "winapi-util", 1704 | ] 1705 | 1706 | [[package]] 1707 | name = "want" 1708 | version = "0.3.1" 1709 | source = "registry+https://github.com/rust-lang/crates.io-index" 1710 | checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" 1711 | dependencies = [ 1712 | "try-lock", 1713 | ] 1714 | 1715 | [[package]] 1716 | name = "wasi" 1717 | version = "0.10.0+wasi-snapshot-preview1" 1718 | source = "registry+https://github.com/rust-lang/crates.io-index" 1719 | checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" 1720 | 1721 | [[package]] 1722 | name = "wasi" 1723 | version = "0.11.0+wasi-snapshot-preview1" 1724 | source = "registry+https://github.com/rust-lang/crates.io-index" 1725 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1726 | 1727 | [[package]] 1728 | name = "wasm-bindgen" 1729 | version = "0.2.87" 1730 | source = "registry+https://github.com/rust-lang/crates.io-index" 1731 | checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" 1732 | dependencies = [ 1733 | "cfg-if", 1734 | "wasm-bindgen-macro", 1735 | ] 1736 | 1737 | [[package]] 1738 | name = "wasm-bindgen-backend" 1739 | version = "0.2.87" 1740 | source = "registry+https://github.com/rust-lang/crates.io-index" 1741 | checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" 1742 | dependencies = [ 1743 | "bumpalo", 1744 | "log", 1745 | "once_cell", 1746 | "proc-macro2", 1747 | "quote", 1748 | "syn", 1749 | "wasm-bindgen-shared", 1750 | ] 1751 | 1752 | [[package]] 1753 | name = "wasm-bindgen-futures" 1754 | version = "0.4.37" 1755 | source = "registry+https://github.com/rust-lang/crates.io-index" 1756 | checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" 1757 | dependencies = [ 1758 | "cfg-if", 1759 | "js-sys", 1760 | "wasm-bindgen", 1761 | "web-sys", 1762 | ] 1763 | 1764 | [[package]] 1765 | name = "wasm-bindgen-macro" 1766 | version = "0.2.87" 1767 | source = "registry+https://github.com/rust-lang/crates.io-index" 1768 | checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" 1769 | dependencies = [ 1770 | "quote", 1771 | "wasm-bindgen-macro-support", 1772 | ] 1773 | 1774 | [[package]] 1775 | name = "wasm-bindgen-macro-support" 1776 | version = "0.2.87" 1777 | source = "registry+https://github.com/rust-lang/crates.io-index" 1778 | checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" 1779 | dependencies = [ 1780 | "proc-macro2", 1781 | "quote", 1782 | "syn", 1783 | "wasm-bindgen-backend", 1784 | "wasm-bindgen-shared", 1785 | ] 1786 | 1787 | [[package]] 1788 | name = "wasm-bindgen-shared" 1789 | version = "0.2.87" 1790 | source = "registry+https://github.com/rust-lang/crates.io-index" 1791 | checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" 1792 | 1793 | [[package]] 1794 | name = "web-sys" 1795 | version = "0.3.64" 1796 | source = "registry+https://github.com/rust-lang/crates.io-index" 1797 | checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" 1798 | dependencies = [ 1799 | "js-sys", 1800 | "wasm-bindgen", 1801 | ] 1802 | 1803 | [[package]] 1804 | name = "webpki" 1805 | version = "0.22.0" 1806 | source = "registry+https://github.com/rust-lang/crates.io-index" 1807 | checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" 1808 | dependencies = [ 1809 | "ring", 1810 | "untrusted", 1811 | ] 1812 | 1813 | [[package]] 1814 | name = "webpki-roots" 1815 | version = "0.22.6" 1816 | source = "registry+https://github.com/rust-lang/crates.io-index" 1817 | checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" 1818 | dependencies = [ 1819 | "webpki", 1820 | ] 1821 | 1822 | [[package]] 1823 | name = "which" 1824 | version = "4.4.0" 1825 | source = "registry+https://github.com/rust-lang/crates.io-index" 1826 | checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" 1827 | dependencies = [ 1828 | "either", 1829 | "libc", 1830 | "once_cell", 1831 | ] 1832 | 1833 | [[package]] 1834 | name = "winapi" 1835 | version = "0.2.8" 1836 | source = "registry+https://github.com/rust-lang/crates.io-index" 1837 | checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" 1838 | 1839 | [[package]] 1840 | name = "winapi" 1841 | version = "0.3.9" 1842 | source = "registry+https://github.com/rust-lang/crates.io-index" 1843 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1844 | dependencies = [ 1845 | "winapi-i686-pc-windows-gnu", 1846 | "winapi-x86_64-pc-windows-gnu", 1847 | ] 1848 | 1849 | [[package]] 1850 | name = "winapi-build" 1851 | version = "0.1.1" 1852 | source = "registry+https://github.com/rust-lang/crates.io-index" 1853 | checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" 1854 | 1855 | [[package]] 1856 | name = "winapi-i686-pc-windows-gnu" 1857 | version = "0.4.0" 1858 | source = "registry+https://github.com/rust-lang/crates.io-index" 1859 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1860 | 1861 | [[package]] 1862 | name = "winapi-util" 1863 | version = "0.1.5" 1864 | source = "registry+https://github.com/rust-lang/crates.io-index" 1865 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 1866 | dependencies = [ 1867 | "winapi 0.3.9", 1868 | ] 1869 | 1870 | [[package]] 1871 | name = "winapi-x86_64-pc-windows-gnu" 1872 | version = "0.4.0" 1873 | source = "registry+https://github.com/rust-lang/crates.io-index" 1874 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1875 | 1876 | [[package]] 1877 | name = "windows" 1878 | version = "0.48.0" 1879 | source = "registry+https://github.com/rust-lang/crates.io-index" 1880 | checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" 1881 | dependencies = [ 1882 | "windows-targets 0.48.1", 1883 | ] 1884 | 1885 | [[package]] 1886 | name = "windows-sys" 1887 | version = "0.45.0" 1888 | source = "registry+https://github.com/rust-lang/crates.io-index" 1889 | checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" 1890 | dependencies = [ 1891 | "windows-targets 0.42.2", 1892 | ] 1893 | 1894 | [[package]] 1895 | name = "windows-sys" 1896 | version = "0.48.0" 1897 | source = "registry+https://github.com/rust-lang/crates.io-index" 1898 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 1899 | dependencies = [ 1900 | "windows-targets 0.48.1", 1901 | ] 1902 | 1903 | [[package]] 1904 | name = "windows-targets" 1905 | version = "0.42.2" 1906 | source = "registry+https://github.com/rust-lang/crates.io-index" 1907 | checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" 1908 | dependencies = [ 1909 | "windows_aarch64_gnullvm 0.42.2", 1910 | "windows_aarch64_msvc 0.42.2", 1911 | "windows_i686_gnu 0.42.2", 1912 | "windows_i686_msvc 0.42.2", 1913 | "windows_x86_64_gnu 0.42.2", 1914 | "windows_x86_64_gnullvm 0.42.2", 1915 | "windows_x86_64_msvc 0.42.2", 1916 | ] 1917 | 1918 | [[package]] 1919 | name = "windows-targets" 1920 | version = "0.48.1" 1921 | source = "registry+https://github.com/rust-lang/crates.io-index" 1922 | checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" 1923 | dependencies = [ 1924 | "windows_aarch64_gnullvm 0.48.0", 1925 | "windows_aarch64_msvc 0.48.0", 1926 | "windows_i686_gnu 0.48.0", 1927 | "windows_i686_msvc 0.48.0", 1928 | "windows_x86_64_gnu 0.48.0", 1929 | "windows_x86_64_gnullvm 0.48.0", 1930 | "windows_x86_64_msvc 0.48.0", 1931 | ] 1932 | 1933 | [[package]] 1934 | name = "windows_aarch64_gnullvm" 1935 | version = "0.42.2" 1936 | source = "registry+https://github.com/rust-lang/crates.io-index" 1937 | checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" 1938 | 1939 | [[package]] 1940 | name = "windows_aarch64_gnullvm" 1941 | version = "0.48.0" 1942 | source = "registry+https://github.com/rust-lang/crates.io-index" 1943 | checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" 1944 | 1945 | [[package]] 1946 | name = "windows_aarch64_msvc" 1947 | version = "0.42.2" 1948 | source = "registry+https://github.com/rust-lang/crates.io-index" 1949 | checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" 1950 | 1951 | [[package]] 1952 | name = "windows_aarch64_msvc" 1953 | version = "0.48.0" 1954 | source = "registry+https://github.com/rust-lang/crates.io-index" 1955 | checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" 1956 | 1957 | [[package]] 1958 | name = "windows_i686_gnu" 1959 | version = "0.42.2" 1960 | source = "registry+https://github.com/rust-lang/crates.io-index" 1961 | checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" 1962 | 1963 | [[package]] 1964 | name = "windows_i686_gnu" 1965 | version = "0.48.0" 1966 | source = "registry+https://github.com/rust-lang/crates.io-index" 1967 | checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" 1968 | 1969 | [[package]] 1970 | name = "windows_i686_msvc" 1971 | version = "0.42.2" 1972 | source = "registry+https://github.com/rust-lang/crates.io-index" 1973 | checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" 1974 | 1975 | [[package]] 1976 | name = "windows_i686_msvc" 1977 | version = "0.48.0" 1978 | source = "registry+https://github.com/rust-lang/crates.io-index" 1979 | checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" 1980 | 1981 | [[package]] 1982 | name = "windows_x86_64_gnu" 1983 | version = "0.42.2" 1984 | source = "registry+https://github.com/rust-lang/crates.io-index" 1985 | checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" 1986 | 1987 | [[package]] 1988 | name = "windows_x86_64_gnu" 1989 | version = "0.48.0" 1990 | source = "registry+https://github.com/rust-lang/crates.io-index" 1991 | checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" 1992 | 1993 | [[package]] 1994 | name = "windows_x86_64_gnullvm" 1995 | version = "0.42.2" 1996 | source = "registry+https://github.com/rust-lang/crates.io-index" 1997 | checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" 1998 | 1999 | [[package]] 2000 | name = "windows_x86_64_gnullvm" 2001 | version = "0.48.0" 2002 | source = "registry+https://github.com/rust-lang/crates.io-index" 2003 | checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" 2004 | 2005 | [[package]] 2006 | name = "windows_x86_64_msvc" 2007 | version = "0.42.2" 2008 | source = "registry+https://github.com/rust-lang/crates.io-index" 2009 | checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" 2010 | 2011 | [[package]] 2012 | name = "windows_x86_64_msvc" 2013 | version = "0.48.0" 2014 | source = "registry+https://github.com/rust-lang/crates.io-index" 2015 | checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" 2016 | 2017 | [[package]] 2018 | name = "winreg" 2019 | version = "0.10.1" 2020 | source = "registry+https://github.com/rust-lang/crates.io-index" 2021 | checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" 2022 | dependencies = [ 2023 | "winapi 0.3.9", 2024 | ] 2025 | 2026 | [[package]] 2027 | name = "yaml-rust" 2028 | version = "0.4.5" 2029 | source = "registry+https://github.com/rust-lang/crates.io-index" 2030 | checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" 2031 | dependencies = [ 2032 | "linked-hash-map", 2033 | ] 2034 | --------------------------------------------------------------------------------