Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
madonuko committed Dec 10, 2023
1 parent df01fd5 commit aba6f67
Show file tree
Hide file tree
Showing 12 changed files with 437 additions and 419 deletions.
806 changes: 407 additions & 399 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ tracing = "0.1"
tracing-subscriber = "0.3"
tracing-log = "0.1.3"
color-eyre = "0.6.2"
toml = "0.7.1"
walkdir = "2.3.2"
tempfile = "3.4.0"
anda-config = { path = "./anda-config", version = "0.1.6" }
Expand All @@ -33,7 +32,7 @@ clap_complete = "4.1.5"
cmd_lib = "1.3.0"
tokio = { version = "1.28.2", features = ["full"] }
async-trait = "0.1.67"
nix = "0.26.2"
nix = { version = "0.26.2", features = ["signal"], default-features = false }
git2 = "0.17.2"
chrono = "0.4.24"
ignore = "0.4.18"
Expand Down
2 changes: 1 addition & 1 deletion anda-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ num-traits = "0.2.15"
regex = "~1"
walkdir = "2.3.2"
ignore = "0.4"
once_cell = "1.16"
once_cell = { version = "1.16", default-features = false, features = ["critical-section"] }
parking_lot = "0.12.1"

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions anda-config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Manifest {
self.project.get(key).map_or_else(
|| {
self.project.iter().find_map(|(_k, v)| {
let Some(alias) = &v.alias else { return None };
let alias = v.alias.as_ref()?;
if alias.contains(&key.to_string()) {
Some(v)
} else {
Expand Down Expand Up @@ -272,7 +272,7 @@ pub fn load_from_string(config: &str) -> Result<Manifest, ProjectError> {
}

/// Lints and checks the config for errors.
///
///
/// # Errors
/// - nothing. This function literally does nothing. For now.
pub const fn check_config(config: Manifest) -> Result<Manifest, ProjectError> {
Expand Down
4 changes: 2 additions & 2 deletions anda-config/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use parking_lot::Mutex;
static GLOBAL_CONTEXT: OnceCell<Mutex<Context>> = OnceCell::new();

/// Generate Context for HCL evaluation
///
///
/// # Panics
/// - cannot lock mutex (poison?)
/// - cannot convert FuncArgs to str
Expand All @@ -32,7 +32,7 @@ pub fn hcl_context() -> Context<'static> {
let env = std::env::vars().collect::<BTreeMap<String, String>>();
let mut map = hcl::Map::new();

map.extend(env.into_iter().map(|(k,v)| (k, Value::String(v))));
map.extend(env.into_iter().map(|(k, v)| (k, Value::String(v))));

ctx.declare_var("env", Value::Object(map));

Expand Down
2 changes: 1 addition & 1 deletion anda-config/src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use hcl::template::Template;
use std::str::FromStr;

/// Parse an HCL template.
///
///
/// # Errors
/// - cannot parse template
/// - cannot evaluate template
Expand Down
1 change: 0 additions & 1 deletion andax/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ anda-config = { version = "0.1.6", path = "../anda-config" }
rhai-fs = "0.1.2"
rhai-url = "0.0.2"
hcl-rs = "0.14.0"
serde-value-flatten = "0.1.0"
directories = "5.0.1"
4 changes: 2 additions & 2 deletions andax/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ where
}
}

pub const EARTH: &str = r#"
pub const EARTH: &str = r"
. . * . . . . * . . . . . . * . . . .
* . . * . . . * . . * . . . * . . .
. * . . . . . * . . . .-o--. . * .
Expand All @@ -84,4 +84,4 @@ ____ * . . . . . . . . : O. Oo; . .
| `._\-' ' . . .
| `.__, \ * . . *. .
| \ \. . .
| \ \ . * jrei *"#;
| \ \ . * jrei *";
2 changes: 1 addition & 1 deletion andax/src/fns/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub mod ar {
pub fn sh_rc(o: (i32, String, String)) -> i32 {
o.0
}
/// get stdout from the return value of `sh()`
/// get stdout from the return value of `sh()`
#[rhai_fn(global)]
pub fn sh_stdout(o: (i32, String, String)) -> String {
o.1
Expand Down
21 changes: 16 additions & 5 deletions andax/src/fns/rpm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
fs,
path::{Path, PathBuf},
};
use tracing::{info, error};
use tracing::{error, info};

lazy_static::lazy_static! {
static ref RE_RELEASE: regex::Regex = regex::Regex::new(r"Release:(\s+)(.+?)\n").unwrap();
Expand All @@ -30,6 +30,9 @@ pub struct RPMSpec {

impl RPMSpec {
/// Creates a new RPMSpec file representation
///
/// # Panics
/// - spec file does not exist / cannot read spec to string
pub fn new<T, U>(name: String, chkupdate: T, spec: U) -> Self
where
T: Into<PathBuf> + AsRef<Path>,
Expand Down Expand Up @@ -57,7 +60,9 @@ impl RPMSpec {
}
/// Sets the version in the spec file
pub fn version(&mut self, ver: &str) {
let Some(m) = RE_VERSION.captures(self.f.as_str()) else { return error!("No `Version:` preamble for {}", self.name) };
let Some(m) = RE_VERSION.captures(self.f.as_str()) else {
return error!("No `Version:` preamble for {}", self.name);
};
let ver = ver.strip_prefix('v').unwrap_or(ver).replace('-', ".");
if ver != m[2] {
info!("{}: {} —→ {ver}", self.name, &m[2]);
Expand All @@ -67,20 +72,26 @@ impl RPMSpec {
}
/// Change the value of a `%define` macro by the name
pub fn define(&mut self, name: &str, val: &str) {
let Some(cap) = RE_DEFINE.captures_iter(self.f.as_str()).find(|cap| &cap[2] == name) else { return error!("No `Version:` preamble for {}", self.name) };
let Some(cap) = RE_DEFINE.captures_iter(self.f.as_str()).find(|cap| &cap[2] == name) else {
return error!("No `Version:` preamble for {}", self.name);
};
self.f = self.f.replace(&cap[0], &format!("%define{}{name}{}{val}", &cap[1], &cap[3]));
self.changed = true;
}
/// Change the value of a `%global` macro by the name
pub fn global(&mut self, name: &str, val: &str) {
let Some(cap) = RE_GLOBAL.captures_iter(self.f.as_str()).find(|cap| &cap[2] == name) else { return error!("No `Version:` preamble for {}", self.name) };
let Some(cap) = RE_GLOBAL.captures_iter(self.f.as_str()).find(|cap| &cap[2] == name) else {
return error!("No `Version:` preamble for {}", self.name);
};
self.f = self.f.replace(&cap[0], &format!("%global{}{name}{}{val}", &cap[1], &cap[3]));
self.changed = true;
}
/// Change the `SourceN:` preamble value by `N`
pub fn source(&mut self, i: i64, p: &str) {
let si = i.to_string();
let Some(cap) = RE_SOURCE.captures_iter(self.f.as_str()).find(|cap| cap[1] == si) else { return error!("No `Source{i}:` preamble for {}", self.name)};
let Some(cap) = RE_SOURCE.captures_iter(self.f.as_str()).find(|cap| cap[1] == si) else {
return error!("No `Source{i}:` preamble for {}", self.name);
};
info!("{}: Source{i}: {p}", self.name);
self.f = self.f.replace(&cap[0], &format!("Source{i}:{}{p}\n", &cap[2]));
self.changed = true;
Expand Down
2 changes: 1 addition & 1 deletion andax/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! AndaX, an embedded scripting system powered by Rhai.
//!
//!
//! To start running a script, use `run()`.
#![warn(clippy::pedantic)]
#![warn(clippy::nursery)]
Expand Down
5 changes: 3 additions & 2 deletions src/util.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
//! Utility functions and types
use anda_config::{Docker, DockerImage, Manifest, Project, RpmBuild};
use clap_verbosity_flag::LevelFilter;
use color_eyre::{eyre::eyre, Result};
use console::style;
use cmd_lib::log::{debug, info, LevelFilter};
use nix::{sys::signal, unistd::Pid};
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::{collections::BTreeMap, path::Path};
use tokio::{io::AsyncBufReadExt, process::Command};
use tracing::{debug, info};

lazy_static::lazy_static! {
static ref BUILDARCH_REGEX: Regex = Regex::new("BuildArch:\\s*(.+)").unwrap();
Expand Down Expand Up @@ -44,7 +45,7 @@ pub fn fetch_build_entries(config: Manifest) -> Vec<BuildEntry> {

if let Some(rpm) = project.rpm {
if rpm.enable_scm.unwrap_or(false) {
for arch in DEFAULT_ARCHES.iter() {
for arch in &*DEFAULT_ARCHES {
entries.push(BuildEntry { pkg: std::mem::take(&mut name), arch: arch.clone() });
}
continue;
Expand Down

0 comments on commit aba6f67

Please sign in to comment.