summaryrefslogtreecommitdiffstats
path: root/meta-boot2qt/classes/sdk-sources.bbclass
diff options
context:
space:
mode:
authorSamuli Piippo <samuli.piippo@qt.io>2018-03-02 13:08:39 +0200
committerSamuli Piippo <samuli.piippo@qt.io>2018-03-12 14:12:31 +0000
commit344c2f97025c6504ec986600498121bb83aaeb8f (patch)
tree3d7ec602603cb083b7c8e998eddca543ce17e57c /meta-boot2qt/classes/sdk-sources.bbclass
parentd9985542d7617b43ec7180c7ade0c4f64db82b42 (diff)
downloadmeta-boot2qt-344c2f97025c6504ec986600498121bb83aaeb8f.tar.gz
Split meta-boot2qt layer
Move distro specific recipes to own layer and leave only new recipes and bbclasses to meta-boot2qt layer. This makes it easier to include meta-boot2qt to your own distro layer to get access e.g., QDB and QBSP recipes that might be useful even without boot2qt distro. Task-number: QTBUG-65871 Change-Id: I6c353774dd1668b00f2d05aa262ad866b90bdef6 Reviewed-by: Timo Aarnipuro <timo.aarnipuro@qt.io>
Diffstat (limited to 'meta-boot2qt/classes/sdk-sources.bbclass')
-rw-r--r--meta-boot2qt/classes/sdk-sources.bbclass99
1 files changed, 99 insertions, 0 deletions
diff --git a/meta-boot2qt/classes/sdk-sources.bbclass b/meta-boot2qt/classes/sdk-sources.bbclass
new file mode 100644
index 0000000..b12f371
--- /dev/null
+++ b/meta-boot2qt/classes/sdk-sources.bbclass
@@ -0,0 +1,99 @@
1############################################################################
2##
3## Copyright (C) 2016 The Qt Company Ltd.
4## Contact: https://www.qt.io/licensing/
5##
6## This file is part of the Boot to Qt meta layer.
7##
8## $QT_BEGIN_LICENSE:GPL$
9## Commercial License Usage
10## Licensees holding valid commercial Qt licenses may use this file in
11## accordance with the commercial license agreement provided with the
12## Software or, alternatively, in accordance with the terms contained in
13## a written agreement between you and The Qt Company. For licensing terms
14## and conditions see https://www.qt.io/terms-conditions. For further
15## information use the contact form at https://www.qt.io/contact-us.
16##
17## GNU General Public License Usage
18## Alternatively, this file may be used under the terms of the GNU
19## General Public License version 3 or (at your option) any later version
20## approved by the KDE Free Qt Foundation. The licenses are as published by
21## the Free Software Foundation and appearing in the file LICENSE.GPL3
22## included in the packaging of this file. Please review the following
23## information to ensure the GNU General Public License requirements will
24## be met: https://www.gnu.org/licenses/gpl-3.0.html.
25##
26## $QT_END_LICENSE$
27##
28############################################################################
29
30python do_fetch () {
31 src_uri = (d.getVar('SRC_URI', True) or "").split()
32 if len(src_uri) == 0:
33 return
34
35 sdk_path = d.getVar('QT_SDK_PATH', True) or ""
36 if len(sdk_path) != 0:
37 uris = list(src_uri);
38 for url in uris:
39 ud = list(bb.fetch2.decodeurl(url))
40 if ("sdk-uri" in ud[5]):
41 src_uri.remove(url)
42
43
44 if len(src_uri) == 0:
45 return
46
47 try:
48 fetcher = bb.fetch2.Fetch(src_uri, d)
49 fetcher.download()
50 except bb.fetch2.BBFetchException as e:
51 raise bb.build.FuncFailed(e)
52}
53
54python do_unpack () {
55 sdk_uds = [];
56 src_uri = (d.getVar('SRC_URI', True) or "").split()
57 if len(src_uri) == 0:
58 return
59
60 rootdir = d.getVar('WORKDIR', True)
61
62 sdk_path = d.getVar('QT_SDK_PATH', True) or ""
63 if len(sdk_path) != 0:
64 uris = list(src_uri);
65 for url in uris:
66 ud = list(bb.fetch2.decodeurl(url))
67 if ("sdk-uri" in ud[5]):
68 sdk_uds.append(ud)
69 src_uri.remove(url)
70
71 if len(src_uri) != 0:
72 try:
73 fetcher = bb.fetch2.Fetch(src_uri, d)
74 fetcher.unpack(rootdir)
75 except bb.fetch2.BBFetchException as e:
76 raise bb.build.FuncFailed(e)
77
78 for ud in sdk_uds:
79 unpack_local_uri(ud, d)
80}
81
82def unpack_local_uri(ud, d):
83 import subprocess
84 rootdir = d.getVar('WORKDIR', True)
85 sdk_path = d.getVar('QT_SDK_PATH', True)
86
87 destdir = os.path.join(rootdir, ud[5].get("destsuffix", "git"))
88 srcdir = os.path.join(sdk_path, ud[5].get("sdk-uri"))
89 cmd = "cp -vrf %s %s" % (srcdir, destdir)
90
91 bb.note("Unpacking SDK sources %s to %s" % (srcdir, destdir))
92
93 if os.path.exists(destdir):
94 bb.utils.prunedir(destdir)
95
96 ret = subprocess.call(cmd, shell=True)
97
98 if ret != 0:
99 raise bb.fetch.UnpackError("Unpack command %s failed with return value %s" % (cmd, ret), ud)