Skip to content

Commit 7f1c87a

Browse files
committed
fix: installing pr-releases
1 parent fb6672e commit 7f1c87a

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Unreleased
2+
3+
- Fix installing from `leanprover/lean4-pr-releases`, which are not part of release.lean-lang.org.
4+
15
# 4.1.0 - 2025-04-30
26

37
- Fetch releases and assets from release.lean-lang.org instead of parsing GitHub HTML. Makes

src/elan-dist/src/manifestation.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@ use elan_utils::{raw::read_file, utils};
1313
use fslock::LockFile;
1414

1515
pub const DEFAULT_ORIGIN: &str = "leanprover/lean4";
16-
pub const DEFAULT_ORIGIN_JSON_URL: &str = "https://release.lean-lang.org";
16+
const DEFAULT_ORIGIN_JSON_URL: &str = "https://release.lean-lang.org";
17+
18+
pub fn get_json_uri_for_releases(origin: &str) -> Option<&str> {
19+
if origin == DEFAULT_ORIGIN || origin == DEFAULT_ORIGIN.to_owned() + "-nightly" {
20+
Some(DEFAULT_ORIGIN_JSON_URL)
21+
} else {
22+
None
23+
}
24+
}
1725

1826
#[derive(Debug)]
1927
pub struct Manifestation {
@@ -92,8 +100,7 @@ impl Manifestation {
92100
// For historical reasons, the informal target for Linux x64 is a substring of Linux
93101
// aarch64; make sure we don't confuse them
94102
let name_substring = informal_target.clone() + ".";
95-
let url = if origin.starts_with(DEFAULT_ORIGIN) {
96-
let url = DEFAULT_ORIGIN_JSON_URL;
103+
let url = if let Some(url) = get_json_uri_for_releases(origin) {
97104
let json = fetch_url(url)?;
98105
let releases = json::parse(&json)
99106
.chain_err(|| format!("failed to parse release data: {}", url))?;

src/elan/toolchain.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use crate::notifications::*;
66
use elan_dist::dist::ToolchainDesc;
77
use elan_dist::download::DownloadCfg;
88
use elan_dist::manifest::Component;
9+
use elan_dist::manifestation::get_json_uri_for_releases;
910
use elan_dist::manifestation::DEFAULT_ORIGIN;
10-
use elan_dist::manifestation::DEFAULT_ORIGIN_JSON_URL;
1111
use elan_utils::utils;
1212
use elan_utils::utils::fetch_url;
1313
use itertools::Itertools;
@@ -136,8 +136,8 @@ pub fn resolve_toolchain_desc_ext(
136136
use_cache,
137137
)
138138
} else if release == "stable" || release == "beta" || release == "nightly" {
139-
let fetch = if origin.starts_with(DEFAULT_ORIGIN) {
140-
utils::fetch_latest_release_json(DEFAULT_ORIGIN_JSON_URL, release, no_net)
139+
let fetch = if let Some(uri) = get_json_uri_for_releases(origin) {
140+
utils::fetch_latest_release_json(uri, release, no_net)
141141
} else {
142142
if release == "beta" {
143143
return Err(Error::from(

0 commit comments

Comments
 (0)