aboutsummaryrefslogtreecommitdiff
path: root/utils/remove.php
diff options
context:
space:
mode:
authorGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-08-29 22:53:51 +0200
committerGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-08-29 22:53:51 +0200
commit859786f14aa36dcf9cb07d1bfd9b1592d432697a (patch)
tree120c7153c0446da6e11d188761e0a7ace0deca82 /utils/remove.php
parentfc15a081828f8eaa59dab467cbc1715aa0eb2a2b (diff)
downloadbuildroot-test-859786f14aa36dcf9cb07d1bfd9b1592d432697a.tar.gz
buildroot-test-859786f14aa36dcf9cb07d1bfd9b1592d432697a.tar.bz2
Add tool to remove build results
This new utility, to be executed directly on the server, allows to remove build results. It is useful to remove bogus build results that are due to autobuilder slaves configuration problems rather than real Buildroot issues. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'utils/remove.php')
-rwxr-xr-xutils/remove.php67
1 files changed, 67 insertions, 0 deletions
diff --git a/utils/remove.php b/utils/remove.php
new file mode 100755
index 0000000..07a7fd3
--- /dev/null
+++ b/utils/remove.php
@@ -0,0 +1,67 @@
+#!/usr/bin/env php5
+<?php
+/*
+ * Remove one build failure from the database
+ */
+
+include(dirname(__FILE__) . "/../web/funcs.inc.php");
+
+if (count($argv) != 2) {
+ echo "Wrong number of arguments\n";
+ exit(1);
+}
+
+$hash = $argv[1];
+
+$db = new db();
+
+echo "Getting id from results...";
+
+$sql = "select id from results where identifier='" . $hash . "'";
+$ret = $db->query($sql);
+if ($ret == FALSE) {
+ echo "FAILED\n";
+ exit(1);
+}
+if (mysql_num_rows($ret) != 1) {
+ echo "NOT FOUND\n";
+ exit(1);
+}
+
+$c = mysql_fetch_object($ret);
+$id = $c->id;
+
+echo " $id\n";
+
+$path = $maindir . "/results/" . substr($hash, 0, 3) . "/" . $hash;
+
+if (!is_writable($path)) {
+ echo "ERROR: you don't have write permission on the result directory\n";
+ exit(1);
+}
+
+echo "Removing from results_config...";
+
+$sql = "delete from results_config where resultid=" . $id;
+$ret = $db->query($sql);
+if ($ret == FALSE) {
+ echo "FAILED\n";
+ exit(1);
+}
+echo "DONE\n";
+
+echo "Removing from results...";
+
+$sql = "delete from results where id=" . $id;
+$ret = $db->query($sql);
+if ($ret == FALSE) {
+ echo "FAILED\n";
+ exit(1);
+}
+echo "DONE\n";
+
+echo "Removing build results...";
+system("rm -rf " . $path);
+echo "DONE\n";
+
+?>