diff options
author | Michael Ho <Michael.Ho@bmw.de> | 2021-06-28 11:11:21 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-07-10 22:46:19 +0100 |
commit | 608f16d94e1cf61c883e85fa0df67350fa8d1a75 (patch) | |
tree | e260f43bab2045780928764d57b81cbc2ffcda22 /meta/classes/sstate.bbclass | |
parent | 95d109b62199f58798834749d16263ddc5575aff (diff) | |
download | poky-608f16d94e1cf61c883e85fa0df67350fa8d1a75.tar.gz |
sstate.bbclass: fix errors about read-only sstate mirrors
If a read-only sstate mirror is used in conjunction with hash equiv,
then OSError will be raised when an sstate-cache hit is achieved.
This is because sstate_task_postfunc will try to "touch" the symlinks
that point to the read-only sstate mirror when sstate_report_unihash
has changed SSTATE_PKG.
This commit adds an additional exception handler to silently mask read
only rootfs errors thrown during the touch.
The fix is also duplicated to sstate_eventhandler as the code is very
similar but it may not be needed there.
Example of the error:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:sstate_task_postfunc(d)
0003:
File: '/poky/meta/classes/sstate.bbclass', lineno: 774, function: sstate_task_postfunc
0770:
0771: omask = os.umask(0o002)
0772: if omask != 0o002:
0773: bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
*** 0774: sstate_package(shared_state, d)
0775: os.umask(omask)
0776:
0777: sstateinst = d.getVar("SSTATE_INSTDIR")
0778: d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
File: '/poky/meta/classes/sstate.bbclass', lineno: 703, function: sstate_package
0699: if not os.path.exists(siginfo):
0700: bb.siggen.dump_this_task(siginfo, d)
0701: else:
0702: try:
*** 0703: os.utime(siginfo, None)
0704: except PermissionError:
0705: pass
0706:
0707: return
Exception: OSError: [Errno 30] Read-only file system
(From OE-Core rev: f2360f796016cce93610a080ff07c8047bda6ee8)
Signed-off-by: Michael Ho <Michael.Ho@bmw.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 244b3be0358a66e0cca4016fe26144e3d7323390)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/sstate.bbclass')
-rw-r--r-- | meta/classes/sstate.bbclass | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index a689f7f677..53dcfc8274 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass | |||
@@ -703,6 +703,10 @@ def sstate_package(ss, d): | |||
703 | os.utime(siginfo, None) | 703 | os.utime(siginfo, None) |
704 | except PermissionError: | 704 | except PermissionError: |
705 | pass | 705 | pass |
706 | except OSError as e: | ||
707 | # Handle read-only file systems gracefully | ||
708 | if e.errno != errno.EROFS: | ||
709 | raise e | ||
706 | 710 | ||
707 | return | 711 | return |
708 | 712 | ||
@@ -1141,6 +1145,10 @@ python sstate_eventhandler() { | |||
1141 | os.utime(siginfo, None) | 1145 | os.utime(siginfo, None) |
1142 | except PermissionError: | 1146 | except PermissionError: |
1143 | pass | 1147 | pass |
1148 | except OSError as e: | ||
1149 | # Handle read-only file systems gracefully | ||
1150 | if e.errno != errno.EROFS: | ||
1151 | raise e | ||
1144 | 1152 | ||
1145 | } | 1153 | } |
1146 | 1154 | ||