From b10dd2d14395b3517e5b7b9a1e71c528934166b3 Mon Sep 17 00:00:00 2001 From: Avinash Singh Date: Oct 13 2025 09:54:48 +0000 Subject: [PATCH 1/3] add weblink to NVR build --- diff --git a/www/kojiweb/index.py b/www/kojiweb/index.py index c9ae5ff..7c73f2f 100644 --- a/www/kojiweb/index.py +++ b/www/kojiweb/index.py @@ -1266,6 +1266,25 @@ def buildinfo(environ, buildID): values['title'] = koji.buildLabel(build) + ' | Build Info' + # For draft builds, find the promoted build with the same target NVR + promoted_build = None + if build.get('draft'): + # Parse the target release from the draft release + # Draft release format: target_release,draft_ + try: + target_release = koji.parse_target_release(build['release']) + # Query for a non-draft build with the same name, version, and target release + target_build_query = { + 'name': build['name'], + 'version': build['version'], + 'release': target_release + } + promoted_build = server.getBuild(target_build_query, strict=False) + except Exception: + # If parsing fails or query fails, just set promoted_build to None + promoted_build = None + values['promoted_build'] = promoted_build + tags = server.listTags(build['id']) tags.sort(key=_sortbyname) rpms = server.listBuildRPMs(build['id']) diff --git a/www/kojiweb/templates/buildinfo.html.j2 b/www/kojiweb/templates/buildinfo.html.j2 index f92fcc4..4d1fb5d 100644 --- a/www/kojiweb/templates/buildinfo.html.j2 +++ b/www/kojiweb/templates/buildinfo.html.j2 @@ -27,6 +27,11 @@ DraftFalse #endif + #if build.draft and promoted_build + + Link to NVR build{{ koji.buildLabel(promoted_build) }} + + #endif #if build.get('source') Source{{ build.source }} From c37043682b691af3ec815d55b3f6f6df719ab9d8 Mon Sep 17 00:00:00 2001 From: Avinash Singh Date: Oct 14 2025 09:21:49 +0000 Subject: [PATCH 2/3] Fixes: https://pagure.io/koji/issue/4438 --- diff --git a/www/kojiweb/index.py b/www/kojiweb/index.py index 7c73f2f..8e4641f 100644 --- a/www/kojiweb/index.py +++ b/www/kojiweb/index.py @@ -1279,10 +1279,13 @@ def buildinfo(environ, buildID): 'version': build['version'], 'release': target_release } - promoted_build = server.getBuild(target_build_query, strict=False) + result = server.getBuild(target_build_query, strict=False) + # Verify that the returned build is indeed a non-draft build + if result and not result.get('draft'): + promoted_build = result except Exception: - # If parsing fails or query fails, just set promoted_build to None - promoted_build = None + # If parsing fails or query fails, promoted_build remains None + pass values['promoted_build'] = promoted_build tags = server.listTags(build['id']) diff --git a/www/kojiweb/templates/buildinfo.html.j2 b/www/kojiweb/templates/buildinfo.html.j2 index 4d1fb5d..500e504 100644 --- a/www/kojiweb/templates/buildinfo.html.j2 +++ b/www/kojiweb/templates/buildinfo.html.j2 @@ -29,7 +29,7 @@ #if build.draft and promoted_build - Link to NVR build{{ koji.buildLabel(promoted_build) }} + Draft superseded by:{{ koji.buildLabel(promoted_build) }} #endif #if build.get('source') From 20af9c0bcbb4baf61a43436d8592d9b212677d9c Mon Sep 17 00:00:00 2001 From: Avinash Singh Date: Oct 14 2025 09:27:01 +0000 Subject: [PATCH 3/3] use non breaking spaces --- diff --git a/www/kojiweb/templates/buildinfo.html.j2 b/www/kojiweb/templates/buildinfo.html.j2 index 500e504..50b0cc1 100644 --- a/www/kojiweb/templates/buildinfo.html.j2 +++ b/www/kojiweb/templates/buildinfo.html.j2 @@ -29,7 +29,7 @@ #if build.draft and promoted_build - Draft superseded by:{{ koji.buildLabel(promoted_build) }} + Draft superseded by:{{ koji.buildLabel(promoted_build) }} #endif #if build.get('source')