summaryrefslogtreecommitdiffstats
path: root/classes
diff options
context:
space:
mode:
authorSamuli Piippo <samuli.piippo@digia.com>2014-10-13 16:25:43 +0300
committerAndy Nichols <andy.nichols@digia.com>2014-10-17 13:26:48 +0300
commit3cb10b94c8dff9a7ea48ea2a681426203327db50 (patch)
tree02805ff6561a7f79e4b7791db6f122c609f1e828 /classes
parent651ce88fad65d82fa7a83871334baf6a0d73c06a (diff)
downloadmeta-boot2qt-3cb10b94c8dff9a7ea48ea2a681426203327db50.tar.gz
Enable to use sources from Qt SDK
This enables sources to be fetched from the Qt SDK, if available, instead of internal git repositories. Required for BYOS customers to build B2Qt things. Git repositories in SRC_URI are configured with 'local-uri' parameter, that defines the path to the source code directory inside the Qt SDK. The base path to Qt SDK is set in local.conf when setup-environment.sh in run. Change-Id: I7f5e96fb6b9e9e55cac9d50cefb17830618193b8 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@digia.com> Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Diffstat (limited to 'classes')
-rw-r--r--classes/local-sources.bbclass81
1 files changed, 81 insertions, 0 deletions
diff --git a/classes/local-sources.bbclass b/classes/local-sources.bbclass
new file mode 100644
index 0000000..adb484d
--- /dev/null
+++ b/classes/local-sources.bbclass
@@ -0,0 +1,81 @@
1#############################################################################
2##
3## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4##
5## This file is part of the Qt Enterprise Embedded Scripts of the Qt
6## framework.
7##
8## $QT_BEGIN_LICENSE$
9## Commercial License Usage Only
10## Licensees holding valid commercial Qt license agreements with Digia
11## with an appropriate addendum covering the Qt Enterprise Embedded Scripts,
12## may use this file in accordance with the terms contained in said license
13## agreement.
14##
15## For further information use the contact form at
16## http://qt.digia.com/contact-us.
17##
18##
19## $QT_END_LICENSE$
20##
21#############################################################################
22
23python do_fetch () {
24 src_uri = (d.getVar('SRC_URI', True) or "").split()
25 if len(src_uri) == 0:
26 return
27
28 sdk_path = d.getVar('QT_SDK_PATH', True) or ""
29 if len(sdk_path) != 0:
30 uris = list(src_uri);
31 for url in uris:
32 ud = list(bb.fetch2.decodeurl(url))
33 if ("local-uri" in ud[5]):
34 src_uri.remove(url)
35
36 try:
37 fetcher = bb.fetch2.Fetch(src_uri, d)
38 fetcher.download()
39 except bb.fetch2.BBFetchException as e:
40 raise bb.build.FuncFailed(e)
41}
42
43python do_unpack () {
44 src_uri = (d.getVar('SRC_URI', True) or "").split()
45 if len(src_uri) == 0:
46 return
47
48 rootdir = d.getVar('WORKDIR', True)
49
50 sdk_path = d.getVar('QT_SDK_PATH', True) or ""
51 if len(sdk_path) != 0:
52 uris = list(src_uri);
53 for url in uris:
54 ud = list(bb.fetch2.decodeurl(url))
55 if ("local-uri" in ud[5]):
56 unpack_local_uri(ud, d)
57 src_uri.remove(url)
58
59 try:
60 fetcher = bb.fetch2.Fetch(src_uri, d)
61 fetcher.unpack(rootdir)
62 except bb.fetch2.BBFetchException as e:
63 raise bb.build.FuncFailed(e)
64}
65
66def unpack_local_uri(ud, d):
67 import subprocess
68 rootdir = d.getVar('WORKDIR', True)
69 sdk_path = d.getVar('QT_SDK_PATH', True)
70
71 destdir = os.path.join(rootdir, ud[5].get("destsuffix", "git"))
72 srcdir = os.path.join(sdk_path, ud[5].get("local-uri"))
73 cmd = "cp -vrf %s %s" % (srcdir, destdir)
74
75 if os.path.exists(destdir):
76 bb.utils.prunedir(destdir)
77
78 ret = subprocess.call(cmd, shell=True)
79
80 if ret != 0:
81 raise bb.fetch.UnpackError("Unpack command %s failed with return value %s" % (cmd, ret), ud)