Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Revert "Evaluation Stats"
  • Loading branch information
grahamc committed Apr 14, 2019
1 parent fa2c21e commit 6c21ae9
Show file tree
Hide file tree
Showing 15 changed files with 198 additions and 898 deletions.
7 changes: 0 additions & 7 deletions ofborg/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions ofborg/Cargo.nix
Expand Up @@ -123,7 +123,6 @@ let crates = cratesIO // rec {
(cratesIO.crates."lru_cache"."${deps."ofborg"."0.1.8"."lru_cache"}" deps)
(cratesIO.crates."md5"."${deps."ofborg"."0.1.8"."md5"}" deps)
(cratesIO.crates."nom"."${deps."ofborg"."0.1.8"."nom"}" deps)
(cratesIO.crates."separator"."${deps."ofborg"."0.1.8"."separator"}" deps)
(cratesIO.crates."serde"."${deps."ofborg"."0.1.8"."serde"}" deps)
(cratesIO.crates."serde_derive"."${deps."ofborg"."0.1.8"."serde_derive"}" deps)
(cratesIO.crates."serde_json"."${deps."ofborg"."0.1.8"."serde_json"}" deps)
Expand All @@ -146,7 +145,6 @@ let crates = cratesIO // rec {
md5."${deps.ofborg."0.1.8".md5}".default = true;
nom."${deps.ofborg."0.1.8".nom}".default = true;
ofborg."0.1.8".default = (f.ofborg."0.1.8".default or true);
separator."${deps.ofborg."0.1.8".separator}".default = true;
serde."${deps.ofborg."0.1.8".serde}".default = true;
serde_derive."${deps.ofborg."0.1.8".serde_derive}".default = true;
serde_json."${deps.ofborg."0.1.8".serde_json}".default = true;
Expand All @@ -169,7 +167,6 @@ let crates = cratesIO // rec {
(cratesIO.features_.lru_cache."${deps."ofborg"."0.1.8"."lru_cache"}" deps)
(cratesIO.features_.md5."${deps."ofborg"."0.1.8"."md5"}" deps)
(cratesIO.features_.nom."${deps."ofborg"."0.1.8"."nom"}" deps)
(cratesIO.features_.separator."${deps."ofborg"."0.1.8"."separator"}" deps)
(cratesIO.features_.serde."${deps."ofborg"."0.1.8"."serde"}" deps)
(cratesIO.features_.serde_derive."${deps."ofborg"."0.1.8"."serde_derive"}" deps)
(cratesIO.features_.serde_json."${deps."ofborg"."0.1.8"."serde_json"}" deps)
Expand Down Expand Up @@ -378,7 +375,6 @@ rec {
lru_cache = "0.1.1";
md5 = "0.3.8";
nom = "4.1.1";
separator = "0.4.1";
serde = "1.0.84";
serde_derive = "1.0.84";
serde_json = "1.0.34";
Expand Down Expand Up @@ -463,7 +459,6 @@ rec {
core_foundation_sys = "0.2.3";
libc = "0.2.46";
};
deps.separator."0.4.1" = {};
deps.serde."1.0.84" = {};
deps.serde_derive."1.0.84" = {
proc_macro2 = "0.4.24";
Expand Down
1 change: 0 additions & 1 deletion ofborg/Cargo.toml
Expand Up @@ -27,7 +27,6 @@ lru-cache = "0.1.1"
nom = "4.0.0-beta3"
sys-info = "0.5.6"
chrono = "0.4.6"
separator = "0.4.1"

[patch.crates-io]
#hubcaps = { path = "../hubcaps" }
Expand Down
1 change: 0 additions & 1 deletion ofborg/crates-io.list
Expand Up @@ -73,7 +73,6 @@ safemem-0.3.0
schannel-0.1.14
security-framework-0.1.16
security-framework-sys-0.1.16
separator-0.4.1
serde-1.0.84
serde_derive-1.0.84
serde_json-1.0.34
Expand Down
14 changes: 0 additions & 14 deletions ofborg/crates-io.nix
Expand Up @@ -2118,20 +2118,6 @@ rec {
];


# end
# separator-0.4.1

crates.separator."0.4.1" = deps: { features?(features_.separator."0.4.1" deps {}) }: buildRustCrate {
crateName = "separator";
version = "0.4.1";
authors = [ "Saghm Rossi <saghmrossi@gmail.com>" ];
sha256 = "1l7yhf6dy09k9cy0kkwb9wy98rn8mnz72q27wbd6bhiflllwghr7";
};
features_.separator."0.4.1" = deps: f: updateFeatures f (rec {
separator."0.4.1".default = (f.separator."0.4.1".default or true);
}) [];


# end
# serde-1.0.84

Expand Down
1 change: 0 additions & 1 deletion ofborg/src/bin/mass-rebuilder.rs
Expand Up @@ -51,7 +51,6 @@ fn main() {
cloner,
&nix,
cfg.github(),
cfg.github_app_vendingmachine(),
cfg.acl(),
cfg.runner.identity.clone(),
events,
Expand Down
3 changes: 0 additions & 3 deletions ofborg/src/lib.rs
Expand Up @@ -27,7 +27,6 @@ extern crate hyper;
extern crate hyper_native_tls;
extern crate lru_cache;
extern crate md5;
extern crate separator;
extern crate tempfile;
extern crate uuid;

Expand All @@ -48,8 +47,6 @@ pub mod locks;
pub mod maintainers;
pub mod message;
pub mod nix;
pub mod nixenv;
pub mod nixstats;
pub mod notifyworker;
pub mod outpathdiff;
pub mod stats;
Expand Down
85 changes: 37 additions & 48 deletions ofborg/src/nix.rs
Expand Up @@ -2,7 +2,6 @@ use ofborg::asynccmd::{AsyncCmd, SpawnedAsyncCmd};
use ofborg::partition_result;
use std::collections::HashMap;
use std::env;
use std::ffi::OsStr;
use std::fmt;
use std::fs;
use std::io::BufRead;
Expand Down Expand Up @@ -162,7 +161,7 @@ impl Nix {
file: File,
attrs: Vec<String>,
) -> Result<fs::File, fs::File> {
let mut command = self.safe_command::<&OsStr>(&Operation::Instantiate, nixpkgs, &[], &[]);
let mut command = self.safe_command(&Operation::Instantiate, nixpkgs, vec![], &[]);
self.set_attrs_command(&mut command, file, attrs);
self.run(command, true)
}
Expand All @@ -183,7 +182,7 @@ impl Nix {
attrargs.push(argstr.to_owned());
}

self.safe_command(&Operation::Evaluate, nixpkgs, &attrargs, &extra_paths)
self.safe_command(&Operation::Evaluate, nixpkgs, attrargs, &extra_paths)
}

pub fn safely_build_attrs(
Expand All @@ -192,7 +191,7 @@ impl Nix {
file: File,
attrs: Vec<String>,
) -> Result<fs::File, fs::File> {
let mut command = self.safe_command::<&OsStr>(&Operation::Build, nixpkgs, &[], &[]);
let mut command = self.safe_command(&Operation::Build, nixpkgs, vec![], &[]);
self.set_attrs_command(&mut command, file, attrs);
self.run(command, true)
}
Expand All @@ -203,7 +202,7 @@ impl Nix {
file: File,
attrs: Vec<String>,
) -> SpawnedAsyncCmd {
let mut command = self.safe_command::<&OsStr>(&Operation::Build, nixpkgs, &[], &[]);
let mut command = self.safe_command(&Operation::Build, nixpkgs, vec![], &[]);
self.set_attrs_command(&mut command, file, attrs);
AsyncCmd::new(command).spawn()
}
Expand Down Expand Up @@ -232,7 +231,7 @@ impl Nix {
args: Vec<String>,
keep_stdout: bool,
) -> Result<fs::File, fs::File> {
self.run(self.safe_command(&op, nixpkgs, &args, &[]), keep_stdout)
self.run(self.safe_command(&op, nixpkgs, args, &[]), keep_stdout)
}

pub fn run(&self, mut cmd: Command, keep_stdout: bool) -> Result<fs::File, fs::File> {
Expand Down Expand Up @@ -262,43 +261,13 @@ impl Nix {
}
}

pub fn run_stderr_stdout(&self, mut cmd: Command) -> (bool, fs::File, fs::File) {
let stdout_file = tempfile().expect("Fetching a stdout tempfile");
let mut stdout_reader = stdout_file
.try_clone()
.expect("Cloning stdout to the reader");

let stderr_file = tempfile().expect("Fetching a stderr tempfile");
let mut stderr_reader = stderr_file
.try_clone()
.expect("Cloning stderr to the reader");

let status = cmd
.stdout(Stdio::from(stdout_file))
.stderr(Stdio::from(stderr_file))
.status()
.expect("Running a program ...");

stdout_reader
.seek(SeekFrom::Start(0))
.expect("Seeking dout to Start(0)");
stderr_reader
.seek(SeekFrom::Start(0))
.expect("Seeking stderr to Start(0)");

(status.success(), stdout_reader, stderr_reader)
}

pub fn safe_command<S>(
pub fn safe_command(
&self,
op: &Operation,
nixpkgs: &Path,
args: &[S],
args: Vec<String>,
safe_paths: &[&Path],
) -> Command
where
S: AsRef<OsStr>,
{
) -> Command {
let nixpkgspath = format!("nixpkgs={}", nixpkgs.display());
let mut nixpath: Vec<String> = safe_paths
.iter()
Expand Down Expand Up @@ -493,7 +462,12 @@ mod tests {
assert_eq!(op.to_string(), "nix-build");

let ret: Result<fs::File, fs::File> = nix.run(
nix.safe_command(&op, build_path().as_path(), &["--version"], &[]),
nix.safe_command(
&op,
build_path().as_path(),
vec![String::from("--version")],
&[],
),
true,
);

Expand All @@ -511,7 +485,12 @@ mod tests {
assert_eq!(op.to_string(), "nix-instantiate");

let ret: Result<fs::File, fs::File> = nix.run(
nix.safe_command(&op, build_path().as_path(), &["--version"], &[]),
nix.safe_command(
&op,
build_path().as_path(),
vec![String::from("--version")],
&[],
),
true,
);

Expand All @@ -525,7 +504,12 @@ mod tests {
assert_eq!(op.to_string(), "nix-env -qa --json");

let ret: Result<fs::File, fs::File> = nix.run(
nix.safe_command(&op, build_path().as_path(), &["--version"], &[]),
nix.safe_command(
&op,
build_path().as_path(),
vec![String::from("--version")],
&[],
),
true,
);

Expand All @@ -543,7 +527,12 @@ mod tests {
assert_eq!(op.to_string(), "nix-env -qaP --no-name --out-path");

let ret: Result<fs::File, fs::File> = nix.run(
nix.safe_command(&op, build_path().as_path(), &["--version"], &[]),
nix.safe_command(
&op,
build_path().as_path(),
vec![String::from("--version")],
&[],
),
true,
);

Expand All @@ -562,7 +551,7 @@ mod tests {
let nix = nix();

let ret: Result<fs::File, fs::File> = nix.run(
nix.safe_command::<&OsStr>(&env_noop(), build_path().as_path(), &[], &[]),
nix.safe_command(&env_noop(), build_path().as_path(), vec![], &[]),
true,
);

Expand All @@ -589,7 +578,7 @@ mod tests {
);

let ret: Result<fs::File, fs::File> = nix.run(
nix.safe_command::<&OsStr>(&env_noop(), build_path().as_path(), &[], &[]),
nix.safe_command(&env_noop(), build_path().as_path(), vec![], &[]),
true,
);

Expand All @@ -612,7 +601,7 @@ mod tests {
let op = noop(Operation::Build);

let ret: Result<fs::File, fs::File> = nix.run(
nix.safe_command::<&OsStr>(&op, build_path().as_path(), &[], &[]),
nix.safe_command(&op, build_path().as_path(), vec![], &[]),
true,
);

Expand All @@ -628,7 +617,7 @@ mod tests {
let nix = nix();
let op = noop(Operation::Build);

let mut command = nix.safe_command::<&OsStr>(&op, build_path().as_path(), &[], &[]);
let mut command = nix.safe_command(&op, build_path().as_path(), vec![], &[]);
nix.set_attrs_command(
&mut command,
File::DefaultNixpkgs,
Expand All @@ -645,7 +634,7 @@ mod tests {
let nix = nix();
let op = noop(Operation::Instantiate);

let mut command = nix.safe_command::<&OsStr>(&op, build_path().as_path(), &[], &[]);
let mut command = nix.safe_command(&op, build_path().as_path(), vec![], &[]);
nix.set_attrs_command(
&mut command,
File::ReleaseNixOS,
Expand Down

0 comments on commit 6c21ae9

Please sign in to comment.