summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--classes/local-sources.bbclass81
-rw-r--r--conf/local.conf.sample1
-rwxr-xr-xscripts/setup-environment.sh8
3 files changed, 90 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)
diff --git a/conf/local.conf.sample b/conf/local.conf.sample
index b5986c4..8ceb5cc 100644
--- a/conf/local.conf.sample
+++ b/conf/local.conf.sample
@@ -280,3 +280,4 @@ INHERIT += "rm_work"
280ACCEPT_FSL_EULA = "1" 280ACCEPT_FSL_EULA = "1"
281LICENSE_FLAGS_WHITELIST = "commercial" 281LICENSE_FLAGS_WHITELIST = "commercial"
282 282
283QT_SDK_PATH = ""
diff --git a/scripts/setup-environment.sh b/scripts/setup-environment.sh
index 92e75aa..cc15776 100755
--- a/scripts/setup-environment.sh
+++ b/scripts/setup-environment.sh
@@ -75,11 +75,19 @@ if [ ! -f ${PWD}/${BUILDDIR}/conf/bblayers.conf ]; then
75 75
76 mkdir -p ${PWD}/${BUILDDIR}/conf 76 mkdir -p ${PWD}/${BUILDDIR}/conf
77 cp ${PWD}/sources/meta-b2qt/conf/${LAYERSCONF} ${PWD}/${BUILDDIR}/conf/bblayers.conf 77 cp ${PWD}/sources/meta-b2qt/conf/${LAYERSCONF} ${PWD}/${BUILDDIR}/conf/bblayers.conf
78
79 if [ ! -d ${PWD}/sources/meta-b2qt/.git ]; then
80 QT_SDK_PATH=$(readlink -f ${PWD}/sources/meta-b2qt/../../)
81 fi
78fi 82fi
79 83
80export TEMPLATECONF="${PWD}/sources/meta-b2qt/conf" 84export TEMPLATECONF="${PWD}/sources/meta-b2qt/conf"
81. sources/poky/oe-init-build-env ${BUILDDIR} 85. sources/poky/oe-init-build-env ${BUILDDIR}
82 86
87# use sources from Qt SDK if that is available
88sed -i -e "/QT_SDK_PATH/s:\"\":\"${QT_SDK_PATH}\":" conf/local.conf
89
90unset QT_SDK_PATH
83unset BUILDDIR 91unset BUILDDIR
84unset TEMPLATECONF 92unset TEMPLATECONF
85unset LAYERSCONF 93unset LAYERSCONF