summaryrefslogtreecommitdiff
path: root/meta/classes/prserv.bbclass
blob: 18b8589a7b94b687a0859f30116f59a0d7735c1f (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
28
29
def prserv_make_conn(d):
    import prserv.serv
    host=d.getVar("PRSERV_HOST",True)
    port=d.getVar("PRSERV_PORT",True)
    try:
        conn=None
        conn=prserv.serv.PRServerConnection(host,int(port))
        d.setVar("__PRSERV_CONN",conn)
    except Exception, exc:
        bb.fatal("Connecting to PR service %s:%s failed: %s" % (host, port, str(exc)))

    return conn

def prserv_get_pr_auto(d):
    if d.getVar('USE_PR_SERV', True) != "0":
        bb.warn("Not using network based PR service")
        return None

    conn=d.getVar("__PRSERV_CONN", True)
    if conn is None:
        conn=prserv_make_conn(d)
        if conn is None:
            return None

    version=d.getVar("PF", True)
    checksum=d.getVar("BB_TASKHASH", True)
    auto_rev=conn.getPR(version,checksum)
    bb.debug(1,"prserv_get_pr_auto: version: %s checksum: %s result %d" % (version, checksum, auto_rev))
    return auto_rev