Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #24 from rwood-moz/bug1156882
Browse files Browse the repository at this point in the history
Bug 1156882 - Add support for emulator ics and kk
  • Loading branch information
Rob Wood committed Apr 27, 2015
2 parents c1643f6 + e8d043d commit 7c265f1
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mozilla-download",
"version": "1.0.4",
"version": "1.0.5",
"description": "Download firefox/b2g-desktop runtimes",
"license": "MIT",
"main": "bin/mozilla-download",
Expand Down
1 change: 1 addition & 0 deletions src/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default async function extract(options) {
case 'dmg':
await extractDmg(options);
break;
case 'tar.gz':
case 'tar.bz2':
await extractTarball(options);
break;
Expand Down
5 changes: 3 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@ export default async function main(args=parser.parseArgs()) {
debug('Artifact url', url);
let path = await download(url, args);
debug('Download to', path);
let extractOpts = { source: path, dest: args.dest, product: args.product };
let product = args.product;
let extractOpts = { source: path, dest: args.dest, product: product };
if (args.fileSuffix) {
let parts = args.fileSuffix.split('.');
extractOpts.filetype = parts[parts.length - 1];
} else {
// They want the regular old build archive.
let os = args.os;
extractOpts.filetype = buildinfo.archiveFiletype(os);
extractOpts.filetype = buildinfo.archiveFiletype(os, product);
}

await extract(extractOpts);
Expand Down
19 changes: 17 additions & 2 deletions src/moz_build_info.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/**
* @return filetype the filetype mozilla uses for build archives on a given os.
*/
export function archiveFiletype(os) {
export function archiveFiletype(os, product) {
if (product.indexOf('emulator') !== -1) {
return 'tar.gz';
}
switch (os) {
case 'mac64':
return 'dmg';
Expand All @@ -20,7 +23,12 @@ export function archiveFiletype(os) {
*/
export function archiveFileSuffix(product, os) {
let ospart = (product === 'firefox' && os === 'mac64') ? 'mac' : os;
return `${ospart}.${archiveFiletype(os)}`;
let filetype = archiveFiletype(os, product);
if (product.indexOf('emulator') !== -1) {
// emulator doen't have os in filename
return filetype;
}
return `${ospart}.${filetype}`;
}

/**
Expand Down Expand Up @@ -60,6 +68,13 @@ export function buildname(options) {
case 'mulet':
result += '-mulet';
break;
case 'emulator':
case 'emulator-ics':
result = 'emulator-ics';
break;
case 'emulator-kk':
result = 'emulator-kk';
break;
default:
throw new Error(`Unknown product ${options.product}`);
}
Expand Down
17 changes: 17 additions & 0 deletions test/detecturl_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,21 @@ suite('detectURL', function() {
assert.equal(error.message, 'Could not find appropriate artifact');
}
});

test('emulator-kk', async function() {
let options = {
product: 'emulator-kk',
os: 'linux-x86_64',
branch: 'mozilla-central'
};

let url = await detectURL(options);
assert.match(
url,
new RegExp(
'^https:\/\/queue\.taskcluster\.net\/v1\/task\/[A-Za-z0-9_\-]+\/' +
'artifacts\/public\/build\/emulator\.tar\.gz$'
)
);
});
});

0 comments on commit 7c265f1

Please sign in to comment.