yocto_console_view: Allow to link commits in alternate repos

Instead of always looking for commits in main repos, use values provided
int the "repo_*" build properties. Make sure to use https protocol.

Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Mathieu Dubois-Briand 2025-10-16 15:20:17 +02:00 committed by Richard Purdie
parent 45b39a1b17
commit 37a0183944

View File

@ -149,6 +149,22 @@ function resolveFakeChange(revision: string, whenTimestamp: number, comment: str
return newChange;
}
const gitHostAliases = new Map([
["push.yoctoproject.org", "git.yoctoproject.org"],
["push.openembedded.org", "git.openembedded.org"],
]);
function getHttpURL(url)
{
let u = new URL(url.replace(RegExp("^[a-z]*://"), "https://"));
u.username = "";
if (gitHostAliases.has(u.host)) {
u.host = gitHostAliases.get(u.host)
}
return u.toString();
}
// Adjusts changesByFakeId for any new fake changes that are created
function selectChangeForBuild(build: Build, buildset: Buildset,
changesBySsid: Map<number, ChangeInfo>,
@ -161,15 +177,25 @@ function selectChangeForBuild(build: Build, buildset: Buildset,
let revision;
let change = undefined;
let oecore_revision = undefined, bitbake_revision = undefined;
let oecore_repo = undefined, bitbake_repo = undefined, poky_repo = undefined;
let use_bitbake_setup = false;
if (build.properties !== null && ('yp_build_revision' in build.properties)) {
revision = build.properties['yp_build_revision'][0];
if ('commit_oecore' in build.properties) {
oecore_revision = build.properties['commit_oecore'][0];
}
if ('repo_oecore' in build.properties) {
oecore_repo = build.properties['repo_oecore'][0];
}
if ('commit_oecore' in build.properties) {
bitbake_revision = build.properties['commit_bitbake'][0];
}
if ('repo_bitbake' in build.properties) {
bitbake_repo = build.properties['repo_bitbake'][0];
}
if ('repo_poky' in build.properties) {
poky_repo = build.properties['repo_poky'][0];
}
if ('use_bitbake_setup' in build.properties) {
use_bitbake_setup = build.properties['use_bitbake_setup'][0];
}
@ -194,16 +220,20 @@ function selectChangeForBuild(build: Build, buildset: Buildset,
change.change.caption = branchMapping[build.buildid];
}
oecore_repo = getHttpURL(oecore_repo);
bitbake_repo = getHttpURL(bitbake_repo);
poky_repo = getHttpURL(poky_repo);
if (!use_bitbake_setup) {
change.change.poky_revlink = "http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=" + revision;
change.change.poky_revlink = poky_repo + "/commit/?id=" + revision;
change.change.poky_revision = revision;
change.change.errorlink = "http://errors.yoctoproject.org/Errors/Latest/?filter=" + revision + "&type=commit&limit=150";
} else {
// We might retrieve the "use_bitbake_setup" after the first execution, so wrong poky data might have been added: remove them.
change.change.poky_revlink = change.change.poky_revision = undefined;
change.change.oecore_revlink = "https://git.openembedded.org/openembedded-core/commit/?id=" + oecore_revision;
change.change.bitbake_revlink = "https://git.openembedded.org/bitbake/commit/?id=" + bitbake_revision;
change.change.oecore_revlink = oecore_repo + "/commit/?id=" + oecore_revision;
change.change.bitbake_revlink = bitbake_repo + "/commit/?id=" + bitbake_revision;
change.change.oecore_revision = oecore_revision;
change.change.bitbake_revision = bitbake_revision;
change.change.errorlink = "http://errors.yoctoproject.org/Errors/Latest/?filter=" + oecore_revision + "&type=commit&limit=150";
@ -267,7 +297,7 @@ export const ConsoleView = observer(() => {
const buildsQuery = useDataApiQuery(() => Build.getAll(accessor, {query: {
limit: buildFetchLimit,
order: '-started_at',
property: ["yp_build_revision", "yp_build_branch", "commit_oecore", "commit_bitbake", "reason", "publish_destination", "use_bitbake_setup"],
property: ["yp_build_revision", "yp_build_branch", "repo_poky", "repo_oecore", "commit_oecore", "repo_bitbake", "commit_bitbake", "reason", "publish_destination", "use_bitbake_setup"],
}}));
const windowSize = useWindowSize()