aboutsummaryrefslogtreecommitdiff
blob: ce4bc1f2c9a8bb55f9c9603c673ec2a508f218dc (plain)
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
<?php

    // Gentoaster build daemon client
    // Licensed under GPL v3, see COPYING file

    if(!isset($argv[1])) die("No config file provided\n");

    $client= new GearmanClient();
    $client->addServer();

    echo "Sending job\n";

    $iniString = file_get_contents($argv[1]);

    $handle = $client->doBackground("invoke_image_build", $iniString);
    $handlehash = md5($handle);

    echo "Job sent, handle was ".$handle." - hash ".$handlehash."\n";

    $db = mysql_connect("localhost", "gentoaster", "");
    if(!$db) die("Could not connect to database ".mysql_error());
    mysql_select_db("gentoaster");
    $query = "INSERT INTO builds (id, handle)".
            ." VALUES('".$handlehash."','".$handle."')";
    mysql_query($query);
    echo "Job handle mapping added to database\n";