File new.php changed (mode: 100644) (index 2f4f0a0..10c2433) |
16 |
16 |
require_once __DIR__ . '/classes/Build.php'; |
require_once __DIR__ . '/classes/Build.php'; |
17 |
17 |
require_once __DIR__ . '/classes/Buildset.php'; |
require_once __DIR__ . '/classes/Buildset.php'; |
18 |
18 |
|
|
19 |
|
// TODO: maybe allow specifying list of builders |
|
20 |
|
if (sizeof($argv) != 3) { |
|
21 |
|
print "Usage: ${argv[0]} name revision\n"; |
|
|
19 |
|
if (sizeof($argv) < 3) { |
|
20 |
|
print "Usage: ${argv[0]} name revision [builder-name..]\n"; |
22 |
21 |
die("Wrong invocation\n"); |
die("Wrong invocation\n"); |
23 |
22 |
} |
} |
24 |
23 |
|
|
|
... |
... |
$revision = $argv[2]; |
27 |
26 |
|
|
28 |
27 |
$buildset = Buildset::create($name, $revision); |
$buildset = Buildset::create($name, $revision); |
29 |
28 |
|
|
30 |
|
$builders = scheduleBuilders($buildset, BUILDERS_PATH, ''); |
|
31 |
|
$builders = array_merge($builders, |
|
32 |
|
scheduleBuilders($buildset, BUILDERS_PATH, "$name/")); |
|
|
29 |
|
if (sizeof($argv) > 3) { |
|
30 |
|
$builders = scheduleBuilders($buildset, BUILDERS_PATH, |
|
31 |
|
array_slice($argv, 3)); |
|
32 |
|
} else { |
|
33 |
|
$builders = scheduleBuildersIn($buildset, BUILDERS_PATH, ''); |
|
34 |
|
$builders = array_merge($builders, |
|
35 |
|
scheduleBuildersIn($buildset, BUILDERS_PATH, |
|
36 |
|
"$name/")); |
|
37 |
|
} |
33 |
38 |
|
|
34 |
39 |
print "Buildset ID: $buildset->buildsetid\n"; |
print "Buildset ID: $buildset->buildsetid\n"; |
35 |
40 |
if (sizeof($builders) == 0) { |
if (sizeof($builders) == 0) { |
|
... |
... |
if (sizeof($builders) == 0) { |
40 |
45 |
. ": " . join(', ', $builders) . "\n"; |
. ": " . join(', ', $builders) . "\n"; |
41 |
46 |
} |
} |
42 |
47 |
|
|
|
48 |
|
/** |
|
49 |
|
* @brief Schedules builders in @p dir directory specified by their name. |
|
50 |
|
* |
|
51 |
|
* @param buildset Parent buildset for newly created builds. |
|
52 |
|
* @param dir Directory to look for builders. |
|
53 |
|
* @param names List of builder names (appended to @p dir by one). |
|
54 |
|
* |
|
55 |
|
* @returns Array of scheduler builder names. |
|
56 |
|
*/ |
|
57 |
|
function scheduleBuilders($buildset, $dir, $names) |
|
58 |
|
{ |
|
59 |
|
$builders = []; |
|
60 |
|
foreach ($names as $name) { |
|
61 |
|
$path = "$dir/$name"; |
|
62 |
|
if (!is_dir($path)) { |
|
63 |
|
Build::create($buildset, $name); |
|
64 |
|
array_push($builders, $name); |
|
65 |
|
|
|
66 |
|
closedir($handle); |
|
67 |
|
} |
|
68 |
|
} |
|
69 |
|
return $builders; |
|
70 |
|
} |
|
71 |
|
|
43 |
72 |
/** |
/** |
44 |
73 |
* @brief Schedules builders discovered in @p dir directory. |
* @brief Schedules builders discovered in @p dir directory. |
45 |
74 |
* |
* |
|
... |
... |
if (sizeof($builders) == 0) { |
49 |
78 |
* |
* |
50 |
79 |
* @returns Array of scheduler builder names. |
* @returns Array of scheduler builder names. |
51 |
80 |
*/ |
*/ |
52 |
|
function scheduleBuilders($buildset, $dir, $suffix) |
|
|
81 |
|
function scheduleBuildersIn($buildset, $dir, $suffix) |
53 |
82 |
{ |
{ |
54 |
83 |
$builders = []; |
$builders = []; |
55 |
84 |
$basePath = "$dir/$suffix"; |
$basePath = "$dir/$suffix"; |