diff --git a/classes/local-sources.bbclass b/classes/local-sources.bbclass new file mode 100644 index 0000000000000000000000000000000000000000..adb484d9926d8dc87a19020996d15a8d1867922a --- /dev/null +++ b/classes/local-sources.bbclass @@ -0,0 +1,81 @@ +############################################################################# +## +## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +## +## This file is part of the Qt Enterprise Embedded Scripts of the Qt +## framework. +## +## $QT_BEGIN_LICENSE$ +## Commercial License Usage Only +## Licensees holding valid commercial Qt license agreements with Digia +## with an appropriate addendum covering the Qt Enterprise Embedded Scripts, +## may use this file in accordance with the terms contained in said license +## agreement. +## +## For further information use the contact form at +## http://qt.digia.com/contact-us. +## +## +## $QT_END_LICENSE$ +## +############################################################################# + +python do_fetch () { + src_uri = (d.getVar('SRC_URI', True) or "").split() + if len(src_uri) == 0: + return + + sdk_path = d.getVar('QT_SDK_PATH', True) or "" + if len(sdk_path) != 0: + uris = list(src_uri); + for url in uris: + ud = list(bb.fetch2.decodeurl(url)) + if ("local-uri" in ud[5]): + src_uri.remove(url) + + try: + fetcher = bb.fetch2.Fetch(src_uri, d) + fetcher.download() + except bb.fetch2.BBFetchException as e: + raise bb.build.FuncFailed(e) +} + +python do_unpack () { + src_uri = (d.getVar('SRC_URI', True) or "").split() + if len(src_uri) == 0: + return + + rootdir = d.getVar('WORKDIR', True) + + sdk_path = d.getVar('QT_SDK_PATH', True) or "" + if len(sdk_path) != 0: + uris = list(src_uri); + for url in uris: + ud = list(bb.fetch2.decodeurl(url)) + if ("local-uri" in ud[5]): + unpack_local_uri(ud, d) + src_uri.remove(url) + + try: + fetcher = bb.fetch2.Fetch(src_uri, d) + fetcher.unpack(rootdir) + except bb.fetch2.BBFetchException as e: + raise bb.build.FuncFailed(e) +} + +def unpack_local_uri(ud, d): + import subprocess + rootdir = d.getVar('WORKDIR', True) + sdk_path = d.getVar('QT_SDK_PATH', True) + + destdir = os.path.join(rootdir, ud[5].get("destsuffix", "git")) + srcdir = os.path.join(sdk_path, ud[5].get("local-uri")) + cmd = "cp -vrf %s %s" % (srcdir, destdir) + + if os.path.exists(destdir): + bb.utils.prunedir(destdir) + + ret = subprocess.call(cmd, shell=True) + + if ret != 0: + 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 b5986c4114c06adb585fb424c1164e49ef1228b2..8ceb5cc29368dfac4485ce07f406f706a9931aa6 100644 --- a/conf/local.conf.sample +++ b/conf/local.conf.sample @@ -280,3 +280,4 @@ INHERIT += "rm_work" ACCEPT_FSL_EULA = "1" LICENSE_FLAGS_WHITELIST = "commercial" +QT_SDK_PATH = "" diff --git a/scripts/setup-environment.sh b/scripts/setup-environment.sh index 92e75aaafbe70699f42dd8404ca5afc8072a4404..cc157764239f6356180ad540fb06a93c2312534d 100755 --- a/scripts/setup-environment.sh +++ b/scripts/setup-environment.sh @@ -75,11 +75,19 @@ if [ ! -f ${PWD}/${BUILDDIR}/conf/bblayers.conf ]; then mkdir -p ${PWD}/${BUILDDIR}/conf cp ${PWD}/sources/meta-b2qt/conf/${LAYERSCONF} ${PWD}/${BUILDDIR}/conf/bblayers.conf + + if [ ! -d ${PWD}/sources/meta-b2qt/.git ]; then + QT_SDK_PATH=$(readlink -f ${PWD}/sources/meta-b2qt/../../) + fi fi export TEMPLATECONF="${PWD}/sources/meta-b2qt/conf" . sources/poky/oe-init-build-env ${BUILDDIR} +# use sources from Qt SDK if that is available +sed -i -e "/QT_SDK_PATH/s:\"\":\"${QT_SDK_PATH}\":" conf/local.conf + +unset QT_SDK_PATH unset BUILDDIR unset TEMPLATECONF unset LAYERSCONF