Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
viperML committed Jul 9, 2023
1 parent 77e2548 commit fffdc42
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"rust-analyzer.showUnlinkedFileNotification": false
}
7 changes: 3 additions & 4 deletions src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use color_eyre::eyre::ensure;
use color_eyre::Help;
use daggy::Walker;
use futures::stream::futures_unordered;
use futures::{StreamExt, TryStreamExt};
use indicatif::{MultiProgress, ProgressBar, MultiProgressAlignment};
use futures::TryStreamExt;
use indicatif::{MultiProgress, ProgressBar};
use owo_colors::OwoColorize;
use tracing::{debug, instrument, span, trace, Level};

Expand Down Expand Up @@ -187,8 +187,7 @@ impl Args {
*t = BuildTask::Finished;

let u = format!("{unit:?}");
let msg =
format!(
let msg = format!(
"{} <- {}",
unit.result().store_path().to_string_lossy().bright_blue(),
&u.bright_black()
Expand Down
6 changes: 3 additions & 3 deletions src/build_fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use std::os::unix::prelude::PermissionsExt;
use std::sync::Mutex;

use async_trait::async_trait;
use futures_util::{Stream, StreamExt};
use futures_util::StreamExt;
use indicatif::{ProgressBar, ProgressStyle};
use tracing::{debug, trace, warn};
use tracing::debug;

use crate::db::DbConnection;
use crate::schema_eval::{Build, Fetch};
Expand Down Expand Up @@ -69,7 +69,7 @@ impl Build for Fetch {

tokio::fs::set_permissions(path, perm).await?;

pb.finish();
pb.finish_and_clear();

conn.lock().unwrap().add(&path)?;
Ok(())
Expand Down
13 changes: 6 additions & 7 deletions src/build_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use nix::mount::{mount, MsFlags};
use nix::sched::CloneFlags;
use nix::unistd::{Gid, Pid, Uid};
use tokio_process_stream::ProcessLineStream;
use tracing::{debug, span, warn, Level};
use tracing::{debug, span, trace, Level};

use crate::db::DbConnection;
use crate::mem_app::MemApp;
Expand All @@ -30,7 +30,7 @@ impl Build for Package {
&self,
rebuild: bool,
conn: &Mutex<DbConnection>,
pb: Option<ProgressBar>,
_pb: Option<ProgressBar>,
) -> Result<()> {
let path = self.result.store_path();
let path = path.as_path();
Expand All @@ -51,7 +51,7 @@ impl Build for Package {
let _sandbox_dir = tempfile::tempdir()?;
let sandbox_path = _sandbox_dir.path().to_owned();

warn!(?sandbox_path, ?build_path);
trace!(?sandbox_path, ?build_path);

let ppid = Pid::this();

Expand Down Expand Up @@ -82,7 +82,7 @@ impl Build for Package {
unsafe {
cmd.pre_exec(move || {
let pid = Pid::this();
let _span = span!(Level::WARN, "child", ?pid, ?ppid);
let _span = span!(Level::DEBUG, "child", ?pid, ?ppid);
let _enter = _span.enter();
let uid_outside = Uid::current();
let uid_inside: uid_t = 0;
Expand Down Expand Up @@ -120,8 +120,7 @@ impl Build for Package {

_self.sandbox_setup(bash, busybox, &sandbox_path, &build_path)?;

warn!("DONE");

debug!("pre_exec done");
Ok(())
})
};
Expand Down Expand Up @@ -184,7 +183,7 @@ impl Package {
let uid = Uid::effective();
let gid = Gid::effective();
let my_pid = Pid::this();
warn!(?self, ?uid, ?gid);
trace!(?self, ?uid, ?gid);

mount(
Some(sandbox_path),
Expand Down
2 changes: 1 addition & 1 deletion src/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::str::FromStr;
use color_eyre::eyre::{bail, ensure, Context};
use color_eyre::{Report, Result};
use daggy::petgraph::dot::{Config, Dot};
use daggy::{Dag, NodeIndex, Walker};
use daggy::{Dag, NodeIndex};
use schema_eval::Unit;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
Expand Down
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ mod lua_package;
mod mem_app;
mod schema_db;
mod schema_eval;
#[cfg(no)]
mod semaphore;

use std::io;
use std::path::PathBuf;

use ambassador::{delegatable_trait, Delegate};
use clap::Parser;
use color_eyre::eyre::{bail, eyre, Context, ContextCompat};
use color_eyre::eyre::{bail, eyre, ContextCompat};
use color_eyre::Result;
use file_lock::{FileLock, FileOptions};
use tracing::info;
Expand Down
4 changes: 1 addition & 3 deletions src/mem_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ use nix::sys::mman::{MapFlags, ProtFlags};
use nix::unistd::ftruncate;
use once_cell::sync::Lazy;

use crate::*;

#[derive(Debug)]
pub struct MemApp {
pub fd: OwnedFd,
Expand All @@ -36,10 +34,10 @@ impl MemApp {
fd.as_raw_fd(),
0,
)?;
info!(?dst);
let src = addr_of!(*bytes) as _;
std::ptr::copy_nonoverlapping(src, dst, len);
}

Ok(MemApp { fd })
}
}
Expand Down

0 comments on commit fffdc42

Please sign in to comment.