diff options
author | Martin Jansa <martin.jansa@gmail.com> | 2018-12-31 09:58:35 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-03 12:35:53 +0000 |
commit | 08eb8565b634b30790e94b7d5ab60641e997cabc (patch) | |
tree | d8c15db62ac795730716a428fdf9e7fdb642b83f | |
parent | 48c0ed2aec236939d369ca3f0093dc43db1e1dd6 (diff) | |
download | poky-08eb8565b634b30790e94b7d5ab60641e997cabc.tar.gz |
sstate.bbclass: catch ValueError from incorrectly written sstate manifests
* in some rare cases the file format might be broken, e.g. when you run
out of disk space while writing to it (hint: make sure to use
BB_DISKMON_DIRS on _all_ the builds, to make sure that they can stop
gracefully before this happens).
* will show error like this:
ERROR: Invalid line '/OE/build/luneos-thud/webos-ports' in sstate manifest '/OE/build/luneos-thud/webos-ports/tmp-glibc/sstate-control/index-allarch'
when the file isn't complete, like in my case:
$ tail -n 2 /OE/build/luneos-thud/webos-ports/tmp-glibc/sstate-control/index-allarch
/OE/build/luneos-thud/webos-ports/tmp-glibc/stamps/all-webos-linux/org.webosports.app.calculator/0.1.1+gitrAUTOINC+9e9eb67c28-r0 /OE/build/luneos-thud/webos-ports/tmp-glibc/sstate-control/manifest-allarch-org.webosports.app.calculator /OE/build/luneos-thud/webos-ports/tmp-glibc/work/all-webos-linux/org.webosports.app.calculator/0.1.1+gitrAUTOINC+9e9eb67c28-r0
/OE/build/luneos-thud/webos-ports
* instead of much longer exception which doesn't really show what's
wrong to selectively fix that (other than removing while TMPDIR):
ERROR: Command execution failed: Traceback (most recent call last):
File "/OE/build/luneos-thud/webos-ports/bitbake/lib/bb/command.py", line 113, in runAsyncCommand
self.cooker.updateCache()
File "/OE/build/luneos-thud/webos-ports/bitbake/lib/bb/cooker.py", line 1562, in updateCache
bb.event.fire(event, self.databuilder.mcdata[mc])
File "/OE/build/luneos-thud/webos-ports/bitbake/lib/bb/event.py", line 225, in fire
fire_class_handlers(event, d)
File "/OE/build/luneos-thud/webos-ports/bitbake/lib/bb/event.py", line 134, in fire_class_handlers
execute_handler(name, handler, event, d)
File "/OE/build/luneos-thud/webos-ports/bitbake/lib/bb/event.py", line 106, in execute_handler
ret = handler(event)
File "/OE/build/luneos-thud/webos-ports/openembedded-core/meta/classes/sstate.bbclass", line 1083, in sstate_eventhandler2
(stamp, manifest, workdir) = l.split()
ValueError: not enough values to unpack (expected 3, got 1)
(From OE-Core rev: 870ba5d80e76e0f989971532fc2adc0ebe811ab6)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/sstate.bbclass | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index 8b48ab465f..be5f19b33e 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass | |||
@@ -1081,12 +1081,15 @@ python sstate_eventhandler2() { | |||
1081 | with open(i, "r") as f: | 1081 | with open(i, "r") as f: |
1082 | lines = f.readlines() | 1082 | lines = f.readlines() |
1083 | for l in lines: | 1083 | for l in lines: |
1084 | (stamp, manifest, workdir) = l.split() | 1084 | try: |
1085 | if stamp not in stamps and stamp not in preservestamps and stamp in machineindex: | 1085 | (stamp, manifest, workdir) = l.split() |
1086 | toremove.append(l) | 1086 | if stamp not in stamps and stamp not in preservestamps and stamp in machineindex: |
1087 | if stamp not in seen: | 1087 | toremove.append(l) |
1088 | bb.debug(2, "Stamp %s is not reachable, removing related manifests" % stamp) | 1088 | if stamp not in seen: |
1089 | seen.append(stamp) | 1089 | bb.debug(2, "Stamp %s is not reachable, removing related manifests" % stamp) |
1090 | seen.append(stamp) | ||
1091 | except ValueError: | ||
1092 | bb.fatal("Invalid line '%s' in sstate manifest '%s'" % (l, i)) | ||
1090 | 1093 | ||
1091 | if toremove: | 1094 | if toremove: |
1092 | msg = "Removing %d recipes from the %s sysroot" % (len(toremove), a) | 1095 | msg = "Removing %d recipes from the %s sysroot" % (len(toremove), a) |