xaizek / fragile (License: AGPLv3+) (since 2018-12-07)
Simple lightweight CI, attempting to be somewhat Unix-like in its philosophy.
Commit 2a7135095236117f6b8b941f050c9fc50ded7450

Allow specifying list of builders to new.php
Author: xaizek
Author date (UTC): 2017-06-21 10:45
Committer name: xaizek
Committer date (UTC): 2017-06-21 10:47
Parent(s): 2034bd4c07529490191c55e855e42c12325cfead
Signing key: 99DC5E4DB05F6BE2
Tree: 7dff6382509e69c959a96f7026ec55f52d948323
File Lines added Lines deleted
new.php 36 7
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";
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/fragile

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/fragile

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master