[pgstatus] [PATCH] Suggest using getbuildlog to download build logs
See-also: <[🔎] 20230703083505.oz5s2kzvae7kriw4@mraw.org>
See-also: <ZKKR0QBp3SZU/FHQ@torres.zugschlus.de>
---
fetch.php | 2 ++
index.php | 3 +++
library.php | 27 +++++++++++++++++++++++++++
logs.php | 3 +++
package.php | 4 ++++
recent.php | 3 +++
6 files changed, 42 insertions(+)
diff --git a/fetch.php b/fetch.php
index b34bdfb..d3579b4 100644
--- a/fetch.php
+++ b/fetch.php
@@ -60,6 +60,8 @@ if (!file_exists($path)) {
);
ifecho($links);
+ ifecho(html_download_logs($pkg, $ver, $arch));
+
ifecho("\n<pre>\n");
$skip = true;
diff --git a/index.php b/index.php
index acd4700..fdcc6b2 100644
--- a/index.php
+++ b/index.php
@@ -40,6 +40,9 @@ select_logs(safe_get($packages, 0, ""));
echo "<h3>Recent build logs</h3>";
select_recent_logs();
+echo "<h3>Download build logs</h3>";
+echo html_download_logs(safe_get($packages, 0, 'example'), '1.2.3-4', 'amd64');
+
echo "</div>";
html_footer();
diff --git a/library.php b/library.php
index 65c3d45..5af7f22 100644
--- a/library.php
+++ b/library.php
@@ -1547,6 +1547,8 @@ function buildd_status($packages, $suite, $archis=array()) {
show_ftbfs_bugs($packages, $suite);
+ echo html_download_logs(safe_get($packages, 0, 'example'));
+
buildd_failures($problems, $pas, $suite);
print_legend();
@@ -1702,6 +1704,31 @@ function request_uri() {
return urlencode(sprintf("https://%s%s", $_SERVER["HTTP_HOST"], $_SERVER["REQUEST_URI"]));
}
+function html_download_logs($pkg=NULL, $ver=NULL, $arch=NULL){
+ if (empty($pkg)) $pkg = NULL;
+ if (empty($ver)) $ver = NULL;
+ if (empty($arch)) $arch = NULL;
+ $html = array(
+ 'Install <a href="https://manpages.debian.org/getbuildlog">getbuildlog</a>: '.
+ '<code>sudo apt install <a href="https://packages.debian.org/devscripts">devscripts</a></code>'
+ );
+ if(isset($pkg, $ver, $arch))
+ $html[] = sprintf('Download %s %s %s build log: <code>getbuildlog %s %s %s</code>', $pkg, $ver, $arch, $pkg, $ver, $arch);
+ if(isset($pkg, $ver))
+ $html[] = sprintf('Download all %s %s build logs: <code>getbuildlog %s %s</code>', $pkg, $ver, $pkg, $ver);
+ if(isset($pkg, $arch)){
+ $html[] = sprintf('Download latest %s %s build log: <code>getbuildlog %s "last" %s</code>', $pkg, $arch, $pkg, $arch);
+ $html[] = sprintf('Download all %s %s build logs: <code>getbuildlog %s "" %s</code>', $pkg, $arch, $pkg, $arch);
+ }
+ if(isset($pkg)) {
+ $html[] = sprintf('Download latest %s build logs: <code>getbuildlog %s last</code>', $pkg, $pkg);
+ $html[] = sprintf('Download all %s build logs: <code>getbuildlog %s</code>', $pkg, $pkg);
+ }
+ $html = implode(array_map(function($s){ return $s."<br/>\n";}, $html));
+ $html = '<p>'.$html.'</p>';
+ return $html;
+}
+
function html_footer_text($raw=false) {
global $time;
diff --git a/logs.php b/logs.php
index 02ead76..e7d6fa9 100644
--- a/logs.php
+++ b/logs.php
@@ -157,6 +157,9 @@ if (empty($pkg)) {
}
echo "</table>";
+
+ echo "<h3>Download build logs</h3>\n";
+ echo html_download_logs($pkg, $ver, $arch[0]);
}
echo "</div>";
diff --git a/package.php b/package.php
index 82cb068..b223678 100644
--- a/package.php
+++ b/package.php
@@ -51,6 +51,10 @@ if ($mail && empty($packages)) {
}
if (!empty($packages)) buildd_status($packages, $suite, $archs);
+else {
+ echo "<h3>Download build logs</h3>\n";
+ echo html_download_logs(safe_get($packages, 0, 'example'));
+}
echo "</div>";
html_footer();
diff --git a/recent.php b/recent.php
index 4fe94e4..6b2acf4 100644
--- a/recent.php
+++ b/recent.php
@@ -68,6 +68,7 @@ echo '<table class="data logs"><tr>
<th>Disk space</th>
</tr>';
while($r = pg_fetch_assoc($query_result)) {
+ $last = $r;
$pkg = sprintf("<a href=\"package.php?p=%s&suite=%s\">%s</a>", urlencode($r["package"]), urlencode($r["distribution"]), $r["package"]);
$ver = logs_link($r["package"], "", $r["version"], $r["distribution"], $r["version"]);
$arch = logs_link($r["package"], $r["arch"], "", $r["distribution"], $r["arch"]);
@@ -105,6 +106,8 @@ while($r = pg_fetch_assoc($query_result)) {
}
echo "</table>";
+printf("<h3>Download build logs</h3>");
+echo html_download_logs($last["package"], $last["version"]);
} else {
print(pg_last_error());
}
--
2.40.1
Reply to: