deno: patch out upgrade check and subcommand

Also move patches to subdir and rename with ordering.
This commit is contained in:
06kellyjac 2025-07-25 14:51:46 +01:00
parent 87b5bc2e12
commit 13a5891f12
6 changed files with 125 additions and 3 deletions

View File

@ -43,9 +43,17 @@ rustPlatform.buildRustPackage (finalAttrs: {
cargoHash = "sha256-ZEWSnath9v04wU1VyFDAx3LANnVhfE5s93jX4QW3XlI=";
patches = [
./tests-replace-hardcoded-paths.patch
./tests-darwin-differences.patch
./tests-no-chown.patch
# Patch out the remote upgrade (deno update) check.
# Not a blocker in the build sandbox, since implementation and tests are
# considerately written for no external networking, but removing brings
# in-line with common nixpkgs practice.
./patches/0000-remove-deno-upgrade-check.patch
# Patch out the upgrade sub-command since that wouldn't correctly upgrade
# deno from nixpkgs.
./patches/0001-remove-deno-upgrade.patch
./patches/0002-tests-replace-hardcoded-paths.patch
./patches/0003-tests-linux-no-chown.patch
./patches/0004-tests-darwin-fixes.patch
];
postPatch =
''

View File

@ -0,0 +1,41 @@
diff --git a/cli/tools/upgrade.rs b/cli/tools/upgrade.rs
index 3f4bcc8c7..74d5805a3 100644
--- a/cli/tools/upgrade.rs
+++ b/cli/tools/upgrade.rs
@@ -310,10 +310,7 @@ async fn print_release_notes(
}
pub fn upgrade_check_enabled() -> bool {
- matches!(
- env::var("DENO_NO_UPDATE_CHECK"),
- Err(env::VarError::NotPresent)
- )
+ false
}
pub fn check_for_upgrades(
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index e1bc861e4..612599c4c 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -1283,7 +1283,6 @@ static ENV_VARIABLES_HELP: &str = cstr!(
database.
<g>DENO_EMIT_CACHE_MODE</> Control if the transpiled sources should be cached.
<g>DENO_NO_PACKAGE_JSON</> Disables auto-resolution of package.json
- <g>DENO_NO_UPDATE_CHECK</> Set to disable checking if a newer Deno version is available
<g>DENO_SERVE_ADDRESS</> Override address for Deno.serve
Example: "tcp:0.0.0.0:8080", "unix:/tmp/deno.sock", or "vsock:1234:5678"
<g>DENO_AUTO_SERVE</> If the entrypoint contains export default { fetch }, `deno run`
diff --git a/tests/integration/upgrade_tests.rs b/tests/integration/upgrade_tests.rs
index b342c17f7..1f54292f0 100644
--- a/tests/integration/upgrade_tests.rs
+++ b/tests/integration/upgrade_tests.rs
@@ -43,6 +43,7 @@ fn upgrade_invalid_lockfile() {
);
}
+#[ignore]
#[flaky_test::flaky_test]
fn upgrade_prompt() {
let context = upgrade_context();

View File

@ -0,0 +1,73 @@
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index e1bc861e4..05f070563 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -1349,8 +1349,6 @@ static DENO_HELP: &str = cstr!(
<g>test</> Run tests
<p(245)>deno test | deno test test.ts</>
<g>publish</> Publish the current working directory's package or workspace
- <g>upgrade</> Upgrade deno executable to given version
- <p(245)>deno upgrade | deno upgrade 1.45.0 | deno upgrade canary</>
{after-help}
<y>Docs:</> https://docs.deno.com
@@ -1536,7 +1534,6 @@ pub fn flags_from_vec(args: Vec<OsString>) -> clap::error::Result<Flags> {
"types" => types_parse(&mut flags, &mut m),
"uninstall" => uninstall_parse(&mut flags, &mut m),
"update" => outdated_parse(&mut flags, &mut m, true)?,
- "upgrade" => upgrade_parse(&mut flags, &mut m),
"vendor" => vendor_parse(&mut flags, &mut m),
"publish" => publish_parse(&mut flags, &mut m)?,
_ => unreachable!(),
@@ -1797,7 +1794,6 @@ pub fn clap_root() -> Command {
.subcommand(test_subcommand())
.subcommand(types_subcommand())
.subcommand(update_subcommand())
- .subcommand(upgrade_subcommand())
.subcommand(vendor_subcommand());
let help = help_subcommand(&cmd);
@@ -6644,6 +6640,7 @@ mod tests {
assert_eq!(flags2, flags);
}
+ #[ignore]
#[test]
fn upgrade() {
let r = flags_from_vec(svec!["deno", "upgrade", "--dry-run", "--force"]);
@@ -6665,6 +6662,7 @@ mod tests {
);
}
+ #[ignore]
#[test]
fn upgrade_with_output_flag() {
let r = flags_from_vec(svec!["deno", "upgrade", "--output", "example.txt"]);
@@ -10599,6 +10597,7 @@ mod tests {
);
}
+ #[ignore]
#[test]
fn upgrade_with_ca_file() {
let r = flags_from_vec(svec!["deno", "upgrade", "--cert", "example.crt"]);
@@ -10620,6 +10619,7 @@ mod tests {
);
}
+ #[ignore]
#[test]
fn upgrade_release_candidate() {
let r = flags_from_vec(svec!["deno", "upgrade", "--rc"]);
diff --git a/tests/integration/upgrade_tests.rs b/tests/integration/upgrade_tests.rs
index b342c17f7..a6c2aafc6 100644
--- a/tests/integration/upgrade_tests.rs
+++ b/tests/integration/upgrade_tests.rs
@@ -9,6 +9,7 @@ use test_util::TestContext;
use test_util::assert_starts_with;
use util::TestContextBuilder;
+#[ignore]
#[flaky_test::flaky_test]
fn upgrade_invalid_lockfile() {
let context = upgrade_context();