From 00a2a7a6c55533096576136e40d22a6e566c6151 Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Mon, 27 Jul 2020 11:24:39 +0200 Subject: [PATCH 1/2] chore: Update common and fixup gitOnlySource The `common` repository was changed to simplify the use of `gitOnlySource`. --- distributed-canisters.nix | 2 +- e2e/bats/default.nix | 2 +- e2e/node/default.nix | 2 +- nix/default.nix | 7 ++++--- nix/sources.json | 2 +- public/default.nix | 2 +- src/agent/javascript/default.nix | 3 +-- src/agent/rust/src/types/canister_id.rs | 1 - src/bootstrap/default.nix | 2 +- 9 files changed, 11 insertions(+), 12 deletions(-) diff --git a/distributed-canisters.nix b/distributed-canisters.nix index b3406068ef..43a9560f92 100644 --- a/distributed-canisters.nix +++ b/distributed-canisters.nix @@ -1,7 +1,7 @@ { pkgs ? import ./nix {} }: let - distributed = lib.noNixFiles (lib.gitOnlySource ./. ./src/distributed); + distributed = lib.noNixFiles (lib.gitOnlySource ./src/distributed); lib = pkgs.lib; in diff --git a/e2e/bats/default.nix b/e2e/bats/default.nix index cabdd4f049..f4f0e92b73 100644 --- a/e2e/bats/default.nix +++ b/e2e/bats/default.nix @@ -4,7 +4,7 @@ , use_ic_ref ? false }: let - e2e = lib.noNixFiles (lib.gitOnlySource ../../. ./.); + e2e = lib.noNixFiles (lib.gitOnlySource ./.); lib = pkgs.lib; sources = pkgs.sources; diff --git a/e2e/node/default.nix b/e2e/node/default.nix index b8d9538b84..f9afac4bcf 100644 --- a/e2e/node/default.nix +++ b/e2e/node/default.nix @@ -3,7 +3,7 @@ , dfx ? import ../../dfx.nix { inherit pkgs; } , agent-js ? import ../../src/agent/javascript { inherit pkgs; } }: -pkgs.napalm.buildPackage (pkgs.lib.noNixFiles (pkgs.lib.gitOnlySource ../../. ./.)) { +pkgs.napalm.buildPackage (pkgs.lib.noNixFiles (pkgs.lib.gitOnlySource ./.)) { root = ./.; name = "node-e2e-tests"; buildInputs = [ dfx.standalone agent-js ]; diff --git a/nix/default.nix b/nix/default.nix index 28f77ccc4c..973c5e282f 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -26,16 +26,17 @@ let sha256 = "007bgq4zy1mjnnkbmaaxvvn4kgpla9wkm0d3lfrz3y1pa3wp9ha1"; }; - pkgs = import commonSrc { + pkgs = import (commonSrc + "/pkgs") { inherit system; + extraSources = sources; + repoRoot = ../.; overlays = [ ( self: super: let - nixFmt = self.lib.nixFmt { root = ../.; }; + nixFmt = self.lib.nixFmt {}; in { - sources = super.sources // sources; # The RustSec-advisory-db used by cargo-audit.nix. # Hydra injects the latest RustSec-advisory-db, otherwise we piggy diff --git a/nix/sources.json b/nix/sources.json index 509ff37817..2cbd73cef7 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -28,7 +28,7 @@ "common": { "ref": "master", "repo": "ssh://git@github.com/dfinity-lab/common", - "rev": "05c44eddb864464c06c27295460eabcf923bc2e9", + "rev": "ecb33243930b8f7ecc0b819215de8599e7be4edc", "type": "git" }, "dfinity": { diff --git a/public/default.nix b/public/default.nix index c11d8e8727..9e7eeb33e1 100644 --- a/public/default.nix +++ b/public/default.nix @@ -5,7 +5,7 @@ let install = pkgs.runCommandNoCC "install.sh.template" { - src = pkgs.lib.gitOnlySource ../. ./install; + src = pkgs.lib.gitOnlySource ./install; preferLocalBuild = true; allowSubstitutes = false; nativeBuildInputs = [ pkgs.shfmt pkgs.shellcheck ]; diff --git a/src/agent/javascript/default.nix b/src/agent/javascript/default.nix index f41b857806..aabcb44b7e 100644 --- a/src/agent/javascript/default.nix +++ b/src/agent/javascript/default.nix @@ -2,8 +2,7 @@ , system ? builtins.currentSystem }: let - repoRoot = ../../..; - src = pkgs.lib.noNixFiles (pkgs.lib.gitOnlySource repoRoot ./.); + src = pkgs.lib.noNixFiles (pkgs.lib.gitOnlySource ./.); in pkgs.napalm.buildPackage src { root = ./.; diff --git a/src/agent/rust/src/types/canister_id.rs b/src/agent/rust/src/types/canister_id.rs index 01ba3cfabd..cfd3544a1f 100644 --- a/src/agent/rust/src/types/canister_id.rs +++ b/src/agent/rust/src/types/canister_id.rs @@ -1,6 +1,5 @@ use crate::types::blob::Blob; use crc8::Crc8; -use hex; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::{fmt, str}; diff --git a/src/bootstrap/default.nix b/src/bootstrap/default.nix index f38e057c38..b45658ad62 100644 --- a/src/bootstrap/default.nix +++ b/src/bootstrap/default.nix @@ -2,7 +2,7 @@ , system ? builtins.currentSystem , agent-js ? import ../agent/javascript { inherit pkgs; } }: -pkgs.napalm.buildPackage (pkgs.lib.noNixFiles (pkgs.lib.gitOnlySource ../../. ./.)) { +pkgs.napalm.buildPackage (pkgs.lib.noNixFiles (pkgs.lib.gitOnlySource ./.)) { root = ./.; name = "bootstrap-js"; buildInputs = [ agent-js ]; From 679cc04419cb836e84b1aa5f1661e84a6e13341b Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Thu, 30 Jul 2020 11:35:14 +0200 Subject: [PATCH 2/2] chore: Apply Rust 1.43 lint fixes The move from 1.41 to 1.43 involves some new lint warnings that are fixed by this commit. --- src/dfx/src/commands/language_service.rs | 1 - src/dfx/src/lib/builders/assets.rs | 2 +- src/dfx/src/lib/canister_info.rs | 2 -- src/dfx/src/lib/logger.rs | 2 -- src/dfx/src/main.rs | 1 - 5 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/dfx/src/commands/language_service.rs b/src/dfx/src/commands/language_service.rs index c0ed7316b8..1a5276c01a 100644 --- a/src/dfx/src/commands/language_service.rs +++ b/src/dfx/src/commands/language_service.rs @@ -3,7 +3,6 @@ use crate::lib::environment::Environment; use crate::lib::error::{DfxError, DfxResult}; use crate::lib::message::UserMessage; use crate::lib::package_arguments::{self, PackageArguments}; -use atty; use clap::{App, AppSettings, Arg, ArgMatches, SubCommand}; use std::process::Stdio; diff --git a/src/dfx/src/lib/builders/assets.rs b/src/dfx/src/lib/builders/assets.rs index a70b0f58b0..b136f6a682 100644 --- a/src/dfx/src/lib/builders/assets.rs +++ b/src/dfx/src/lib/builders/assets.rs @@ -162,7 +162,7 @@ fn delete_output_directory( let output_assets_path = output_assets_path.canonicalize()?; if !output_assets_path.starts_with(info.get_workspace_root()) { return Err(DfxError::DirectoryIsOutsideWorkspaceRoot( - output_assets_path.to_path_buf(), + output_assets_path, )); } fs::remove_dir_all(output_assets_path)?; diff --git a/src/dfx/src/lib/canister_info.rs b/src/dfx/src/lib/canister_info.rs index 7961925b51..ddbf889232 100644 --- a/src/dfx/src/lib/canister_info.rs +++ b/src/dfx/src/lib/canister_info.rs @@ -152,7 +152,6 @@ impl CanisterInfo { .join(PathBuf::from(&self.name)) .join(&self.name) .with_extension("wasm") - .to_path_buf() } pub fn get_build_idl_path(&self) -> PathBuf { @@ -160,7 +159,6 @@ impl CanisterInfo { .join(PathBuf::from(&self.name)) .join(&self.name) .with_extension("did") - .to_path_buf() } pub fn get_output_wasm_path(&self) -> Option { diff --git a/src/dfx/src/lib/logger.rs b/src/dfx/src/lib/logger.rs index ed9e86d83c..c1839e4ab1 100644 --- a/src/dfx/src/lib/logger.rs +++ b/src/dfx/src/lib/logger.rs @@ -1,7 +1,5 @@ use crate::config::dfx_version_str; use slog::{Drain, Level, Logger}; -use slog_async; -use slog_term; use std::fs::File; use std::path::PathBuf; diff --git a/src/dfx/src/main.rs b/src/dfx/src/main.rs index 97fd3fdfd7..f0e741574e 100644 --- a/src/dfx/src/main.rs +++ b/src/dfx/src/main.rs @@ -4,7 +4,6 @@ use crate::lib::environment::{Environment, EnvironmentImpl}; use crate::lib::error::*; use crate::lib::logger::{create_root_logger, LoggingMode}; use clap::{App, AppSettings, Arg, ArgMatches}; -use slog; use std::path::PathBuf; mod actors;