ci: remove hardcoded chromium version and sysroot file

This commit is contained in:
deepak1556 2022-08-01 21:53:12 +09:00
Родитель cdf6e99020
Коммит b7e713947e
6 изменённых файлов: 28 добавлений и 56 удалений

Просмотреть файл

@ -10,6 +10,7 @@ const fs_1 = require("fs");
const os_1 = require("os");
const path = require("path");
const dep_lists_1 = require("./dep-lists");
const manifests = require("../../../cgmanifest.json");
// A flag that can easily be toggled.
// Make sure to compile the build directory after toggling the value.
// If false, we warn about new dependencies if they show up
@ -76,7 +77,10 @@ function calculatePackageDeps(binaryPath, arch, sysroot) {
console.error('Tried to stat ' + binaryPath + ' but failed.');
}
// Get the Chromium dpkg-shlibdeps file.
const dpkgShlibdepsUrl = 'https://raw.githubusercontent.com/chromium/chromium/100.0.4896.160/third_party/dpkg-shlibdeps/dpkg-shlibdeps.pl';
const chromiumManifest = manifests.registrations.filter(registration => {
return registration.component.type === 'git' && registration.component.git.name === 'chromium';
});
const dpkgShlibdepsUrl = `https://raw.githubusercontent.com/chromium/chromium/${chromiumManifest[0].version}/third_party/dpkg-shlibdeps/dpkg-shlibdeps.pl`;
const dpkgShlibdepsScriptLocation = `${(0, os_1.tmpdir)()}/dpkg-shlibdeps.pl`;
const result = (0, child_process_1.spawnSync)('curl', [dpkgShlibdepsUrl, '-o', dpkgShlibdepsScriptLocation]);
if (result.status !== 0) {

Просмотреть файл

@ -11,6 +11,7 @@ import { tmpdir } from 'os';
import path = require('path');
import { additionalDeps, bundledDeps, referenceGeneratedDepsByArch } from './dep-lists';
import { ArchString } from './types';
import * as manifests from '../../../cgmanifest.json';
// A flag that can easily be toggled.
// Make sure to compile the build directory after toggling the value.
@ -86,7 +87,10 @@ function calculatePackageDeps(binaryPath: string, arch: ArchString, sysroot: str
}
// Get the Chromium dpkg-shlibdeps file.
const dpkgShlibdepsUrl = 'https://raw.githubusercontent.com/chromium/chromium/100.0.4896.160/third_party/dpkg-shlibdeps/dpkg-shlibdeps.pl';
const chromiumManifest = manifests.registrations.filter(registration => {
return registration.component.type === 'git' && registration.component.git!.name === 'chromium';
});
const dpkgShlibdepsUrl = `https://raw.githubusercontent.com/chromium/chromium/${chromiumManifest[0].version}/third_party/dpkg-shlibdeps/dpkg-shlibdeps.pl`;
const dpkgShlibdepsScriptLocation = `${tmpdir()}/dpkg-shlibdeps.pl`;
const result = spawnSync('curl', [dpkgShlibdepsUrl, '-o', dpkgShlibdepsScriptLocation]);
if (result.status !== 0) {

Просмотреть файл

@ -11,7 +11,7 @@ const os_1 = require("os");
const fs = require("fs");
const https = require("https");
const path = require("path");
const sysroots_1 = require("./sysroots");
const util = require("../../lib/util");
// Based on https://source.chromium.org/chromium/chromium/src/+/main:build/linux/sysroot_scripts/install-sysroot.py.
const URL_PREFIX = 'https://msftelectron.blob.core.windows.net';
const URL_PATH = 'sysroots/toolchain';
@ -30,7 +30,14 @@ function getSha(filename) {
return hash.digest('hex');
}
async function getSysroot(arch) {
const sysrootDict = sysroots_1.sysrootInfo[arch];
const sysrootJSONUrl = `https://raw.githubusercontent.com/electron/electron/v${util.getElectronVersion()}/script/sysroots.json`;
const sysrootDictLocation = `${(0, os_1.tmpdir)()}/sysroots.json`;
const result = (0, child_process_1.spawnSync)('curl', [sysrootJSONUrl, '-o', sysrootDictLocation]);
if (result.status !== 0) {
throw new Error('Cannot retrieve sysroots.json. Stderr:\n' + result.stderr);
}
const sysrootInfo = require(sysrootDictLocation);
const sysrootDict = sysrootInfo[`bullseye_${arch}`];
const tarballFilename = sysrootDict['Tarball'];
const tarballSha = sysrootDict['Sha1Sum'];
const sysroot = path.join((0, os_1.tmpdir)(), sysrootDict['SysrootDir']);

Просмотреть файл

@ -9,8 +9,8 @@ import { tmpdir } from 'os';
import * as fs from 'fs';
import * as https from 'https';
import * as path from 'path';
import { sysrootInfo } from './sysroots';
import { ArchString } from './types';
import * as util from '../../lib/util';
// Based on https://source.chromium.org/chromium/chromium/src/+/main:build/linux/sysroot_scripts/install-sysroot.py.
const URL_PREFIX = 'https://msftelectron.blob.core.windows.net';
@ -38,7 +38,14 @@ type SysrootDictEntry = {
};
export async function getSysroot(arch: ArchString): Promise<string> {
const sysrootDict: SysrootDictEntry = sysrootInfo[arch];
const sysrootJSONUrl = `https://raw.githubusercontent.com/electron/electron/v${util.getElectronVersion()}/script/sysroots.json`;
const sysrootDictLocation = `${tmpdir()}/sysroots.json`;
const result = spawnSync('curl', [sysrootJSONUrl, '-o', sysrootDictLocation]);
if (result.status !== 0) {
throw new Error('Cannot retrieve sysroots.json. Stderr:\n' + result.stderr);
}
const sysrootInfo = require(sysrootDictLocation);
const sysrootDict: SysrootDictEntry = sysrootInfo[`bullseye_${arch}`];
const tarballFilename = sysrootDict['Tarball'];
const tarballSha = sysrootDict['Sha1Sum'];
const sysroot = path.join(tmpdir(), sysrootDict['SysrootDir']);

Просмотреть файл

@ -1,26 +0,0 @@
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.sysrootInfo = void 0;
// Based on https://github.com/electron/electron/blob/main/script/sysroots.json,
// which itself is based on https://source.chromium.org/chromium/chromium/src/+/main:build/linux/sysroot_scripts/sysroots.json.
exports.sysrootInfo = {
'amd64': {
'Sha1Sum': '7e008cea9eae822d80d55c67fbb5ef4204678e74',
'SysrootDir': 'debian_sid_amd64-sysroot',
'Tarball': 'debian_sid_amd64_sysroot.tar.xz'
},
'armhf': {
'Sha1Sum': 'b6f4bb07817bea91b06514a9c1e3832df5a90dbf',
'SysrootDir': 'debian_sid_arm-sysroot',
'Tarball': 'debian_sid_arm_sysroot.tar.xz'
},
'arm64': {
'Sha1Sum': '5a56c1ef714154ea5003bcafb16f21b0f8dde023',
'SysrootDir': 'debian_sid_arm64-sysroot',
'Tarball': 'debian_sid_arm64_sysroot.tar.xz'
}
};

Просмотреть файл

@ -1,24 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// Based on https://github.com/electron/electron/blob/main/script/sysroots.json,
// which itself is based on https://source.chromium.org/chromium/chromium/src/+/main:build/linux/sysroot_scripts/sysroots.json.
export const sysrootInfo = {
'amd64': {
'Sha1Sum': '7e008cea9eae822d80d55c67fbb5ef4204678e74',
'SysrootDir': 'debian_sid_amd64-sysroot',
'Tarball': 'debian_sid_amd64_sysroot.tar.xz'
},
'armhf': {
'Sha1Sum': 'b6f4bb07817bea91b06514a9c1e3832df5a90dbf',
'SysrootDir': 'debian_sid_arm-sysroot',
'Tarball': 'debian_sid_arm_sysroot.tar.xz'
},
'arm64': {
'Sha1Sum': '5a56c1ef714154ea5003bcafb16f21b0f8dde023',
'SysrootDir': 'debian_sid_arm64-sysroot',
'Tarball': 'debian_sid_arm64_sysroot.tar.xz'
}
};