Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new toolchain release 10.3-2021.07 #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
release:
- '10.3-2021.07'
- '10-2020-q4'
- '9-2020-q2'
- '9-2019-q4'
Expand Down
12 changes: 8 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17676,7 +17676,7 @@ function urlExt(s) {
const components = (_a = u.path) === null || _a === void 0 ? void 0 : _a.split('/');
if (components && (components === null || components === void 0 ? void 0 : components.length) > 0) {
const last = components[(components === null || components === void 0 ? void 0 : components.length) - 1];
const dot = last.indexOf('.');
const dot = last.lastIndexOf('.');
if (dot >= 0) {
return last.substr(dot).toLowerCase();
}
Expand Down Expand Up @@ -17707,7 +17707,7 @@ function retryInstall(maxRetries, release, directory, platform) {
extractor = unzipper.Extract({ path: directory });
resp.body.pipe(extractor);
break;
case '.tar.bz2':
case '.bz2':
extractor = tar_1.default.x({ strip: 1, C: directory });
resp.body.pipe(unbzip2_stream_1.default()).pipe(extractor);
break;
Expand Down Expand Up @@ -25026,6 +25026,7 @@ function Extract (opts) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.distributionUrl = exports.availableVersions = void 0;
const versions = {
'10.3-2021.07': 'https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.07/gcc-arm-none-eabi-10.3-2021.07-${ARCH_OS}${MAC_EXTRA_OS}.${EXT}',
'10-2020-q4': 'https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-${ARCH_OS}.${EXT}',
'9-2020-q2': 'https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-${ARCH_OS}.${EXT}',
'9-2019-q4': 'https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-${ARCH_OS}.${EXT}',
Expand Down Expand Up @@ -25065,11 +25066,13 @@ function distributionUrl(version, platform) {
let archOs;
let ext;
let winExtraExt = '';
let macExtraOS = '';
switch (platform) {
case 'darwin':
osName = 'mac';
archOs = 'mac';
ext = 'tar.bz2';
macExtraOS = '-10.14.6';
break;
case 'linux':
osName = 'linux';
Expand All @@ -25085,8 +25088,7 @@ function distributionUrl(version, platform) {
default:
throw new Error(`platform ${platform} is not supported`);
}
const parts = version.split('-');
if (parts.length !== 3) {
if (!versions.hasOwnProperty(version)) {
throw new Error(`invalid version ${version}. Available: ${availableVersions()}`);
}
// Try platform specific URL first
Expand All @@ -25107,6 +25109,8 @@ function distributionUrl(version, platform) {
return ext;
case 'WIN_EXTRA_EXT':
return winExtraExt;
case 'MAC_EXTRA_OS':
return macExtraOS;
}
throw new Error(`unknown replacement ${p1}`);
});
Expand Down
9 changes: 7 additions & 2 deletions src/gcc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const versions: {[key: string]: string} = {
'10.3-2021.07':
'https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.07/gcc-arm-none-eabi-10.3-2021.07-${ARCH_OS}${MAC_EXTRA_OS}.${EXT}',
'10-2020-q4':
'https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-${ARCH_OS}.${EXT}',
'9-2020-q2':
Expand Down Expand Up @@ -67,11 +69,13 @@ export function distributionUrl(version: string, platform: string): string {
let archOs: string
let ext: string
let winExtraExt = ''
let macExtraOS = ''
switch (platform) {
case 'darwin':
osName = 'mac'
archOs = 'mac'
ext = 'tar.bz2'
macExtraOS = '-10.14.6'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The macOS download now contains the OS version (I assume used to build GCC) in the filename, so ${MAC_EXTRA_OS} has been added to the URL to be replaced.

break
case 'linux':
osName = 'linux'
Expand All @@ -87,8 +91,7 @@ export function distributionUrl(version: string, platform: string): string {
default:
throw new Error(`platform ${platform} is not supported`)
}
const parts = version.split('-')
if (parts.length !== 3) {
Comment on lines -90 to -91
Copy link
Author

@carlosperate carlosperate Sep 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the version string now only contains two - this needed to be updated as well.

It looks to me that thiss was basically checking if the version inputted by the user was valid, so I've replaced it with a check for the key in the versions object: if (!versions.hasOwnProperty(version))

if (!versions.hasOwnProperty(version)) {
throw new Error(`invalid version ${version}. Available: ${availableVersions()}`)
}
// Try platform specific URL first
Expand All @@ -109,6 +112,8 @@ export function distributionUrl(version: string, platform: string): string {
return ext
case 'WIN_EXTRA_EXT':
return winExtraExt
case 'MAC_EXTRA_OS':
return macExtraOS
}
throw new Error(`unknown replacement ${p1}`)
})
Expand Down
4 changes: 2 additions & 2 deletions src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function urlExt(s: string): string {
const components = u.path?.split('/')
if (components && components?.length > 0) {
const last = components[components?.length - 1]
const dot = last.indexOf('.')
const dot = last.lastIndexOf('.')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the version format contains dots (.) urlExt() was returning .3-2021.07.tar.bz2 as the extension. So with this change we only look at the last part of the extension.

This also required a change in the switch case below to match .bz2 instead of .tar.bz2.

if (dot >= 0) {
return last.substr(dot).toLowerCase()
}
Expand Down Expand Up @@ -43,7 +43,7 @@ async function retryInstall(maxRetries: number, release: string, directory: stri
extractor = unzipper.Extract({path: directory})
resp.body.pipe(extractor)
break
case '.tar.bz2':
case '.bz2':
extractor = tar.x({strip: 1, C: directory})
resp.body.pipe(bz2()).pipe(extractor)
break
Expand Down