summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNamilskyy <alive6863@gmail.com>2025-11-30 20:30:56 +0300
committerNamilskyy <alive6863@gmail.com>2025-11-30 20:30:56 +0300
commit4c050bce3b93fdebc00ceecae034ddcffc01bde6 (patch)
treef18c6fe9893dc3d4104c60401b34cae4e44e9394
parent5abbc4394cb5fc3af432fa5177b203018db009a6 (diff)
Fixed fmt & the number of threads in CI is limited to 2
-rw-r--r--.woodpecker.yaml8
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml10
-rw-r--r--src/main.rs3
-rw-r--r--src/pkgtoolkit/pkgtools.rs67
5 files changed, 34 insertions, 56 deletions
diff --git a/.woodpecker.yaml b/.woodpecker.yaml
index c3cc1ab..4de9fdc 100644
--- a/.woodpecker.yaml
+++ b/.woodpecker.yaml
@@ -35,13 +35,13 @@ jobs:
run: cargo fmt --all -- --check
- name: Lint with clippy
- run: cargo clippy -- -D warnings
+ run: cargo clippy --jobs 2 -- -D warnings
- name: Build
- run: cargo build --verbose
+ run: cargo build --verbose --release --jobs 2
- name: Run tests
- run: cargo test --verbose
+ run: cargo test --verbose --jobs 2
build-cross:
runs-on: ubuntu-latest
@@ -79,7 +79,7 @@ jobs:
if: matrix.target == 'aarch64-unknown-linux-gnu'
- name: Build for ${{ matrix.target }}
- run: cargo build --target ${{ matrix.target }} --release --verbose
+ run: cargo build --target ${{ matrix.target }} --release --verbose --jobs 2
# release:
# runs-on: ubuntu-latest
diff --git a/Cargo.lock b/Cargo.lock
index c9d144f..5716b77 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1198,7 +1198,7 @@ checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
[[package]]
name = "mesk"
-version = "0.1.0"
+version = "0.0.1"
dependencies = [
"cc",
"clap",
diff --git a/Cargo.toml b/Cargo.toml
index 4bd5611..5cdd184 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,10 +1,12 @@
[package]
name = "mesk"
-version = "0.1.0"
+version = "0.0.1"
edition = "2024"
license = "GPL-3.0"
-authors = ["namilsk <namilsk@namilsk.tech>",
- "asya <asyamozgoff@gmail.com>"]
+authors = [ "namilsk <namilsk@namilsk.tech>",
+ "asya <asyamozgoff@gmail.com>" ]
+description = "An i2p-based package manager developed by Anthrill project"
+
[dependencies]
@@ -12,6 +14,7 @@ clap = { version = "4.5.53", features = ["derive"] }
toml = { version = "0.9.8", features = ["serde"] }
serde = { version = "1.0.228", features = ["derive"] }
tokio = { version = "1.48.0", features = ["fs", "io-util", "macros", "rt"] }
+reqwest = { version = "0.12.24", features = ["stream"] }
flate2 = "1.1.5"
log = "0.4.28"
sqlite = "0.37.0"
@@ -19,7 +22,6 @@ tar = "0.4.44"
emissary-core = "0.2.0"
yosemite = "0.6.1"
cc = "1.2.48"
-reqwest = { version = "0.12.24", features = ["stream"] }
url = "2.5.7"
indicatif = "0.18.3"
futures-util = "0.3.31"
diff --git a/src/main.rs b/src/main.rs
index e4d4fd4..2d36f20 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -3,8 +3,7 @@ mod net; // This should contain both i2p_package and http_package modules
mod pkgtoolkit;
use crate::cfg::config::Config;
-use crate::net::{i2p_package::I2PPackage,
- http_package::HTTPPackage};
+use crate::net::{http_package::HTTPPackage, i2p_package::I2PPackage};
#[allow(unused_imports)]
use crate::pkgtoolkit::pkgtools::Package;
diff --git a/src/pkgtoolkit/pkgtools.rs b/src/pkgtoolkit/pkgtools.rs
index 877c8c8..9fe01c6 100644
--- a/src/pkgtoolkit/pkgtools.rs
+++ b/src/pkgtoolkit/pkgtools.rs
@@ -100,9 +100,9 @@ impl Package {
///
/// Returns an error if the build command fails.
fn execute_build(&self, build_meta: &Build) -> Result<(), std::io::Error> {
- let config = Config::parse()
- .map_err(|e| std::io::Error::other(e.to_string()))?;
- let build_dir = Path::new(&config.paths.cache_dir).join(format!("{}-{}", self.name, self.version));
+ let config = Config::parse().map_err(|e| std::io::Error::other(e.to_string()))?;
+ let build_dir =
+ Path::new(&config.paths.cache_dir).join(format!("{}-{}", self.name, self.version));
let mut cmd = match build_meta.build_system {
BuildSystems::Make => {
@@ -139,17 +139,13 @@ impl Package {
}
};
- let output = cmd.output().map_err(|e| {
- std::io::Error::other(
- format!("Build command failed: {}", e),
- )
- })?;
+ let output = cmd
+ .output()
+ .map_err(|e| std::io::Error::other(format!("Build command failed: {}", e)))?;
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
- return Err(std::io::Error::other(
- format!("Build failed:\n{}", stderr),
- ));
+ return Err(std::io::Error::other(format!("Build failed:\n{}", stderr)));
}
Ok(())
@@ -433,10 +429,9 @@ impl Package {
///
/// Returns an error if the BUILD file is invalid or if the build or install hook fails.
pub fn install(&mut self) -> Result<bool, std::io::Error> {
- let config = Config::parse()
- .map_err(|e| std::io::Error::other( e.to_string()))?;
- let (install_meta, _setts_meta, build_meta) = Self::loadmeta(self)
- .map_err(|e| std::io::Error::other(e.to_string()))?;
+ let config = Config::parse().map_err(|e| std::io::Error::other(e.to_string()))?;
+ let (install_meta, _setts_meta, build_meta) =
+ Self::loadmeta(self).map_err(|e| std::io::Error::other(e.to_string()))?;
let is_build_present_and_not_empty = build_meta.is_some();
@@ -456,17 +451,14 @@ impl Package {
.arg("install")
.current_dir(&build_dir)
.output()
- .map_err(|e| {
- std::io::Error::other(
- format!("'make install' failed: {}", e),
- )
- })?;
+ .map_err(|e| std::io::Error::other(format!("'make install' failed: {}", e)))?;
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
- return Err(std::io::Error::other(
- format!("'make install' failed:\n{}", stderr),
- ));
+ return Err(std::io::Error::other(format!(
+ "'make install' failed:\n{}",
+ stderr
+ )));
}
}
} else {
@@ -485,15 +477,11 @@ impl Package {
Command::new(script).status()
}
.map_err(|e| {
- std::io::Error::other(
- format!("Failed to run custom script: {}", e),
- )
+ std::io::Error::other(format!("Failed to run custom script: {}", e))
})?;
if !status.success() {
- return Err(std::io::Error::other(
- "Custom install script failed",
- ));
+ return Err(std::io::Error::other("Custom install script failed"));
}
} else {
log::info!(
@@ -508,17 +496,12 @@ impl Package {
if let Some(parent) = dest_path.parent() {
create_dir_all(parent).map_err(|e| {
- std::io::Error::other(
- format!("Failed to create parent dir: {}", e),
- )
+ std::io::Error::other(format!("Failed to create parent dir: {}", e))
})?;
}
- fs::copy(&src_path, dest_path).map_err(|e| {
- std::io::Error::other(
- format!("Failed to copy file: {}", e),
- )
- })?;
+ fs::copy(&src_path, dest_path)
+ .map_err(|e| std::io::Error::other(format!("Failed to copy file: {}", e)))?;
let mode = u32::from_str_radix(&install_meta.install.mode, 8).map_err(|_| {
std::io::Error::new(
@@ -528,9 +511,7 @@ impl Package {
})?;
let perms = PermissionsExt::from_mode(mode);
fs::set_permissions(dest_path, perms).map_err(|e| {
- std::io::Error::other(
- format!("Failed to set permissions: {}", e),
- )
+ std::io::Error::other(format!("Failed to set permissions: {}", e))
})?;
let output = Command::new("chown")
@@ -540,11 +521,7 @@ impl Package {
))
.arg(dest_path)
.output()
- .map_err(|e| {
- std::io::Error::other(
- format!("'chown' command failed: {}", e),
- )
- })?;
+ .map_err(|e| std::io::Error::other(format!("'chown' command failed: {}", e)))?;
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);