Skip to content

Commit

Permalink
chore(maker-rpm): map arm64 -> aarch64 (#3137)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanders11 authored Feb 7, 2023
1 parent 3d5c87c commit fd9de41
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 7 additions & 1 deletion packages/maker/rpm/src/MakerRpm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ import { ForgeArch, ForgePlatform } from '@electron-forge/shared-types';

import { MakerRpmConfig } from './Config';

function renameRpm(dest: string, _src: string): string {
return path.join(dest, '<%= name %>-<%= version %>-<%= revision %>.<%= arch === "aarch64" ? "arm64" : arch %>.rpm');
}

export function rpmArch(nodeArch: ForgeArch): string {
switch (nodeArch) {
case 'ia32':
return 'i386';
case 'x64':
return 'x86_64';
case 'arm64':
return 'aarch64';
case 'armv7l':
return 'armv7hl';
case 'arm':
Expand Down Expand Up @@ -43,7 +49,7 @@ export default class MakerRpm extends MakerBase<MakerRpmConfig> {
arch: rpmArch(targetArch),
src: dir,
dest: outDir,
rename: undefined,
rename: renameRpm,
});
return packagePaths;
}
Expand Down
8 changes: 6 additions & 2 deletions packages/maker/rpm/test/MakerRpm_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ describe('MakerRpm', () => {
packageJSON,
});
const opts = eirStub.firstCall.args[0];
delete opts.rename;
expect(opts).to.deep.equal({
arch: rpmArch(process.arch as ForgeArch),
src: dir,
dest: path.join(makeDir, 'rpm', process.arch),
rename: undefined,
});
});

Expand All @@ -81,14 +81,14 @@ describe('MakerRpm', () => {
packageJSON,
});
const opts = eirStub.firstCall.args[0];
delete opts.rename;
expect(opts).to.deep.equal({
arch: rpmArch(process.arch as ForgeArch),
options: {
productName: 'Redhat',
},
src: dir,
dest: path.join(makeDir, 'rpm', process.arch),
rename: undefined,
});
});

Expand All @@ -101,6 +101,10 @@ describe('MakerRpm', () => {
expect(rpmArch('x64')).to.equal('x86_64');
});

it('should convert arm64 to aarch64', () => {
expect(rpmArch('arm64')).to.equal('aarch64');
});

it('should convert arm to armv6hl', () => {
expect(rpmArch('arm')).to.equal('armv6hl');
});
Expand Down

0 comments on commit fd9de41

Please sign in to comment.