From d5fb163618e360c5f21ea8fa6821a9b379e776f6 Mon Sep 17 00:00:00 2001
From: Maximilian Bosch <maximilian@mbosch.me>
Date: Sun, 17 Mar 2024 12:57:59 +0100
Subject: [PATCH] Only show stepname if it doesn't equal the name of the drv

When building e.g. nixpkgs, the "Running builds" view will mostly look
like this

    hello.x86_64-linux (Build of hello-X.Y)
    exa.x86_64-linux (Build of exa-X.Y)
    ...

This doesn't provide any useful information. Showing the step name only
makes sense if it's not a child of the job's derivation. With this
patch, that information will only be shown if the drv name (i.e. w/o
`/nix/store/` prefix, .drv ext & hash) is not equal to the drv name of
the job itself (build.nixname).
---
 src/root/common.tt | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/root/common.tt b/src/root/common.tt
index b96cf99c..842ad109 100644
--- a/src/root/common.tt
+++ b/src/root/common.tt
@@ -96,8 +96,10 @@ BLOCK renderDrvInfo;
     .substr(11) # strip `/nix/store/`
     .split('-').slice(1).join("-") # strip hash part
     .substr(0, -4); # strip `.drv`
-  IF step.type == 0; action = "Build"; ELSE; action = "Substitution"; END;
-  IF drvname; %]<em> ([% action %] of [% drvname %])</em>[% END;
+  IF drvname != releasename;
+    IF step.type == 0; action = "Build"; ELSE; action = "Substitution"; END;
+    IF drvname; %]<em> ([% action %] of [% drvname %])</em>[% END;
+  END;
 END;
 
 
@@ -143,7 +145,7 @@ BLOCK renderBuildListBody;
         <td>
           <a href="[%link%]">[% IF !hideJobsetName %][%build.jobset.get_column("project")%]:[%build.jobset.get_column("name")%]:[% END %][%build.get_column("job")%]</a>
           [% IF showStepName %]
-            [% INCLUDE renderDrvInfo step=build.buildsteps %]
+            [% INCLUDE renderDrvInfo step=build.buildsteps releasename=build.nixname %]
           [% END %]
         </td>
       [% END %]