Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/ofborg
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1a924fe0b127
Choose a base ref
...
head repository: NixOS/ofborg
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fa2c21ec8c06
Choose a head ref
  • 19 commits
  • 15 files changed
  • 1 contributor

Commits on Apr 13, 2019

  1. is_none()

    grahamc committed Apr 13, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a92f4ab View commit details
  2. nixstats: init

    grahamc committed Apr 13, 2019
    Copy the full SHA
    8bd49f5 View commit details
  3. outpath diff scratch commit

    grahamc committed Apr 13, 2019
    Copy the full SHA
    09e20e5 View commit details
  4. Copy the full SHA
    62a66a8 View commit details
  5. Copy the full SHA
    9f544b0 View commit details
  6. Copy the full SHA
    d68e35e View commit details
  7. Commit nixenv

    grahamc committed Apr 13, 2019
    Copy the full SHA
    c754739 View commit details
  8. Copy the full SHA
    ad15fd1 View commit details
  9. Delete outpaths

    grahamc committed Apr 13, 2019
    Copy the full SHA
    61be62b View commit details
  10. Copy the full SHA
    3a4bff2 View commit details
  11. Diff nix stats

    grahamc committed Apr 13, 2019
    Copy the full SHA
    a114e86 View commit details

Commits on Apr 14, 2019

  1. num_format: Add to carnix

    grahamc committed Apr 14, 2019
    Copy the full SHA
    9ada5c2 View commit details
  2. fixups

    grahamc committed Apr 14, 2019
    Copy the full SHA
    a7a4152 View commit details
  3. Copy the full SHA
    d297515 View commit details
  4. Publish evaluation erports

    grahamc committed Apr 14, 2019
    Copy the full SHA
    289dba8 View commit details
  5. fixup: nixenv stdout/stderr

    grahamc committed Apr 14, 2019
    Copy the full SHA
    bc943c2 View commit details
  6. send completed_at time

    grahamc committed Apr 14, 2019
    Copy the full SHA
    4f036ec View commit details
  7. fmt

    grahamc committed Apr 14, 2019
    Copy the full SHA
    2bebc96 View commit details
  8. Merge pull request #351 from NixOS/stats

    Evaluation Stats
    grahamc authored Apr 14, 2019
    Copy the full SHA
    fa2c21e View commit details
7 changes: 7 additions & 0 deletions ofborg/Cargo.lock

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

5 changes: 5 additions & 0 deletions ofborg/Cargo.nix
Original file line number Diff line number Diff line change
@@ -123,6 +123,7 @@ 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)
@@ -145,6 +146,7 @@ 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;
@@ -167,6 +169,7 @@ 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)
@@ -375,6 +378,7 @@ 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";
@@ -459,6 +463,7 @@ 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";
1 change: 1 addition & 0 deletions ofborg/Cargo.toml
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ 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" }
1 change: 1 addition & 0 deletions ofborg/crates-io.list
Original file line number Diff line number Diff line change
@@ -73,6 +73,7 @@ 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
14 changes: 14 additions & 0 deletions ofborg/crates-io.nix
Original file line number Diff line number Diff line change
@@ -2118,6 +2118,20 @@ 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

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

@@ -47,6 +48,8 @@ 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;
85 changes: 48 additions & 37 deletions ofborg/src/nix.rs
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ 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;
@@ -161,7 +162,7 @@ impl Nix {
file: File,
attrs: Vec<String>,
) -> Result<fs::File, fs::File> {
let mut command = self.safe_command(&Operation::Instantiate, nixpkgs, vec![], &[]);
let mut command = self.safe_command::<&OsStr>(&Operation::Instantiate, nixpkgs, &[], &[]);
self.set_attrs_command(&mut command, file, attrs);
self.run(command, true)
}
@@ -182,7 +183,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(
@@ -191,7 +192,7 @@ impl Nix {
file: File,
attrs: Vec<String>,
) -> Result<fs::File, fs::File> {
let mut command = self.safe_command(&Operation::Build, nixpkgs, vec![], &[]);
let mut command = self.safe_command::<&OsStr>(&Operation::Build, nixpkgs, &[], &[]);
self.set_attrs_command(&mut command, file, attrs);
self.run(command, true)
}
@@ -202,7 +203,7 @@ impl Nix {
file: File,
attrs: Vec<String>,
) -> SpawnedAsyncCmd {
let mut command = self.safe_command(&Operation::Build, nixpkgs, vec![], &[]);
let mut command = self.safe_command::<&OsStr>(&Operation::Build, nixpkgs, &[], &[]);
self.set_attrs_command(&mut command, file, attrs);
AsyncCmd::new(command).spawn()
}
@@ -231,7 +232,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> {
@@ -261,13 +262,43 @@ impl Nix {
}
}

pub fn safe_command(
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>(
&self,
op: &Operation,
nixpkgs: &Path,
args: Vec<String>,
args: &[S],
safe_paths: &[&Path],
) -> Command {
) -> Command
where
S: AsRef<OsStr>,
{
let nixpkgspath = format!("nixpkgs={}", nixpkgs.display());
let mut nixpath: Vec<String> = safe_paths
.iter()
@@ -462,12 +493,7 @@ 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(),
vec![String::from("--version")],
&[],
),
nix.safe_command(&op, build_path().as_path(), &["--version"], &[]),
true,
);

@@ -485,12 +511,7 @@ 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(),
vec![String::from("--version")],
&[],
),
nix.safe_command(&op, build_path().as_path(), &["--version"], &[]),
true,
);

@@ -504,12 +525,7 @@ 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(),
vec![String::from("--version")],
&[],
),
nix.safe_command(&op, build_path().as_path(), &["--version"], &[]),
true,
);

@@ -527,12 +543,7 @@ 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(),
vec![String::from("--version")],
&[],
),
nix.safe_command(&op, build_path().as_path(), &["--version"], &[]),
true,
);

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

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

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

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

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

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

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

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

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