Skip to content

Commit

Permalink
Merge branch 'main' of github.com:FyraLabs/anda
Browse files Browse the repository at this point in the history
  • Loading branch information
madonuko committed Jan 15, 2025
2 parents d5258d8 + 9fc9e7d commit 3498ded
Show file tree
Hide file tree
Showing 8 changed files with 345 additions and 48 deletions.
332 changes: 312 additions & 20 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,32 @@ tracing-subscriber = "0.3"
tracing-log = "0.2.0"
color-eyre = { workspace = true }
walkdir = "2.5.0"
tempfile = "3.14.0"
tempfile = "3.15.0"
anda-config = { workspace = true }
andax = { path = "./andax", version = "0.4.8" }
flatpak = "0.18.1"
clap-verbosity-flag = "3.0.2"
tokio = { version = "1.42.0", features = [
tokio = { version = "1.43.0", features = [
"process",
"io-util",
"macros",
"signal",
"rt-multi-thread",
] }
async-trait = "0.1.83"
async-trait = "0.1.85"
nix = { version = "0.29.0", features = ["signal"], default-features = false }
git2 = "0.19.0"
git2 = "0.20.0"
chrono = { workspace = true }
ignore = { workspace = true }
promptly = "0.3.1"
console = "0.15.10"
serde = { workspace = true }
serde_json = { workspace = true }
regex = { workspace = true }
itertools = "0.13.0"
itertools = "0.14.0"
lazy_format = "2.0.3"
lazy_static = { workspace = true }
shell-quote = "0.7.1"
shell-quote = "0.7.2"


[lints]
Expand Down
4 changes: 2 additions & 2 deletions anda-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ version = "0.4.8"
edition = "2021"
license = "MIT"
repository = "https://github.com/FyraLabs/anda"
# TODO:
# readme = "README.md"
readme = "../README.md"

[lib]
path = "./lib.rs"
Expand All @@ -21,6 +20,7 @@ tracing = "0.1"
ignore = { workspace = true }
once_cell = { version = "1.20", default-features = false, features = ["std"] }
parking_lot = "0.12.3"
serde_with = "3.12.0"

[dev-dependencies]
env_logger = ">= 0.10, < 0.12"
Expand Down
10 changes: 9 additions & 1 deletion anda-config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,21 @@ use tracing::{debug, instrument, trace};
use crate::error::ProjectError;

#[derive(Deserialize, Serialize, Debug, Clone)]
#[serde_with::skip_serializing_none]
pub struct ProjectData {
pub manifest: HashMap<String, String>,
}

#[derive(Deserialize, Serialize, Debug, Clone)]
#[serde_with::skip_serializing_none]
pub struct Manifest {
pub project: BTreeMap<String, Project>,
#[serde(default)]
pub config: Config,
}

#[derive(Deserialize, Serialize, Debug, Clone, Default)]
#[serde_with::skip_serializing_none]
pub struct Config {
pub mock_config: Option<String>,
pub strip_prefix: Option<String>,
Expand Down Expand Up @@ -48,6 +51,7 @@ impl Manifest {
}

#[derive(Deserialize, PartialEq, Eq, Serialize, Debug, Clone, Default)]
#[serde_with::skip_serializing_none]
pub struct Project {
pub rpm: Option<RpmBuild>,
pub podman: Option<Docker>,
Expand Down Expand Up @@ -76,7 +80,7 @@ where
{
struct WildString;

impl<'de> serde::de::Visitor<'de> for WildString {
impl serde::de::Visitor<'_> for WildString {
type Value = String;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down Expand Up @@ -176,6 +180,7 @@ where
}

#[derive(Deserialize, PartialEq, Eq, Serialize, Debug, Clone, Default)]
#[serde_with::skip_serializing_none]
pub struct RpmBuild {
pub spec: PathBuf,
pub sources: Option<PathBuf>,
Expand All @@ -194,6 +199,7 @@ pub struct RpmBuild {
}

#[derive(Deserialize, PartialEq, Eq, Serialize, Debug, Clone, Default)]
#[serde_with::skip_serializing_none]
pub struct Docker {
pub image: BTreeMap<String, DockerImage>, // tag, file
}
Expand All @@ -215,6 +221,7 @@ pub fn parse_labels<'a, I: Iterator<Item = &'a str>>(labels: I) -> Option<Vec<(S
}

#[derive(Deserialize, PartialEq, Eq, Serialize, Debug, Clone, Default)]
#[serde_with::skip_serializing_none]
pub struct DockerImage {
pub dockerfile: Option<String>,
pub import: Option<PathBuf>,
Expand All @@ -224,6 +231,7 @@ pub struct DockerImage {
}

#[derive(Deserialize, PartialEq, Eq, Serialize, Debug, Clone)]
#[serde_with::skip_serializing_none]
pub struct Flatpak {
pub manifest: PathBuf,
pub pre_script: Option<PathBuf>,
Expand Down
7 changes: 3 additions & 4 deletions andax/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ edition = "2021"
license = "MIT"
description = "Andaman scripting runtime"
repository = "https://github.com/FyraLabs/anda"
# TODO:
# readme = "README.md"
readme = "../README.md"

[lib]
path = "./lib.rs"
Expand All @@ -22,12 +21,12 @@ ureq = { version = "~2", features = ["json"] }
tracing = { workspace = true }
color-eyre = { workspace = true }
smartstring = "1.0.1"
tempfile = "3.14.0"
tempfile = "3.15.0"
anda-config = { workspace = true }
rhai-fs = "0.1.2"
rhai-url = "0.0.5"
hcl-rs = "0.15.0"
directories = "5.0.1"
directories = "6.0.0"
chrono = { workspace = true }

[lints]
Expand Down
2 changes: 2 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


disallowed-types = ["std::sync::Mutex"]
disallowed-names = ["binding", ".."]
disallowed-macros = ["cmd_lib::run_cmd", "cmd_lib::run_fun"]
Expand Down
24 changes: 10 additions & 14 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,19 @@ 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 {
entries.push(BuildEntry {
pkg: std::mem::take(&mut name),
arch: arch.clone(),
labels: project.labels.clone(),
});
}
entries.extend(DEFAULT_ARCHES.iter().map(|arch| BuildEntry {
pkg: std::mem::take(&mut name),
arch: arch.clone(),
labels: project.labels.clone(),
}));
continue;
}
}
for arch in project.arches.unwrap_or_else(|| DEFAULT_ARCHES.to_vec()) {
entries.push(BuildEntry {
pkg: name.clone(),
arch: arch.clone(),
labels: project.labels.clone(),
});
}
entries.extend(project.arches.unwrap_or_else(|| DEFAULT_ARCHES.to_vec()).into_iter().map(|arch| BuildEntry {
pkg: name.clone(),
arch,
labels: project.labels.clone(),
}));
}

entries
Expand Down
2 changes: 1 addition & 1 deletion xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap_mangen = "0.2.24"
clap_mangen = "0.2.26"
anda = { path = ".." }
clap = { workspace = true }
anyhow = "1.0.95"
Expand Down

0 comments on commit 3498ded

Please sign in to comment.