cargo-edit: 0.4.1 -> 0.4.2
This commit is contained in:
parent
691bebf68b
commit
b0ce0c83f6
@ -1,33 +1,22 @@
|
|||||||
{ stdenv, lib, darwin
|
{ stdenv, lib, darwin
|
||||||
, rustPlatform, fetchFromGitHub
|
, rustPlatform, fetchFromGitHub
|
||||||
, openssl, pkgconfig }:
|
, openssl, pkg-config, libiconv }:
|
||||||
|
|
||||||
rustPlatform.buildRustPackage rec {
|
rustPlatform.buildRustPackage rec {
|
||||||
pname = "cargo-edit";
|
pname = "cargo-edit";
|
||||||
version = "0.4.1";
|
version = "0.4.2";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "killercup";
|
owner = "killercup";
|
||||||
repo = pname;
|
repo = pname;
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "087l8qdwfnnklw6zyjwflxh7hyhh4r7wala36cc4lrj7lag2xm9n";
|
sha256 = "0y0sq0kll6bg0qrfdyas8rcx5dj50j9f05qx244kv7vqxp2q25jq";
|
||||||
};
|
};
|
||||||
|
|
||||||
cargoSha256 = "1ih1p9jdwr1ymq2p6ipz6rybi17f3qn65kn4bqkgzx36afvpnd5l";
|
cargoSha256 = "0prd53p20cha2y2qp8dmq0ywd32f6jm8mszdkbi4x606dj9bcgbl";
|
||||||
|
|
||||||
nativeBuildInputs = lib.optional (!stdenv.isDarwin) pkgconfig;
|
nativeBuildInputs = [ pkg-config ];
|
||||||
buildInputs = lib.optional (!stdenv.isDarwin) openssl;
|
buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ libiconv darwin.apple_sdk.frameworks.Security ];
|
||||||
propagatedBuildInputs = lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
|
|
||||||
|
|
||||||
patches = [
|
|
||||||
# https://github.com/killercup/cargo-edit/pull/362
|
|
||||||
./no_upgrade_index_in_tests.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
# The default `/build` will fail the test (seems) due to permission problem.
|
|
||||||
preCheck = ''
|
|
||||||
export TMPDIR="/tmp"
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "A utility for managing cargo dependencies from the command line";
|
description = "A utility for managing cargo dependencies from the command line";
|
||||||
|
@ -1,123 +0,0 @@
|
|||||||
diff --git a/src/bin/add/main.rs b/src/bin/add/main.rs
|
|
||||||
index 41cde585..848612b3 100644
|
|
||||||
--- a/src/bin/add/main.rs
|
|
||||||
+++ b/src/bin/add/main.rs
|
|
||||||
@@ -87,7 +87,7 @@ fn handle_add(args: &Args) -> Result<()> {
|
|
||||||
let mut manifest = Manifest::open(manifest_path)?;
|
|
||||||
let deps = &args.parse_dependencies()?;
|
|
||||||
|
|
||||||
- if !args.offline {
|
|
||||||
+ if !args.offline && std::env::var("CARGO_IS_TEST").is_err() {
|
|
||||||
let url = registry_url(
|
|
||||||
&find(&manifest_path)?,
|
|
||||||
args.registry.as_ref().map(String::as_ref),
|
|
||||||
diff --git a/src/bin/upgrade/main.rs b/src/bin/upgrade/main.rs
|
|
||||||
index cf2414da..c066e6f4 100644
|
|
||||||
--- a/src/bin/upgrade/main.rs
|
|
||||||
+++ b/src/bin/upgrade/main.rs
|
|
||||||
@@ -409,7 +409,7 @@ fn process(args: Args) -> Result<()> {
|
|
||||||
..
|
|
||||||
} = args;
|
|
||||||
|
|
||||||
- if !args.offline && !to_lockfile {
|
|
||||||
+ if !args.offline && !to_lockfile && std::env::var("CARGO_IS_TEST").is_err() {
|
|
||||||
let url = registry_url(&find(&manifest_path)?, None)?;
|
|
||||||
update_registry_index(&url)?;
|
|
||||||
}
|
|
||||||
@@ -427,7 +427,7 @@ fn process(args: Args) -> Result<()> {
|
|
||||||
|
|
||||||
// Update indices for any alternative registries, unless
|
|
||||||
// we're offline.
|
|
||||||
- if !args.offline {
|
|
||||||
+ if !args.offline && std::env::var("CARGO_IS_TEST").is_err() {
|
|
||||||
for registry_url in existing_dependencies
|
|
||||||
.0
|
|
||||||
.values()
|
|
||||||
diff --git a/tests/cargo-add.rs b/tests/cargo-add.rs
|
|
||||||
index fbdbf4e2..612ffa78 100644
|
|
||||||
--- a/tests/cargo-add.rs
|
|
||||||
+++ b/tests/cargo-add.rs
|
|
||||||
@@ -1184,6 +1184,7 @@ fn add_prints_message() {
|
|
||||||
"--vers=0.6.0",
|
|
||||||
&format!("--manifest-path={}", manifest),
|
|
||||||
])
|
|
||||||
+ .with_env(&[("CARGO_IS_TEST", "1")])
|
|
||||||
.succeeds()
|
|
||||||
.and()
|
|
||||||
.stdout()
|
|
||||||
@@ -1204,6 +1205,7 @@ fn add_prints_message_with_section() {
|
|
||||||
"--vers=0.1.0",
|
|
||||||
&format!("--manifest-path={}", manifest),
|
|
||||||
])
|
|
||||||
+ .with_env(&[("CARGO_IS_TEST", "1")])
|
|
||||||
.succeeds()
|
|
||||||
.and()
|
|
||||||
.stdout()
|
|
||||||
@@ -1224,6 +1226,7 @@ fn add_prints_message_for_dev_deps() {
|
|
||||||
"0.8.0",
|
|
||||||
&format!("--manifest-path={}", manifest),
|
|
||||||
])
|
|
||||||
+ .with_env(&[("CARGO_IS_TEST", "1")])
|
|
||||||
.succeeds()
|
|
||||||
.and()
|
|
||||||
.stdout()
|
|
||||||
@@ -1244,6 +1247,7 @@ fn add_prints_message_for_build_deps() {
|
|
||||||
"0.1.0",
|
|
||||||
&format!("--manifest-path={}", manifest),
|
|
||||||
])
|
|
||||||
+ .with_env(&[("CARGO_IS_TEST", "1")])
|
|
||||||
.succeeds()
|
|
||||||
.and()
|
|
||||||
.stdout()
|
|
||||||
diff --git a/tests/cargo-upgrade.rs b/tests/cargo-upgrade.rs
|
|
||||||
index b11a88dc..cf117940 100644
|
|
||||||
--- a/tests/cargo-upgrade.rs
|
|
||||||
+++ b/tests/cargo-upgrade.rs
|
|
||||||
@@ -385,6 +385,7 @@ fn upgrade_workspace() {
|
|
||||||
|
|
||||||
/// Detect if attempting to run against a workspace root and give a helpful warning.
|
|
||||||
#[test]
|
|
||||||
+#[cfg(feature = "test-external-apis")]
|
|
||||||
fn detect_workspace() {
|
|
||||||
let (_tmpdir, root_manifest, _workspace_manifests) = copy_workspace_test();
|
|
||||||
|
|
||||||
@@ -414,6 +415,7 @@ fn invalid_manifest() {
|
|
||||||
"--manifest-path",
|
|
||||||
&manifest,
|
|
||||||
])
|
|
||||||
+ .with_env(&[("CARGO_IS_TEST", "1")])
|
|
||||||
.fails_with(1)
|
|
||||||
.and()
|
|
||||||
.stderr()
|
|
||||||
@@ -442,6 +444,7 @@ fn invalid_root_manifest() {
|
|
||||||
"--manifest-path",
|
|
||||||
&manifest,
|
|
||||||
])
|
|
||||||
+ .with_env(&[("CARGO_IS_TEST", "1")])
|
|
||||||
.fails_with(1)
|
|
||||||
.and()
|
|
||||||
.stderr()
|
|
||||||
@@ -457,6 +460,7 @@ fn unknown_flags() {
|
|
||||||
"foo",
|
|
||||||
"--flag",
|
|
||||||
])
|
|
||||||
+ .with_env(&[("CARGO_IS_TEST", "1")])
|
|
||||||
.fails_with(1)
|
|
||||||
.and()
|
|
||||||
.stderr()
|
|
||||||
@@ -473,6 +477,7 @@ For more information try --help ",
|
|
||||||
|
|
||||||
// Verify that an upgraded Cargo.toml matches what we expect.
|
|
||||||
#[test]
|
|
||||||
+#[cfg(feature = "test-external-apis")]
|
|
||||||
fn upgrade_to_lockfile() {
|
|
||||||
let (tmpdir, manifest) = clone_out_test("tests/fixtures/upgrade/Cargo.toml.lockfile_source");
|
|
||||||
fs::copy(
|
|
||||||
@@ -489,6 +494,7 @@ fn upgrade_to_lockfile() {
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
+#[cfg(feature = "test-external-apis")]
|
|
||||||
fn upgrade_workspace_to_lockfile() {
|
|
||||||
let (tmpdir, root_manifest, _workspace_manifests) = copy_workspace_test();
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user