summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/sdk.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-04-19 23:09:11 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-04-19 21:11:24 +0100
commit519600c607ba0f1da7b915160aff49fc63b3ca15 (patch)
tree4df562f95c8ff95ae43915994fe2b4f7306d1cf8 /scripts/lib/devtool/sdk.py
parentc7980b60890c05e055ec76a403a21cb673525319 (diff)
downloadpoky-519600c607ba0f1da7b915160aff49fc63b3ca15.tar.gz
devtool: sdk-update: fix handling of UNINATIVE_CHECKSUM changes
If UNINATIVE_CHECKSUM changes over an SDK update, bitbake within the extensible SDK will be broken because it will see that the matching uninative tarball doesn't exist and if there is a default value of UNINATIVE_URL it will attempt to download the file and will then fail because the checksums don't match up; alternatively if no UNINATIVE_URL is set then it'll also fail with an error about misconfiguration. To fix this, add some logic to devtool sdk-update to download the matching uninative tarball(s) for the checksum(s) in the newly fetched SDK configuration. Fixes [YOCTO #9301]. (From OE-Core rev: 14ff58ad98a5afac08db77068d80f152d8875766) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/sdk.py')
-rw-r--r--scripts/lib/devtool/sdk.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/lib/devtool/sdk.py b/scripts/lib/devtool/sdk.py
index a22841d789..46fd12bdb2 100644
--- a/scripts/lib/devtool/sdk.py
+++ b/scripts/lib/devtool/sdk.py
@@ -23,6 +23,7 @@ import shutil
23import errno 23import errno
24import sys 24import sys
25import tempfile 25import tempfile
26import re
26from devtool import exec_build_env_command, setup_tinfoil, parse_recipe, DevtoolError 27from devtool import exec_build_env_command, setup_tinfoil, parse_recipe, DevtoolError
27 28
28logger = logging.getLogger('devtool') 29logger = logging.getLogger('devtool')
@@ -209,6 +210,28 @@ def sdk_update(args, config, basepath, workspace):
209 logger.error("Updating %s failed" % changedfile) 210 logger.error("Updating %s failed" % changedfile)
210 return ret 211 return ret
211 212
213 # Check if UNINATIVE_CHECKSUM changed
214 uninative = False
215 if 'conf/local.conf' in changedfiles:
216 def read_uninative_checksums(fn):
217 chksumitems = []
218 with open(fn, 'r') as f:
219 for line in f:
220 if line.startswith('UNINATIVE_CHECKSUM'):
221 splitline = re.split(r'[\[\]"\']', line)
222 if len(splitline) > 3:
223 chksumitems.append((splitline[1], splitline[3]))
224 return chksumitems
225
226 oldsums = read_uninative_checksums(os.path.join(basepath, 'conf/local.conf'))
227 newsums = read_uninative_checksums(os.path.join(tmpsdk_dir, 'conf/local.conf'))
228 if oldsums != newsums:
229 uninative = True
230 for buildarch, chksum in newsums:
231 uninative_file = os.path.join('downloads', 'uninative', chksum, '%s-nativesdk-libc.tar.bz2' % buildarch)
232 mkdir(os.path.join(tmpsdk_dir, os.path.dirname(uninative_file)))
233 ret = subprocess.call("wget -q -O %s %s/%s" % (uninative_file, updateserver, uninative_file), shell=True, cwd=tmpsdk_dir)
234
212 # Ok, all is well at this point - move everything over 235 # Ok, all is well at this point - move everything over
213 tmplayers_dir = os.path.join(tmpsdk_dir, 'layers') 236 tmplayers_dir = os.path.join(tmpsdk_dir, 'layers')
214 if os.path.exists(tmplayers_dir): 237 if os.path.exists(tmplayers_dir):
@@ -220,6 +243,9 @@ def sdk_update(args, config, basepath, workspace):
220 shutil.move(os.path.join(tmpsdk_dir, changedfile), destfile) 243 shutil.move(os.path.join(tmpsdk_dir, changedfile), destfile)
221 os.remove(os.path.join(conf_dir, 'sdk-conf-manifest')) 244 os.remove(os.path.join(conf_dir, 'sdk-conf-manifest'))
222 shutil.move(tmpmanifest, conf_dir) 245 shutil.move(tmpmanifest, conf_dir)
246 if uninative:
247 shutil.rmtree(os.path.join(basepath, 'downloads', 'uninative'))
248 shutil.move(os.path.join(tmpsdk_dir, 'downloads', 'uninative'), os.path.join(basepath, 'downloads'))
223 249
224 if not sstate_mirrors: 250 if not sstate_mirrors:
225 with open(os.path.join(conf_dir, 'site.conf'), 'a') as f: 251 with open(os.path.join(conf_dir, 'site.conf'), 'a') as f: