From a839ee5e5ce65a1be7c438e4a112dc208b987dd1 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Sat, 26 Apr 2025 10:00:35 +0000 Subject: Fix history links --- autobuild/history.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'autobuild/history.php') diff --git a/autobuild/history.php b/autobuild/history.php index c74b0b9..4f8b91c 100644 --- a/autobuild/history.php +++ b/autobuild/history.php @@ -11,14 +11,24 @@ if (!$package_id) { echo "

History of package \"$package\"

\n"; $result = $db->query("SELECT date(datetime(Start, 'unixepoch')) as run, ResultValues.Name FROM Runs, Results, ResultValues WHERE Runs.Id = Results.Run AND Results.Result = ResultValues.Id AND Results.Package = '$package_id' ORDER BY Start DESC"); while ($entry = $result->fetchArray(SQLITE3_ASSOC)) { - $run = $entry['run']; - $build_result = $entry['Name']; - echo "$run "; - if ($link = glob("cauldron/*/core/$run/$package-*.src.rpm/")) { - echo "$build_result
\n"; - } else { - echo "$build_result
\n"; - } + $run = $entry['run']; + $build_result = $entry['Name']; + echo "$run "; + $link_exists = false; + if ($link = glob("cauldron/*/core/$run/$package-*/")) { + # Handle the case when a package is a prefix of several packages + $p = preg_quote($package); + foreach ($link as $l) { + if (preg_match("/$p-[^-]*-[^-]*$/", $l)) { + echo "$build_result
\n"; + $link_exists = true; + break; + } + } + } + if (!$link_exists) { + echo "$build_result
\n"; + } } ?> -- cgit v1.2.1