1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mageia-sysadm] [268] Import blino's web interface
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5B268%5D%20Import%20blino%27s%20web%20interface&In-Reply-To=%3C20110112114210.7FEFB421F5%40valstar.mageia.org%3E">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="001929.html">
<LINK REL="Next" HREF="001931.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mageia-sysadm] [268] Import blino's web interface</H1>
<B>root at mageia.org</B>
<A HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5B268%5D%20Import%20blino%27s%20web%20interface&In-Reply-To=%3C20110112114210.7FEFB421F5%40valstar.mageia.org%3E"
TITLE="[Mageia-sysadm] [268] Import blino's web interface">root at mageia.org
</A><BR>
<I>Wed Jan 12 12:42:10 CET 2011</I>
<P><UL>
<LI>Previous message: <A HREF="001929.html">[Mageia-sysadm] [Online] Alerte monitoring - Serveur SD-19688 Service ping up
</A></li>
<LI>Next message: <A HREF="001931.html">[Mageia-sysadm] [269] Import my changes + rda's style
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#1930">[ date ]</a>
<a href="thread.html#1930">[ thread ]</a>
<a href="subject.html#1930">[ subject ]</a>
<a href="author.html#1930">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Revision: 268
Author: pterjan
Date: 2011-01-12 12:42:10 +0100 (Wed, 12 Jan 2011)
Log Message:
-----------
Import blino's web interface
Added Paths:
-----------
build_system/web/
build_system/web/index.php
Added: build_system/web/index.php
===================================================================
--- build_system/web/index.php (rev 0)
+++ build_system/web/index.php 2011-01-12 11:42:10 UTC (rev 268)
@@ -0,0 +1,137 @@
+<?php
+
+/* Copyright (C) 2011 Oliver Blin *\
+/**************************************************************************\
+* This program is free software; you can redistribute it and/or modify it *
+* under the terms of the GNU General Public License aspublished by the *
+* Free Software Foundation; either version 2 of the License, or (at your *
+* option) any later version. *
+\**************************************************************************/
+
+error_reporting(E_ALL);
+
+$upload_dir = "/home/schedbot/uploads";
+$max_modified = 2;
+$title = "Mageia build system";
+
+chdir($upload_dir);
+$all_files = shell_exec("find \( -name '*.rpm' -o -name '*.src.rpm.info' -o -name '*.youri' -o -name '*.lock' \) ! -ctime $max_modified");
+
+preg_match_all("!^\./(\w+)/((\w+)/(\w+)/(\w+)/(\d+)\.(\w+)\.(\w+)\.(\d+))_?(.+)(\.src\.rpm(?:\.info)?|\.youri|\.lock)$!m", $all_files, $matches, PREG_SET_ORDER);
+
+$pkgs = array();
+foreach ($matches as $val) {
+ $key = $val[6];
+ if (!is_array($pkgs[$key])) {
+ $pkgs[$key] = array();
+ $pkgs[$key]["status"] = array();
+ $pkgs[$key]["path"] = $val[2];
+ $pkgs[$key]["version"] = $val[3];
+ $pkgs[$key]["media"] = $val[4];
+ $pkgs[$key]["section"] = $val[5];
+ $pkgs[$key]["user"] = $val[7];
+ $pkgs[$key]["host"] = $val[8];
+ $pkgs[$key]["job"] = $val[9];
+ }
+
+ $status = $val[1];
+ $pkgs[$key]["status"][$status] = 1;
+ $data = $val[10];
+ $ext = $val[11];
+ if ($ext == ".src.rpm.info") {
+ preg_match("!^(?:@\d+:)?(.*)!", $data, $name);
+ $pkgs[$key]["package"] = $name[1];
+ } else if ($ext == ".src") {
+ $pkgs[$key]["status"]["src"] = 1;
+ } else if ($ext == ".youri") {
+ $pkgs[$key]["status"]["youri"] = 1;
+ } else if ($ext == ".lock") {
+ // parse build bot from $data
+ $pkgs[$key]["status"]["build"] = 1;
+ }
+}
+// sort by key in reverse order to have more recent pkgs first
+krsort($pkgs);
+?>
+<html>
+
+<head>
+<title><? echo $title ?></title>
+<style type="text/css">
+td.todo {
+ color: black;
+}
+td.building {
+ color: fuchsia;
+}
+td.partial {
+ color: purple;
+}
+td.built {
+ color: blue;
+}
+td.youri {
+ color: olive
+}
+td.uploaded {
+ color: green;
+}
+td.failure, td.failure a, td.rejected, td.rejected a {
+ color: red;
+}
+</style>
+</head>
+
+<body>
+<h1><? echo $title ?></h1>
+
+<table>
+<?
+function pkg_gettype($pkg) {
+ if (array_key_exists("rejected", $pkg["status"]))
+ return "rejected";
+ if (array_key_exists("youri", $pkg["status"])) {
+ if (array_key_exists("src", $pkg["status"]))
+ return "youri";
+ else
+ return "uploaded";
+ }
+ if (array_key_exists("failure", $pkg["status"]))
+ return "failure";
+ if (array_key_exists("done", $pkg["status"]))
+ return "partial";
+ if (array_key_exists("build", $pkg["status"]))
+ return "building";
+ if (array_key_exists("todo", $pkg["status"]))
+ return "todo";
+ return "unknown";
+}
+
+foreach ($pkgs as $key => $p) {
+ $p["type"] = pkg_gettype(&$p);
+ echo "<tr>\n";
+ echo "<td>" . $p["user"] . "</td>\n";
+ echo "<td>" . $p["package"] . "</td>\n";
+ echo "<td>" . $p["version"] . "</td>\n";
+ echo "<td>" . $p["media"] . "/" . $p["section"] . "</td>\n";
+ $typelink = "";
+ if ($p["type"] == "failure") {
+ $typelink = "/uploads/" . $p["type"] . "/" . $p["path"];
+ } else if ($p["type"] == "rejected") {
+ $typelink = "/uploads/" . $p["type"] . "/" . $p["path"] . ".youri";
+ }
+ echo "<td class='" . $p["type"] . "'>";
+ if ($typelink)
+ echo "<a href='$typelink'>";
+ echo $p["type"];
+ if ($typelink)
+ echo "</a>";
+ echo "</td>\n";;
+ echo "</tr>\n";
+}
+?>
+</table>
+
+</body>
+
+</html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20110112/e1e58ce8/attachment.html>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="001929.html">[Mageia-sysadm] [Online] Alerte monitoring - Serveur SD-19688 Service ping up
</A></li>
<LI>Next message: <A HREF="001931.html">[Mageia-sysadm] [269] Import my changes + rda's style
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#1930">[ date ]</a>
<a href="thread.html#1930">[ thread ]</a>
<a href="subject.html#1930">[ subject ]</a>
<a href="author.html#1930">[ author ]</a>
</LI>
</UL>
<hr>
<a href="https://www.mageia.org/mailman/listinfo/mageia-sysadm">More information about the Mageia-sysadm
mailing list</a><br>
</body></html>
|