mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-21 12:18:32 +00:00
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
Lock Linux to minimum supported version (Ubuntu 18.04 / RHEL 8, glibc 2.28).
43 lines
1 KiB
JavaScript
43 lines
1 KiB
JavaScript
import { exec as execSync } from "child_process";
|
|
import util from "node:util";
|
|
|
|
const exec = util.promisify(execSync);
|
|
const binaryPath = process.argv[2];
|
|
|
|
// get glibc symbols by l
|
|
const symbols = await exec(`objdump -T ${binaryPath}`);
|
|
|
|
const GLIBC_VERSION_REGEX = /\(GLIBC_([\d.]+)\)/;
|
|
|
|
const versionSet = new Set(
|
|
symbols.stdout
|
|
.split("\n")
|
|
.filter((line) => line.match(GLIBC_VERSION_REGEX))
|
|
.map((line) => line.match(GLIBC_VERSION_REGEX)[1]),
|
|
);
|
|
|
|
class GLIBCVersion {
|
|
constructor(version) {
|
|
this.semver = version.split(".").map((it) => Number.parseInt(it));
|
|
}
|
|
}
|
|
|
|
const versions = Array.from(versionSet)
|
|
.map((version) => new GLIBCVersion(version))
|
|
.filter((it) => it.semver.length == 2);
|
|
|
|
let maxMinor = 0;
|
|
for (const version of versions) {
|
|
if (version.semver[0] !== 2) {
|
|
throw new Error("GLIBC version is not 2");
|
|
}
|
|
if (version.semver[1] > maxMinor) {
|
|
maxMinor = version.semver[1];
|
|
}
|
|
}
|
|
|
|
console.log(maxMinor);
|
|
|
|
if (maxMinor > 28) {
|
|
throw new Error(`GLIBC version is greater than 2.28, got GLIBC_2.${maxMinor}`);
|
|
}
|