diff mbox series

[yocto-autobuilder2,06/10] yocto_console_view: fix commit links

Message ID 20251007-contrib-mathieu-bb-setup-links-v1-6-bb1d79289c3f@bootlin.com
State New
Headers show
Series Fix links with bitbake setup and general improvements | expand

Commit Message

Mathieu Dubois-Briand Oct. 7, 2025, 2:37 p.m. UTC
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
---
 .../src/views/ConsoleView/ConsoleView.tsx          | 37 +++++++++++++++---
 .../src/views/ConsoleView/YoctoChangeDetails.tsx   | 44 +++++++++++++++++-----
 2 files changed, 66 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx b/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
index 826ba2aec8bdc775e7365c987284a82628c0db1a..dd84c7913cdab3ae3e4537e4b00d0fb077be4b71 100644
--- a/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
+++ b/yocto_console_view/src/views/ConsoleView/ConsoleView.tsx
@@ -125,7 +125,7 @@  function resolveFakeChange(revision: string, whenTimestamp: number, comment: str
   }
 
   const newChange = {
-    change: new Change(undefined as unknown as IDataAccessor, "a/1", {
+    change: new Change(undefined as unknown as IDataAccessor, {
       changeid: revision,
       author: "",
       branch: "",
@@ -135,8 +135,12 @@  function resolveFakeChange(revision: string, whenTimestamp: number, comment: str
       project: "",
       properties: {},
       repository: "",
-      revision: revision,
-      revlink: null,
+      poky_revision: revision,
+      oecore_revision: null,
+      bitbake_revision: null,
+      poky_revlink: null,
+      oecore_revlink: null,
+      bitbake_revlink: null,
       when_timestamp: whenTimestamp,
     }),
     buildsByBuilderId: new Map<number, Build[]>
@@ -156,8 +160,19 @@  function selectChangeForBuild(build: Build, buildset: Buildset,
   if ((build.properties !== null && ('yp_build_revision' in build.properties))  || (build.buildid in revMapping)) {
     let revision;
     let change = undefined;
+    let oecore_revision = undefined, bitbake_revision = 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 ('commit_oecore' in build.properties) {
+        bitbake_revision = build.properties['commit_bitbake'][0];
+      }
+      if ('use_bitbake_setup' in build.properties) {
+        use_bitbake_setup = build.properties['use_bitbake_setup'][0];
+      }
     } else {
       revision = revMapping[build.buildid];
     }
@@ -178,7 +193,19 @@  function selectChangeForBuild(build: Build, buildset: Buildset,
       if (build.buildid in branchMapping) {
         change.change.caption = branchMapping[build.buildid];
       }
-      change.change.revlink = "http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=" + revision;
+
+      if (!use_bitbake_setup) {
+        change.change.poky_revlink = "http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=" + revision;
+        change.change.poky_revision = revision;
+      } 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_revision = oecore_revision;
+        change.change.bitbake_revision = bitbake_revision;
+      }
       change.change.errorlink = "http://errors.yoctoproject.org/Errors/Latest/?filter=" + revision + "&type=commit&limit=150";
 
       let bid = build.buildid;
@@ -239,7 +266,7 @@  export const ConsoleView = observer(() => {
   const buildsQuery = useDataApiQuery(() => Build.getAll(accessor, {query: {
       limit: buildFetchLimit,
       order: '-started_at',
-      property: ["yp_build_revision", "yp_build_branch", "reason", "publish_destination"],
+      property: ["yp_build_revision", "yp_build_branch", "commit_oecore", "commit_bitbake", "reason", "publish_destination", "use_bitbake_setup"],
     }}));
 
   const windowSize = useWindowSize()
diff --git a/yocto_console_view/src/views/ConsoleView/YoctoChangeDetails.tsx b/yocto_console_view/src/views/ConsoleView/YoctoChangeDetails.tsx
index 37670de255c96efb7135c9eb2ef8f4847a627222..18a74cf170034b4eda6a30b0bd3f484fa686e7a9 100644
--- a/yocto_console_view/src/views/ConsoleView/YoctoChangeDetails.tsx
+++ b/yocto_console_view/src/views/ConsoleView/YoctoChangeDetails.tsx
@@ -70,16 +70,33 @@  export const YoctoChangeDetails = observer(({change, compact, showDetails, setSh
             </tr>
             : <></>
           }
-          <tr>
-            <td>Revision</td>
+          { change.poky_revlink
+          ? <tr>
+            <td>poky revision</td>
             <td>
-            {
-              change.revlink
-              ? <a href={change.revlink}>{change.revision}</a>
-              : <></>
-            }
+              <a href={change.poky_revlink}>{change.poky_revision}</a>
+            </td>
+          </tr>
+          : <></>
+          }
+          { change.oecore_revlink
+          ? <tr>
+            <td>openembedded-core revision</td>
+            <td>
+              <a href={change.oecore_revlink}>{change.oecore_revision}</a>
             </td>
           </tr>
+          : <></>
+          }
+          { change.bitbake_revlink
+          ? <tr>
+            <td>bitbake revision</td>
+            <td>
+              <a href={change.bitbake_revlink}>{change.bitbake_revision}</a>
+            </td>
+          </tr>
+          : <></>
+          }
         </tbody>
       </Table>
       <h5>Comment</h5>
@@ -117,9 +134,16 @@  export const YoctoChangeDetails = observer(({change, compact, showDetails, setSh
                         overlay={popoverWithText("comments-" + change.id, change.caption)}>
           <React.Fragment>
             {
-              change.revlink
-              ? <a href={change.revlink}>{change.caption}</a>
-              : <span>{change.caption}</span>
+              change.poky_revlink
+              ? <a href={change.poky_revlink}>{change.caption} (poky)</a>
+              : change.oecore_revlink
+                ? <a href={change.oecore_revlink}>{change.caption} (oe-core)</a>
+               : <span>{change.caption}</span>
+            }
+            {
+              change.bitbake_revlink
+              ? <a href={change.bitbake_revlink}>{change.caption} (bitbake)</a>
+              : <></>
             }
             {
               change.errorlink