Skip to content

Commit

Permalink
add downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
partouf committed Nov 25, 2024
1 parent d2e29f0 commit 9e8b6fc
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cpp-build-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ class CppBuildResultsView {
if (!item.success.BOOL && has_logging(compiler_details.compiler_version, compiler_details.arch, compiler_details.libcxx)) {
logging_url = `/getlogging_forcommit/${library}/${library_version}/${commit_hash}/${compiler_details.compiler_version}/${compiler_details.arch || ' '}/${compiler_details.libcxx || ' '}`;
} else if (item.success.BOOL) {
// TODO: requires new API call downloadpkg specifically for arch+libcxx
// TODO: how to make sure user knows this is the latest package and might not be for this commit?
package_url = '';
package_url = `/downloadpkg/${library}/${library_version}/${compiler_details.compiler_version}/${compiler_details.arch || ' '}/${compiler_details.libcxx || ' '}`;
}

return {
...compiler_details,
success: item.success.BOOL ? 'ok' : 'failed',
logging_url,
package_url,
}
});

Expand Down
31 changes: 31 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,37 @@ function main() {
res.send(e);
}
})
.options('/downloadpkg/:library/:library_version/:compiler_version/:arch/:libcxx', libraryexpireheaders, async (req, res) => {
res.send();
})
.get('/downloadpkg/:library/:library_version/:compiler_version/:arch/:libcxx', libraryexpireheaders, async (req, res) => {
let found = false;
try {
const all = await getConanBinaries(req.params.library, req.params.library_version);
const compiler = all.perCompiler[req.params.compiler_version];
const combinationIdx = all.possibleCombinations.findIndex((combo) =>
combo.arch === req.params.arch.trim() &&
combo['compiler.libcxx'] === req.params.libcxx.trim());

if (combinationIdx !== -1 && compiler) {

const hashIdx = compiler.combinations.indexOf(combinationIdx);
if (hashIdx !== -1) {
const hash = compiler.hashes[hashIdx];
const url = await getPackageUrl(req.params.library, req.params.library_version, hash);
if (url && url['conan_package.tgz']) {
found = true;
res.redirect(302, url['conan_package.tgz']);
}
}
}

if (!found) res.sendStatus(404);
} catch (e) {
console.error(e);
res.send(e);
}
})
.get('/annotations/:libraryid/:version/:buildhash', expireshourly, async (req, res) => {
const data = await annotations.readAnnotations(req.params.libraryid, req.params.version, req.params.buildhash);
res.send(data);
Expand Down
3 changes: 3 additions & 0 deletions views/library_build_results.pug
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ block prepend content
//- else
//- a(href='?allcompilers=1') Show all possible compilers
div(class='caveats')
em * note that logging for failed builds is only available for the most recent commits and package downloads are always for the latest build

table(width="100%" class="table table-striped")
theader
tr(class="binmatrixheader")
Expand Down

0 comments on commit 9e8b6fc

Please sign in to comment.