summaryrefslogtreecommitdiffstats
path: root/meta/classes/prserv.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/prserv.bbclass')
-rw-r--r--meta/classes/prserv.bbclass33
1 files changed, 33 insertions, 0 deletions
diff --git a/meta/classes/prserv.bbclass b/meta/classes/prserv.bbclass
new file mode 100644
index 0000000..b440d86
--- /dev/null
+++ b/meta/classes/prserv.bbclass
@@ -0,0 +1,33 @@
1def prserv_get_pr_auto(d):
2 import oe.prservice
3 import re
4
5 pv = d.getVar("PV", True)
6 if not d.getVar('PRSERV_HOST', True):
7 if 'AUTOINC' in pv:
8 d.setVar("PKGV", pv.replace("AUTOINC", "0"))
9 bb.warn("Not using network based PR service")
10 return None
11
12 version = d.getVar("PRAUTOINX", True)
13 pkgarch = d.getVar("PACKAGE_ARCH", True)
14 checksum = d.getVar("BB_TASKHASH", True)
15
16 conn = d.getVar("__PRSERV_CONN", True)
17 if conn is None:
18 conn = oe.prservice.prserv_make_conn(d)
19 if conn is None:
20 return None
21
22 if "AUTOINC" in pv:
23 srcpv = bb.fetch2.get_srcrev(d)
24 base_ver = "AUTOINC-%s" % version[:version.find(srcpv)]
25 value = conn.getPR(base_ver, pkgarch, srcpv)
26 d.setVar("PKGV", pv.replace("AUTOINC", str(value)))
27
28 if d.getVar('PRSERV_LOCKDOWN', True):
29 auto_rev = d.getVar('PRAUTO_' + version + '_' + pkgarch, True) or d.getVar('PRAUTO_' + version, True) or None
30 else:
31 auto_rev = conn.getPR(version, pkgarch, checksum)
32
33 return auto_rev