Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit b59e4d0

Browse files
authored
Fix dist search (#99)
simple check for 'rls-preview' no longer works
1 parent 9b467c3 commit b59e4d0

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lib/dist-fetch.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ const _ = require('underscore-plus')
44
const datedNightlyHasRlsCache = new Map()
55
const DATED_REGEX = /(^[^-]+)-(\d{4,}-\d{2}-\d{2})$/
66

7+
/**
8+
* @param {string} manifest toml
9+
* @return {boolean}
10+
*/
11+
function manifest_includes_rls(manifest) {
12+
return manifest.includes('rls-preview') && !manifest.includes('[pkg.rls-preview]\nversion = ""')
13+
}
14+
715
/**
816
* @param {Date|string} date
917
* @param {string=} channel defaults to `nightly`
@@ -22,7 +30,7 @@ async function checkDatedDistHasRls(date, channel='nightly') {
2230
let body = ""
2331
res.on("data", data => {
2432
body += data
25-
if (body.includes('rls-preview')) resolve(cacheKey)
33+
if (manifest_includes_rls(body)) resolve(cacheKey)
2634
})
2735
res.on("end", () => reject(new Error("no 'rls-preview'")))
2836
})
@@ -82,9 +90,9 @@ async function fetchLatestDist({ toolchain, currentVersion="none" }) {
8290
if (!rustcInfo) return reject(new Error('could not split channel toml output'))
8391
let rustcVersion = require('toml').parse(rustcInfo[1]).pkg.rustc.version.trim()
8492
resolve(
85-
!currentVersion.trim().endsWith(rustcVersion) &&
86-
body.includes('rls-preview') &&
87-
`rustc ${rustcVersion}`
93+
!currentVersion.trim().endsWith(rustcVersion)
94+
&& manifest_includes_rls(body)
95+
&& `rustc ${rustcVersion}`
8896
)
8997
})
9098
})

0 commit comments

Comments
 (0)