chore(deps): bump all deps (#618)
This commit is contained in:
1392
Cargo.lock
generated
1392
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
27
Cargo.toml
27
Cargo.toml
@@ -22,26 +22,26 @@ path = "src/main.rs"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
home = "~0.5"
|
home = "~0.5"
|
||||||
etcetera = "~0.8"
|
etcetera = "~0.8"
|
||||||
once_cell = "~1.17"
|
once_cell = "~1.18"
|
||||||
serde = { version = "~1.0", features = ["derive"] }
|
serde = { version = "~1.0", features = ["derive"] }
|
||||||
toml = "0.5"
|
toml = "0.8"
|
||||||
which_crate = { version = "~4.1", package = "which" }
|
which_crate = { version = "~4.1", package = "which" }
|
||||||
shellexpand = "~2.1"
|
shellexpand = "~3.1"
|
||||||
clap = { version = "~3.1", features = ["cargo", "derive"] }
|
clap = { version = "~4.4", features = ["cargo", "derive"] }
|
||||||
clap_complete = "~3.1"
|
clap_complete = "~4.4"
|
||||||
clap_mangen = "~0.1"
|
clap_mangen = "~0.2"
|
||||||
walkdir = "~2.3"
|
walkdir = "~2.4"
|
||||||
console = "~0.15"
|
console = "~0.15"
|
||||||
lazy_static = "~1.4"
|
lazy_static = "~1.4"
|
||||||
chrono = "~0.4"
|
chrono = "~0.4"
|
||||||
glob = "~0.3"
|
glob = "~0.3"
|
||||||
strum = { version = "~0.24", features = ["derive"] }
|
strum = { version = "~0.24", features = ["derive"] }
|
||||||
thiserror = "~1.0"
|
thiserror = "~1.0"
|
||||||
tempfile = "~3.6"
|
tempfile = "~3.8"
|
||||||
cfg-if = "~1.0"
|
cfg-if = "~1.0"
|
||||||
tokio = { version = "~1.18", features = ["process", "rt-multi-thread"] }
|
tokio = { version = "~1.34", features = ["process", "rt-multi-thread"] }
|
||||||
futures = "~0.3"
|
futures = "~0.3"
|
||||||
regex = "~1.7"
|
regex = "~1.10"
|
||||||
semver = "~1.0"
|
semver = "~1.0"
|
||||||
shell-words = "~1.1"
|
shell-words = "~1.1"
|
||||||
color-eyre = "~0.6"
|
color-eyre = "~0.6"
|
||||||
@@ -49,10 +49,10 @@ tracing = { version = "~0.1", features = ["attributes", "log"] }
|
|||||||
tracing-subscriber = { version = "~0.3", features = ["env-filter", "time"] }
|
tracing-subscriber = { version = "~0.3", features = ["env-filter", "time"] }
|
||||||
merge = "~0.1"
|
merge = "~0.1"
|
||||||
regex-split = "~0.1"
|
regex-split = "~0.1"
|
||||||
notify-rust = "~4.8"
|
notify-rust = "~4.10"
|
||||||
|
|
||||||
[package.metadata.generate-rpm]
|
[package.metadata.generate-rpm]
|
||||||
assets = [{source = "target/release/topgrade", dest="/usr/bin/topgrade"}]
|
assets = [{ source = "target/release/topgrade", dest = "/usr/bin/topgrade" }]
|
||||||
|
|
||||||
[package.metadata.generate-rpm.requires]
|
[package.metadata.generate-rpm.requires]
|
||||||
git = "*"
|
git = "*"
|
||||||
@@ -61,8 +61,7 @@ git = "*"
|
|||||||
depends = "$auto,git"
|
depends = "$auto,git"
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
libc = "~0.2"
|
nix = { version = "~0.27", features = ["hostname", "signal", "user"] }
|
||||||
nix = "~0.24"
|
|
||||||
rust-ini = "~0.19"
|
rust-ini = "~0.19"
|
||||||
self_update_crate = { version = "~0.30", default-features = false, optional = true, package = "self_update", features = ["archive-tar", "compression-flate2", "rustls"] }
|
self_update_crate = { version = "~0.30", default-features = false, optional = true, package = "self_update", features = ["archive-tar", "compression-flate2", "rustls"] }
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use std::path::{Path, PathBuf};
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::{env, fs};
|
use std::{env, fs};
|
||||||
|
|
||||||
use clap::{ArgEnum, Parser};
|
use clap::{Parser, ValueEnum};
|
||||||
use clap_complete::Shell;
|
use clap_complete::Shell;
|
||||||
use color_eyre::eyre::Context;
|
use color_eyre::eyre::Context;
|
||||||
use color_eyre::eyre::Result;
|
use color_eyre::eyre::Result;
|
||||||
@@ -19,10 +19,10 @@ use serde::Deserialize;
|
|||||||
use strum::{EnumIter, EnumString, EnumVariantNames, IntoEnumIterator};
|
use strum::{EnumIter, EnumString, EnumVariantNames, IntoEnumIterator};
|
||||||
use which_crate::which;
|
use which_crate::which;
|
||||||
|
|
||||||
use super::utils::{editor, hostname};
|
use super::utils::editor;
|
||||||
use crate::command::CommandExt;
|
use crate::command::CommandExt;
|
||||||
use crate::sudo::SudoKind;
|
use crate::sudo::SudoKind;
|
||||||
use crate::utils::string_prepend_str;
|
use crate::utils::{hostname, string_prepend_str};
|
||||||
use tracing::{debug, error};
|
use tracing::{debug, error};
|
||||||
|
|
||||||
pub static EXAMPLE_CONFIG: &str = include_str!("../config.example.toml");
|
pub static EXAMPLE_CONFIG: &str = include_str!("../config.example.toml");
|
||||||
@@ -44,7 +44,7 @@ macro_rules! str_value {
|
|||||||
|
|
||||||
pub type Commands = BTreeMap<String, String>;
|
pub type Commands = BTreeMap<String, String>;
|
||||||
|
|
||||||
#[derive(ArgEnum, EnumString, EnumVariantNames, Debug, Clone, PartialEq, Eq, Deserialize, EnumIter, Copy)]
|
#[derive(ValueEnum, EnumString, EnumVariantNames, Debug, Clone, PartialEq, Eq, Deserialize, EnumIter, Copy)]
|
||||||
#[clap(rename_all = "snake_case")]
|
#[clap(rename_all = "snake_case")]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
#[strum(serialize_all = "snake_case")]
|
#[strum(serialize_all = "snake_case")]
|
||||||
@@ -671,19 +671,19 @@ pub struct CommandLineArgs {
|
|||||||
no_retry: bool,
|
no_retry: bool,
|
||||||
|
|
||||||
/// Do not perform upgrades for the given steps
|
/// Do not perform upgrades for the given steps
|
||||||
#[clap(long = "disable", value_name = "STEP", arg_enum, multiple_values = true)]
|
#[clap(long = "disable", value_name = "STEP", value_enum, num_args = 1..)]
|
||||||
disable: Vec<Step>,
|
disable: Vec<Step>,
|
||||||
|
|
||||||
/// Perform only the specified steps (experimental)
|
/// Perform only the specified steps (experimental)
|
||||||
#[clap(long = "only", value_name = "STEP", arg_enum, multiple_values = true)]
|
#[clap(long = "only", value_name = "STEP", value_enum, num_args = 1..)]
|
||||||
only: Vec<Step>,
|
only: Vec<Step>,
|
||||||
|
|
||||||
/// Run only specific custom commands
|
/// Run only specific custom commands
|
||||||
#[clap(long = "custom-commands", value_name = "NAME", multiple_values = true)]
|
#[clap(long = "custom-commands", value_name = "NAME", num_args = 1..)]
|
||||||
custom_commands: Vec<String>,
|
custom_commands: Vec<String>,
|
||||||
|
|
||||||
/// Set environment variables
|
/// Set environment variables
|
||||||
#[clap(long = "env", value_name = "NAME=VALUE", multiple_values = true)]
|
#[clap(long = "env", value_name = "NAME=VALUE", num_args = 1..)]
|
||||||
env: Vec<String>,
|
env: Vec<String>,
|
||||||
|
|
||||||
/// Output debug logs. Alias for `--log-filter debug`.
|
/// Output debug logs. Alias for `--log-filter debug`.
|
||||||
@@ -703,9 +703,8 @@ pub struct CommandLineArgs {
|
|||||||
short = 'y',
|
short = 'y',
|
||||||
long = "yes",
|
long = "yes",
|
||||||
value_name = "STEP",
|
value_name = "STEP",
|
||||||
arg_enum,
|
value_enum,
|
||||||
multiple_values = true,
|
num_args = 0..,
|
||||||
min_values = 0
|
|
||||||
)]
|
)]
|
||||||
yes: Option<Vec<Step>>,
|
yes: Option<Vec<Step>>,
|
||||||
|
|
||||||
@@ -732,7 +731,7 @@ pub struct CommandLineArgs {
|
|||||||
pub log_filter: String,
|
pub log_filter: String,
|
||||||
|
|
||||||
/// Print completion script for the given shell and exit
|
/// Print completion script for the given shell and exit
|
||||||
#[clap(long, arg_enum, hide = true)]
|
#[clap(long, value_enum, hide = true)]
|
||||||
pub gen_completion: Option<Shell>,
|
pub gen_completion: Option<Shell>,
|
||||||
|
|
||||||
/// Print roff manpage and exit
|
/// Print roff manpage and exit
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! SIGINT handling in Unix systems.
|
//! SIGINT handling in Unix systems.
|
||||||
use crate::ctrlc::interrupted::set_interrupted;
|
use crate::ctrlc::interrupted::set_interrupted;
|
||||||
use nix::sys::signal;
|
use nix::sys::signal::{sigaction, SaFlags, SigAction, SigHandler, SigSet, Signal};
|
||||||
|
|
||||||
/// Handle SIGINT. Set the interruption flag.
|
/// Handle SIGINT. Set the interruption flag.
|
||||||
extern "C" fn handle_sigint(_: i32) {
|
extern "C" fn handle_sigint(_: i32) {
|
||||||
@@ -10,12 +10,8 @@ extern "C" fn handle_sigint(_: i32) {
|
|||||||
/// Set the necessary signal handlers.
|
/// Set the necessary signal handlers.
|
||||||
/// The function panics on failure.
|
/// The function panics on failure.
|
||||||
pub fn set_handler() {
|
pub fn set_handler() {
|
||||||
let sig_action = signal::SigAction::new(
|
let sig_action = SigAction::new(SigHandler::Handler(handle_sigint), SaFlags::empty(), SigSet::empty());
|
||||||
signal::SigHandler::Handler(handle_sigint),
|
|
||||||
signal::SaFlags::empty(),
|
|
||||||
signal::SigSet::empty(),
|
|
||||||
);
|
|
||||||
unsafe {
|
unsafe {
|
||||||
signal::sigaction(signal::SIGINT, &sig_action).unwrap();
|
sigaction(Signal::SIGINT, &sig_action).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
41
src/utils.rs
41
src/utils.rs
@@ -119,44 +119,13 @@ pub fn string_prepend_str(string: &mut String, s: &str) {
|
|||||||
*string = new_string;
|
*string = new_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sys-info-rs
|
|
||||||
*
|
|
||||||
* Copyright (c) 2015 Siyu Wang
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
#[cfg(target_family = "unix")]
|
#[cfg(target_family = "unix")]
|
||||||
pub fn hostname() -> Result<String> {
|
pub fn hostname() -> Result<String> {
|
||||||
use std::ffi;
|
match nix::unistd::gethostname() {
|
||||||
extern crate libc;
|
Ok(os_str) => Ok(os_str
|
||||||
|
.into_string()
|
||||||
unsafe {
|
.map_err(|_| SkipStep("Failed to get a UTF-8 encoded hostname".into()))?),
|
||||||
let buf_size = libc::sysconf(libc::_SC_HOST_NAME_MAX) as usize;
|
Err(e) => Err(e.into()),
|
||||||
let mut buf = Vec::<u8>::with_capacity(buf_size + 1);
|
|
||||||
|
|
||||||
if libc::gethostname(buf.as_mut_ptr() as *mut libc::c_char, buf_size) < 0 {
|
|
||||||
return Err(SkipStep(format!("Failed to get hostname: {}", std::io::Error::last_os_error())).into());
|
|
||||||
}
|
|
||||||
let hostname_len = libc::strnlen(buf.as_ptr() as *const libc::c_char, buf_size);
|
|
||||||
buf.set_len(hostname_len);
|
|
||||||
|
|
||||||
Ok(ffi::CString::new(buf).unwrap().into_string().unwrap())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user